Skip to content

Commit ce54a77

Browse files
committed
refactor(multiple services): generator style updates
1 parent 93652b7 commit ce54a77

File tree

16 files changed

+3991
-2808
lines changed

16 files changed

+3991
-2808
lines changed

compare-comply/v1.ts

Lines changed: 279 additions & 148 deletions
Large diffs are not rendered by default.

discovery/v1.ts

Lines changed: 1300 additions & 624 deletions
Large diffs are not rendered by default.

language-translator/v3.ts

Lines changed: 284 additions & 141 deletions
Large diffs are not rendered by default.

natural-language-classifier/v1.ts

Lines changed: 139 additions & 69 deletions
Large diffs are not rendered by default.

personality-insights/v3.ts

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515
*/
1616

1717
/**
18-
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-902c9336-20210507-162723
18+
* IBM OpenAPI SDK Code Generator Version: 3.38.0-07189efd-20210827-205025
1919
*/
2020

21-
2221
import * as extend from 'extend';
2322
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
24-
import { Authenticator, BaseService, getAuthenticatorFromEnvironment, getMissingParams, UserOptions } from 'ibm-cloud-sdk-core';
23+
import {
24+
Authenticator,
25+
BaseService,
26+
getAuthenticatorFromEnvironment,
27+
getMissingParams,
28+
UserOptions,
29+
} from 'ibm-cloud-sdk-core';
2530
import { getSdkHeaders } from '../lib/common';
2631

2732
/**
@@ -51,11 +56,14 @@ import { getSdkHeaders } from '../lib/common';
5156
*
5257
* **Note:** Request logging is disabled for the Personality Insights service. Regardless of whether you set the
5358
* `X-Watson-Learning-Opt-Out` request header, the service does not log or retain data from requests and responses.
59+
*
60+
* API Version: 3.4.4
61+
* See: https://cloud.ibm.com/docs/personality-insights
5462
*/
5563

