You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,9 @@ Watson services are migrating to token-based Identity and Access Management (IAM
93
93
94
94
- With some service instances, you authenticate to the API by using **[IAM](#iam)**.
95
95
- In other instances, you authenticate by providing the **[username and password](#username-and-password)** for the service instance.
96
+
- If you're using a Watson service on ICP, you'll need to authenticate in [a specific way](icp).
97
+
98
+
To specify the type of authentication to use, there is an optional parameter called `authentication_type`. Possible values are `iam`, `basic`, and `icp4d`.
96
99
97
100
### Getting credentials
98
101
@@ -152,6 +155,39 @@ You supply either an IAM service **API key** or an **access token**:
152
155
- Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
153
156
- Use the access token if you want to manage the lifecycle yourself. For details, see [Authenticating with IAM tokens](https://cloud.ibm.com/docs/services/watson/getting-started-iam.html). If you want to switch to API key, override your stored IAM credentials with an IAM API key.
154
157
158
+
##### ICP
159
+
160
+
Like IAM, you can pass in credentials to let the SDK manage an access token for you or directly supply an access token to do it yourself.
161
+
162
+
If you choose to let the SDK manage the token, `authentication_type` must be set to `icp4d`.
@@ -40,9 +39,18 @@ class NaturalLanguageClassifierV1 extends BaseService {
40
39
* @param {string} [options.iam_access_token] - An IAM access token fully managed by the application. Responsibility falls on the application to refresh the token, either before it expires or reactively upon receiving a 401 from the service, as any requests made with an expired token will fail.
41
40
* @param {string} [options.iam_apikey] - An API key that can be used to request IAM tokens. If this API key is provided, the SDK will manage the token and handle the refreshing.
42
41
* @param {string} [options.iam_url] - An optional URL for the IAM service API. Defaults to 'https://iam.cloud.ibm.com/identity/token'.
43
-
* @param {boolean} [options.use_unauthenticated] - Set to `true` to avoid including an authorization header. This option may be useful for requests that are proxied.
44
-
* @param {Object} [options.headers] - Default headers that shall be included with every request to the service.
45
-
* @param {boolean} [options.headers.X-Watson-Learning-Opt-Out] - Set to `true` to opt-out of data collection. By default, all IBM Watson services log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public. If you are concerned with protecting the privacy of users' personal information or otherwise do not want your requests to be logged, you can opt out of logging.
42
+
* @param {string} [options.iam_client_id] - client id (username) for request to iam service
43
+
* @param {string} [options.iam_client_secret] - client secret (password) for request to iam service
44
+
* @param {string} [options.icp4d_access_token] - icp for data access token provided and managed by user
45
+
* @param {string} [options.icp4d_url] - icp for data base url - used for authentication
46
+
* @param {string} [options.authentication_type] - authentication pattern to be used. can be iam, basic, or icp4d
47
+
* @param {boolean} [options.use_unauthenticated] - Set to `true` to avoid including an authorization header. This
48
+
* option may be useful for requests that are proxied.
49
+
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
50
+
* @param {boolean} [options.headers.X-Watson-Learning-Opt-Out] - Set to `true` to opt-out of data collection. By
51
+
* default, all IBM Watson services log requests and their results. Logging is done only to improve the services for
52
+
* future users. The logged data is not shared or made public. If you are concerned with protecting the privacy of
53
+
* users' personal information or otherwise do not want your requests to be logged, you can opt out of logging.
46
54
* @constructor
47
55
* @returns {NaturalLanguageClassifierV1}
48
56
*/
@@ -63,7 +71,7 @@ class NaturalLanguageClassifierV1 extends BaseService {
63
71
* @param {Object} params - The parameters to send to the service.
64
72
* @param {string} params.classifier_id - Classifier ID to use.
65
73
* @param {string} params.text - The submitted phrase. The maximum length is 2048 characters.
/** Parameters for the `createClassifier` operation. */
440
469
exportinterfaceCreateClassifierParams{
441
470
/** Metadata in JSON format. The metadata identifies the language of the data, and an optional name to identify the classifier. Specify the language with the 2-letter primary language code as assigned in ISO standard 639. Supported languages are English (`en`), Arabic (`ar`), French (`fr`), German, (`de`), Italian (`it`), Japanese (`ja`), Korean (`ko`), Brazilian Portuguese (`pt`), and Spanish (`es`). */
/** Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes and 20,000 records. For details, see [Data preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html). */
472
+
/** Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes and 20,000 records. For details, see [Data preparation](https://cloud.ibm.com/docs/services/natural-language-classifier?topic=natural-language-classifier-using-your-data). */
0 commit comments