|
1 | 1 | /*
|
2 |
| - * (C) Copyright IBM Corp. 2019. |
| 2 | + * (C) Copyright IBM Corp. 2019, 2020. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
5 | 5 | * the License. You may obtain a copy of the License at
|
|
99 | 99 | */
|
100 | 100 | public class Assistant extends BaseService {
|
101 | 101 |
|
102 |
| - private static final String SERVICE_NAME = "assistant"; |
103 |
| - private static final String SERVICE_URL = "https://gateway.watsonplatform.net/assistant/api"; |
| 102 | + private static final String DEFAULT_SERVICE_NAME = "assistant"; |
| 103 | + |
| 104 | + private static final String DEFAULT_SERVICE_URL = "https://gateway.watsonplatform.net/assistant/api"; |
104 | 105 |
|
105 | 106 | private String versionDate;
|
106 | 107 |
|
107 | 108 | /**
|
108 |
| - * Constructs a new `Assistant` client. |
| 109 | + * Constructs a new `Assistant` client using the DEFAULT_SERVICE_NAME. |
109 | 110 | *
|
110 | 111 | * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API
|
111 | 112 | * calls from failing when the service introduces breaking changes.
|
112 | 113 | */
|
113 | 114 | public Assistant(String versionDate) {
|
114 |
| - this(versionDate, ConfigBasedAuthenticatorFactory.getAuthenticator(SERVICE_NAME)); |
| 115 | + this(versionDate, DEFAULT_SERVICE_NAME, ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); |
115 | 116 | }
|
116 | 117 |
|
117 | 118 | /**
|
118 |
| - * Constructs a new `Assistant` client with the specified Authenticator. |
| 119 | + * Constructs a new `Assistant` client with the DEFAULT_SERVICE_NAME |
| 120 | + * and the specified Authenticator. |
119 | 121 | *
|
120 | 122 | * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API
|
121 | 123 | * calls from failing when the service introduces breaking changes.
|
122 | 124 | * @param authenticator the Authenticator instance to be configured for this service
|
123 | 125 | */
|
124 | 126 | public Assistant(String versionDate, Authenticator authenticator) {
|
125 |
| - super(SERVICE_NAME, authenticator); |
126 |
| - if ((getServiceUrl() == null) || getServiceUrl().isEmpty()) { |
127 |
| - setServiceUrl(SERVICE_URL); |
128 |
| - } |
| 127 | + this(versionDate, DEFAULT_SERVICE_NAME, authenticator); |
| 128 | + } |
| 129 | + |
| 130 | + /** |
| 131 | + * Constructs a new `Assistant` client with the specified serviceName. |
| 132 | + * |
| 133 | + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API |
| 134 | + * calls from failing when the service introduces breaking changes. |
| 135 | + * @param serviceName The name of the service to configure. |
| 136 | + */ |
| 137 | + public Assistant(String versionDate, String serviceName) { |
| 138 | + this(versionDate, serviceName, ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName)); |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * Constructs a new `Assistant` client with the specified Authenticator |
| 143 | + * and serviceName. |
| 144 | + * |
| 145 | + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API |
| 146 | + * calls from failing when the service introduces breaking changes. |
| 147 | + * @param serviceName The name of the service to configure. |
| 148 | + * @param authenticator the Authenticator instance to be configured for this service |
| 149 | + */ |
| 150 | + public Assistant(String versionDate, String serviceName, Authenticator authenticator) { |
| 151 | + super(serviceName, authenticator); |
| 152 | + setServiceUrl(DEFAULT_SERVICE_URL); |
129 | 153 | com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(),
|
130 | 154 | "version cannot be null.");
|
131 | 155 | this.versionDate = versionDate;
|
| 156 | + this.configureService(serviceName); |
132 | 157 | }
|
133 | 158 |
|
134 | 159 | /**
|
@@ -2039,6 +2064,8 @@ public ServiceCall<LogCollection> listAllLogs(ListAllLogsOptions listAllLogsOpti
|
2039 | 2064 | * For more information about personal data and customer IDs, see [Information
|
2040 | 2065 | * security](https://cloud.ibm.com/docs/services/assistant?topic=assistant-information-security#information-security).
|
2041 | 2066 | *
|
| 2067 | + * This operation is limited to 4 requests per minute. For more information, see **Rate limiting**. |
| 2068 | + * |
2042 | 2069 | * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call
|
2043 | 2070 | * @return a {@link ServiceCall} with a response type of Void
|
2044 | 2071 | */
|
|
0 commit comments