5664
class PersonalityInsightsV3 extends BaseService {
57-
5865
static DEFAULT_SERVICE_URL: string = 'https://api.us-south.personality-insights.watson.cloud.ibm.com';
66+
5967
static DEFAULT_SERVICE_NAME: string = 'personality_insights';
6068

6169
/** Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current
@@ -146,8 +154,8 @@ class PersonalityInsightsV3 extends BaseService {
146154
* profile](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-outputCSV#outputCSV).
147155
*
148156
* @param {Object} params - The parameters to send to the service.
149-
* @param {Content|string} params.content - A maximum of 20 MB of content to analyze, though the service requires much
150-
* less text; for more information, see [Providing sufficient
157+
* @param {Content | string} params.content - A maximum of 20 MB of content to analyze, though the service requires
158+
* much less text; for more information, see [Providing sufficient
151159
* input](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-input#sufficient). For JSON
152160
* input, provide an object of type `Content`.
153161
* @param {string} [params.contentType] - The type of the input. For more information, see **Content types** in the
@@ -175,8 +183,10 @@ class PersonalityInsightsV3 extends BaseService {
175183
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
176184
* @returns {Promise<PersonalityInsightsV3.Response<PersonalityInsightsV3.Profile>>}
177185
*/
178-
public profile(params: PersonalityInsightsV3.ProfileParams): Promise<PersonalityInsightsV3.Response<PersonalityInsightsV3.Profile>> {
179-
const _params = Object.assign({}, params);
186+
public profile(
187+
params: PersonalityInsightsV3.ProfileParams
188+
): Promise<PersonalityInsightsV3.Response<PersonalityInsightsV3.Profile>> {
189+
const _params = { ...params };
180190
const requiredParams = ['content'];
181191

182192
const missingParams = getMissingParams(_params, requiredParams);
@@ -189,10 +199,14 @@ class PersonalityInsightsV3 extends BaseService {
189199
'version': this.version,
190200
'raw_scores': _params.rawScores,
191201
'csv_headers': _params.csvHeaders,
192-
'consumption_preferences': _params.consumptionPreferences
202+
'consumption_preferences': _params.consumptionPreferences,
193203
};
194204

195-
const sdkHeaders = getSdkHeaders(PersonalityInsightsV3.DEFAULT_SERVICE_NAME, 'v3', 'profile');
205+
const sdkHeaders = getSdkHeaders(
206+
PersonalityInsightsV3.DEFAULT_SERVICE_NAME,
207+
'v3',
208+
'profile'
209+
);
196210

197211
const parameters = {
198212
options: {
@@ -202,17 +216,22 @@ class PersonalityInsightsV3 extends BaseService {
202216
qs: query,
203217
},
204218
defaultOptions: extend(true, {}, this.baseOptions, {
205-
headers: extend(true, sdkHeaders, {
206-
'Accept': 'application/json',
207-
'Content-Type': _params.contentType,
208-
'Content-Language': _params.contentLanguage,
209-
'Accept-Language': _params.acceptLanguage
210-
}, _params.headers),
219+
headers: extend(
220+
true,
221+
sdkHeaders,
222+
{
223+
'Accept': 'application/json',
224+
'Content-Type': _params.contentType,
225+
'Content-Language': _params.contentLanguage,
226+
'Accept-Language': _params.acceptLanguage,
227+
},
228+
_params.headers
229+
),
211230
}),
212231
};
213232

214233
return this.createRequest(parameters);
215-
};
234+
}
216235

217236
/**
218237
* Get profile as csv.
@@ -253,8 +272,8 @@ class PersonalityInsightsV3 extends BaseService {
253272
* profile](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-outputCSV#outputCSV).
254273
*
255274
* @param {Object} params - The parameters to send to the service.
256-
* @param {Content|string} params.content - A maximum of 20 MB of content to analyze, though the service requires much
257-
* less text; for more information, see [Providing sufficient
275+
* @param {Content | string} params.content - A maximum of 20 MB of content to analyze, though the service requires
276+
* much less text; for more information, see [Providing sufficient
258277
* input](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-input#sufficient). For JSON
259278
* input, provide an object of type `Content`.
260279
* @param {string} [params.contentType] - The type of the input. For more information, see **Content types** in the
@@ -280,10 +299,12 @@ class PersonalityInsightsV3 extends BaseService {
280299
* @param {boolean} [params.consumptionPreferences] - Indicates whether consumption preferences are returned with the
281300
* results. By default, no consumption preferences are returned.
282301
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
283-
* @returns {Promise<PersonalityInsightsV3.Response<NodeJS.ReadableStream|Buffer>>}
302+
* @returns {Promise<PersonalityInsightsV3.Response<NodeJS.ReadableStream>>}
284303
*/
285-
public profileAsCsv(params: PersonalityInsightsV3.ProfileAsCsvParams): Promise<PersonalityInsightsV3.Response<NodeJS.ReadableStream|Buffer>> {
286-
const _params = Object.assign({}, params);
304+
public profileAsCsv(
305+
params: PersonalityInsightsV3.ProfileAsCsvParams
306+
): Promise<PersonalityInsightsV3.Response<NodeJS.ReadableStream>> {
307+
const _params = { ...params };
287308
const requiredParams = ['content'];
288309

289310
const missingParams = getMissingParams(_params, requiredParams);
@@ -296,10 +317,14 @@ class PersonalityInsightsV3 extends BaseService {
296317
'version': this.version,
297318
'raw_scores': _params.rawScores,
298319
'csv_headers': _params.csvHeaders,
299-
'consumption_preferences': _params.consumptionPreferences
320+
'consumption_preferences': _params.consumptionPreferences,
300321
};
301322

302-
const sdkHeaders = getSdkHeaders(PersonalityInsightsV3.DEFAULT_SERVICE_NAME, 'v3', 'profileAsCsv');
323+
const sdkHeaders = getSdkHeaders(
324+
PersonalityInsightsV3.DEFAULT_SERVICE_NAME,
325+
'v3',
326+
'profileAsCsv'
327+
);
303328

304329
const parameters = {
305330
options: {
@@ -309,37 +334,39 @@ class PersonalityInsightsV3 extends BaseService {
309334
qs: query,
310335
},
311336
defaultOptions: extend(true, {}, this.baseOptions, {
312-
headers: extend(true, sdkHeaders, {
313-
'Accept': 'text/csv',
314-
'Content-Type': _params.contentType,
315-
'Content-Language': _params.contentLanguage,
316-
'Accept-Language': _params.acceptLanguage
317-
}, _params.headers),
337+
headers: extend(
338+
true,
339+
sdkHeaders,
340+
{
341+
'Accept': 'text/csv',
342+
'Content-Type': _params.contentType,
343+
'Content-Language': _params.contentLanguage,
344+
'Accept-Language': _params.acceptLanguage,
345+
},
346+
_params.headers
347+
),
318348
}),
319349
};
320350

321351
return this.createRequest(parameters);
322-
};
323-
352+
}
324353
}
325354

326355
/*************************
327356
* interfaces
328357
************************/
329358

330359
namespace PersonalityInsightsV3 {
331-
332360
/** Options for the `PersonalityInsightsV3` constructor. */
333361
export interface Options extends UserOptions {
334-
335362
/** Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current
336363
* version is `2017-10-13`.
337364
*/
338365
version: string;
339366
}
340367

341368
/** An operation response. */
342-
export interface Response<T = any> {
369+
export interface Response<T = any> {
343370
result: T;
344371
status: number;
345372
statusText: string;
@@ -350,7 +377,7 @@ namespace PersonalityInsightsV3 {
350377
export type Callback<T> = (error: any, response?: Response<T>) => void;
351378

352379
/** The body of a service request that returns no response data. */
353-
export interface Empty { }
380+
export interface Empty {}
354381

355382
/** A standard JS object, defined to avoid the limitations of `Object` and `object` */
356383
export interface JsonObject {
@@ -368,7 +395,7 @@ namespace PersonalityInsightsV3 {
368395
* input](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-input#sufficient). For JSON
369396
* input, provide an object of type `Content`.
370397
*/
371-
content: Content|string;
398+
content: Content | string;
372399
/** The type of the input. For more information, see **Content types** in the method description. */
373400
contentType?: ProfileConstants.ContentType | string;
374401
/** The language of the input text for the request: Arabic, English, Japanese, Korean, or Spanish. Regional
@@ -441,7 +468,7 @@ namespace PersonalityInsightsV3 {
441468
* input](https://cloud.ibm.com/docs/personality-insights?topic=personality-insights-input#sufficient). For JSON
442469
* input, provide an object of type `Content`.
443470
*/
444-
content: Content|string;
471+
content: Content | string;
445472
/** The type of the input. For more information, see **Content types** in the method description. */
446473
contentType?: ProfileAsCsvConstants.ContentType | string;
447474
/** The language of the input text for the request: Arabic, English, Japanese, Korean, or Spanish. Regional
@@ -697,7 +724,6 @@ namespace PersonalityInsightsV3 {
697724
*/
698725
message: string;
699726
}
700-
701727
}
702728

703729
export = PersonalityInsightsV3;

0 commit comments

Comments
 (0)