From ab8b8538e859683c3f044ce94ce174382d0e815a Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 21 Feb 2022 17:43:34 +0200 Subject: [PATCH 01/27] add swagger-codegen templates (typescript-axios) --- templates/swagger-codegen/api-all.mustache | 23 ++ templates/swagger-codegen/api-single.mustache | 284 ++++++++++++++++++ templates/swagger-codegen/api.mustache | 3 + .../swagger-codegen/licenseInfo.mustache | 11 + templates/swagger-codegen/model.mustache | 81 +++++ templates/swagger-codegen/models.mustache | 255 ++++++++++++++++ 6 files changed, 657 insertions(+) create mode 100644 templates/swagger-codegen/api-all.mustache create mode 100644 templates/swagger-codegen/api-single.mustache create mode 100644 templates/swagger-codegen/api.mustache create mode 100644 templates/swagger-codegen/licenseInfo.mustache create mode 100644 templates/swagger-codegen/model.mustache create mode 100644 templates/swagger-codegen/models.mustache diff --git a/templates/swagger-codegen/api-all.mustache b/templates/swagger-codegen/api-all.mustache new file mode 100644 index 000000000..16b585d9e --- /dev/null +++ b/templates/swagger-codegen/api-all.mustache @@ -0,0 +1,23 @@ +{{#apiInfo}} +{{#apis}} +{{#operations}} +export * from './{{ classFilename }}'; +import { {{ classname }} } from './{{ classFilename }}'; +{{/operations}} +{{#withInterfaces}} +export * from './{{ classFilename }}Interface' +{{/withInterfaces}} +{{/apis}} +import * as http from 'http'; + +export class HttpError extends Error { + constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) { + super('HTTP request failed'); + this.name = 'HttpError'; + } +} + +export { RequestFile } from '../model/models'; + +export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; +{{/apiInfo}} diff --git a/templates/swagger-codegen/api-single.mustache b/templates/swagger-codegen/api-single.mustache new file mode 100644 index 000000000..081893a93 --- /dev/null +++ b/templates/swagger-codegen/api-single.mustache @@ -0,0 +1,284 @@ +{{>licenseInfo}} + +import localVarRequest from 'request'; +import http from 'http'; + +/* tslint:disable:no-unused-locals */ +{{#imports}} +import { {{classname}} } from '{{filename}}'; +{{/imports}} + +import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; +{{#hasAuthMethods}} +import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; +{{/hasAuthMethods}} + +import { HttpError, RequestFile } from './apis'; + +let defaultBasePath = '{{{basePath}}}'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +{{#operations}} +{{#description}} +/** +* {{&description}} +*/ +{{/description}} +export enum {{classname}}ApiKeys { +{{#authMethods}} +{{#isApiKey}} + {{name}}, +{{/isApiKey}} +{{/authMethods}} +} + +export class {{classname}} { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasicBasic}} + '{{name}}': new HttpBasicAuth(), +{{/isBasicBasic}} +{{#isBasicBearer}} + '{{name}}': new HttpBearerAuth(), +{{/isBasicBearer}} +{{#isApiKey}} + '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}{{#isKeyInCookie}}'cookie'{{/isKeyInCookie}}, '{{keyParamName}}'), +{{/isApiKey}} +{{#isOAuth}} + '{{name}}': new OAuth(), +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + } + + protected interceptors: Interceptor[] = []; + + constructor(basePath?: string); +{{#authMethods}} +{{#isBasicBasic}} + constructor(username: string, password: string, basePath?: string); +{{/isBasicBasic}} +{{/authMethods}} + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { +{{#authMethods}} +{{#isBasicBasic}} + this.username = basePathOrUsername; + this.password = password +{{/isBasicBasic}} +{{/authMethods}} + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: {{classname}}ApiKeys, value: string) { + (this.authentications as any)[{{classname}}ApiKeys[key]].apiKey = value; + } +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasicBasic}} + + set username(username: string) { + this.authentications.{{name}}.username = username; + } + + set password(password: string) { + this.authentications.{{name}}.password = password; + } +{{/isBasicBasic}} +{{#isBasicBearer}} + + set accessToken(accessToken: string | (() => string)) { + this.authentications.{{name}}.accessToken = accessToken; + } +{{/isBasicBearer}} +{{#isOAuth}} + + set accessToken(token: string) { + this.authentications.{{name}}.accessToken = token; + } +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + +{{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{paramName}} {{description}} + {{/allParams}} + */ + public async {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { + const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}} + .replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}}; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); +{{#hasProduces}} + const produces = [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } +{{/hasProduces}} + let localVarFormParams: any = {}; + +{{#allParams}} +{{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + +{{/required}} +{{/allParams}} +{{#queryParams}} + if ({{paramName}} !== undefined) { + localVarQueryParameters['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); + } + +{{/queryParams}} +{{#headerParams}} + localVarHeaderParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); +{{/headerParams}} + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + +{{#formParams}} + if ({{paramName}} !== undefined) { + {{#isFile}} + localVarFormParams['{{baseName}}'] = {{paramName}}; + {{/isFile}} + {{^isFile}} + localVarFormParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); + {{/isFile}} + } +{{#isFile}} + localVarUseFormData = true; +{{/isFile}} + +{{/formParams}} + let localVarRequestOptions: localVarRequest.Options = { + method: '{{httpMethod}}', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, +{{^isResponseFile}} + json: true, +{{/isResponseFile}} +{{#isResponseFile}} + encoding: null, +{{/isResponseFile}} +{{#bodyParam}} + body: ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}") +{{/bodyParam}} + }; + + let authenticationPromise = Promise.resolve(); +{{#authMethods}} + {{#isApiKey}} + if (this.authentications.{{name}}.apiKey) { + authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); + } + {{/isApiKey}} + {{#isBasicBasic}} + if (this.authentications.{{name}}.username && this.authentications.{{name}}.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + if (this.authentications.{{name}}.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); + } + {{/isBasicBearer}} + {{#isOAuth}} + if (this.authentications.{{name}}.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); + } + {{/isOAuth}} +{{/authMethods}} + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + {{#returnType}} + body = ObjectSerializer.deserialize(body, "{{{returnType}}}"); + {{/returnType}} + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +{{/operation}} +} +{{/operations}} diff --git a/templates/swagger-codegen/api.mustache b/templates/swagger-codegen/api.mustache new file mode 100644 index 000000000..4b76122d8 --- /dev/null +++ b/templates/swagger-codegen/api.mustache @@ -0,0 +1,3 @@ +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; \ No newline at end of file diff --git a/templates/swagger-codegen/licenseInfo.mustache b/templates/swagger-codegen/licenseInfo.mustache new file mode 100644 index 000000000..9866f297a --- /dev/null +++ b/templates/swagger-codegen/licenseInfo.mustache @@ -0,0 +1,11 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ diff --git a/templates/swagger-codegen/model.mustache b/templates/swagger-codegen/model.mustache new file mode 100644 index 000000000..1f0d487fd --- /dev/null +++ b/templates/swagger-codegen/model.mustache @@ -0,0 +1,81 @@ +{{>licenseInfo}} +{{#models}} +{{#model}} +import { RequestFile } from './models'; +{{#tsImports}} +import { {{classname}} } from '{{filename}}'; +{{/tsImports}} + +{{#description}} +/** +* {{{description}}} +*/ +{{/description}} +{{^isEnum}} +export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#vars}} +{{#description}} + /** + * {{{description}}} + */ +{{/description}} + '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; +{{/vars}} + + {{#discriminator}} + static discriminator: string | undefined = "{{discriminatorName}}"; + {{/discriminator}} + {{^discriminator}} + static discriminator: string | undefined = undefined; + {{/discriminator}} + + {{^isArray}} + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + {{#vars}} + { + "name": "{{name}}", + "baseName": "{{baseName}}", + "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}" + }{{^-last}}, + {{/-last}} + {{/vars}} + ]; + + static getAttributeTypeMap() { + {{#parent}} + return super.getAttributeTypeMap().concat({{classname}}.attributeTypeMap); + {{/parent}} + {{^parent}} + return {{classname}}.attributeTypeMap; + {{/parent}} + } + {{/isArray}} +} + +{{#hasEnums}} +export namespace {{classname}} { +{{#vars}} +{{#isEnum}} + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } +{{/isEnum}} +{{/vars}} +} +{{/hasEnums}} +{{/isEnum}} +{{#isEnum}} +export enum {{classname}} { + {{#allowableValues}} + {{#enumVars}} + {{name}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} +} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/templates/swagger-codegen/models.mustache b/templates/swagger-codegen/models.mustache new file mode 100644 index 000000000..e803dfeb6 --- /dev/null +++ b/templates/swagger-codegen/models.mustache @@ -0,0 +1,255 @@ +{{#generateApis}} +import localVarRequest from 'request'; +{{/generateApis}} + +{{#models}} +{{#model}} +export * from '{{{ classFilename }}}'; +{{/model}} +{{/models}} + +import * as fs from 'fs'; + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + +{{! Object serialization only relevant if generating APIs, too }} +{{#generateApis}} + +{{#models}} +{{#model}} +import { {{classname}} } from '{{{ classFilename }}}'; +{{/model}} +{{/models}} + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + {{#models}} + {{#model}} + {{#hasEnums}} + {{#vars}} + {{#isEnum}} + {{#isContainer}}"{{classname}}.{{enumName}}": {{classname}}.{{enumName}}{{/isContainer}}{{^isContainer}}"{{datatypeWithEnum}}": {{datatypeWithEnum}}{{/isContainer}}, + {{/isEnum}} + {{/vars}} + {{/hasEnums}} + {{#isEnum}} + "{{classname}}": {{classname}}, + {{/isEnum}} + {{/model}} + {{/models}} +} + +let typeMap: {[index: string]: any} = { + {{#models}} + {{#model}} + {{^isEnum}} + "{{classname}}": {{classname}}, + {{/isEnum}} + {{/model}} + {{/models}} +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index = 0; index < data.length; index++) { + let datum = data[index]; + transformedData.push(ObjectSerializer.serialize(datum, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toISOString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index = 0; index < attributeTypes.length; index++) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + if (data == undefined) { + return data; + } else if (primitives.indexOf(type.toLowerCase()) !== -1) { + return data; + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index = 0; index < data.length; index++) { + let datum = data[index]; + transformedData.push(ObjectSerializer.deserialize(datum, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index = 0; index < attributeTypes.length; index++) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): Promise | void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) { + if (requestOptions.headers['Cookie']) { + requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey); + } + else { + requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey); + } + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); +{{/generateApis}} From 8220645e9cf7c1a889bc3b1289aeb58cd1548e1f Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 22 Feb 2022 12:16:12 +0200 Subject: [PATCH 02/27] first pass on generating User Type API client --- src/v3/.swagger-codegen/VERSION | 1 + src/v3/api.ts | 39 + src/v3/apis/user-type-api.ts | 705 ++++++++++++++++++ src/v3/base.ts | 69 ++ src/v3/configuration.ts | 74 ++ src/v3/index.ts | 16 + src/v3/models/user-type-condition.ts | 32 + src/v3/models/user-type.ts | 80 ++ templates/swagger-codegen/api-all.mustache | 23 - templates/swagger-codegen/api-single.mustache | 284 ------- templates/swagger-codegen/api.mustache | 14 +- templates/swagger-codegen/apiInner.mustache | 408 ++++++++++ templates/swagger-codegen/baseApi.mustache | 60 ++ .../swagger-codegen/configuration.mustache | 65 ++ templates/swagger-codegen/index.mustache | 7 + .../swagger-codegen/licenseInfo.mustache | 8 +- templates/swagger-codegen/model.mustache | 88 +-- templates/swagger-codegen/modelAllOf.mustache | 6 + templates/swagger-codegen/modelEnum.mustache | 12 + .../swagger-codegen/modelGeneric.mustache | 39 + templates/swagger-codegen/modelIndex.mustache | 2 + templates/swagger-codegen/modelOneOf.mustache | 6 + templates/swagger-codegen/models.mustache | 255 ------- 23 files changed, 1645 insertions(+), 648 deletions(-) create mode 100644 src/v3/.swagger-codegen/VERSION create mode 100644 src/v3/api.ts create mode 100644 src/v3/apis/user-type-api.ts create mode 100644 src/v3/base.ts create mode 100644 src/v3/configuration.ts create mode 100644 src/v3/index.ts create mode 100644 src/v3/models/user-type-condition.ts create mode 100644 src/v3/models/user-type.ts delete mode 100644 templates/swagger-codegen/api-all.mustache delete mode 100644 templates/swagger-codegen/api-single.mustache create mode 100644 templates/swagger-codegen/apiInner.mustache create mode 100644 templates/swagger-codegen/baseApi.mustache create mode 100644 templates/swagger-codegen/configuration.mustache create mode 100644 templates/swagger-codegen/index.mustache create mode 100644 templates/swagger-codegen/modelAllOf.mustache create mode 100644 templates/swagger-codegen/modelEnum.mustache create mode 100644 templates/swagger-codegen/modelGeneric.mustache create mode 100644 templates/swagger-codegen/modelIndex.mustache create mode 100644 templates/swagger-codegen/modelOneOf.mustache delete mode 100644 templates/swagger-codegen/models.mustache diff --git a/src/v3/.swagger-codegen/VERSION b/src/v3/.swagger-codegen/VERSION new file mode 100644 index 000000000..bdb1390d1 --- /dev/null +++ b/src/v3/.swagger-codegen/VERSION @@ -0,0 +1 @@ +3.0.30 \ No newline at end of file diff --git a/src/v3/api.ts b/src/v3/api.ts new file mode 100644 index 000000000..fbbaef818 --- /dev/null +++ b/src/v3/api.ts @@ -0,0 +1,39 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */export * from './apis/application-api'; +export * from './apis/authenticator-api'; +export * from './apis/authorization-server-api'; +export * from './apis/brand-api'; +export * from './apis/captchaapi'; +export * from './apis/domain-api'; +export * from './apis/event-hook-api'; +export * from './apis/feature-api'; +export * from './apis/group-api'; +export * from './apis/identity-provider-api'; +export * from './apis/inline-hook-api'; +export * from './apis/linked-object-api'; +export * from './apis/network-zone-api'; +export * from './apis/org-setting-api'; +export * from './apis/policy-api'; +export * from './apis/profile-mapping-api'; +export * from './apis/schema-api'; +export * from './apis/session-api'; +export * from './apis/subscription-api'; +export * from './apis/system-log-api'; +export * from './apis/template-api'; +export * from './apis/threat-insight-api'; +export * from './apis/trusted-origin-api'; +export * from './apis/user-api'; +export * from './apis/user-factor-api'; +export * from './apis/user-type-api'; + diff --git a/src/v3/apis/user-type-api.ts b/src/v3/apis/user-type-api.ts new file mode 100644 index 000000000..501462e60 --- /dev/null +++ b/src/v3/apis/user-type-api.ts @@ -0,0 +1,705 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { UserType } from '../models'; +import { OAuth } from '../OAuth'; + + +/** + * UserTypeApi - request parameter creator + * @export + */ +export const UserTypeApiRequestParamCreator = function (configuration?: Configuration) { + const configLoader = new ConfigLoader(); + const clientConfig = Object.assign({}, configuration); + configLoader.applyDefaults(); + configLoader.apply({ + client: clientConfig || {} + }); + + const parsedConfig = configLoader.config; + const requestExecutor = clientConfig.requestExecutor || new DefaultRequestExecutor(); + const errors = []; + if (!parsedConfig.client.orgUrl) { + errors.push('Okta Org URL not provided'); + } + + if (!parsedConfig.client.token && parsedConfig.client.authorizationMode !== 'PrivateKey') { + errors.push('Okta API token not provided'); + } + + if (parsedConfig.client.authorizationMode === 'PrivateKey') { + if (!parsedConfig.client.clientId) { + errors.push('Okta Client ID not provided'); + } + if (!parsedConfig.client.scopes) { + errors.push('Scopes not provided'); + } + if (!parsedConfig.client.privateKey) { + errors.push('Private Key not provided'); + } + } else if (parsedConfig.client.authorizationMode !== 'SSWS') { + errors.push('Unknown Authorization Mode'); + } + if (errors.length) { + throw new Error(`Found ${errors.length} errors:\n${errors.join('\n')}\nSee ${repoUrl} for usage.`); + } + const authorizationMode = parsedConfig.client.authorizationMode; + const baseUrl = parsedConfig.client.orgUrl.replace(/\/$/, ''); + const apiToken = parsedConfig.client.token; + + let clientId; + let scopes; + let privateKey; + let oauth; + if (authorizationMode === 'PrivateKey') { + clientId = parsedConfig.client.clientId; + scopes = parsedConfig.client.scopes.split(' '); + privateKey = parsedConfig.client.privateKey; + oauth = new OAuth(this); + } + + const http = new Http({ + cacheStore: clientConfig.cacheStore, + cacheMiddleware: clientConfig.cacheMiddleware, + defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, + requestExecutor: requestExecutor, + oauth: oauth + }); + if (authorizationMode === 'SSWS') { + http.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + } + http.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; + + return { + http: http, + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType: async (body: UserType, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createUserType.'); + } + const localVarPath = `/api/v1/meta/types/user`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType: async (typeId: string, options: any = {}): Promise => { + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling deleteUserType.'); + } + const localVarPath = `/api/v1/meta/types/user/{typeId}` + .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType: async (typeId: string, options: any = {}): Promise => { + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling getUserType.'); + } + const localVarPath = `/api/v1/meta/types/user/{typeId}` + .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes: async (options: any = {}): Promise => { + const localVarPath = `/api/v1/meta/types/user`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType: async (body: UserType, typeId: string, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling replaceUserType.'); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling replaceUserType.'); + } + const localVarPath = `/api/v1/meta/types/user/{typeId}` + .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType: async (body: UserType, typeId: string, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateUserType.'); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling updateUserType.'); + } + const localVarPath = `/api/v1/meta/types/user/{typeId}` + .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_token required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("Authorization") + : await configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + // authentication oauth2 required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserTypeApi - functional programming interface + * @export + */ +export const UserTypeApiFp = function(configuration?: Configuration) { + return { + This is Array + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async createUserType(body: UserType, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.createUserType(body, options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + This is Array + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async deleteUserType(typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.deleteUserType(typeId, options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + This is Array + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async getUserType(typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.getUserType(typeId, options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + This is Array + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async listUserTypes(options?: any): Promise<(http?: Http, basePath?: string) => Promise>> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.listUserTypes(options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + This is Array + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async replaceUserType(body: UserType, typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.replaceUserType(body, typeId, options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + This is Array + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + + + async updateUserType(body: UserType, typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { + const api = RequestParamCreator(configuration); + const localVarRequestArgs = await api.updateUserType(body, typeId, options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + } +}; + +/** + * UserTypeApi - factory interface + * @export + */ +export const UserTypeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType(body: UserType, options?: any): AxiosPromise { + return UserTypeApiFp(configuration).createUserType(body, options).then((request) => request(axios, basePath)); + }, + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType(typeId: string, options?: any): AxiosPromise { + return UserTypeApiFp(configuration).deleteUserType(typeId, options).then((request) => request(axios, basePath)); + }, + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType(typeId: string, options?: any): AxiosPromise { + return UserTypeApiFp(configuration).getUserType(typeId, options).then((request) => request(axios, basePath)); + }, + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes(options?: any): AxiosPromise> { + return UserTypeApiFp(configuration).listUserTypes(options).then((request) => request(axios, basePath)); + }, + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType(body: UserType, typeId: string, options?: any): AxiosPromise { + return UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then((request) => request(axios, basePath)); + }, + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType(body: UserType, typeId: string, options?: any): AxiosPromise { + return UserTypeApiFp(configuration).updateUserType(body, typeId, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * UserTypeApi - object-oriented interface + * @export + * @class UserTypeApi + * @extends {BaseAPI} + */ +export class UserTypeApi extends BaseAPI { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public createUserType(body: UserType, options?: any) { + return UserTypeApiFp(this.configuration).createUserType(body, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public deleteUserType(typeId: string, options?: any) { + return UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public getUserType(typeId: string, options?: any) { + return UserTypeApiFp(this.configuration).getUserType(typeId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public listUserTypes(options?: any) { + return UserTypeApiFp(this.configuration).listUserTypes(options).then((request) => request(this.axios, this.basePath)); + } + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public replaceUserType(body: UserType, typeId: string, options?: any) { + return UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + public updateUserType(body: UserType, typeId: string, options?: any) { + return UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/v3/base.ts b/src/v3/base.ts new file mode 100644 index 000000000..1f9922651 --- /dev/null +++ b/src/v3/base.ts @@ -0,0 +1,69 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/v3/configuration.ts b/src/v3/configuration.ts new file mode 100644 index 000000000..9c0e9d738 --- /dev/null +++ b/src/v3/configuration.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + } +} diff --git a/src/v3/index.ts b/src/v3/index.ts new file mode 100644 index 000000000..43c40f93d --- /dev/null +++ b/src/v3/index.ts @@ -0,0 +1,16 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export * from "./api"; +export * from "./configuration"; + diff --git a/src/v3/models/user-type-condition.ts b/src/v3/models/user-type-condition.ts new file mode 100644 index 000000000..1fc2c2d95 --- /dev/null +++ b/src/v3/models/user-type-condition.ts @@ -0,0 +1,32 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +/** + * + * @export + * @interface UserTypeCondition + */ +export interface UserTypeCondition { + /** + * + * @type {Array<string>} + * @memberof UserTypeCondition + */ + exclude?: any; + /** + * + * @type {Array<string>} + * @memberof UserTypeCondition + */ + include?: any; +} diff --git a/src/v3/models/user-type.ts b/src/v3/models/user-type.ts new file mode 100644 index 000000000..19d155bff --- /dev/null +++ b/src/v3/models/user-type.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +/** + * + * @export + * @interface UserType + */ +export interface UserType { + /** + * + * @type {{ [key, string]: any;}} + * @memberof UserType + */ + links?: any; + /** + * + * @type {Date} + * @memberof UserType + */ + created?: any; + /** + * + * @type {string} + * @memberof UserType + */ + createdBy?: any; + /** + * + * @type {boolean} + * @memberof UserType + */ + _default?: any; + /** + * + * @type {string} + * @memberof UserType + */ + description?: any; + /** + * + * @type {string} + * @memberof UserType + */ + displayName?: any; + /** + * + * @type {string} + * @memberof UserType + */ + id?: any; + /** + * + * @type {Date} + * @memberof UserType + */ + lastUpdated?: any; + /** + * + * @type {string} + * @memberof UserType + */ + lastUpdatedBy?: any; + /** + * + * @type {string} + * @memberof UserType + */ + name?: any; +} diff --git a/templates/swagger-codegen/api-all.mustache b/templates/swagger-codegen/api-all.mustache deleted file mode 100644 index 16b585d9e..000000000 --- a/templates/swagger-codegen/api-all.mustache +++ /dev/null @@ -1,23 +0,0 @@ -{{#apiInfo}} -{{#apis}} -{{#operations}} -export * from './{{ classFilename }}'; -import { {{ classname }} } from './{{ classFilename }}'; -{{/operations}} -{{#withInterfaces}} -export * from './{{ classFilename }}Interface' -{{/withInterfaces}} -{{/apis}} -import * as http from 'http'; - -export class HttpError extends Error { - constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) { - super('HTTP request failed'); - this.name = 'HttpError'; - } -} - -export { RequestFile } from '../model/models'; - -export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; -{{/apiInfo}} diff --git a/templates/swagger-codegen/api-single.mustache b/templates/swagger-codegen/api-single.mustache deleted file mode 100644 index 081893a93..000000000 --- a/templates/swagger-codegen/api-single.mustache +++ /dev/null @@ -1,284 +0,0 @@ -{{>licenseInfo}} - -import localVarRequest from 'request'; -import http from 'http'; - -/* tslint:disable:no-unused-locals */ -{{#imports}} -import { {{classname}} } from '{{filename}}'; -{{/imports}} - -import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models'; -{{#hasAuthMethods}} -import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models'; -{{/hasAuthMethods}} - -import { HttpError, RequestFile } from './apis'; - -let defaultBasePath = '{{{basePath}}}'; - -// =============================================== -// This file is autogenerated - Please do not edit -// =============================================== - -{{#operations}} -{{#description}} -/** -* {{&description}} -*/ -{{/description}} -export enum {{classname}}ApiKeys { -{{#authMethods}} -{{#isApiKey}} - {{name}}, -{{/isApiKey}} -{{/authMethods}} -} - -export class {{classname}} { - protected _basePath = defaultBasePath; - protected _defaultHeaders : any = {}; - protected _useQuerystring : boolean = false; - - protected authentications = { - 'default': new VoidAuth(), -{{#hasAuthMethods}} -{{#authMethods}} -{{#isBasicBasic}} - '{{name}}': new HttpBasicAuth(), -{{/isBasicBasic}} -{{#isBasicBearer}} - '{{name}}': new HttpBearerAuth(), -{{/isBasicBearer}} -{{#isApiKey}} - '{{name}}': new ApiKeyAuth({{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}{{#isKeyInCookie}}'cookie'{{/isKeyInCookie}}, '{{keyParamName}}'), -{{/isApiKey}} -{{#isOAuth}} - '{{name}}': new OAuth(), -{{/isOAuth}} -{{/authMethods}} -{{/hasAuthMethods}} - } - - protected interceptors: Interceptor[] = []; - - constructor(basePath?: string); -{{#authMethods}} -{{#isBasicBasic}} - constructor(username: string, password: string, basePath?: string); -{{/isBasicBasic}} -{{/authMethods}} - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { -{{#authMethods}} -{{#isBasicBasic}} - this.username = basePathOrUsername; - this.password = password -{{/isBasicBasic}} -{{/authMethods}} - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - set defaultHeaders(defaultHeaders: any) { - this._defaultHeaders = defaultHeaders; - } - - get defaultHeaders() { - return this._defaultHeaders; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: {{classname}}ApiKeys, value: string) { - (this.authentications as any)[{{classname}}ApiKeys[key]].apiKey = value; - } -{{#hasAuthMethods}} -{{#authMethods}} -{{#isBasicBasic}} - - set username(username: string) { - this.authentications.{{name}}.username = username; - } - - set password(password: string) { - this.authentications.{{name}}.password = password; - } -{{/isBasicBasic}} -{{#isBasicBearer}} - - set accessToken(accessToken: string | (() => string)) { - this.authentications.{{name}}.accessToken = accessToken; - } -{{/isBasicBearer}} -{{#isOAuth}} - - set accessToken(token: string) { - this.authentications.{{name}}.accessToken = token; - } -{{/isOAuth}} -{{/authMethods}} -{{/hasAuthMethods}} - - public addInterceptor(interceptor: Interceptor) { - this.interceptors.push(interceptor); - } - -{{#operation}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#allParams}} - * @param {{paramName}} {{description}} - {{/allParams}} - */ - public async {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { - const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}} - .replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}}; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); -{{#hasProduces}} - const produces = [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]; - // give precedence to 'application/json' - if (produces.indexOf('application/json') >= 0) { - localVarHeaderParams.Accept = 'application/json'; - } else { - localVarHeaderParams.Accept = produces.join(','); - } -{{/hasProduces}} - let localVarFormParams: any = {}; - -{{#allParams}} -{{#required}} - // verify required parameter '{{paramName}}' is not null or undefined - if ({{paramName}} === null || {{paramName}} === undefined) { - throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); - } - -{{/required}} -{{/allParams}} -{{#queryParams}} - if ({{paramName}} !== undefined) { - localVarQueryParameters['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); - } - -{{/queryParams}} -{{#headerParams}} - localVarHeaderParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); -{{/headerParams}} - (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - -{{#formParams}} - if ({{paramName}} !== undefined) { - {{#isFile}} - localVarFormParams['{{baseName}}'] = {{paramName}}; - {{/isFile}} - {{^isFile}} - localVarFormParams['{{baseName}}'] = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}"); - {{/isFile}} - } -{{#isFile}} - localVarUseFormData = true; -{{/isFile}} - -{{/formParams}} - let localVarRequestOptions: localVarRequest.Options = { - method: '{{httpMethod}}', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, -{{^isResponseFile}} - json: true, -{{/isResponseFile}} -{{#isResponseFile}} - encoding: null, -{{/isResponseFile}} -{{#bodyParam}} - body: ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}") -{{/bodyParam}} - }; - - let authenticationPromise = Promise.resolve(); -{{#authMethods}} - {{#isApiKey}} - if (this.authentications.{{name}}.apiKey) { - authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); - } - {{/isApiKey}} - {{#isBasicBasic}} - if (this.authentications.{{name}}.username && this.authentications.{{name}}.password) { - authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); - } - {{/isBasicBasic}} - {{#isBasicBearer}} - if (this.authentications.{{name}}.accessToken) { - authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); - } - {{/isBasicBearer}} - {{#isOAuth}} - if (this.authentications.{{name}}.accessToken) { - authenticationPromise = authenticationPromise.then(() => this.authentications.{{name}}.applyToRequest(localVarRequestOptions)); - } - {{/isOAuth}} -{{/authMethods}} - authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); - - let interceptorPromise = authenticationPromise; - for (const interceptor of this.interceptors) { - interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); - } - - return interceptorPromise.then(() => { - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }>((resolve, reject) => { - localVarRequest(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - {{#returnType}} - body = ObjectSerializer.deserialize(body, "{{{returnType}}}"); - {{/returnType}} - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject(new HttpError(response, body, response.statusCode)); - } - } - }); - }); - }); - } -{{/operation}} -} -{{/operations}} diff --git a/templates/swagger-codegen/api.mustache b/templates/swagger-codegen/api.mustache index 4b76122d8..7fdf1a233 100644 --- a/templates/swagger-codegen/api.mustache +++ b/templates/swagger-codegen/api.mustache @@ -1,3 +1,11 @@ -// This is the entrypoint for the package -export * from './api/apis'; -export * from './model/models'; \ No newline at end of file +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} +{{#apiInfo}} +{{#apis}} +{{#operations}} +export * from './{{tsApiPackage}}/{{classFilename}}'; +{{/operations}} +{{/apis}} +{{/apiInfo}} + diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache new file mode 100644 index 000000000..27c6616c5 --- /dev/null +++ b/templates/swagger-codegen/apiInner.mustache @@ -0,0 +1,408 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} +import { Configuration } from '{{apiRelativeToRoot}}configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base'; +{{#imports}} +import { {{import}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; +import { OAuth } from '{{apiRelativeToRoot}}OAuth'; +{{/imports}} +{{#operations}} + + +/** + * {{classname}} - request parameter creator{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}RequestParamCreator = function (configuration?: Configuration) { + const configLoader = new ConfigLoader(); + const clientConfig = Object.assign({}, configuration); + configLoader.applyDefaults(); + configLoader.apply({ + client: clientConfig || {} + }); + + const parsedConfig = configLoader.config; + const requestExecutor = clientConfig.requestExecutor || new DefaultRequestExecutor(); + const errors = []; + if (!parsedConfig.client.orgUrl) { + errors.push('Okta Org URL not provided'); + } + + if (!parsedConfig.client.token && parsedConfig.client.authorizationMode !== 'PrivateKey') { + errors.push('Okta API token not provided'); + } + + if (parsedConfig.client.authorizationMode === 'PrivateKey') { + if (!parsedConfig.client.clientId) { + errors.push('Okta Client ID not provided'); + } + if (!parsedConfig.client.scopes) { + errors.push('Scopes not provided'); + } + if (!parsedConfig.client.privateKey) { + errors.push('Private Key not provided'); + } + } else if (parsedConfig.client.authorizationMode !== 'SSWS') { + errors.push('Unknown Authorization Mode'); + } + if (errors.length) { + throw new Error(`Found ${errors.length} errors:\n${errors.join('\n')}\nSee ${repoUrl} for usage.`); + } + const authorizationMode = parsedConfig.client.authorizationMode; + const baseUrl = parsedConfig.client.orgUrl.replace(/\/$/, ''); + const apiToken = parsedConfig.client.token; + + let clientId; + let scopes; + let privateKey; + let oauth; + if (authorizationMode === 'PrivateKey') { + clientId = parsedConfig.client.clientId; + scopes = parsedConfig.client.scopes.split(' '); + privateKey = parsedConfig.client.privateKey; + oauth = new OAuth(this); + } + + const http = new Http({ + cacheStore: clientConfig.cacheStore, + cacheMiddleware: clientConfig.cacheMiddleware, + defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, + requestExecutor: requestExecutor, + oauth: oauth + }); + if (authorizationMode === 'SSWS') { + http.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + } + http.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; + + return { + http: http, + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}: async ({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options: any = {}): Promise => { + {{#parameters}} + {{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + {{/required}} + {{/parameters}} + const localVarPath = `{{{path}}}`{{#pathParams}} + .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}} + const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}FormData(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}} + + {{#authMethods}} + // authentication {{name}} required + {{#isApiKey}} + {{#isKeyInHeader}} + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("{{keyParamName}}") + : await configuration.apiKey; + localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInHeader}} + {{#isKeyInQuery}} + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey("{{keyParamName}}") + : await configuration.apiKey; + localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInQuery}} + {{/isApiKey}} + {{#isBasicBasic}} + // http basic authentication required + if (configuration && (configuration.username || configuration.password)) { + localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password }; + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // http bearer authentication required + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; + } + {{/isBasicBearer}} + {{#isOAuth}} + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("{{name}}", [{{#each scopes}}"{{@key}}"{{^@last}}, {{/@last}}{{/each}}]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + {{/isOAuth}} + + {{/authMethods}} + {{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + {{#isDateTime}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? + ({{paramName}} as any).toISOString() : + {{paramName}}; + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? + ({{paramName}} as any).toISOString().substr(0,10) : + {{paramName}}; + {{/isDate}} + {{^isDate}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isDate}} + {{/isDateTime}} + } + {{/isListContainer}} + + {{/queryParams}} + {{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + {{#isString}} + localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); + {{/isString}} + {{^isString}} + localVarHeaderParameter['{{baseName}}'] = String(JSON.stringify({{paramName}})); + {{/isString}} + } + {{/isListContainer}} + + {{/headerParams}} + {{#vendorExtensions}} + {{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + localVarFormParams.append('{{baseName}}', element as any); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}}{{^multipartFormData}} + localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}{{#multipartFormData}} + localVarFormParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}} + {{/isCollectionFormatMulti}} + }{{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { {{^multipartFormData}} + localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}} + localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/multipartFormData}} + } + {{/isListContainer}} + {{/formParams}}{{/vendorExtensions}} + {{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}} + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}} + localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}} + {{/hasFormParams}}{{/vendorExtensions}} + {{#bodyParam}} + {{^consumes}} + localVarHeaderParameter['Content-Type'] = 'application/json'; + {{/consumes}} + {{#consumes.0}} + localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}'; + {{/consumes.0}} + + {{/bodyParam}} + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + {{#hasFormParams}} + localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}}; + {{/hasFormParams}} + {{#bodyParam}} + const needsSerialization = (typeof {{paramName}} !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {}) : ({{paramName}} || ""); + {{/bodyParam}} + + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + {{/contents}} + {{/operation}} + } +}; + +/** + * {{classname}} - functional programming interface{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export const {{classname}}Fp = function(configuration?: Configuration) { + return { + {{#operation}} + {{#if responses['200'].schema.items.$ref}} + This is Array + {{/if}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{../responses/what/description}} + + async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(http?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> { + const api = {{className}}RequestParamCreator(configuration); + const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); + return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; + return httpClient.http(requestArgs); + }, + {{/contents}} + {{/operation}} + } +}; + +/** + * {{classname}} - factory interface{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { + return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(axios, basePath)); + }, + {{/contents}} + {{/operation}} + }; +}; + +{{#withInterfaces}} +/** + * {{classname}} - interface{{#description}} + * {{&description}}{{/description}} + * @export + * @interface {{classname}} + */ +export interface {{classname}}Interface { +{{#operation}} +{{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}}Interface + */ + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>; + +{{/contents}} +{{/operation}} +} + +{{/withInterfaces}} +/** + * {{classname}} - object-oriented interface{{#description}} + * {{{description}}}{{/description}} + * @export + * @class {{classname}} + * @extends {BaseAPI} + */ +{{#withInterfaces}} +export class {{classname}} extends BaseAPI implements {{classname}}Interface { +{{/withInterfaces}} +{{^withInterfaces}} +export class {{classname}} extends BaseAPI { +{{/withInterfaces}} + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}} + */ + public {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any) { + return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(this.axios, this.basePath)); + } + {{^@last}} + + {{/@last}} + {{/contents}} + {{/operation}} +} +{{/operations}} diff --git a/templates/swagger-codegen/baseApi.mustache b/templates/swagger-codegen/baseApi.mustache new file mode 100644 index 000000000..519b7c7d9 --- /dev/null +++ b/templates/swagger-codegen/baseApi.mustache @@ -0,0 +1,60 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/templates/swagger-codegen/configuration.mustache b/templates/swagger-codegen/configuration.mustache new file mode 100644 index 000000000..ae7e0dcc2 --- /dev/null +++ b/templates/swagger-codegen/configuration.mustache @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + } +} diff --git a/templates/swagger-codegen/index.mustache b/templates/swagger-codegen/index.mustache new file mode 100644 index 000000000..b8e9eb606 --- /dev/null +++ b/templates/swagger-codegen/index.mustache @@ -0,0 +1,7 @@ +/* tslint:disable */ +/* eslint-disable */ +{{>licenseInfo}} + +export * from "./api"; +export * from "./configuration"; +{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}} diff --git a/templates/swagger-codegen/licenseInfo.mustache b/templates/swagger-codegen/licenseInfo.mustache index 9866f297a..7d61c4ee0 100644 --- a/templates/swagger-codegen/licenseInfo.mustache +++ b/templates/swagger-codegen/licenseInfo.mustache @@ -2,10 +2,10 @@ * {{{appName}}} * {{{appDescription}}} * - * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} + * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - */ + */ \ No newline at end of file diff --git a/templates/swagger-codegen/model.mustache b/templates/swagger-codegen/model.mustache index 1f0d487fd..f94509811 100644 --- a/templates/swagger-codegen/model.mustache +++ b/templates/swagger-codegen/model.mustache @@ -1,81 +1,11 @@ +/* tslint:disable */ +/* eslint-disable */ {{>licenseInfo}} -{{#models}} -{{#model}} -import { RequestFile } from './models'; -{{#tsImports}} -import { {{classname}} } from '{{filename}}'; -{{/tsImports}} +{{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}} +import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}} +import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}} +import { {{class}} } from './{{filename}}';{{/imports}}{{/hasOneOf}}{{/hasAllOf}}{{/withSeparateModelsAndApi}} +{{#models}}{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{#oneOf}}{{#@first}}{{>modelOneOf}}{{/@first}}{{/oneOf}}{{#allOf}}{{#@first}}{{>modelAllOf}}{{/@first}}{{/allOf}}{{^isEnum}}{{^oneOf}}{{^allOf}}{{>modelGeneric}}{{/allOf}}{{/oneOf}}{{/isEnum}} +{{/model}}{{/models}} -{{#description}} -/** -* {{{description}}} -*/ -{{/description}} -{{^isEnum}} -export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ -{{#vars}} -{{#description}} - /** - * {{{description}}} - */ -{{/description}} - '{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; -{{/vars}} - - {{#discriminator}} - static discriminator: string | undefined = "{{discriminatorName}}"; - {{/discriminator}} - {{^discriminator}} - static discriminator: string | undefined = undefined; - {{/discriminator}} - - {{^isArray}} - static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ - {{#vars}} - { - "name": "{{name}}", - "baseName": "{{baseName}}", - "type": "{{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}" - }{{^-last}}, - {{/-last}} - {{/vars}} - ]; - - static getAttributeTypeMap() { - {{#parent}} - return super.getAttributeTypeMap().concat({{classname}}.attributeTypeMap); - {{/parent}} - {{^parent}} - return {{classname}}.attributeTypeMap; - {{/parent}} - } - {{/isArray}} -} - -{{#hasEnums}} -export namespace {{classname}} { -{{#vars}} -{{#isEnum}} - export enum {{enumName}} { - {{#allowableValues}} - {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} - } -{{/isEnum}} -{{/vars}} -} -{{/hasEnums}} -{{/isEnum}} -{{#isEnum}} -export enum {{classname}} { - {{#allowableValues}} - {{#enumVars}} - {{name}} = {{{value}}}{{^-last}},{{/-last}} - {{/enumVars}} - {{/allowableValues}} -} -{{/isEnum}} -{{/model}} -{{/models}} diff --git a/templates/swagger-codegen/modelAllOf.mustache b/templates/swagger-codegen/modelAllOf.mustache new file mode 100644 index 000000000..e0fbf0ab7 --- /dev/null +++ b/templates/swagger-codegen/modelAllOf.mustache @@ -0,0 +1,6 @@ +/** + * @type {{classname}}{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export type {{classname}} = {{#allOf}}{{{.}}}{{^@last}} & {{/@last}}{{/allOf}}; diff --git a/templates/swagger-codegen/modelEnum.mustache b/templates/swagger-codegen/modelEnum.mustache new file mode 100644 index 000000000..98c73f2cf --- /dev/null +++ b/templates/swagger-codegen/modelEnum.mustache @@ -0,0 +1,12 @@ +/** + * {{{description}}} + * @export + * @enum {string} + */ +export enum {{classname}} { +{{#allowableValues}} +{{#enumVars}} + {{{name}}} = {{{value}}}{{^@last}},{{/@last}} +{{/enumVars}} +{{/allowableValues}} +} diff --git a/templates/swagger-codegen/modelGeneric.mustache b/templates/swagger-codegen/modelGeneric.mustache new file mode 100644 index 000000000..19b00602c --- /dev/null +++ b/templates/swagger-codegen/modelGeneric.mustache @@ -0,0 +1,39 @@ +/** + * {{{description}}} + * @export + * @interface {{classname}} + */ +export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#additionalPropertiesType}} + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + +{{/additionalPropertiesType}} +{{#vars}} + /** + * {{{description}}} + * @type {{braces "left"}}{{datatype}}{{braces "right"}} + * @memberof {{classname}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; +{{/vars}} +}{{#hasEnums}} + +{{#vars}} +{{#isEnum}} +/** + * @export + * @enum {string} + */ +export enum {{enumName}} { +{{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{value}}}{{^@last}},{{/@last}} + {{/enumVars}} +{{/allowableValues}} +} +{{/isEnum}} +{{/vars}} +{{/hasEnums}} diff --git a/templates/swagger-codegen/modelIndex.mustache b/templates/swagger-codegen/modelIndex.mustache new file mode 100644 index 000000000..947111206 --- /dev/null +++ b/templates/swagger-codegen/modelIndex.mustache @@ -0,0 +1,2 @@ +{{#models}}{{#model}}export * from './{{classFilename}}';{{/model}} +{{/models}} \ No newline at end of file diff --git a/templates/swagger-codegen/modelOneOf.mustache b/templates/swagger-codegen/modelOneOf.mustache new file mode 100644 index 000000000..2e89c82f5 --- /dev/null +++ b/templates/swagger-codegen/modelOneOf.mustache @@ -0,0 +1,6 @@ +/** + * @type {{classname}}{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export type {{classname}} = {{#oneOf}}{{{.}}}{{^@last}} | {{/@last}}{{/oneOf}}; diff --git a/templates/swagger-codegen/models.mustache b/templates/swagger-codegen/models.mustache deleted file mode 100644 index e803dfeb6..000000000 --- a/templates/swagger-codegen/models.mustache +++ /dev/null @@ -1,255 +0,0 @@ -{{#generateApis}} -import localVarRequest from 'request'; -{{/generateApis}} - -{{#models}} -{{#model}} -export * from '{{{ classFilename }}}'; -{{/model}} -{{/models}} - -import * as fs from 'fs'; - -export interface RequestDetailedFile { - value: Buffer; - options?: { - filename?: string; - contentType?: string; - } -} - -export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; - -{{! Object serialization only relevant if generating APIs, too }} -{{#generateApis}} - -{{#models}} -{{#model}} -import { {{classname}} } from '{{{ classFilename }}}'; -{{/model}} -{{/models}} - -/* tslint:disable:no-unused-variable */ -let primitives = [ - "string", - "boolean", - "double", - "integer", - "long", - "float", - "number", - "any" - ]; - -let enumsMap: {[index: string]: any} = { - {{#models}} - {{#model}} - {{#hasEnums}} - {{#vars}} - {{#isEnum}} - {{#isContainer}}"{{classname}}.{{enumName}}": {{classname}}.{{enumName}}{{/isContainer}}{{^isContainer}}"{{datatypeWithEnum}}": {{datatypeWithEnum}}{{/isContainer}}, - {{/isEnum}} - {{/vars}} - {{/hasEnums}} - {{#isEnum}} - "{{classname}}": {{classname}}, - {{/isEnum}} - {{/model}} - {{/models}} -} - -let typeMap: {[index: string]: any} = { - {{#models}} - {{#model}} - {{^isEnum}} - "{{classname}}": {{classname}}, - {{/isEnum}} - {{/model}} - {{/models}} -} - -export class ObjectSerializer { - public static findCorrectType(data: any, expectedType: string) { - if (data == undefined) { - return expectedType; - } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { - return expectedType; - } else if (expectedType === "Date") { - return expectedType; - } else { - if (enumsMap[expectedType]) { - return expectedType; - } - - if (!typeMap[expectedType]) { - return expectedType; // w/e we don't know the type - } - - // Check the discriminator - let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty == null) { - return expectedType; // the type does not have a discriminator. use it. - } else { - if (data[discriminatorProperty]) { - var discriminatorType = data[discriminatorProperty]; - if(typeMap[discriminatorType]){ - return discriminatorType; // use the type given in the discriminator - } else { - return expectedType; // discriminator did not map to a type - } - } else { - return expectedType; // discriminator was not present (or an empty string) - } - } - } - } - - public static serialize(data: any, type: string) { - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - let datum = data[index]; - transformedData.push(ObjectSerializer.serialize(datum, subType)); - } - return transformedData; - } else if (type === "Date") { - return data.toISOString(); - } else { - if (enumsMap[type]) { - return data; - } - if (!typeMap[type]) { // in case we dont know the type - return data; - } - - // Get the actual type of this object - type = this.findCorrectType(data, type); - - // get the map for the correct type. - let attributeTypes = typeMap[type].getAttributeTypeMap(); - let instance: {[index: string]: any} = {}; - for (let index = 0; index < attributeTypes.length; index++) { - let attributeType = attributeTypes[index]; - instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); - } - return instance; - } - } - - public static deserialize(data: any, type: string) { - // polymorphism may change the actual type. - type = ObjectSerializer.findCorrectType(data, type); - if (data == undefined) { - return data; - } else if (primitives.indexOf(type.toLowerCase()) !== -1) { - return data; - } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace("Array<", ""); // Array => Type> - subType = subType.substring(0, subType.length - 1); // Type> => Type - let transformedData: any[] = []; - for (let index = 0; index < data.length; index++) { - let datum = data[index]; - transformedData.push(ObjectSerializer.deserialize(datum, subType)); - } - return transformedData; - } else if (type === "Date") { - return new Date(data); - } else { - if (enumsMap[type]) {// is Enum - return data; - } - - if (!typeMap[type]) { // dont know the type - return data; - } - let instance = new typeMap[type](); - let attributeTypes = typeMap[type].getAttributeTypeMap(); - for (let index = 0; index < attributeTypes.length; index++) { - let attributeType = attributeTypes[index]; - instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); - } - return instance; - } - } -} - -export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: localVarRequest.Options): Promise | void; -} - -export class HttpBasicAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - requestOptions.auth = { - username: this.username, password: this.password - } - } -} - -export class HttpBearerAuth implements Authentication { - public accessToken: string | (() => string) = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - const accessToken = typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - requestOptions.headers["Authorization"] = "Bearer " + accessToken; - } - } -} - -export class ApiKeyAuth implements Authentication { - public apiKey: string = ''; - - constructor(private location: string, private paramName: string) { - } - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (this.location == "query") { - (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location == "header" && requestOptions && requestOptions.headers) { - requestOptions.headers[this.paramName] = this.apiKey; - } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) { - if (requestOptions.headers['Cookie']) { - requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey); - } - else { - requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey); - } - } - } -} - -export class OAuth implements Authentication { - public accessToken: string = ''; - - applyToRequest(requestOptions: localVarRequest.Options): void { - if (requestOptions && requestOptions.headers) { - requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; - } - } -} - -export class VoidAuth implements Authentication { - public username: string = ''; - public password: string = ''; - - applyToRequest(_: localVarRequest.Options): void { - // Do nothing - } -} - -export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); -{{/generateApis}} From 8853574da332a5cee29ef8442a8a0af2c2d3097d Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 23 Feb 2022 13:02:39 +0200 Subject: [PATCH 03/27] fix v3 client return type --- src/types/client.d.ts | 27 ++-- src/types/config-loader.d.ts | 3 +- src/types/http.d.ts | 3 +- src/v3/apis/user-type-api.ts | 163 +++++++++++--------- src/v3/models/index.ts | 2 + src/v3/models/user-type-condition.ts | 32 ---- templates/swagger-codegen/apiInner.mustache | 64 +++++--- templates/swagger-codegen/baseApi.mustache | 5 +- 8 files changed, 151 insertions(+), 148 deletions(-) create mode 100644 src/v3/models/index.ts delete mode 100644 src/v3/models/user-type-condition.ts diff --git a/src/types/client.d.ts b/src/types/client.d.ts index 8b5d1ee02..8ff9a8650 100644 --- a/src/types/client.d.ts +++ b/src/types/client.d.ts @@ -17,21 +17,22 @@ import { RequestExecutor } from './request-executor'; import { defaultCacheMiddleware } from './default-cache-middleware'; import { CacheStorage } from './memory-store'; +export declare interface V2Configuration { + orgUrl?: string, + token?: string, + clientId?: string, + scopes?: string[], + requestExecutor?: RequestExecutor, + authorizationMode?: string, + privateKey?: string | Record + cacheStore?: CacheStorage, + cacheMiddleware?: typeof defaultCacheMiddleware | unknown + defaultCacheMiddlewareResponseBufferSize?: number, + httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56 +} export declare class Client extends ParameterizedOperationsClient { - constructor(config?: { - orgUrl?: string, - token?: string, - clientId?: string, - scopes?: string[], - requestExecutor?: RequestExecutor, - authorizationMode?: string, - privateKey?: string | Record - cacheStore?: CacheStorage, - cacheMiddleware?: typeof defaultCacheMiddleware | unknown - defaultCacheMiddlewareResponseBufferSize?: number, - httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56 - }); + constructor(config?: V2Configuration); requestExecutor: RequestExecutor; authorizationMode: string; diff --git a/src/types/config-loader.d.ts b/src/types/config-loader.d.ts index 0b30a473c..2481df6d6 100644 --- a/src/types/config-loader.d.ts +++ b/src/types/config-loader.d.ts @@ -19,7 +19,8 @@ export declare class ConfigLoader { token: string; clientId: string; scopes: string; - privateKey: string; + privateKey?: string; + userAgent?: string; }; }; applyDefaults(): void; diff --git a/src/types/http.d.ts b/src/types/http.d.ts index 5c4aff326..f038ccc14 100644 --- a/src/types/http.d.ts +++ b/src/types/http.d.ts @@ -29,7 +29,8 @@ export declare class Http { oauth: OAuth, cacheStore?: CacheStorage, cacheMiddleware?: typeof defaultCacheMiddleware | unknown, - httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56 + httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56, + defaultCacheMiddlewareResponseBufferSize?: number, }); defaultHeaders: Record; requestExecutor: RequestExecutor; diff --git a/src/v3/apis/user-type-api.ts b/src/v3/apis/user-type-api.ts index 501462e60..8233d4955 100644 --- a/src/v3/apis/user-type-api.ts +++ b/src/v3/apis/user-type-api.ts @@ -15,15 +15,28 @@ // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { UserType } from '../models'; -import { OAuth } from '../OAuth'; +import { Response } from 'node-fetch'; +import { OAuth } from '../../types/OAuth'; +import { Http } from '../../types/Http'; +import { ConfigLoader } from '../../types/config-loader'; +import { DefaultRequestExecutor } from '../../types/default-request-executor'; +import { V2Configuration } from '../../types/client'; + + +const os = require('os'); +const packageJson = require('../../../package.json'); + +const DEFAULT_USER_AGENT = `${packageJson.name}/${packageJson.version} node/${process.versions.node} ${os.platform()}/${os.release()}`; + +const repoUrl = 'https://github.com/okta/okta-sdk-nodejs'; /** * UserTypeApi - request parameter creator * @export */ -export const UserTypeApiRequestParamCreator = function (configuration?: Configuration) { - const configLoader = new ConfigLoader(); +export const UserTypeApiRequestParamCreator = function (configuration?: Configuration & V2Configuration) { + const configLoader = new ConfigLoader(); const clientConfig = Object.assign({}, configuration); configLoader.applyDefaults(); configLoader.apply({ @@ -72,7 +85,7 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur oauth = new OAuth(this); } - const http = new Http({ + const httpClient = new Http({ cacheStore: clientConfig.cacheStore, cacheMiddleware: clientConfig.cacheMiddleware, defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, @@ -80,12 +93,12 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur oauth: oauth }); if (authorizationMode === 'SSWS') { - http.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + httpClient.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; } - http.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; + httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; return { - http: http, + httpClient, /** * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. * @summary Create User Type @@ -450,9 +463,8 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur * UserTypeApi - functional programming interface * @export */ -export const UserTypeApiFp = function(configuration?: Configuration) { +export const UserTypeApiFp = function(configuration?: Configuration & V2Configuration) { return { - This is Array /** * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. * @summary Create User Type @@ -460,16 +472,15 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async createUserType(body: UserType, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { - const api = RequestParamCreator(configuration); + async createUserType(body: UserType, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.createUserType(body, options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; + } }, - This is Array /** * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users * @summary Delete User Type @@ -477,16 +488,15 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async deleteUserType(typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { - const api = RequestParamCreator(configuration); + async deleteUserType(typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.deleteUserType(typeId, options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs) as Promise; + } }, - This is Array /** * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. * @summary Get User Type @@ -494,32 +504,30 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async getUserType(typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { - const api = RequestParamCreator(configuration); + async getUserType(typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.getUserType(typeId, options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; + } }, - This is Array /** * Fetches all User Types in your org * @summary List User Types * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async listUserTypes(options?: any): Promise<(http?: Http, basePath?: string) => Promise>> { - const api = RequestParamCreator(configuration); + async listUserTypes(options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise>> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.listUserTypes(options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise>; + } }, - This is Array /** * Replace an existing User Type * @summary Replace User Type @@ -528,16 +536,15 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async replaceUserType(body: UserType, typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { - const api = RequestParamCreator(configuration); + async replaceUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.replaceUserType(body, typeId, options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; + } }, - This is Array /** * Updates an existing User Type * @summary Update User Type @@ -546,14 +553,14 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - - - async updateUserType(body: UserType, typeId: string, options?: any): Promise<(http?: Http, basePath?: string) => Promise> { - const api = RequestParamCreator(configuration); + async updateUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { + const api = UserTypeApiRequestParamCreator(configuration); const localVarRequestArgs = await api.updateUserType(body, typeId, options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; + } }, } }; @@ -562,7 +569,7 @@ export const UserTypeApiFp = function(configuration?: Configuration) { * UserTypeApi - factory interface * @export */ -export const UserTypeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { +export const UserTypeApiFactory = function (configuration?: Configuration, basePath?: string, httpClient?: Http) { return { /** * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. @@ -571,8 +578,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - createUserType(body: UserType, options?: any): AxiosPromise { - return UserTypeApiFp(configuration).createUserType(body, options).then((request) => request(axios, basePath)); + createUserType(body: UserType, options?: any): Promise { + return UserTypeApiFp(configuration).createUserType(body, options).then((request) => request(httpClient, basePath)); }, /** * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users @@ -581,8 +588,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - deleteUserType(typeId: string, options?: any): AxiosPromise { - return UserTypeApiFp(configuration).deleteUserType(typeId, options).then((request) => request(axios, basePath)); + deleteUserType(typeId: string, options?: any): Promise { + return UserTypeApiFp(configuration).deleteUserType(typeId, options).then((request) => request(httpClient, basePath)); }, /** * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. @@ -591,8 +598,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - getUserType(typeId: string, options?: any): AxiosPromise { - return UserTypeApiFp(configuration).getUserType(typeId, options).then((request) => request(axios, basePath)); + getUserType(typeId: string, options?: any): Promise { + return UserTypeApiFp(configuration).getUserType(typeId, options).then((request) => request(httpClient, basePath)); }, /** * Fetches all User Types in your org @@ -600,8 +607,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listUserTypes(options?: any): AxiosPromise> { - return UserTypeApiFp(configuration).listUserTypes(options).then((request) => request(axios, basePath)); + listUserTypes(options?: any): Promise> { + return UserTypeApiFp(configuration).listUserTypes(options).then((request) => request(httpClient, basePath)); }, /** * Replace an existing User Type @@ -611,8 +618,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - replaceUserType(body: UserType, typeId: string, options?: any): AxiosPromise { - return UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then((request) => request(axios, basePath)); + replaceUserType(body: UserType, typeId: string, options?: any): Promise { + return UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then((request) => request(httpClient, basePath)); }, /** * Updates an existing User Type @@ -622,8 +629,8 @@ export const UserTypeApiFactory = function (configuration?: Configuration, baseP * @param {*} [options] Override http request option. * @throws {RequiredError} */ - updateUserType(body: UserType, typeId: string, options?: any): AxiosPromise { - return UserTypeApiFp(configuration).updateUserType(body, typeId, options).then((request) => request(axios, basePath)); + updateUserType(body: UserType, typeId: string, options?: any): Promise { + return UserTypeApiFp(configuration).updateUserType(body, typeId, options).then((request) => request(httpClient, basePath)); }, }; }; @@ -644,7 +651,8 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public createUserType(body: UserType, options?: any) { - return UserTypeApiFp(this.configuration).createUserType(body, options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).createUserType(body, options).then((request) => request(api.httpClient, this.basePath)); } /** * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users @@ -655,7 +663,8 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public deleteUserType(typeId: string, options?: any) { - return UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then((request) => request(api.httpClient, this.basePath)); } /** * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. @@ -666,7 +675,8 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public getUserType(typeId: string, options?: any) { - return UserTypeApiFp(this.configuration).getUserType(typeId, options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).getUserType(typeId, options).then((request) => request(api.httpClient, this.basePath)); } /** * Fetches all User Types in your org @@ -676,7 +686,8 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public listUserTypes(options?: any) { - return UserTypeApiFp(this.configuration).listUserTypes(options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).listUserTypes(options).then((request) => request(api.httpClient, this.basePath)); } /** * Replace an existing User Type @@ -688,7 +699,8 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public replaceUserType(body: UserType, typeId: string, options?: any) { - return UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then((request) => request(api.httpClient, this.basePath)); } /** * Updates an existing User Type @@ -700,6 +712,7 @@ export class UserTypeApi extends BaseAPI { * @memberof UserTypeApi */ public updateUserType(body: UserType, typeId: string, options?: any) { - return UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then((request) => request(this.axios, this.basePath)); + const api = UserTypeApiRequestParamCreator(this.configuration); + return UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then((request) => request(api.httpClient, this.basePath)); } } diff --git a/src/v3/models/index.ts b/src/v3/models/index.ts new file mode 100644 index 000000000..e499da260 --- /dev/null +++ b/src/v3/models/index.ts @@ -0,0 +1,2 @@ +export * from './user-type'; + diff --git a/src/v3/models/user-type-condition.ts b/src/v3/models/user-type-condition.ts deleted file mode 100644 index 1fc2c2d95..000000000 --- a/src/v3/models/user-type-condition.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -/** - * - * @export - * @interface UserTypeCondition - */ -export interface UserTypeCondition { - /** - * - * @type {Array<string>} - * @memberof UserTypeCondition - */ - exclude?: any; - /** - * - * @type {Array<string>} - * @memberof UserTypeCondition - */ - include?: any; -} diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index 27c6616c5..0c548b554 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -7,18 +7,31 @@ import { Configuration } from '{{apiRelativeToRoot}}configuration'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base'; {{#imports}} import { {{import}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; -import { OAuth } from '{{apiRelativeToRoot}}OAuth'; +import { Response } from 'node-fetch'; +import { OAuth } from '../../types/OAuth'; +import { Http } from '../../types/Http'; +import { ConfigLoader } from '../../types/config-loader'; +import { DefaultRequestExecutor } from '../../types/default-request-executor'; +import { V2Configuration } from '../../types/client'; + + +const os = require('os'); +const packageJson = require('../../../package.json'); + +const DEFAULT_USER_AGENT = `${packageJson.name}/${packageJson.version} node/${process.versions.node} ${os.platform()}/${os.release()}`; + +const repoUrl = 'https://github.com/okta/okta-sdk-nodejs'; + {{/imports}} {{#operations}} - /** * {{classname}} - request parameter creator{{#description}} * {{&description}}{{/description}} * @export */ -export const {{classname}}RequestParamCreator = function (configuration?: Configuration) { - const configLoader = new ConfigLoader(); +export const {{classname}}RequestParamCreator = function (configuration?: Configuration & V2Configuration) { + const configLoader = new ConfigLoader(); const clientConfig = Object.assign({}, configuration); configLoader.applyDefaults(); configLoader.apply({ @@ -67,7 +80,7 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config oauth = new OAuth(this); } - const http = new Http({ + const httpClient = new Http({ cacheStore: clientConfig.cacheStore, cacheMiddleware: clientConfig.cacheMiddleware, defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, @@ -75,12 +88,12 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config oauth: oauth }); if (authorizationMode === 'SSWS') { - http.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + httpClient.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; } - http.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; + httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; return { - http: http, + httpClient, {{#operation}} {{#contents}} /** @@ -280,12 +293,9 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config * {{{description}}}{{/description}} * @export */ -export const {{classname}}Fp = function(configuration?: Configuration) { +export const {{classname}}Fp = function(configuration?: Configuration & V2Configuration) { return { {{#operation}} - {{#if responses['200'].schema.items.$ref}} - This is Array - {{/if}} {{#contents}} /** * {{¬es}} @@ -298,14 +308,19 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - {{../responses/what/description}} - - async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(http?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>> { - const api = {{className}}RequestParamCreator(configuration); + async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>> { + const api = {{classname}}RequestParamCreator(configuration); const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); - return (httpClient: Http = api.http, basePath: string = BASE_PATH) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarAxiosArgs.url}; - return httpClient.http(requestArgs); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + {{#returnType}} + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise<{{{returnType}}}>; + {{/returnType}} + {{^returnType}} + return httpClient.http(requestArgs.url, requestArgs) as Promise; + {{/returnType}} + } }, {{/contents}} {{/operation}} @@ -317,7 +332,7 @@ export const {{classname}}Fp = function(configuration?: Configuration) { * {{&description}}{{/description}} * @export */ -export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { +export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, httpClient?: Http) { return { {{#operation}} {{#contents}} @@ -332,8 +347,8 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas * @param {*} [options] Override http request option. * @throws {RequiredError} */ - {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { - return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(axios, basePath)); + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { + return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(httpClient, basePath)); }, {{/contents}} {{/operation}} @@ -362,7 +377,7 @@ export interface {{classname}}Interface { * @throws {RequiredError} * @memberof {{classname}}Interface */ - {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>; + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>; {{/contents}} {{/operation}} @@ -397,7 +412,8 @@ export class {{classname}} extends BaseAPI { * @memberof {{classname}} */ public {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any) { - return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(this.axios, this.basePath)); + const api = {{classname}}RequestParamCreator(this.configuration); + return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(api.httpClient, this.basePath)); } {{^@last}} diff --git a/templates/swagger-codegen/baseApi.mustache b/templates/swagger-codegen/baseApi.mustache index 519b7c7d9..863405c4f 100644 --- a/templates/swagger-codegen/baseApi.mustache +++ b/templates/swagger-codegen/baseApi.mustache @@ -3,9 +3,10 @@ {{>licenseInfo}} import { Configuration } from "./configuration"; +import { Http } from "../types/http"; + // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); @@ -38,7 +39,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected httpClient?: Http) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; From ef102df61db648b7f17893dbc1c77cd484d2fd10 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 23 Feb 2022 13:20:34 +0200 Subject: [PATCH 04/27] include v3 models into index --- src/v3/api.ts | 27 ++---------------------- src/v3/base.ts | 5 +++-- src/v3/index.ts | 1 + templates/swagger-codegen/index.mustache | 2 +- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/v3/api.ts b/src/v3/api.ts index fbbaef818..1c43b5193 100644 --- a/src/v3/api.ts +++ b/src/v3/api.ts @@ -10,30 +10,7 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - */export * from './apis/application-api'; -export * from './apis/authenticator-api'; -export * from './apis/authorization-server-api'; -export * from './apis/brand-api'; -export * from './apis/captchaapi'; -export * from './apis/domain-api'; -export * from './apis/event-hook-api'; -export * from './apis/feature-api'; -export * from './apis/group-api'; -export * from './apis/identity-provider-api'; -export * from './apis/inline-hook-api'; -export * from './apis/linked-object-api'; -export * from './apis/network-zone-api'; -export * from './apis/org-setting-api'; -export * from './apis/policy-api'; -export * from './apis/profile-mapping-api'; -export * from './apis/schema-api'; -export * from './apis/session-api'; -export * from './apis/subscription-api'; -export * from './apis/system-log-api'; -export * from './apis/template-api'; -export * from './apis/threat-insight-api'; -export * from './apis/trusted-origin-api'; -export * from './apis/user-api'; -export * from './apis/user-factor-api'; + */ + export * from './apis/user-type-api'; diff --git a/src/v3/base.ts b/src/v3/base.ts index 1f9922651..7cec1df21 100644 --- a/src/v3/base.ts +++ b/src/v3/base.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ import { Configuration } from "./configuration"; +import { Http } from "../types/http"; + // Some imports not used depending on template conditions // @ts-ignore -import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; export const BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); @@ -47,7 +48,7 @@ export interface RequestArgs { export class BaseAPI { protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected httpClient?: Http) { if (configuration) { this.configuration = configuration; this.basePath = configuration.basePath || this.basePath; diff --git a/src/v3/index.ts b/src/v3/index.ts index 43c40f93d..6e78c4e4e 100644 --- a/src/v3/index.ts +++ b/src/v3/index.ts @@ -13,4 +13,5 @@ */ export * from "./api"; export * from "./configuration"; +export * from "./models"; diff --git a/templates/swagger-codegen/index.mustache b/templates/swagger-codegen/index.mustache index b8e9eb606..adce028bf 100644 --- a/templates/swagger-codegen/index.mustache +++ b/templates/swagger-codegen/index.mustache @@ -4,4 +4,4 @@ export * from "./api"; export * from "./configuration"; -{{#withSeparateModelsAndApi}}export * from "./{{tsModelPackage}}";{{/withSeparateModelsAndApi}} +export * from "./models"; \ No newline at end of file From 27790a2086b657fe4301d9a5cb823be7e39ae565 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 23 Feb 2022 15:02:30 +0200 Subject: [PATCH 05/27] add integration test for User Type API --- src/v3/apis/user-type-api.ts | 60 +++++++++---------- templates/codegen-config.json | 5 ++ templates/swagger-codegen/apiInner.mustache | 28 ++++----- .../swagger-codegen/configuration.mustache | 8 +-- test/it/user-type-api.ts | 14 +++++ 5 files changed, 67 insertions(+), 48 deletions(-) create mode 100644 templates/codegen-config.json create mode 100644 test/it/user-type-api.ts diff --git a/src/v3/apis/user-type-api.ts b/src/v3/apis/user-type-api.ts index 8233d4955..5578240ab 100644 --- a/src/v3/apis/user-type-api.ts +++ b/src/v3/apis/user-type-api.ts @@ -16,11 +16,11 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { UserType } from '../models'; import { Response } from 'node-fetch'; -import { OAuth } from '../../types/OAuth'; -import { Http } from '../../types/Http'; -import { ConfigLoader } from '../../types/config-loader'; -import { DefaultRequestExecutor } from '../../types/default-request-executor'; -import { V2Configuration } from '../../types/client'; +import OAuth = require('../../OAuth'); +import Http = require('../../Http'); +import ConfigLoader = require('../../config-loader'); +import DefaultRequestExecutor = require('../../default-request-executor'); +import V2Configuration = require ('../../client'); const os = require('os'); @@ -93,7 +93,7 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur oauth: oauth }); if (authorizationMode === 'SSWS') { - httpClient.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + httpClient.defaultHeaders.Authorization = `SSWS ${apiToken}`; } httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; @@ -123,10 +123,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } @@ -184,10 +184,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } @@ -241,10 +241,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } @@ -292,10 +292,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } @@ -354,10 +354,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } @@ -420,10 +420,10 @@ export const UserTypeApiRequestParamCreator = function (configuration?: Configur const localVarQueryParameter = {} as any; // authentication api_token required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("Authorization") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("Authorization") + : await configuration.apiToken; localVarHeaderParameter["Authorization"] = localVarApiKeyValue; } diff --git a/templates/codegen-config.json b/templates/codegen-config.json new file mode 100644 index 000000000..c10ba9ea1 --- /dev/null +++ b/templates/codegen-config.json @@ -0,0 +1,5 @@ +{ + "additionalProperties": { + "supportsES6": true + } +} \ No newline at end of file diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index 0c548b554..70eb7defa 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -8,11 +8,11 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr {{#imports}} import { {{import}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; import { Response } from 'node-fetch'; -import { OAuth } from '../../types/OAuth'; -import { Http } from '../../types/Http'; -import { ConfigLoader } from '../../types/config-loader'; -import { DefaultRequestExecutor } from '../../types/default-request-executor'; -import { V2Configuration } from '../../types/client'; +import OAuth = require('../../OAuth'); +import Http = require('../../Http'); +import ConfigLoader = require('../../config-loader'); +import DefaultRequestExecutor = require('../../default-request-executor'); +import V2Configuration = require ('../../client'); const os = require('os'); @@ -88,7 +88,7 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config oauth: oauth }); if (authorizationMode === 'SSWS') { - httpClient.defaultHeaders.Authorization = `SSWS ${this.apiToken}`; + httpClient.defaultHeaders.Authorization = `SSWS ${apiToken}`; } httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; @@ -133,18 +133,18 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config // authentication {{name}} required {{#isApiKey}} {{#isKeyInHeader}} - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("{{keyParamName}}") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("{{keyParamName}}") + : await configuration.apiToken; localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; } {{/isKeyInHeader}} {{#isKeyInQuery}} - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey("{{keyParamName}}") - : await configuration.apiKey; + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("{{keyParamName}}") + : await configuration.apiToken; localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; } {{/isKeyInQuery}} diff --git a/templates/swagger-codegen/configuration.mustache b/templates/swagger-codegen/configuration.mustache index ae7e0dcc2..f484baa34 100644 --- a/templates/swagger-codegen/configuration.mustache +++ b/templates/swagger-codegen/configuration.mustache @@ -3,7 +3,7 @@ {{>licenseInfo}} export interface ConfigurationParameters { - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); @@ -13,11 +13,11 @@ export interface ConfigurationParameters { export class Configuration { /** - * parameter for apiKey security + * parameter for apiToken security * @param name security name * @memberof Configuration */ - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security * @@ -55,7 +55,7 @@ export class Configuration { baseOptions?: any; constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; + this.apiToken = param.apiToken; this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; diff --git a/test/it/user-type-api.ts b/test/it/user-type-api.ts new file mode 100644 index 000000000..271d2f913 --- /dev/null +++ b/test/it/user-type-api.ts @@ -0,0 +1,14 @@ +import { expect } from 'chai'; +import { UserTypeApiFp } from '../../src/v3/apis/user-type-api'; +import { UserType } from '../../src/v3/models/user-type'; + + +describe('User Type API', () => { + it('lists existing user types', async () => { + const userTypes: UserType[] = await UserTypeApiFp({ + orgUrl: process.env.OKTA_CLIENT_ORGURL, + token: process.env.OKTA_CLIENT_TOKEN, + }).listUserTypes().then(method => method()); + expect(userTypes.length).to.be.greaterThan(0); + }); +}); From 525c7c8384b7f5043835721907c3377302e366fb Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 23 Feb 2022 15:08:54 +0200 Subject: [PATCH 06/27] rename apiKey -> apiToken --- src/v3/configuration.ts | 8 ++++---- templates/swagger-codegen/index.mustache | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/v3/configuration.ts b/src/v3/configuration.ts index 9c0e9d738..81c81fe98 100644 --- a/src/v3/configuration.ts +++ b/src/v3/configuration.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ export interface ConfigurationParameters { - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); username?: string; password?: string; accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); @@ -22,11 +22,11 @@ export interface ConfigurationParameters { export class Configuration { /** - * parameter for apiKey security + * parameter for apiToken security * @param name security name * @memberof Configuration */ - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); /** * parameter for basic security * @@ -64,7 +64,7 @@ export class Configuration { baseOptions?: any; constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; + this.apiToken = param.apiToken; this.username = param.username; this.password = param.password; this.accessToken = param.accessToken; diff --git a/templates/swagger-codegen/index.mustache b/templates/swagger-codegen/index.mustache index adce028bf..585364a48 100644 --- a/templates/swagger-codegen/index.mustache +++ b/templates/swagger-codegen/index.mustache @@ -4,4 +4,4 @@ export * from "./api"; export * from "./configuration"; -export * from "./models"; \ No newline at end of file +export * from "./models"; From ac9f03d0ae7cd2e93876a8c586ee03d35ddb71e0 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 7 Mar 2022 16:04:15 +0100 Subject: [PATCH 07/27] add placeholder imports for type modules --- src/v3/apis/user-type-api.ts | 6 +++--- templates/swagger-codegen/apiInner.mustache | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/v3/apis/user-type-api.ts b/src/v3/apis/user-type-api.ts index 5578240ab..153b7ebed 100644 --- a/src/v3/apis/user-type-api.ts +++ b/src/v3/apis/user-type-api.ts @@ -10,7 +10,7 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - */import { Configuration } from '../configuration'; + */ // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; @@ -20,8 +20,8 @@ import OAuth = require('../../OAuth'); import Http = require('../../Http'); import ConfigLoader = require('../../config-loader'); import DefaultRequestExecutor = require('../../default-request-executor'); -import V2Configuration = require ('../../client'); - +import { V2Configuration } from '../../configuration'; +import { Configuration } from '../configuration'; const os = require('os'); const packageJson = require('../../../package.json'); diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index 70eb7defa..928b4572a 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -9,10 +9,11 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr import { {{import}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; import { Response } from 'node-fetch'; import OAuth = require('../../OAuth'); -import Http = require('../../Http'); +import HttpClass = require('../../Http'); import ConfigLoader = require('../../config-loader'); import DefaultRequestExecutor = require('../../default-request-executor'); -import V2Configuration = require ('../../client'); +import { V2Configuration } from '../../configuration'; +import { Http } from '../../http'; const os = require('os'); @@ -80,7 +81,7 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config oauth = new OAuth(this); } - const httpClient = new Http({ + const httpClient = new HttpClass({ cacheStore: clientConfig.cacheStore, cacheMiddleware: clientConfig.cacheMiddleware, defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, From 52f86a97e11297e4c80873a0f941e46a76366e1d Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 7 Mar 2022 16:27:43 +0100 Subject: [PATCH 08/27] add v3 typings --- src/types/v3/api.d.ts | 12 ++ src/types/v3/apis/user-type-api.d.ts | 246 +++++++++++++++++++++++++++ src/types/v3/base.d.ts | 55 ++++++ src/types/v3/configuration.d.ts | 63 +++++++ src/types/v3/index.d.ts | 14 ++ src/types/v3/models/index.d.ts | 1 + src/types/v3/models/user-type.d.ts | 78 +++++++++ src/v3/base.ts | 2 +- 8 files changed, 470 insertions(+), 1 deletion(-) create mode 100644 src/types/v3/api.d.ts create mode 100644 src/types/v3/apis/user-type-api.d.ts create mode 100644 src/types/v3/base.d.ts create mode 100644 src/types/v3/configuration.d.ts create mode 100644 src/types/v3/index.d.ts create mode 100644 src/types/v3/models/index.d.ts create mode 100644 src/types/v3/models/user-type.d.ts diff --git a/src/types/v3/api.d.ts b/src/types/v3/api.d.ts new file mode 100644 index 000000000..2f2e44752 --- /dev/null +++ b/src/types/v3/api.d.ts @@ -0,0 +1,12 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export * from './apis/user-type-api'; diff --git a/src/types/v3/apis/user-type-api.d.ts b/src/types/v3/apis/user-type-api.d.ts new file mode 100644 index 000000000..9e9f13dd1 --- /dev/null +++ b/src/types/v3/apis/user-type-api.d.ts @@ -0,0 +1,246 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { RequestArgs, BaseAPI } from '../base'; +import { UserType } from '../models'; +import { Response } from 'node-fetch'; +import Http = require('../../Http'); +import { V2Configuration } from '../../configuration'; +import { Configuration } from '../configuration'; +/** + * UserTypeApi - request parameter creator + * @export + */ +export declare const UserTypeApiRequestParamCreator: (configuration?: Configuration & V2Configuration) => { + httpClient: any; + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType: (body: UserType, options?: any) => Promise; + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType: (typeId: string, options?: any) => Promise; + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType: (typeId: string, options?: any) => Promise; + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes: (options?: any) => Promise; + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType: (body: UserType, typeId: string, options?: any) => Promise; + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType: (body: UserType, typeId: string, options?: any) => Promise; +}; +/** + * UserTypeApi - functional programming interface + * @export + */ +export declare const UserTypeApiFp: (configuration?: Configuration & V2Configuration) => { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType(body: UserType, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>; + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType(typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>; + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType(typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>; + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes(options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>>; + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>; + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: any, basePath?: string) => Promise>; +}; +/** + * UserTypeApi - factory interface + * @export + */ +export declare const UserTypeApiFactory: (configuration?: Configuration, basePath?: string, httpClient?: any) => { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType(body: UserType, options?: any): Promise; + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType(typeId: string, options?: any): Promise; + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType(typeId: string, options?: any): Promise; + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes(options?: any): Promise>; + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType(body: UserType, typeId: string, options?: any): Promise; + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType(body: UserType, typeId: string, options?: any): Promise; +}; +/** + * UserTypeApi - object-oriented interface + * @export + * @class UserTypeApi + * @extends {BaseAPI} + */ +export declare class UserTypeApi extends BaseAPI { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + createUserType(body: UserType, options?: any): Promise; + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + deleteUserType(typeId: string, options?: any): Promise; + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + getUserType(typeId: string, options?: any): Promise; + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + listUserTypes(options?: any): Promise; + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + replaceUserType(body: UserType, typeId: string, options?: any): Promise; + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + updateUserType(body: UserType, typeId: string, options?: any): Promise; +} diff --git a/src/types/v3/base.d.ts b/src/types/v3/base.d.ts new file mode 100644 index 000000000..ed51963af --- /dev/null +++ b/src/types/v3/base.d.ts @@ -0,0 +1,55 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { Configuration } from "./configuration"; +import { Http } from "../http"; +export declare const BASE_PATH: string; +/** + * + * @export + */ +export declare const COLLECTION_FORMATS: { + csv: string; + ssv: string; + tsv: string; + pipes: string; +}; +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} +/** + * + * @export + * @class BaseAPI + */ +export declare class BaseAPI { + protected basePath: string; + protected httpClient?: Http; + protected configuration: Configuration | undefined; + constructor(configuration?: Configuration, basePath?: string, httpClient?: Http); +} +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export declare class RequiredError extends Error { + field: string; + name: "RequiredError"; + constructor(field: string, msg?: string); +} diff --git a/src/types/v3/configuration.d.ts b/src/types/v3/configuration.d.ts new file mode 100644 index 000000000..8a7f36f99 --- /dev/null +++ b/src/types/v3/configuration.d.ts @@ -0,0 +1,63 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export interface ConfigurationParameters { + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; +} +export declare class Configuration { + /** + * parameter for apiToken security + * @param name security name + * @memberof Configuration + */ + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + constructor(param?: ConfigurationParameters); +} diff --git a/src/types/v3/index.d.ts b/src/types/v3/index.d.ts new file mode 100644 index 000000000..f5c67b893 --- /dev/null +++ b/src/types/v3/index.d.ts @@ -0,0 +1,14 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +export * from "./api"; +export * from "./configuration"; +export * from "./models"; diff --git a/src/types/v3/models/index.d.ts b/src/types/v3/models/index.d.ts new file mode 100644 index 000000000..576fa1b9c --- /dev/null +++ b/src/types/v3/models/index.d.ts @@ -0,0 +1 @@ +export * from './user-type'; diff --git a/src/types/v3/models/user-type.d.ts b/src/types/v3/models/user-type.d.ts new file mode 100644 index 000000000..1238e0de7 --- /dev/null +++ b/src/types/v3/models/user-type.d.ts @@ -0,0 +1,78 @@ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +/** + * + * @export + * @interface UserType + */ +export interface UserType { + /** + * + * @type {{ [key, string]: any;}} + * @memberof UserType + */ + links?: any; + /** + * + * @type {Date} + * @memberof UserType + */ + created?: any; + /** + * + * @type {string} + * @memberof UserType + */ + createdBy?: any; + /** + * + * @type {boolean} + * @memberof UserType + */ + _default?: any; + /** + * + * @type {string} + * @memberof UserType + */ + description?: any; + /** + * + * @type {string} + * @memberof UserType + */ + displayName?: any; + /** + * + * @type {string} + * @memberof UserType + */ + id?: any; + /** + * + * @type {Date} + * @memberof UserType + */ + lastUpdated?: any; + /** + * + * @type {string} + * @memberof UserType + */ + lastUpdatedBy?: any; + /** + * + * @type {string} + * @memberof UserType + */ + name?: any; +} diff --git a/src/v3/base.ts b/src/v3/base.ts index 7cec1df21..da67ac3af 100644 --- a/src/v3/base.ts +++ b/src/v3/base.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ import { Configuration } from "./configuration"; -import { Http } from "../types/http"; +import { Http } from "../http"; // Some imports not used depending on template conditions // @ts-ignore From eb24a967118b8afe056be45fdfaa60dd8b225794 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 7 Mar 2022 17:07:27 +0100 Subject: [PATCH 09/27] replace TypeScript modules with JS + typings --- src/configuration.js | 2 + src/index.js | 3 +- src/types/configuration.d.ts | 15 + src/types/index.d.ts | 1 + src/v3/.swagger-codegen/VERSION | 1 - src/v3/api.js | 26 + src/v3/api.ts | 16 - src/v3/apis/user-type-api.js | 953 ++++++++++++++++++++ src/v3/apis/user-type-api.ts | 718 --------------- src/v3/base.js | 67 ++ src/v3/base.ts | 70 -- src/v3/configuration.js | 16 + src/v3/configuration.ts | 74 -- src/v3/index.js | 28 + src/v3/index.ts | 17 - src/v3/models/index.js | 13 + src/v3/models/index.ts | 2 - src/v3/models/user-type.js | 2 + src/v3/models/user-type.ts | 80 -- templates/swagger-codegen/apiInner.mustache | 9 +- 20 files changed, 1129 insertions(+), 984 deletions(-) create mode 100644 src/configuration.js create mode 100644 src/types/configuration.d.ts delete mode 100644 src/v3/.swagger-codegen/VERSION create mode 100644 src/v3/api.js delete mode 100644 src/v3/api.ts create mode 100644 src/v3/apis/user-type-api.js delete mode 100644 src/v3/apis/user-type-api.ts create mode 100644 src/v3/base.js delete mode 100644 src/v3/base.ts create mode 100644 src/v3/configuration.js delete mode 100644 src/v3/configuration.ts create mode 100644 src/v3/index.js delete mode 100644 src/v3/index.ts create mode 100644 src/v3/models/index.js delete mode 100644 src/v3/models/index.ts create mode 100644 src/v3/models/user-type.js delete mode 100644 src/v3/models/user-type.ts diff --git a/src/configuration.js b/src/configuration.js new file mode 100644 index 000000000..0fba4c766 --- /dev/null +++ b/src/configuration.js @@ -0,0 +1,2 @@ +// no js code for V2Configuration, it is only used as a type in TypeScript modules +module.exports = {} \ No newline at end of file diff --git a/src/index.js b/src/index.js index e6a6cd91a..30d537688 100644 --- a/src/index.js +++ b/src/index.js @@ -18,5 +18,6 @@ module.exports = Object.assign( DefaultRequestExecutor: require('./default-request-executor'), Collection: require('./collection'), }, - require('./models') + require('./models'), + require('./v3') ); diff --git a/src/types/configuration.d.ts b/src/types/configuration.d.ts new file mode 100644 index 000000000..64e0947c1 --- /dev/null +++ b/src/types/configuration.d.ts @@ -0,0 +1,15 @@ +import { defaultCacheMiddleware } from './default-cache-middleware'; +import { RequestExecutor } from './request-executor'; + +export declare interface V2Configuration { + orgUrl?: string, + token?: string, + clientId?: string, + scopes?: string[], + requestExecutor?: RequestExecutor, + authorizationMode?: string, + privateKey?: string | Record + cacheStore?: CacheStorage, + cacheMiddleware?: typeof defaultCacheMiddleware | unknown + defaultCacheMiddlewareResponseBufferSize?: number, +} \ No newline at end of file diff --git a/src/types/index.d.ts b/src/types/index.d.ts index a88b1fad0..4ef5e4166 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -28,6 +28,7 @@ export * from './request-options/SecurePasswordStoreApplicationOptions'; export * from './request-options/SwaApplicationOptions'; export * from './request-options/SwaThreeFieldApplicationOptions'; export * from './request-options/WsFederationApplicationOptions'; +export * from './v3'; export * from './models/AccessPolicy'; export * from './models/AccessPolicyConstraint'; diff --git a/src/v3/.swagger-codegen/VERSION b/src/v3/.swagger-codegen/VERSION deleted file mode 100644 index bdb1390d1..000000000 --- a/src/v3/.swagger-codegen/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.0.30 \ No newline at end of file diff --git a/src/v3/api.js b/src/v3/api.js new file mode 100644 index 000000000..52bd903e5 --- /dev/null +++ b/src/v3/api.js @@ -0,0 +1,26 @@ +"use strict"; +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; +__exportStar(require("./apis/user-type-api"), exports); diff --git a/src/v3/api.ts b/src/v3/api.ts deleted file mode 100644 index 1c43b5193..000000000 --- a/src/v3/api.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - -export * from './apis/user-type-api'; - diff --git a/src/v3/apis/user-type-api.js b/src/v3/apis/user-type-api.js new file mode 100644 index 000000000..505f483fa --- /dev/null +++ b/src/v3/apis/user-type-api.js @@ -0,0 +1,953 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +exports.__esModule = true; +exports.UserTypeApi = exports.UserTypeApiFactory = exports.UserTypeApiFp = exports.UserTypeApiRequestParamCreator = void 0; +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +// Some imports not used depending on template conditions +// @ts-ignore +var base_1 = require("../base"); +var Oauth = require("../../oauth"); +var Http = require("../../http"); +var ConfigLoader = require("../../config-loader"); +var DefaultRequestExecutor = require("../../default-request-executor"); +var os = require('os'); +var packageJson = require('../../../package.json'); +var DEFAULT_USER_AGENT = packageJson.name + "/" + packageJson.version + " node/" + process.versions.node + " " + os.platform() + "/" + os.release(); +var repoUrl = 'https://github.com/okta/okta-sdk-nodejs'; +/** + * UserTypeApi - request parameter creator + * @export + */ +var UserTypeApiRequestParamCreator = function (configuration) { + var _this = this; + var configLoader = new ConfigLoader(); + var clientConfig = Object.assign({}, configuration); + configLoader.applyDefaults(); + configLoader.apply({ + client: clientConfig || {} + }); + var parsedConfig = configLoader.config; + var requestExecutor = clientConfig.requestExecutor || new DefaultRequestExecutor(); + var errors = []; + if (!parsedConfig.client.orgUrl) { + errors.push('Okta Org URL not provided'); + } + if (!parsedConfig.client.token && parsedConfig.client.authorizationMode !== 'PrivateKey') { + errors.push('Okta API token not provided'); + } + if (parsedConfig.client.authorizationMode === 'PrivateKey') { + if (!parsedConfig.client.clientId) { + errors.push('Okta Client ID not provided'); + } + if (!parsedConfig.client.scopes) { + errors.push('Scopes not provided'); + } + if (!parsedConfig.client.privateKey) { + errors.push('Private Key not provided'); + } + } + else if (parsedConfig.client.authorizationMode !== 'SSWS') { + errors.push('Unknown Authorization Mode'); + } + if (errors.length) { + throw new Error("Found " + errors.length + " errors:\n" + errors.join('\n') + "\nSee " + repoUrl + " for usage."); + } + var authorizationMode = parsedConfig.client.authorizationMode; + var baseUrl = parsedConfig.client.orgUrl.replace(/\/$/, ''); + var apiToken = parsedConfig.client.token; + var clientId; + var scopes; + var privateKey; + var oauth; + if (authorizationMode === 'PrivateKey') { + clientId = parsedConfig.client.clientId; + scopes = parsedConfig.client.scopes.split(' '); + privateKey = parsedConfig.client.privateKey; + oauth = new Oauth(this); + } + var httpClient = new Http({ + cacheStore: clientConfig.cacheStore, + cacheMiddleware: clientConfig.cacheMiddleware, + defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, + requestExecutor: requestExecutor, + oauth: oauth + }); + if (authorizationMode === 'SSWS') { + httpClient.defaultHeaders.Authorization = "SSWS " + apiToken; + } + httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; + return { + httpClient: httpClient, + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType: function (body, options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions, needsSerialization; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling createUserType.'); + } + localVarPath = "/api/v1/meta/types/user"; + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + localVarHeaderParameter['Content-Type'] = 'application/json'; + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + }, + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType: function (typeId, options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new base_1.RequiredError('typeId', 'Required parameter typeId was null or undefined when calling deleteUserType.'); + } + localVarPath = "/api/v1/meta/types/user/{typeId}" + .replace("{" + "typeId" + "}", encodeURIComponent(String(typeId))); + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'DELETE' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + }, + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType: function (typeId, options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new base_1.RequiredError('typeId', 'Required parameter typeId was null or undefined when calling getUserType.'); + } + localVarPath = "/api/v1/meta/types/user/{typeId}" + .replace("{" + "typeId" + "}", encodeURIComponent(String(typeId))); + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + }, + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes: function (options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + localVarPath = "/api/v1/meta/types/user"; + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + }, + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType: function (body, typeId, options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions, needsSerialization; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling replaceUserType.'); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new base_1.RequiredError('typeId', 'Required parameter typeId was null or undefined when calling replaceUserType.'); + } + localVarPath = "/api/v1/meta/types/user/{typeId}" + .replace("{" + "typeId" + "}", encodeURIComponent(String(typeId))); + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'PUT' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + localVarHeaderParameter['Content-Type'] = 'application/json'; + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + }, + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType: function (body, typeId, options) { + if (options === void 0) { options = {}; } + return __awaiter(_this, void 0, void 0, function () { + var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, localVarApiKeyValue, _a, localVarAccessTokenValue, _b, query, key, key, headersFromBaseOptions, needsSerialization; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling updateUserType.'); + } + // verify required parameter 'typeId' is not null or undefined + if (typeId === null || typeId === undefined) { + throw new base_1.RequiredError('typeId', 'Required parameter typeId was null or undefined when calling updateUserType.'); + } + localVarPath = "/api/v1/meta/types/user/{typeId}" + .replace("{" + "typeId" + "}", encodeURIComponent(String(typeId))); + localVarUrlObj = new URL(localVarPath, 'https://example.com'); + if (configuration) { + baseOptions = configuration.baseOptions; + } + localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options); + localVarHeaderParameter = {}; + localVarQueryParameter = {}; + if (!(configuration && configuration.apiToken)) return [3 /*break*/, 5]; + if (!(typeof configuration.apiToken === 'function')) return [3 /*break*/, 2]; + return [4 /*yield*/, configuration.apiToken("Authorization")]; + case 1: + _a = _c.sent(); + return [3 /*break*/, 4]; + case 2: return [4 /*yield*/, configuration.apiToken]; + case 3: + _a = _c.sent(); + _c.label = 4; + case 4: + localVarApiKeyValue = _a; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + _c.label = 5; + case 5: + if (!(configuration && configuration.accessToken)) return [3 /*break*/, 10]; + if (!(typeof configuration.accessToken === 'function')) return [3 /*break*/, 7]; + return [4 /*yield*/, configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"])]; + case 6: + _b = _c.sent(); + return [3 /*break*/, 9]; + case 7: return [4 /*yield*/, configuration.accessToken]; + case 8: + _b = _c.sent(); + _c.label = 9; + case 9: + localVarAccessTokenValue = _b; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + _c.label = 10; + case 10: + localVarHeaderParameter['Content-Type'] = 'application/json'; + query = new URLSearchParams(localVarUrlObj.search); + for (key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); + needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + return [2 /*return*/, { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions + }]; + } + }); + }); + } + }; +}; +exports.UserTypeApiRequestParamCreator = UserTypeApiRequestParamCreator; +/** + * UserTypeApi - functional programming interface + * @export + */ +var UserTypeApiFp = function (configuration) { + return { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType: function (body, options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.createUserType(body, options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs).then(function (res) { return res.json(); }); + }]; + } + }); + }); + }, + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType: function (typeId, options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.deleteUserType(typeId, options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs); + }]; + } + }); + }); + }, + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType: function (typeId, options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.getUserType(typeId, options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs).then(function (res) { return res.json(); }); + }]; + } + }); + }); + }, + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes: function (options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.listUserTypes(options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs).then(function (res) { return res.json(); }); + }]; + } + }); + }); + }, + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType: function (body, typeId, options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.replaceUserType(body, typeId, options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs).then(function (res) { return res.json(); }); + }]; + } + }); + }); + }, + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType: function (body, typeId, options) { + return __awaiter(this, void 0, void 0, function () { + var api, localVarRequestArgs; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + api = exports.UserTypeApiRequestParamCreator(configuration); + return [4 /*yield*/, api.updateUserType(body, typeId, options)]; + case 1: + localVarRequestArgs = _a.sent(); + return [2 /*return*/, function (httpClient, basePath) { + if (httpClient === void 0) { httpClient = api.httpClient; } + if (basePath === void 0) { basePath = configuration.basePath || configuration.orgUrl; } + var requestArgs = __assign(__assign({}, localVarRequestArgs.options), { url: basePath + localVarRequestArgs.url }); + return httpClient.http(requestArgs.url, requestArgs).then(function (res) { return res.json(); }); + }]; + } + }); + }); + } + }; +}; +exports.UserTypeApiFp = UserTypeApiFp; +/** + * UserTypeApi - factory interface + * @export + */ +var UserTypeApiFactory = function (configuration, basePath, httpClient) { + return { + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUserType: function (body, options) { + return exports.UserTypeApiFp(configuration).createUserType(body, options).then(function (request) { return request(httpClient, basePath); }); + }, + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUserType: function (typeId, options) { + return exports.UserTypeApiFp(configuration).deleteUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); + }, + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserType: function (typeId, options) { + return exports.UserTypeApiFp(configuration).getUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); + }, + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUserTypes: function (options) { + return exports.UserTypeApiFp(configuration).listUserTypes(options).then(function (request) { return request(httpClient, basePath); }); + }, + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + replaceUserType: function (body, typeId, options) { + return exports.UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); + }, + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUserType: function (body, typeId, options) { + return exports.UserTypeApiFp(configuration).updateUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); + } + }; +}; +exports.UserTypeApiFactory = UserTypeApiFactory; +/** + * UserTypeApi - object-oriented interface + * @export + * @class UserTypeApi + * @extends {BaseAPI} + */ +var UserTypeApi = /** @class */ (function (_super) { + __extends(UserTypeApi, _super); + function UserTypeApi() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.createUserType = function (body, options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).createUserType(body, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + /** + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.deleteUserType = function (typeId, options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + /** + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.getUserType = function (typeId, options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).getUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + /** + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.listUserTypes = function (options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).listUserTypes(options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + /** + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.replaceUserType = function (body, typeId, options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + /** + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ + UserTypeApi.prototype.updateUserType = function (body, typeId, options) { + var _this = this; + var api = exports.UserTypeApiRequestParamCreator(this.configuration); + return exports.UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + }; + return UserTypeApi; +}(base_1.BaseAPI)); +exports.UserTypeApi = UserTypeApi; diff --git a/src/v3/apis/user-type-api.ts b/src/v3/apis/user-type-api.ts deleted file mode 100644 index 153b7ebed..000000000 --- a/src/v3/apis/user-type-api.ts +++ /dev/null @@ -1,718 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -// Some imports not used depending on template conditions -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; -import { UserType } from '../models'; -import { Response } from 'node-fetch'; -import OAuth = require('../../OAuth'); -import Http = require('../../Http'); -import ConfigLoader = require('../../config-loader'); -import DefaultRequestExecutor = require('../../default-request-executor'); -import { V2Configuration } from '../../configuration'; -import { Configuration } from '../configuration'; - -const os = require('os'); -const packageJson = require('../../../package.json'); - -const DEFAULT_USER_AGENT = `${packageJson.name}/${packageJson.version} node/${process.versions.node} ${os.platform()}/${os.release()}`; - -const repoUrl = 'https://github.com/okta/okta-sdk-nodejs'; - - -/** - * UserTypeApi - request parameter creator - * @export - */ -export const UserTypeApiRequestParamCreator = function (configuration?: Configuration & V2Configuration) { - const configLoader = new ConfigLoader(); - const clientConfig = Object.assign({}, configuration); - configLoader.applyDefaults(); - configLoader.apply({ - client: clientConfig || {} - }); - - const parsedConfig = configLoader.config; - const requestExecutor = clientConfig.requestExecutor || new DefaultRequestExecutor(); - const errors = []; - if (!parsedConfig.client.orgUrl) { - errors.push('Okta Org URL not provided'); - } - - if (!parsedConfig.client.token && parsedConfig.client.authorizationMode !== 'PrivateKey') { - errors.push('Okta API token not provided'); - } - - if (parsedConfig.client.authorizationMode === 'PrivateKey') { - if (!parsedConfig.client.clientId) { - errors.push('Okta Client ID not provided'); - } - if (!parsedConfig.client.scopes) { - errors.push('Scopes not provided'); - } - if (!parsedConfig.client.privateKey) { - errors.push('Private Key not provided'); - } - } else if (parsedConfig.client.authorizationMode !== 'SSWS') { - errors.push('Unknown Authorization Mode'); - } - if (errors.length) { - throw new Error(`Found ${errors.length} errors:\n${errors.join('\n')}\nSee ${repoUrl} for usage.`); - } - const authorizationMode = parsedConfig.client.authorizationMode; - const baseUrl = parsedConfig.client.orgUrl.replace(/\/$/, ''); - const apiToken = parsedConfig.client.token; - - let clientId; - let scopes; - let privateKey; - let oauth; - if (authorizationMode === 'PrivateKey') { - clientId = parsedConfig.client.clientId; - scopes = parsedConfig.client.scopes.split(' '); - privateKey = parsedConfig.client.privateKey; - oauth = new OAuth(this); - } - - const httpClient = new Http({ - cacheStore: clientConfig.cacheStore, - cacheMiddleware: clientConfig.cacheMiddleware, - defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, - requestExecutor: requestExecutor, - oauth: oauth - }); - if (authorizationMode === 'SSWS') { - httpClient.defaultHeaders.Authorization = `SSWS ${apiToken}`; - } - httpClient.defaultHeaders['User-Agent'] = parsedConfig.client.userAgent ? parsedConfig.client.userAgent + ' ' + DEFAULT_USER_AGENT : DEFAULT_USER_AGENT; - - return { - httpClient, - /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createUserType: async (body: UserType, options: any = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling createUserType.'); - } - const localVarPath = `/api/v1/meta/types/user`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteUserType: async (typeId: string, options: any = {}): Promise => { - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling deleteUserType.'); - } - const localVarPath = `/api/v1/meta/types/user/{typeId}` - .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUserType: async (typeId: string, options: any = {}): Promise => { - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling getUserType.'); - } - const localVarPath = `/api/v1/meta/types/user/{typeId}` - .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listUserTypes: async (options: any = {}): Promise => { - const localVarPath = `/api/v1/meta/types/user`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - replaceUserType: async (body: UserType, typeId: string, options: any = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling replaceUserType.'); - } - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling replaceUserType.'); - } - const localVarPath = `/api/v1/meta/types/user/{typeId}` - .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateUserType: async (body: UserType, typeId: string, options: any = {}): Promise => { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body','Required parameter body was null or undefined when calling updateUserType.'); - } - // verify required parameter 'typeId' is not null or undefined - if (typeId === null || typeId === undefined) { - throw new RequiredError('typeId','Required parameter typeId was null or undefined when calling updateUserType.'); - } - const localVarPath = `/api/v1/meta/types/user/{typeId}` - .replace(`{${"typeId"}}`, encodeURIComponent(String(typeId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api_token required - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("Authorization") - : await configuration.apiToken; - localVarHeaderParameter["Authorization"] = localVarApiKeyValue; - } - - // authentication oauth2 required - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("oauth2", ["okta.apps.read", "okta.apps.manage", "okta.authenticators.read", "okta.authenticators.manage", "okta.authorizationServers.read", "okta.authorizationServers.manage", "okta.brands.read", "okta.brands.manage", "okta.captchas.manage", "okta.captchas.read", "okta.domains.read", "okta.domains.manage", "okta.eventHooks.read", "okta.eventHooks.manage", "okta.groups.read", "okta.groups.manage", "okta.roles.read", "okta.roles.manage", "okta.idps.read", "okta.idps.manage", "okta.users.manage", "okta.inlineHooks.read", "okta.inlineHooks.manage", "okta.logs.read", "okta.profileMappings.read", "okta.profileMappings.manage", "okta.schemas.read", "okta.schemas.manage", "okta.linkedObjects.read", "okta.linkedObjects.manage", "okta.userTypes.read", "okta.userTypes.manage", "okta.orgs.read", "okta.orgs.manage", "okta.policies.read", "okta.policies.manage", "okta.sessions.read", "okta.sessions.manage", "okta.templates.read", "okta.templates.manage", "okta.trustedOrigins.read", "okta.trustedOrigins.manage", "okta.users.read.self", "okta.users.read"]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); - - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * UserTypeApi - functional programming interface - * @export - */ -export const UserTypeApiFp = function(configuration?: Configuration & V2Configuration) { - return { - /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createUserType(body: UserType, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.createUserType(body, options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; - } - }, - /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteUserType(typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.deleteUserType(typeId, options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs) as Promise; - } - }, - /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getUserType(typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.getUserType(typeId, options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; - } - }, - /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async listUserTypes(options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise>> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.listUserTypes(options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise>; - } - }, - /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async replaceUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.replaceUserType(body, typeId, options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; - } - }, - /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async updateUserType(body: UserType, typeId: string, options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise> { - const api = UserTypeApiRequestParamCreator(configuration); - const localVarRequestArgs = await api.updateUserType(body, typeId, options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise; - } - }, - } -}; - -/** - * UserTypeApi - factory interface - * @export - */ -export const UserTypeApiFactory = function (configuration?: Configuration, basePath?: string, httpClient?: Http) { - return { - /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createUserType(body: UserType, options?: any): Promise { - return UserTypeApiFp(configuration).createUserType(body, options).then((request) => request(httpClient, basePath)); - }, - /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteUserType(typeId: string, options?: any): Promise { - return UserTypeApiFp(configuration).deleteUserType(typeId, options).then((request) => request(httpClient, basePath)); - }, - /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUserType(typeId: string, options?: any): Promise { - return UserTypeApiFp(configuration).getUserType(typeId, options).then((request) => request(httpClient, basePath)); - }, - /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listUserTypes(options?: any): Promise> { - return UserTypeApiFp(configuration).listUserTypes(options).then((request) => request(httpClient, basePath)); - }, - /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - replaceUserType(body: UserType, typeId: string, options?: any): Promise { - return UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then((request) => request(httpClient, basePath)); - }, - /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateUserType(body: UserType, typeId: string, options?: any): Promise { - return UserTypeApiFp(configuration).updateUserType(body, typeId, options).then((request) => request(httpClient, basePath)); - }, - }; -}; - -/** - * UserTypeApi - object-oriented interface - * @export - * @class UserTypeApi - * @extends {BaseAPI} - */ -export class UserTypeApi extends BaseAPI { - /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public createUserType(body: UserType, options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).createUserType(body, options).then((request) => request(api.httpClient, this.basePath)); - } - /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public deleteUserType(typeId: string, options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then((request) => request(api.httpClient, this.basePath)); - } - /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public getUserType(typeId: string, options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).getUserType(typeId, options).then((request) => request(api.httpClient, this.basePath)); - } - /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public listUserTypes(options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).listUserTypes(options).then((request) => request(api.httpClient, this.basePath)); - } - /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public replaceUserType(body: UserType, typeId: string, options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then((request) => request(api.httpClient, this.basePath)); - } - /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ - public updateUserType(body: UserType, typeId: string, options?: any) { - const api = UserTypeApiRequestParamCreator(this.configuration); - return UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then((request) => request(api.httpClient, this.basePath)); - } -} diff --git a/src/v3/base.js b/src/v3/base.js new file mode 100644 index 000000000..588f317e1 --- /dev/null +++ b/src/v3/base.js @@ -0,0 +1,67 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +exports.__esModule = true; +exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0; +// Some imports not used depending on template conditions +// @ts-ignore +exports.BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); +/** + * + * @export + */ +exports.COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|" +}; +/** + * + * @export + * @class BaseAPI + */ +var BaseAPI = /** @class */ (function () { + function BaseAPI(configuration, basePath, httpClient) { + if (basePath === void 0) { basePath = exports.BASE_PATH; } + this.basePath = basePath; + this.httpClient = httpClient; + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } + return BaseAPI; +}()); +exports.BaseAPI = BaseAPI; +; +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +var RequiredError = /** @class */ (function (_super) { + __extends(RequiredError, _super); + function RequiredError(field, msg) { + var _this = _super.call(this, msg) || this; + _this.field = field; + _this.name = "RequiredError"; + return _this; + } + return RequiredError; +}(Error)); +exports.RequiredError = RequiredError; diff --git a/src/v3/base.ts b/src/v3/base.ts deleted file mode 100644 index da67ac3af..000000000 --- a/src/v3/base.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -import { Configuration } from "./configuration"; -import { Http } from "../http"; - -// Some imports not used depending on template conditions -// @ts-ignore - -export const BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); - -/** - * - * @export - */ -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -/** - * - * @export - * @interface RequestArgs - */ -export interface RequestArgs { - url: string; - options: any; -} - -/** - * - * @export - * @class BaseAPI - */ -export class BaseAPI { - protected configuration: Configuration | undefined; - - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected httpClient?: Http) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } - } -}; - -/** - * - * @export - * @class RequiredError - * @extends {Error} - */ -export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} diff --git a/src/v3/configuration.js b/src/v3/configuration.js new file mode 100644 index 000000000..bd959a543 --- /dev/null +++ b/src/v3/configuration.js @@ -0,0 +1,16 @@ +"use strict"; +exports.__esModule = true; +exports.Configuration = void 0; +var Configuration = /** @class */ (function () { + function Configuration(param) { + if (param === void 0) { param = {}; } + this.apiToken = param.apiToken; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + } + return Configuration; +}()); +exports.Configuration = Configuration; diff --git a/src/v3/configuration.ts b/src/v3/configuration.ts deleted file mode 100644 index 81c81fe98..000000000 --- a/src/v3/configuration.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -export interface ConfigurationParameters { - apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - username?: string; - password?: string; - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - basePath?: string; - baseOptions?: any; -} - -export class Configuration { - /** - * parameter for apiToken security - * @param name security name - * @memberof Configuration - */ - apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - username?: string; - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - password?: string; - /** - * parameter for oauth2 security - * @param name security name - * @param scopes oauth2 scope - * @memberof Configuration - */ - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - /** - * override base path - * - * @type {string} - * @memberof Configuration - */ - basePath?: string; - /** - * base options for axios calls - * - * @type {any} - * @memberof Configuration - */ - baseOptions?: any; - - constructor(param: ConfigurationParameters = {}) { - this.apiToken = param.apiToken; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.baseOptions = param.baseOptions; - } -} diff --git a/src/v3/index.js b/src/v3/index.js new file mode 100644 index 000000000..237bbd37e --- /dev/null +++ b/src/v3/index.js @@ -0,0 +1,28 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; +/* tslint:disable */ +/* eslint-disable */ +/** + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +__exportStar(require("./api"), exports); +__exportStar(require("./configuration"), exports); +__exportStar(require("./models"), exports); diff --git a/src/v3/index.ts b/src/v3/index.ts deleted file mode 100644 index 6e78c4e4e..000000000 --- a/src/v3/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -export * from "./api"; -export * from "./configuration"; -export * from "./models"; - diff --git a/src/v3/models/index.js b/src/v3/models/index.js new file mode 100644 index 000000000..19e98e356 --- /dev/null +++ b/src/v3/models/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; +__exportStar(require("./user-type"), exports); diff --git a/src/v3/models/index.ts b/src/v3/models/index.ts deleted file mode 100644 index e499da260..000000000 --- a/src/v3/models/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './user-type'; - diff --git a/src/v3/models/user-type.js b/src/v3/models/user-type.js new file mode 100644 index 000000000..0e345787d --- /dev/null +++ b/src/v3/models/user-type.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/src/v3/models/user-type.ts b/src/v3/models/user-type.ts deleted file mode 100644 index 19d155bff..000000000 --- a/src/v3/models/user-type.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Okta API - * Allows customers to easily access the Okta API - * - * OpenAPI spec version: 2.10.0 - * Contact: devex-public@okta.com - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ -/** - * - * @export - * @interface UserType - */ -export interface UserType { - /** - * - * @type {{ [key, string]: any;}} - * @memberof UserType - */ - links?: any; - /** - * - * @type {Date} - * @memberof UserType - */ - created?: any; - /** - * - * @type {string} - * @memberof UserType - */ - createdBy?: any; - /** - * - * @type {boolean} - * @memberof UserType - */ - _default?: any; - /** - * - * @type {string} - * @memberof UserType - */ - description?: any; - /** - * - * @type {string} - * @memberof UserType - */ - displayName?: any; - /** - * - * @type {string} - * @memberof UserType - */ - id?: any; - /** - * - * @type {Date} - * @memberof UserType - */ - lastUpdated?: any; - /** - * - * @type {string} - * @memberof UserType - */ - lastUpdatedBy?: any; - /** - * - * @type {string} - * @memberof UserType - */ - name?: any; -} diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index 928b4572a..db9b581be 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -8,12 +8,11 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr {{#imports}} import { {{import}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}'; import { Response } from 'node-fetch'; -import OAuth = require('../../OAuth'); -import HttpClass = require('../../Http'); +import Oauth = require('../../oauth'); +import Http = require('../../http'); import ConfigLoader = require('../../config-loader'); import DefaultRequestExecutor = require('../../default-request-executor'); import { V2Configuration } from '../../configuration'; -import { Http } from '../../http'; const os = require('os'); @@ -78,10 +77,10 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config clientId = parsedConfig.client.clientId; scopes = parsedConfig.client.scopes.split(' '); privateKey = parsedConfig.client.privateKey; - oauth = new OAuth(this); + oauth = new Oauth(this); } - const httpClient = new HttpClass({ + const httpClient = new Http({ cacheStore: clientConfig.cacheStore, cacheMiddleware: clientConfig.cacheMiddleware, defaultCacheMiddlewareResponseBufferSize: clientConfig.defaultCacheMiddlewareResponseBufferSize, From c1a43dbbf47148ed369ae13c5f41aa2811dc5909 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 7 Mar 2022 17:39:26 +0100 Subject: [PATCH 10/27] fix lint --- src/configuration.js | 4 +- src/types/configuration.d.ts | 2 +- ...SecurePasswordStoreApplicationOptions.d.ts | 36 ++-- .../SecurePasswordStoreApplicationOptions.js | 13 ++ .../SwaApplicationOptions.d.ts | 26 ++- .../request-options/SwaApplicationOptions.js | 13 ++ src/types/v3/apis/user-type-api.d.ts | 24 +-- src/types/v3/base.d.ts | 18 +- src/types/v3/configuration.d.ts | 26 +-- src/types/v3/index.d.ts | 6 +- src/v3/.eslintrc | 11 ++ src/v3/api.js | 2 +- src/v3/apis/user-type-api.js | 170 ++++++++++++------ src/v3/base.js | 89 +++++---- src/v3/configuration.js | 22 +-- src/v3/index.js | 28 ++- src/v3/models/index.js | 30 ++-- src/v3/models/user-type.js | 2 +- test/it/user-type-api.ts | 2 +- 19 files changed, 327 insertions(+), 197 deletions(-) create mode 100644 src/types/request-options/SecurePasswordStoreApplicationOptions.js create mode 100644 src/types/request-options/SwaApplicationOptions.js create mode 100644 src/v3/.eslintrc diff --git a/src/configuration.js b/src/configuration.js index 0fba4c766..f6af78bcb 100644 --- a/src/configuration.js +++ b/src/configuration.js @@ -1,2 +1,2 @@ -// no js code for V2Configuration, it is only used as a type in TypeScript modules -module.exports = {} \ No newline at end of file +// no js code for V2Configuration, it is only used as a type in TypeScript modules +module.exports = {}; diff --git a/src/types/configuration.d.ts b/src/types/configuration.d.ts index 64e0947c1..14a90b137 100644 --- a/src/types/configuration.d.ts +++ b/src/types/configuration.d.ts @@ -12,4 +12,4 @@ export declare interface V2Configuration { cacheStore?: CacheStorage, cacheMiddleware?: typeof defaultCacheMiddleware | unknown defaultCacheMiddlewareResponseBufferSize?: number, -} \ No newline at end of file +} diff --git a/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts b/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts index 7c7318306..47d326c41 100644 --- a/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts +++ b/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts @@ -12,25 +12,21 @@ declare interface SecurePasswordStoreApplicationOptions { - label: string; - name: string; /* 'template_sps' */ - signOnMode: string; /* 'SECURE_PASSWORD_STORE' */ - settings: { - app: { - url: string; - passwordField: string; - usernameField: string; - optionalField1?: string; - optionalField1Value?: string; - optionalField2?: string; - optionalField2Value?: string; - optionalField3?: string; - optionalField3Value?: string; + label: string; + name: string; + signOnMode: string; + settings: { + app: { + url: string; + passwordField: string; + usernameField: string; + optionalField1?: string; + optionalField1Value?: string; + optionalField2?: string; + optionalField2Value?: string; + optionalField3?: string; + optionalField3Value?: string; + }; }; - }; } - -export { - SecurePasswordStoreApplicationOptions -}; - +export { SecurePasswordStoreApplicationOptions }; diff --git a/src/types/request-options/SecurePasswordStoreApplicationOptions.js b/src/types/request-options/SecurePasswordStoreApplicationOptions.js new file mode 100644 index 000000000..3e1a690d6 --- /dev/null +++ b/src/types/request-options/SecurePasswordStoreApplicationOptions.js @@ -0,0 +1,13 @@ +'use strict'; +/*! + * Copyright (c) 2017-present; Okta; Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License; Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing; software + * distributed under the License is distributed on an "AS IS" BASIS; WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND; either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + */ +exports.__esModule = true; diff --git a/src/types/request-options/SwaApplicationOptions.d.ts b/src/types/request-options/SwaApplicationOptions.d.ts index 133da6cf7..cfeb4630c 100644 --- a/src/types/request-options/SwaApplicationOptions.d.ts +++ b/src/types/request-options/SwaApplicationOptions.d.ts @@ -12,20 +12,16 @@ declare interface SwaApplicationOptions { - label: string; - name: string; /* 'template_swa' */ - settings: { - app: { - buttonField: string; - passwordField: string; - usernameField: string; - url: string; + label: string; + name: string; + settings: { + app: { + buttonField: string; + passwordField: string; + usernameField: string; + url: string; + }; }; - }; - signOnMode: string; /* 'BROWSER_PLUGIN' */ - + signOnMode: string; } - -export { - SwaApplicationOptions -}; +export { SwaApplicationOptions }; diff --git a/src/types/request-options/SwaApplicationOptions.js b/src/types/request-options/SwaApplicationOptions.js new file mode 100644 index 000000000..3e1a690d6 --- /dev/null +++ b/src/types/request-options/SwaApplicationOptions.js @@ -0,0 +1,13 @@ +'use strict'; +/*! + * Copyright (c) 2017-present; Okta; Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License; Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing; software + * distributed under the License is distributed on an "AS IS" BASIS; WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND; either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + */ +exports.__esModule = true; diff --git a/src/types/v3/apis/user-type-api.d.ts b/src/types/v3/apis/user-type-api.d.ts index 9e9f13dd1..9ee846362 100644 --- a/src/types/v3/apis/user-type-api.d.ts +++ b/src/types/v3/apis/user-type-api.d.ts @@ -188,7 +188,7 @@ export declare const UserTypeApiFactory: (configuration?: Configuration, basePat * @extends {BaseAPI} */ export declare class UserTypeApi extends BaseAPI { - /** + /** * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. * @summary Create User Type * @param {UserType} body @@ -196,8 +196,8 @@ export declare class UserTypeApi extends BaseAPI { * @throws {RequiredError} * @memberof UserTypeApi */ - createUserType(body: UserType, options?: any): Promise; - /** + createUserType(body: UserType, options?: any): Promise; + /** * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users * @summary Delete User Type * @param {string} typeId @@ -205,8 +205,8 @@ export declare class UserTypeApi extends BaseAPI { * @throws {RequiredError} * @memberof UserTypeApi */ - deleteUserType(typeId: string, options?: any): Promise; - /** + deleteUserType(typeId: string, options?: any): Promise; + /** * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. * @summary Get User Type * @param {string} typeId @@ -214,16 +214,16 @@ export declare class UserTypeApi extends BaseAPI { * @throws {RequiredError} * @memberof UserTypeApi */ - getUserType(typeId: string, options?: any): Promise; - /** + getUserType(typeId: string, options?: any): Promise; + /** * Fetches all User Types in your org * @summary List User Types * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof UserTypeApi */ - listUserTypes(options?: any): Promise; - /** + listUserTypes(options?: any): Promise; + /** * Replace an existing User Type * @summary Replace User Type * @param {UserType} body @@ -232,8 +232,8 @@ export declare class UserTypeApi extends BaseAPI { * @throws {RequiredError} * @memberof UserTypeApi */ - replaceUserType(body: UserType, typeId: string, options?: any): Promise; - /** + replaceUserType(body: UserType, typeId: string, options?: any): Promise; + /** * Updates an existing User Type * @summary Update User Type * @param {UserType} body @@ -242,5 +242,5 @@ export declare class UserTypeApi extends BaseAPI { * @throws {RequiredError} * @memberof UserTypeApi */ - updateUserType(body: UserType, typeId: string, options?: any): Promise; + updateUserType(body: UserType, typeId: string, options?: any): Promise; } diff --git a/src/types/v3/base.d.ts b/src/types/v3/base.d.ts index ed51963af..f49f3a9c0 100644 --- a/src/types/v3/base.d.ts +++ b/src/types/v3/base.d.ts @@ -9,8 +9,8 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -import { Configuration } from "./configuration"; -import { Http } from "../http"; +import { Configuration } from './configuration'; +import { Http } from '../http'; export declare const BASE_PATH: string; /** * @@ -37,10 +37,10 @@ export interface RequestArgs { * @class BaseAPI */ export declare class BaseAPI { - protected basePath: string; - protected httpClient?: Http; - protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, basePath?: string, httpClient?: Http); + protected basePath: string; + protected httpClient?: Http; + protected configuration: Configuration | undefined; + constructor(configuration?: Configuration, basePath?: string, httpClient?: Http); } /** * @@ -49,7 +49,7 @@ export declare class BaseAPI { * @extends {Error} */ export declare class RequiredError extends Error { - field: string; - name: "RequiredError"; - constructor(field: string, msg?: string); + field: string; + name: 'RequiredError'; + constructor(field: string, msg?: string); } diff --git a/src/types/v3/configuration.d.ts b/src/types/v3/configuration.d.ts index 8a7f36f99..02e19b30b 100644 --- a/src/types/v3/configuration.d.ts +++ b/src/types/v3/configuration.d.ts @@ -18,46 +18,46 @@ export interface ConfigurationParameters { baseOptions?: any; } export declare class Configuration { - /** + /** * parameter for apiToken security * @param name security name * @memberof Configuration */ - apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - /** + apiToken?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** * parameter for basic security * * @type {string} * @memberof Configuration */ - username?: string; - /** + username?: string; + /** * parameter for basic security * * @type {string} * @memberof Configuration */ - password?: string; - /** + password?: string; + /** * parameter for oauth2 security * @param name security name * @param scopes oauth2 scope * @memberof Configuration */ - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - /** + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** * override base path * * @type {string} * @memberof Configuration */ - basePath?: string; - /** + basePath?: string; + /** * base options for axios calls * * @type {any} * @memberof Configuration */ - baseOptions?: any; - constructor(param?: ConfigurationParameters); + baseOptions?: any; + constructor(param?: ConfigurationParameters); } diff --git a/src/types/v3/index.d.ts b/src/types/v3/index.d.ts index f5c67b893..c56d78d04 100644 --- a/src/types/v3/index.d.ts +++ b/src/types/v3/index.d.ts @@ -9,6 +9,6 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -export * from "./api"; -export * from "./configuration"; -export * from "./models"; +export * from './api'; +export * from './configuration'; +export * from './models'; diff --git a/src/v3/.eslintrc b/src/v3/.eslintrc new file mode 100644 index 000000000..705d42acb --- /dev/null +++ b/src/v3/.eslintrc @@ -0,0 +1,11 @@ +{ + "rules": { + "no-use-before-define": [ + "error", + { + "functions": false, + "variables": false + } + ] + } +} diff --git a/src/v3/api.js b/src/v3/api.js index 52bd903e5..b06782de8 100644 --- a/src/v3/api.js +++ b/src/v3/api.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /** diff --git a/src/v3/apis/user-type-api.js b/src/v3/apis/user-type-api.js index 505f483fa..e348befb5 100644 --- a/src/v3/apis/user-type-api.js +++ b/src/v3/apis/user-type-api.js @@ -1,65 +1,131 @@ -"use strict"; +'use strict'; var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + }) || + function (d, b) { + for (var p in b) { + if (Object.prototype.hasOwnProperty.call(b, p)) { + d[p] = b[p]; + } + } + }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== 'function' && b !== null) { + throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null'); + } + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}()); var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) { + if (Object.prototype.hasOwnProperty.call(s, p)) { + t[p] = s[p]; } - return t; - }; - return __assign.apply(this, arguments); + } + } + return t; + }; + return __assign.apply(this, arguments); }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); }); + } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator['throw'](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); }; var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; + var _ = { label: 0, sent: function () { + if (t[0] & 1) { + throw t[1]; + } return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function () { + return this; + }), g; + function verb(n) { + return function (v) { + return step([n, v]); + }; + } + function step(op) { + if (f) { + throw new TypeError('Generator is already executing.'); + } + while (_) { + try { + if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { + return t; + } + if (y = 0, t) { + op = [op[0] & 2, t.value]; + } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; continue; + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1]; break; } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; t = op; break; + } + if (t && _.label < t[2]) { + _.label = t[2]; _.ops.push(op); break; + } + if (t[2]) { + _.ops.pop(); + } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; y = 0; + } finally { + f = t = 0; + } } + if (op[0] & 5) { + throw op[1]; + } return { value: op[0] ? op[1] : void 0, done: true }; + } }; exports.__esModule = true; exports.UserTypeApi = exports.UserTypeApiFactory = exports.UserTypeApiFp = exports.UserTypeApiRequestParamCreator = void 0; diff --git a/src/v3/base.js b/src/v3/base.js index 588f317e1..d3bd4d273 100644 --- a/src/v3/base.js +++ b/src/v3/base.js @@ -1,33 +1,44 @@ -"use strict"; +'use strict'; var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + }) || + function (d, b) { + for (var p in b) { + if (Object.prototype.hasOwnProperty.call(b, p)) { + d[p] = b[p]; + } + } + }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== 'function' && b !== null) { + throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null'); + } + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}()); exports.__esModule = true; exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0; // Some imports not used depending on template conditions // @ts-ignore -exports.BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); +exports.BASE_PATH = 'https://{subdomain}.{domain}'.replace(/\/+$/, ''); /** * * @export */ exports.COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|" + csv: ',', + ssv: ' ', + tsv: '\t', + pipes: '|' }; /** * @@ -35,19 +46,21 @@ exports.COLLECTION_FORMATS = { * @class BaseAPI */ var BaseAPI = /** @class */ (function () { - function BaseAPI(configuration, basePath, httpClient) { - if (basePath === void 0) { basePath = exports.BASE_PATH; } - this.basePath = basePath; - this.httpClient = httpClient; - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } + function BaseAPI(configuration, basePath, httpClient) { + if (basePath === void 0) { + basePath = exports.BASE_PATH; } - return BaseAPI; + this.basePath = basePath; + this.httpClient = httpClient; + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } + return BaseAPI; }()); exports.BaseAPI = BaseAPI; -; + /** * * @export @@ -55,13 +68,13 @@ exports.BaseAPI = BaseAPI; * @extends {Error} */ var RequiredError = /** @class */ (function (_super) { - __extends(RequiredError, _super); - function RequiredError(field, msg) { - var _this = _super.call(this, msg) || this; - _this.field = field; - _this.name = "RequiredError"; - return _this; - } - return RequiredError; + __extends(RequiredError, _super); + function RequiredError(field, msg) { + var _this = _super.call(this, msg) || this; + _this.field = field; + _this.name = 'RequiredError'; + return _this; + } + return RequiredError; }(Error)); exports.RequiredError = RequiredError; diff --git a/src/v3/configuration.js b/src/v3/configuration.js index bd959a543..83b7603f8 100644 --- a/src/v3/configuration.js +++ b/src/v3/configuration.js @@ -1,16 +1,18 @@ -"use strict"; +'use strict'; exports.__esModule = true; exports.Configuration = void 0; var Configuration = /** @class */ (function () { - function Configuration(param) { - if (param === void 0) { param = {}; } - this.apiToken = param.apiToken; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.baseOptions = param.baseOptions; + function Configuration(param) { + if (param === void 0) { + param = {}; } - return Configuration; + this.apiToken = param.apiToken; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + } + return Configuration; }()); exports.Configuration = Configuration; diff --git a/src/v3/index.js b/src/v3/index.js index 237bbd37e..1f1a7e0fe 100644 --- a/src/v3/index.js +++ b/src/v3/index.js @@ -1,13 +1,23 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +'use strict'; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + Object.defineProperty(o, k2, { enumerable: true, get: function () { + return m[k]; + } }); +}) : (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __exportStar = (this && this.__exportStar) || function (m, exports) { + for (var p in m) { + if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { + __createBinding(exports, m, p); + } + } }; exports.__esModule = true; /* tslint:disable */ diff --git a/src/v3/models/index.js b/src/v3/models/index.js index 19e98e356..dfb61e4b2 100644 --- a/src/v3/models/index.js +++ b/src/v3/models/index.js @@ -1,13 +1,23 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +'use strict'; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + Object.defineProperty(o, k2, { enumerable: true, get: function () { + return m[k]; + } }); +}) : (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __exportStar = (this && this.__exportStar) || function (m, exports) { + for (var p in m) { + if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { + __createBinding(exports, m, p); + } + } }; exports.__esModule = true; -__exportStar(require("./user-type"), exports); +__exportStar(require('./user-type'), exports); diff --git a/src/v3/models/user-type.js b/src/v3/models/user-type.js index 0e345787d..a95632782 100644 --- a/src/v3/models/user-type.js +++ b/src/v3/models/user-type.js @@ -1,2 +1,2 @@ -"use strict"; +'use strict'; exports.__esModule = true; diff --git a/test/it/user-type-api.ts b/test/it/user-type-api.ts index 271d2f913..07b7145ce 100644 --- a/test/it/user-type-api.ts +++ b/test/it/user-type-api.ts @@ -5,7 +5,7 @@ import { UserType } from '../../src/v3/models/user-type'; describe('User Type API', () => { it('lists existing user types', async () => { - const userTypes: UserType[] = await UserTypeApiFp({ + const userTypes: UserType[] = await UserTypeApiFp({ orgUrl: process.env.OKTA_CLIENT_ORGURL, token: process.env.OKTA_CLIENT_TOKEN, }).listUserTypes().then(method => method()); From d3980abcd8163fa7f90f16ae7985d372ddf3898b Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 14:15:52 +0100 Subject: [PATCH 11/27] update template formatting --- templates/swagger-codegen/apiInner.mustache | 537 ++++++++++---------- templates/swagger-codegen/baseApi.mustache | 2 +- 2 files changed, 270 insertions(+), 269 deletions(-) diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index db9b581be..92972aad4 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{>licenseInfo}} -import { Configuration } from '{{apiRelativeToRoot}}configuration'; + // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base'; @@ -13,6 +13,7 @@ import Http = require('../../http'); import ConfigLoader = require('../../config-loader'); import DefaultRequestExecutor = require('../../default-request-executor'); import { V2Configuration } from '../../configuration'; +import { Configuration } from '{{apiRelativeToRoot}}configuration'; const os = require('os'); @@ -94,197 +95,197 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config return { httpClient, - {{#operation}} - {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - {{nickname}}: async ({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options: any = {}): Promise => { - {{#parameters}} - {{#required}} - // verify required parameter '{{paramName}}' is not null or undefined - if ({{paramName}} === null || {{paramName}} === undefined) { - throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); - } - {{/required}} - {{/parameters}} - const localVarPath = `{{{path}}}`{{#pathParams}} - .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, 'https://example.com'); - let baseOptions; - if (configuration) { - baseOptions = configuration.baseOptions; - } - const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}} - const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}FormData(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}} + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}: async ({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options: any = {}): Promise => { + {{#parameters}} + {{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + {{/required}} + {{/parameters}} + const localVarPath = `{{{path}}}`{{#pathParams}} + .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = { method: '{{httpMethod}}', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any;{{#vendorExtensions}}{{#hasFormParams}} + const localVarFormParams = new {{^multipartFormData}}URLSearchParams(){{/multipartFormData}}{{#multipartFormData}}FormData(){{/multipartFormData}};{{/hasFormParams}}{{/vendorExtensions}} - {{#authMethods}} - // authentication {{name}} required - {{#isApiKey}} - {{#isKeyInHeader}} - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("{{keyParamName}}") - : await configuration.apiToken; - localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; - } - {{/isKeyInHeader}} - {{#isKeyInQuery}} - if (configuration && configuration.apiToken) { - const localVarApiKeyValue = typeof configuration.apiToken === 'function' - ? await configuration.apiToken("{{keyParamName}}") - : await configuration.apiToken; - localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; - } - {{/isKeyInQuery}} - {{/isApiKey}} - {{#isBasicBasic}} - // http basic authentication required - if (configuration && (configuration.username || configuration.password)) { - localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password }; - } - {{/isBasicBasic}} - {{#isBasicBearer}} - // http bearer authentication required - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; - } - {{/isBasicBearer}} - {{#isOAuth}} - // oauth required - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken("{{name}}", [{{#each scopes}}"{{@key}}"{{^@last}}, {{/@last}}{{/each}}]) - : await configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } - {{/isOAuth}} + {{#authMethods}} + // authentication {{name}} required + {{#isApiKey}} + {{#isKeyInHeader}} + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("{{keyParamName}}") + : await configuration.apiToken; + localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInHeader}} + {{#isKeyInQuery}} + if (configuration && configuration.apiToken) { + const localVarApiKeyValue = typeof configuration.apiToken === 'function' + ? await configuration.apiToken("{{keyParamName}}") + : await configuration.apiToken; + localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInQuery}} + {{/isApiKey}} + {{#isBasicBasic}} + // http basic authentication required + if (configuration && (configuration.username || configuration.password)) { + localVarRequestOptions["auth"] = { username: configuration.username, password: configuration.password }; + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // http bearer authentication required + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; + } + {{/isBasicBearer}} + {{#isOAuth}} + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken("{{name}}", [{{#each scopes}}"{{@key}}"{{^@last}}, {{/@last}}{{/each}}]) + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + {{/isOAuth}} - {{/authMethods}} - {{#queryParams}} - {{#isListContainer}} - if ({{paramName}}) { - {{#isCollectionFormatMulti}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}); - {{/isCollectionFormatMulti}} - } - {{/isListContainer}} - {{^isListContainer}} - if ({{paramName}} !== undefined) { - {{#isDateTime}} - localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? - ({{paramName}} as any).toISOString() : - {{paramName}}; - {{/isDateTime}} - {{^isDateTime}} - {{#isDate}} - localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? - ({{paramName}} as any).toISOString().substr(0,10) : - {{paramName}}; - {{/isDate}} - {{^isDate}} - localVarQueryParameter['{{baseName}}'] = {{paramName}}; - {{/isDate}} - {{/isDateTime}} - } - {{/isListContainer}} + {{/authMethods}} + {{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + {{#isDateTime}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? + ({{paramName}} as any).toISOString() : + {{paramName}}; + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any instanceof Date) ? + ({{paramName}} as any).toISOString().substr(0,10) : + {{paramName}}; + {{/isDate}} + {{^isDate}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isDate}} + {{/isDateTime}} + } + {{/isListContainer}} - {{/queryParams}} - {{#headerParams}} - {{#isListContainer}} - if ({{paramName}}) { - let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); - localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); - } - {{/isListContainer}} - {{^isListContainer}} - if ({{paramName}} !== undefined && {{paramName}} !== null) { - {{#isString}} - localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); - {{/isString}} - {{^isString}} - localVarHeaderParameter['{{baseName}}'] = String(JSON.stringify({{paramName}})); - {{/isString}} - } - {{/isListContainer}} + {{/queryParams}} + {{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + {{#isString}} + localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); + {{/isString}} + {{^isString}} + localVarHeaderParameter['{{baseName}}'] = String(JSON.stringify({{paramName}})); + {{/isString}} + } + {{/isListContainer}} - {{/headerParams}} - {{#vendorExtensions}} - {{#formParams}} - {{#isListContainer}} - if ({{paramName}}) { - {{#isCollectionFormatMulti}} - {{paramName}}.forEach((element) => { - localVarFormParams.append('{{baseName}}', element as any); - }) - {{/isCollectionFormatMulti}} - {{^isCollectionFormatMulti}}{{^multipartFormData}} - localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}{{#multipartFormData}} - localVarFormParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}} - {{/isCollectionFormatMulti}} - }{{/isListContainer}} - {{^isListContainer}} - if ({{paramName}} !== undefined) { {{^multipartFormData}} - localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}} - localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/multipartFormData}} - } - {{/isListContainer}} - {{/formParams}}{{/vendorExtensions}} - {{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}} - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}} - localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}} - {{/hasFormParams}}{{/vendorExtensions}} - {{#bodyParam}} - {{^consumes}} - localVarHeaderParameter['Content-Type'] = 'application/json'; - {{/consumes}} - {{#consumes.0}} - localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}'; - {{/consumes.0}} + {{/headerParams}} + {{#vendorExtensions}} + {{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + localVarFormParams.append('{{baseName}}', element as any); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}}{{^multipartFormData}} + localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}}{{#multipartFormData}} + localVarFormParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}));{{/multipartFormData}} + {{/isCollectionFormatMulti}} + }{{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { {{^multipartFormData}} + localVarFormParams.set('{{baseName}}', {{paramName}} as any);{{/multipartFormData}}{{#multipartFormData}} + localVarFormParams.append('{{baseName}}', {{paramName}} as any);{{/multipartFormData}} + } + {{/isListContainer}} + {{/formParams}}{{/vendorExtensions}} + {{#vendorExtensions}}{{#hasFormParams}}{{^multipartFormData}} + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded';{{/multipartFormData}}{{#multipartFormData}} + localVarHeaderParameter['Content-Type'] = 'multipart/form-data';{{/multipartFormData}} + {{/hasFormParams}}{{/vendorExtensions}} + {{#bodyParam}} + {{^consumes}} + localVarHeaderParameter['Content-Type'] = 'application/json'; + {{/consumes}} + {{#consumes.0}} + localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}'; + {{/consumes.0}} - {{/bodyParam}} - const query = new URLSearchParams(localVarUrlObj.search); - for (const key in localVarQueryParameter) { - query.set(key, localVarQueryParameter[key]); - } - for (const key in options.query) { - query.set(key, options.query[key]); - } - localVarUrlObj.search = (new URLSearchParams(query)).toString(); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - {{#hasFormParams}} - localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}}; - {{/hasFormParams}} - {{#bodyParam}} - const needsSerialization = (typeof {{paramName}} !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {}) : ({{paramName}} || ""); - {{/bodyParam}} + {{/bodyParam}} + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.query) { + query.set(key, options.query[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + {{#hasFormParams}} + localVarRequestOptions.data = localVarFormParams{{#vendorExtensions}}{{^multipartFormData}}.toString(){{/multipartFormData}}{{/vendorExtensions}}; + {{/hasFormParams}} + {{#bodyParam}} + const needsSerialization = (typeof {{paramName}} !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} !== undefined ? {{paramName}} : {}) : ({{paramName}} || ""); + {{/bodyParam}} - return { - url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, - options: localVarRequestOptions, - }; - }, - {{/contents}} - {{/operation}} + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + {{/contents}} + {{/operation}} } }; @@ -295,35 +296,35 @@ export const {{classname}}RequestParamCreator = function (configuration?: Config */ export const {{classname}}Fp = function(configuration?: Configuration & V2Configuration) { return { - {{#operation}} - {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>> { - const api = {{classname}}RequestParamCreator(configuration); - const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - {{#returnType}} - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise<{{{returnType}}}>; - {{/returnType}} - {{^returnType}} - return httpClient.http(requestArgs.url, requestArgs) as Promise; - {{/returnType}} - } - }, - {{/contents}} - {{/operation}} + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>> { + const api = {{classname}}RequestParamCreator(configuration); + const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + + {{#returnType}} + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise<{{{returnType}}}>; + {{/returnType}} + {{^returnType}} + return httpClient.http(requestArgs.url, requestArgs) as Promise; + {{/returnType}} + } + }, + {{/contents}} + {{/operation}} } }; @@ -334,24 +335,24 @@ export const {{classname}}Fp = function(configuration?: Configuration & V2Config */ export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string, httpClient?: Http) { return { - {{#operation}} - {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { - return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(httpClient, basePath)); - }, - {{/contents}} - {{/operation}} + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { + return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(httpClient, basePath)); + }, + {{/contents}} + {{/operation}} }; }; @@ -365,19 +366,19 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas export interface {{classname}}Interface { {{#operation}} {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof {{classname}}Interface - */ - {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>; + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}}Interface + */ + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>; {{/contents}} {{/operation}} @@ -397,28 +398,28 @@ export class {{classname}} extends BaseAPI implements {{classname}}Interface { {{^withInterfaces}} export class {{classname}} extends BaseAPI { {{/withInterfaces}} - {{#operation}} - {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof {{classname}} - */ - public {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any) { - const api = {{classname}}RequestParamCreator(this.configuration); - return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(api.httpClient, this.basePath)); - } - {{^@last}} + {{#operation}} + {{#contents}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}} + */ + public {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any) { + const api = {{classname}}RequestParamCreator(this.configuration); + return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(api.httpClient, this.basePath)); + } + {{^@last}} - {{/@last}} - {{/contents}} - {{/operation}} + {{/@last}} + {{/contents}} + {{/operation}} } {{/operations}} diff --git a/templates/swagger-codegen/baseApi.mustache b/templates/swagger-codegen/baseApi.mustache index 863405c4f..d6d9e0d26 100644 --- a/templates/swagger-codegen/baseApi.mustache +++ b/templates/swagger-codegen/baseApi.mustache @@ -3,7 +3,7 @@ {{>licenseInfo}} import { Configuration } from "./configuration"; -import { Http } from "../types/http"; +import { Http } from "../http"; // Some imports not used depending on template conditions // @ts-ignore From fb404a1669c9911cd9364595888683b1b3a4a782 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 14:16:41 +0100 Subject: [PATCH 12/27] add unused swagger-codegen output to gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 1eeaa2aa1..c2915f768 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,9 @@ test-reports/ .yalc yalc.lock +src/v3/.gitignore +src/v3/.npmignore +src/v3/.swagger-codegen-ignore +src/v3/git_push.sh +src/v3/README.md +src/v3/tsconfig.json From a63ce8ec456e49ab1b6d4e1f13acc081cef8e197 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 15:19:10 +0100 Subject: [PATCH 13/27] add v3 APIs index module --- src/v3/apis/index.js | 13 +++++++++++++ src/v3/models/index.js | 30 ++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 src/v3/apis/index.js diff --git a/src/v3/apis/index.js b/src/v3/apis/index.js new file mode 100644 index 000000000..cca3d3d4f --- /dev/null +++ b/src/v3/apis/index.js @@ -0,0 +1,13 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; +__exportStar(require("./user-type-api"), exports); diff --git a/src/v3/models/index.js b/src/v3/models/index.js index dfb61e4b2..19e98e356 100644 --- a/src/v3/models/index.js +++ b/src/v3/models/index.js @@ -1,23 +1,13 @@ -'use strict'; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { - if (k2 === undefined) { - k2 = k; - } - Object.defineProperty(o, k2, { enumerable: true, get: function () { - return m[k]; - } }); -}) : (function (o, m, k, k2) { - if (k2 === undefined) { - k2 = k; - } - o[k2] = m[k]; +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function (m, exports) { - for (var p in m) { - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { - __createBinding(exports, m, p); - } - } +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; exports.__esModule = true; -__exportStar(require('./user-type'), exports); +__exportStar(require("./user-type"), exports); From 948c7763d27f55d3df27d89a7de57ef2ee295b8b Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 15:19:30 +0100 Subject: [PATCH 14/27] add script for emitting V3 types --- scripts/emitV3Types.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 scripts/emitV3Types.sh diff --git a/scripts/emitV3Types.sh b/scripts/emitV3Types.sh new file mode 100755 index 000000000..30ec06a3b --- /dev/null +++ b/scripts/emitV3Types.sh @@ -0,0 +1,3 @@ +tsc src/v3/**/*.ts --declaration +rsync -r src/v3/**/*.d.ts src/types/v3 +find src/v3/ -type f ! -name "*.js" -delete From 547deac805ce5edf955574576af1da5a3279b110 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 15:21:15 +0100 Subject: [PATCH 15/27] fix lint errors --- .gitignore | 1 + src/v3/apis/index.js | 30 ++++++++++++++++++++---------- src/v3/models/index.js | 30 ++++++++++++++++++++---------- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index c2915f768..d4b938492 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ test-reports/ .yalc yalc.lock +src/v3/.swagger-codegen/ src/v3/.gitignore src/v3/.npmignore src/v3/.swagger-codegen-ignore diff --git a/src/v3/apis/index.js b/src/v3/apis/index.js index cca3d3d4f..5bd06d075 100644 --- a/src/v3/apis/index.js +++ b/src/v3/apis/index.js @@ -1,13 +1,23 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +'use strict'; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + Object.defineProperty(o, k2, { enumerable: true, get: function () { + return m[k]; + } }); +}) : (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __exportStar = (this && this.__exportStar) || function (m, exports) { + for (var p in m) { + if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { + __createBinding(exports, m, p); + } + } }; exports.__esModule = true; -__exportStar(require("./user-type-api"), exports); +__exportStar(require('./user-type-api'), exports); diff --git a/src/v3/models/index.js b/src/v3/models/index.js index 19e98e356..dfb61e4b2 100644 --- a/src/v3/models/index.js +++ b/src/v3/models/index.js @@ -1,13 +1,23 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +'use strict'; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + Object.defineProperty(o, k2, { enumerable: true, get: function () { + return m[k]; + } }); +}) : (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __exportStar = (this && this.__exportStar) || function (m, exports) { + for (var p in m) { + if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { + __createBinding(exports, m, p); + } + } }; exports.__esModule = true; -__exportStar(require("./user-type"), exports); +__exportStar(require('./user-type'), exports); From 16c6347c398a13f3721c680b5e97f3892c14ecbb Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 8 Mar 2022 17:20:19 +0100 Subject: [PATCH 16/27] do not expose v3 models through package root --- src/index.js | 1 - src/types/index.d.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/index.js b/src/index.js index 30d537688..49c42b5dc 100644 --- a/src/index.js +++ b/src/index.js @@ -18,6 +18,5 @@ module.exports = Object.assign( DefaultRequestExecutor: require('./default-request-executor'), Collection: require('./collection'), }, - require('./models'), require('./v3') ); diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 4ef5e4166..a88b1fad0 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -28,7 +28,6 @@ export * from './request-options/SecurePasswordStoreApplicationOptions'; export * from './request-options/SwaApplicationOptions'; export * from './request-options/SwaThreeFieldApplicationOptions'; export * from './request-options/WsFederationApplicationOptions'; -export * from './v3'; export * from './models/AccessPolicy'; export * from './models/AccessPolicyConstraint'; From e36d1846e7068980652fecdf22acfa48f9a1ced7 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 9 Mar 2022 15:06:42 +0100 Subject: [PATCH 17/27] expose v2 models --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 49c42b5dc..e6a6cd91a 100644 --- a/src/index.js +++ b/src/index.js @@ -18,5 +18,5 @@ module.exports = Object.assign( DefaultRequestExecutor: require('./default-request-executor'), Collection: require('./collection'), }, - require('./v3') + require('./models') ); From 7e7341ae24f119f3c45dd41e018d0e4263290f47 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 9 Mar 2022 15:31:17 +0100 Subject: [PATCH 18/27] add instructions for generating SDK with swagger-codegen --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index cb31ab097..9d058b93a 100644 --- a/README.md +++ b/README.md @@ -987,6 +987,14 @@ This version 4.0 release also updated APIs latest `@okta/openapi` (v2.0.0) that Run `yarn build` from repository root. +### Building with swagger-codegen + - Obtain OASv3 combined spec + - Install [swagger-codegen](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#homebrew) + - run `swagger-codegen generate -i ./path/to/specfile.yaml|json -o ./src/v3 -l typescript-axios -t ./templates/swagger-codegen` + - remove APIs and models which are not intended to be pushed to upstream from `src/v3` + - run `./scripts/emitV3Types.sh` to replace TypeScript modules with typings + javascript modules + - commit changes + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) if you would like to propose changes to this library. From ee32e216340e6a9c0c68f718bfae78bea868c0a4 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 9 Mar 2022 16:33:22 +0100 Subject: [PATCH 19/27] remove merge artifacts --- ...SecurePasswordStoreApplicationOptions.d.ts | 35 ++++++++++--------- .../SecurePasswordStoreApplicationOptions.js | 13 ------- .../SwaApplicationOptions.d.ts | 26 ++++++++------ .../request-options/SwaApplicationOptions.js | 13 ------- 4 files changed, 34 insertions(+), 53 deletions(-) delete mode 100644 src/types/request-options/SecurePasswordStoreApplicationOptions.js delete mode 100644 src/types/request-options/SwaApplicationOptions.js diff --git a/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts b/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts index 47d326c41..2ff623e19 100644 --- a/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts +++ b/src/types/request-options/SecurePasswordStoreApplicationOptions.d.ts @@ -12,21 +12,24 @@ declare interface SecurePasswordStoreApplicationOptions { - label: string; - name: string; - signOnMode: string; - settings: { - app: { - url: string; - passwordField: string; - usernameField: string; - optionalField1?: string; - optionalField1Value?: string; - optionalField2?: string; - optionalField2Value?: string; - optionalField3?: string; - optionalField3Value?: string; - }; + label: string; + name: string; /* 'template_sps' */ + signOnMode: string; /* 'SECURE_PASSWORD_STORE' */ + settings: { + app: { + url: string; + passwordField: string; + usernameField: string; + optionalField1?: string; + optionalField1Value?: string; + optionalField2?: string; + optionalField2Value?: string; + optionalField3?: string; + optionalField3Value?: string; }; + }; } -export { SecurePasswordStoreApplicationOptions }; + +export { + SecurePasswordStoreApplicationOptions +}; diff --git a/src/types/request-options/SecurePasswordStoreApplicationOptions.js b/src/types/request-options/SecurePasswordStoreApplicationOptions.js deleted file mode 100644 index 3e1a690d6..000000000 --- a/src/types/request-options/SecurePasswordStoreApplicationOptions.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; -/*! - * Copyright (c) 2017-present; Okta; Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License; Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing; software - * distributed under the License is distributed on an "AS IS" BASIS; WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND; either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ -exports.__esModule = true; diff --git a/src/types/request-options/SwaApplicationOptions.d.ts b/src/types/request-options/SwaApplicationOptions.d.ts index cfeb4630c..c0a268c9b 100644 --- a/src/types/request-options/SwaApplicationOptions.d.ts +++ b/src/types/request-options/SwaApplicationOptions.d.ts @@ -12,16 +12,20 @@ declare interface SwaApplicationOptions { - label: string; - name: string; - settings: { - app: { - buttonField: string; - passwordField: string; - usernameField: string; - url: string; - }; + label: string; + name: string; /* 'template_swa' */ + settings: { + app: { + buttonField: string; + passwordField: string; + usernameField: string; + url: string; }; - signOnMode: string; + }; + signOnMode: string; /* 'BROWSER_PLUGIN' */ + } -export { SwaApplicationOptions }; + +export { + SwaApplicationOptions +}; \ No newline at end of file diff --git a/src/types/request-options/SwaApplicationOptions.js b/src/types/request-options/SwaApplicationOptions.js deleted file mode 100644 index 3e1a690d6..000000000 --- a/src/types/request-options/SwaApplicationOptions.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; -/*! - * Copyright (c) 2017-present; Okta; Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License; Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing; software - * distributed under the License is distributed on an "AS IS" BASIS; WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND; either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ -exports.__esModule = true; From 8fcc26ce9d07dff9d91e7b93893e9943ddae7797 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 9 Mar 2022 16:44:20 +0100 Subject: [PATCH 20/27] fix eslint error --- src/types/request-options/SwaApplicationOptions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/request-options/SwaApplicationOptions.d.ts b/src/types/request-options/SwaApplicationOptions.d.ts index c0a268c9b..133da6cf7 100644 --- a/src/types/request-options/SwaApplicationOptions.d.ts +++ b/src/types/request-options/SwaApplicationOptions.d.ts @@ -28,4 +28,4 @@ declare interface SwaApplicationOptions { export { SwaApplicationOptions -}; \ No newline at end of file +}; From 7d7c2395d6cfc519063526cf0f43c555c274af39 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Wed, 9 Mar 2022 17:23:02 +0100 Subject: [PATCH 21/27] correct import case --- src/types/v3/apis/user-type-api.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/v3/apis/user-type-api.d.ts b/src/types/v3/apis/user-type-api.d.ts index 9ee846362..90976af3c 100644 --- a/src/types/v3/apis/user-type-api.d.ts +++ b/src/types/v3/apis/user-type-api.d.ts @@ -12,7 +12,7 @@ import { RequestArgs, BaseAPI } from '../base'; import { UserType } from '../models'; import { Response } from 'node-fetch'; -import Http = require('../../Http'); +import Http = require('../../http'); import { V2Configuration } from '../../configuration'; import { Configuration } from '../configuration'; /** From ff70a8f5f704555da20d24f229895b93821144fa Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 14 Mar 2022 12:24:24 +0100 Subject: [PATCH 22/27] remove duplicate V2Configuration --- src/types/client.d.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/types/client.d.ts b/src/types/client.d.ts index 8ff9a8650..0c741a562 100644 --- a/src/types/client.d.ts +++ b/src/types/client.d.ts @@ -14,22 +14,7 @@ import { ParameterizedOperationsClient } from './parameterized-operations-client import { OAuth } from './oauth'; import { Http } from './http'; import { RequestExecutor } from './request-executor'; -import { defaultCacheMiddleware } from './default-cache-middleware'; -import { CacheStorage } from './memory-store'; - -export declare interface V2Configuration { - orgUrl?: string, - token?: string, - clientId?: string, - scopes?: string[], - requestExecutor?: RequestExecutor, - authorizationMode?: string, - privateKey?: string | Record - cacheStore?: CacheStorage, - cacheMiddleware?: typeof defaultCacheMiddleware | unknown - defaultCacheMiddlewareResponseBufferSize?: number, - httpsProxy?: string | unknown, // https://github.com/TooTallNate/node-agent-base/issues/56 -} +import { V2Configuration } from './configuration'; export declare class Client extends ParameterizedOperationsClient { constructor(config?: V2Configuration); From cfb016e2a5745a66a49bafd3472768f1bb30a865 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Mon, 14 Mar 2022 16:06:16 +0100 Subject: [PATCH 23/27] consistent indents in templates --- templates/swagger-codegen/apiInner.mustache | 81 +++++++++---------- .../swagger-codegen/licenseInfo.mustache | 13 ++- .../swagger-codegen/modelGeneric.mustache | 26 +++--- 3 files changed, 65 insertions(+), 55 deletions(-) diff --git a/templates/swagger-codegen/apiInner.mustache b/templates/swagger-codegen/apiInner.mustache index 92972aad4..aeb19d3d4 100644 --- a/templates/swagger-codegen/apiInner.mustache +++ b/templates/swagger-codegen/apiInner.mustache @@ -298,31 +298,30 @@ export const {{classname}}Fp = function(configuration?: Configuration & V2Config return { {{#operation}} {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>> { - const api = {{classname}}RequestParamCreator(configuration); - const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); - return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { - const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; - - {{#returnType}} - return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise<{{{returnType}}}>; - {{/returnType}} - {{^returnType}} - return httpClient.http(requestArgs.url, requestArgs) as Promise; - {{/returnType}} - } - }, + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<(httpClient?: Http, basePath?: string) => Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}>> { + const api = {{classname}}RequestParamCreator(configuration); + const localVarRequestArgs = await api.{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options); + return (httpClient: Http = api.httpClient, basePath: string = configuration.basePath || configuration.orgUrl) => { + const requestArgs = {...localVarRequestArgs.options, url: basePath + localVarRequestArgs.url}; + {{#returnType}} + return httpClient.http(requestArgs.url, requestArgs).then(res => res.json()) as Promise<{{{returnType}}}>; + {{/returnType}} + {{^returnType}} + return httpClient.http(requestArgs.url, requestArgs) as Promise; + {{/returnType}} + } + }, {{/contents}} {{/operation}} } @@ -337,20 +336,20 @@ export const {{classname}}Factory = function (configuration?: Configuration, bas return { {{#operation}} {{#contents}} - /** - * {{¬es}} - {{#summary}} - * @summary {{&summary}} - {{/summary}} - {{#parameters}} - * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} - {{/parameters}} - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { - return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(httpClient, basePath)); - }, + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#parameters}} + * @param {{braces "left"}}{{dataType}}{{braces "right"}} {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/parameters}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { + return {{classname}}Fp(configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(httpClient, basePath)); + }, {{/contents}} {{/operation}} }; @@ -413,8 +412,8 @@ export class {{classname}} extends BaseAPI { * @memberof {{classname}} */ public {{nickname}}({{#parameters}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/parameters}}options?: any) { - const api = {{classname}}RequestParamCreator(this.configuration); - return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(api.httpClient, this.basePath)); + const api = {{classname}}RequestParamCreator(this.configuration); + return {{classname}}Fp(this.configuration).{{nickname}}({{#parameters}}{{paramName}}, {{/parameters}}options).then((request) => request(api.httpClient, this.basePath)); } {{^@last}} diff --git a/templates/swagger-codegen/licenseInfo.mustache b/templates/swagger-codegen/licenseInfo.mustache index 7d61c4ee0..ae3214a98 100644 --- a/templates/swagger-codegen/licenseInfo.mustache +++ b/templates/swagger-codegen/licenseInfo.mustache @@ -1,4 +1,14 @@ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * {{{appName}}} * {{{appDescription}}} * @@ -8,4 +18,5 @@ * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. - */ \ No newline at end of file + */ + \ No newline at end of file diff --git a/templates/swagger-codegen/modelGeneric.mustache b/templates/swagger-codegen/modelGeneric.mustache index 19b00602c..6fbef046d 100644 --- a/templates/swagger-codegen/modelGeneric.mustache +++ b/templates/swagger-codegen/modelGeneric.mustache @@ -5,28 +5,28 @@ */ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{#additionalPropertiesType}} - [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; {{/additionalPropertiesType}} {{#vars}} - /** - * {{{description}}} - * @type {{braces "left"}}{{datatype}}{{braces "right"}} - * @memberof {{classname}} - {{#deprecated}} - * @deprecated - {{/deprecated}} - */ - {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; + /** + * {{{description}}} + * @type {{braces "left"}}{{datatype}}{{braces "right"}} + * @memberof {{classname}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}}; {{/vars}} }{{#hasEnums}} {{#vars}} {{#isEnum}} /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum {{enumName}} { {{#allowableValues}} {{#enumVars}} From 35e9f8d67c4971dd8e1d6f0909f83ecf5524e49d Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 15 Mar 2022 10:40:55 +0100 Subject: [PATCH 24/27] expose v3 models through alias --- src/index.js | 3 ++- src/types/index.d.ts | 1 + src/types/v3/index.d.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index e6a6cd91a..30d537688 100644 --- a/src/index.js +++ b/src/index.js @@ -18,5 +18,6 @@ module.exports = Object.assign( DefaultRequestExecutor: require('./default-request-executor'), Collection: require('./collection'), }, - require('./models') + require('./models'), + require('./v3') ); diff --git a/src/types/index.d.ts b/src/types/index.d.ts index a88b1fad0..4ef5e4166 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -28,6 +28,7 @@ export * from './request-options/SecurePasswordStoreApplicationOptions'; export * from './request-options/SwaApplicationOptions'; export * from './request-options/SwaThreeFieldApplicationOptions'; export * from './request-options/WsFederationApplicationOptions'; +export * from './v3'; export * from './models/AccessPolicy'; export * from './models/AccessPolicyConstraint'; diff --git a/src/types/v3/index.d.ts b/src/types/v3/index.d.ts index c56d78d04..ce084fffe 100644 --- a/src/types/v3/index.d.ts +++ b/src/types/v3/index.d.ts @@ -11,4 +11,4 @@ */ export * from './api'; export * from './configuration'; -export * from './models'; +export * as v3 from './models'; From 1f356851157663d9bc319efc3fcc963a9e96ff93 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 15 Mar 2022 13:39:58 +0100 Subject: [PATCH 25/27] wrap v3 exports into namespace --- src/types/v3/index.d.ts | 21 +++++++++++++++--- src/v3/configuration.js | 45 ++++++++++++++++++++++++++++---------- src/v3/index.js | 47 +++++++++++++++++++--------------------- test/it/user-type-api.ts | 6 ++--- 4 files changed, 76 insertions(+), 43 deletions(-) diff --git a/src/types/v3/index.d.ts b/src/types/v3/index.d.ts index ce084fffe..87aeb453d 100644 --- a/src/types/v3/index.d.ts +++ b/src/types/v3/index.d.ts @@ -1,4 +1,14 @@ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * Okta API * Allows customers to easily access the Okta API * @@ -9,6 +19,11 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -export * from './api'; -export * from './configuration'; -export * as v3 from './models'; +import * as models from './models'; +import * as apis from './api'; +import * as config from './configuration'; +export declare namespace v3 { + export import model = models; + export import api = apis; + export import configuration = config; +} diff --git a/src/v3/configuration.js b/src/v3/configuration.js index 83b7603f8..5b595dbc7 100644 --- a/src/v3/configuration.js +++ b/src/v3/configuration.js @@ -1,18 +1,39 @@ -'use strict'; +"use strict"; +/* tslint:disable */ +/* eslint-disable */ +/** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ exports.__esModule = true; exports.Configuration = void 0; var Configuration = /** @class */ (function () { - function Configuration(param) { - if (param === void 0) { - param = {}; + function Configuration(param) { + if (param === void 0) { param = {}; } + this.apiToken = param.apiToken; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; } - this.apiToken = param.apiToken; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.baseOptions = param.baseOptions; - } - return Configuration; + return Configuration; }()); exports.Configuration = Configuration; diff --git a/src/v3/index.js b/src/v3/index.js index 1f1a7e0fe..122275195 100644 --- a/src/v3/index.js +++ b/src/v3/index.js @@ -1,28 +1,17 @@ -'use strict'; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { - if (k2 === undefined) { - k2 = k; - } - Object.defineProperty(o, k2, { enumerable: true, get: function () { - return m[k]; - } }); -}) : (function (o, m, k, k2) { - if (k2 === undefined) { - k2 = k; - } - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function (m, exports) { - for (var p in m) { - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { - __createBinding(exports, m, p); - } - } -}; -exports.__esModule = true; +"use strict"; /* tslint:disable */ /* eslint-disable */ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * Okta API * Allows customers to easily access the Okta API * @@ -33,6 +22,14 @@ exports.__esModule = true; * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -__exportStar(require("./api"), exports); -__exportStar(require("./configuration"), exports); -__exportStar(require("./models"), exports); +exports.__esModule = true; +exports.v3 = void 0; +var models = require("./models"); +var apis = require("./api"); +var config = require("./configuration"); +var v3; +(function (v3) { + v3.model = models; + v3.api = apis; + v3.configuration = config; +})(v3 = exports.v3 || (exports.v3 = {})); diff --git a/test/it/user-type-api.ts b/test/it/user-type-api.ts index 07b7145ce..c1ca7864a 100644 --- a/test/it/user-type-api.ts +++ b/test/it/user-type-api.ts @@ -1,11 +1,11 @@ import { expect } from 'chai'; -import { UserTypeApiFp } from '../../src/v3/apis/user-type-api'; -import { UserType } from '../../src/v3/models/user-type'; +import { v3 } from '@okta/okta-sdk-nodejs'; +//import { } from '@okta/okta-sdk-nodejs'; describe('User Type API', () => { it('lists existing user types', async () => { - const userTypes: UserType[] = await UserTypeApiFp({ + const userTypes: v3.model.UserType[] = await v3.api.UserTypeApiFp({ orgUrl: process.env.OKTA_CLIENT_ORGURL, token: process.env.OKTA_CLIENT_TOKEN, }).listUserTypes().then(method => method()); From 3447e79808f1cd7b9696cd1362d4912640207777 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 15 Mar 2022 15:17:05 +0100 Subject: [PATCH 26/27] use classes for models for non-void JS output --- src/types/v3/models/user-type.d.ts | 94 +-- src/v3/api.js | 34 +- src/v3/apis/user-type-api.js | 562 ++++++++---------- src/v3/base.js | 112 ++-- src/v3/models/user-type.js | 37 +- templates/swagger-codegen/api.mustache | 1 + templates/swagger-codegen/model.mustache | 1 + .../swagger-codegen/modelGeneric.mustache | 4 +- templates/swagger-codegen/modelIndex.mustache | 2 + 9 files changed, 430 insertions(+), 417 deletions(-) diff --git a/src/types/v3/models/user-type.d.ts b/src/types/v3/models/user-type.d.ts index 1238e0de7..7e379193c 100644 --- a/src/types/v3/models/user-type.d.ts +++ b/src/types/v3/models/user-type.d.ts @@ -1,4 +1,14 @@ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * Okta API * Allows customers to easily access the Okta API * @@ -12,67 +22,67 @@ /** * * @export - * @interface UserType + * @class UserType */ -export interface UserType { +export declare class UserType { /** - * - * @type {{ [key, string]: any;}} - * @memberof UserType - */ + * + * @type {{ [key, string]: any;}} + * @memberof UserType + */ links?: any; /** - * - * @type {Date} - * @memberof UserType - */ + * + * @type {Date} + * @memberof UserType + */ created?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ createdBy?: any; /** - * - * @type {boolean} - * @memberof UserType - */ + * + * @type {boolean} + * @memberof UserType + */ _default?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ description?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ displayName?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ id?: any; /** - * - * @type {Date} - * @memberof UserType - */ + * + * @type {Date} + * @memberof UserType + */ lastUpdated?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ lastUpdatedBy?: any; /** - * - * @type {string} - * @memberof UserType - */ + * + * @type {string} + * @memberof UserType + */ name?: any; } diff --git a/src/v3/api.js b/src/v3/api.js index b06782de8..9e03b135b 100644 --- a/src/v3/api.js +++ b/src/v3/api.js @@ -1,7 +1,28 @@ -'use strict'; +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +exports.__esModule = true; /* tslint:disable */ /* eslint-disable */ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * Okta API * Allows customers to easily access the Okta API * @@ -12,15 +33,4 @@ * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -exports.__esModule = true; __exportStar(require("./apis/user-type-api"), exports); diff --git a/src/v3/apis/user-type-api.js b/src/v3/apis/user-type-api.js index e348befb5..9d1442bbe 100644 --- a/src/v3/apis/user-type-api.js +++ b/src/v3/apis/user-type-api.js @@ -1,137 +1,17 @@ -'use strict'; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { - d.__proto__ = b; - }) || - function (d, b) { - for (var p in b) { - if (Object.prototype.hasOwnProperty.call(b, p)) { - d[p] = b[p]; - } - } - }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== 'function' && b !== null) { - throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null'); - } - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -}()); -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) { - if (Object.prototype.hasOwnProperty.call(s, p)) { - t[p] = s[p]; - } - } - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function () { - if (t[0] & 1) { - throw t[1]; - } return t[1]; - }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function () { - return this; - }), g; - function verb(n) { - return function (v) { - return step([n, v]); - }; - } - function step(op) { - if (f) { - throw new TypeError('Generator is already executing.'); - } - while (_) { - try { - if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { - return t; - } - if (y = 0, t) { - op = [op[0] & 2, t.value]; - } - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; continue; - } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { - _.label = op[1]; break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; t = op; break; - } - if (t && _.label < t[2]) { - _.label = t[2]; _.ops.push(op); break; - } - if (t[2]) { - _.ops.pop(); - } - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { - op = [6, e]; y = 0; - } finally { - f = t = 0; - } - } - if (op[0] & 5) { - throw op[1]; - } return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -exports.__esModule = true; -exports.UserTypeApi = exports.UserTypeApiFactory = exports.UserTypeApiFp = exports.UserTypeApiRequestParamCreator = void 0; +"use strict"; /* tslint:disable */ /* eslint-disable */ /** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * * Okta API * Allows customers to easily access the Okta API * @@ -142,6 +22,70 @@ exports.UserTypeApi = exports.UserTypeApiFactory = exports.UserTypeApiFp = expor * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +exports.__esModule = true; +exports.UserTypeApi = exports.UserTypeApiFactory = exports.UserTypeApiFp = exports.UserTypeApiRequestParamCreator = void 0; // Some imports not used depending on template conditions // @ts-ignore var base_1 = require("../base"); @@ -218,12 +162,12 @@ var UserTypeApiRequestParamCreator = function (configuration) { return { httpClient: httpClient, /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ createUserType: function (body, options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -295,12 +239,12 @@ var UserTypeApiRequestParamCreator = function (configuration) { }); }, /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ deleteUserType: function (typeId, options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -370,12 +314,12 @@ var UserTypeApiRequestParamCreator = function (configuration) { }); }, /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ getUserType: function (typeId, options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -445,11 +389,11 @@ var UserTypeApiRequestParamCreator = function (configuration) { }); }, /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ listUserTypes: function (options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -514,13 +458,13 @@ var UserTypeApiRequestParamCreator = function (configuration) { }); }, /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ replaceUserType: function (body, typeId, options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -597,13 +541,13 @@ var UserTypeApiRequestParamCreator = function (configuration) { }); }, /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ updateUserType: function (body, typeId, options) { if (options === void 0) { options = {}; } return __awaiter(_this, void 0, void 0, function () { @@ -689,19 +633,19 @@ exports.UserTypeApiRequestParamCreator = UserTypeApiRequestParamCreator; var UserTypeApiFp = function (configuration) { return { /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ createUserType: function (body, options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.createUserType(body, options)]; case 1: localVarRequestArgs = _a.sent(); @@ -716,19 +660,19 @@ var UserTypeApiFp = function (configuration) { }); }, /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ deleteUserType: function (typeId, options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.deleteUserType(typeId, options)]; case 1: localVarRequestArgs = _a.sent(); @@ -743,19 +687,19 @@ var UserTypeApiFp = function (configuration) { }); }, /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ getUserType: function (typeId, options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.getUserType(typeId, options)]; case 1: localVarRequestArgs = _a.sent(); @@ -770,18 +714,18 @@ var UserTypeApiFp = function (configuration) { }); }, /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ listUserTypes: function (options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.listUserTypes(options)]; case 1: localVarRequestArgs = _a.sent(); @@ -796,20 +740,20 @@ var UserTypeApiFp = function (configuration) { }); }, /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ replaceUserType: function (body, typeId, options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.replaceUserType(body, typeId, options)]; case 1: localVarRequestArgs = _a.sent(); @@ -824,20 +768,20 @@ var UserTypeApiFp = function (configuration) { }); }, /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ updateUserType: function (body, typeId, options) { return __awaiter(this, void 0, void 0, function () { var api, localVarRequestArgs; return __generator(this, function (_a) { switch (_a.label) { case 0: - api = exports.UserTypeApiRequestParamCreator(configuration); + api = (0, exports.UserTypeApiRequestParamCreator)(configuration); return [4 /*yield*/, api.updateUserType(body, typeId, options)]; case 1: localVarRequestArgs = _a.sent(); @@ -861,65 +805,65 @@ exports.UserTypeApiFp = UserTypeApiFp; var UserTypeApiFactory = function (configuration, basePath, httpClient) { return { /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ createUserType: function (body, options) { - return exports.UserTypeApiFp(configuration).createUserType(body, options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).createUserType(body, options).then(function (request) { return request(httpClient, basePath); }); }, /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ deleteUserType: function (typeId, options) { - return exports.UserTypeApiFp(configuration).deleteUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).deleteUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); }, /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ getUserType: function (typeId, options) { - return exports.UserTypeApiFp(configuration).getUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).getUserType(typeId, options).then(function (request) { return request(httpClient, basePath); }); }, /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ listUserTypes: function (options) { - return exports.UserTypeApiFp(configuration).listUserTypes(options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).listUserTypes(options).then(function (request) { return request(httpClient, basePath); }); }, /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ replaceUserType: function (body, typeId, options) { - return exports.UserTypeApiFp(configuration).replaceUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).replaceUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); }, /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ updateUserType: function (body, typeId, options) { - return exports.UserTypeApiFp(configuration).updateUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); + return (0, exports.UserTypeApiFp)(configuration).updateUserType(body, typeId, options).then(function (request) { return request(httpClient, basePath); }); } }; }; @@ -936,83 +880,83 @@ var UserTypeApi = /** @class */ (function (_super) { return _super !== null && _super.apply(this, arguments) || this; } /** - * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. - * @summary Create User Type - * @param {UserType} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Creates a new User Type. A default User Type is automatically created along with your org, and you may add another 9 User Types for a maximum of 10. + * @summary Create User Type + * @param {UserType} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.createUserType = function (body, options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).createUserType(body, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).createUserType(body, options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; /** - * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users - * @summary Delete User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Deletes a User Type permanently. This operation is not permitted for the default type, nor for any User Type that has existing users + * @summary Delete User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.deleteUserType = function (typeId, options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).deleteUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).deleteUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; /** - * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. - * @summary Get User Type - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Fetches a User Type by ID. The special identifier `default` may be used to fetch the default User Type. + * @summary Get User Type + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.getUserType = function (typeId, options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).getUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).getUserType(typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; /** - * Fetches all User Types in your org - * @summary List User Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Fetches all User Types in your org + * @summary List User Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.listUserTypes = function (options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).listUserTypes(options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).listUserTypes(options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; /** - * Replace an existing User Type - * @summary Replace User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Replace an existing User Type + * @summary Replace User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.replaceUserType = function (body, typeId, options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).replaceUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).replaceUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; /** - * Updates an existing User Type - * @summary Update User Type - * @param {UserType} body - * @param {string} typeId - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserTypeApi - */ + * Updates an existing User Type + * @summary Update User Type + * @param {UserType} body + * @param {string} typeId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserTypeApi + */ UserTypeApi.prototype.updateUserType = function (body, typeId, options) { var _this = this; - var api = exports.UserTypeApiRequestParamCreator(this.configuration); - return exports.UserTypeApiFp(this.configuration).updateUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); + var api = (0, exports.UserTypeApiRequestParamCreator)(this.configuration); + return (0, exports.UserTypeApiFp)(this.configuration).updateUserType(body, typeId, options).then(function (request) { return request(api.httpClient, _this.basePath); }); }; return UserTypeApi; }(base_1.BaseAPI)); diff --git a/src/v3/base.js b/src/v3/base.js index d3bd4d273..1933d507a 100644 --- a/src/v3/base.js +++ b/src/v3/base.js @@ -1,44 +1,56 @@ -'use strict'; +"use strict"; +/* tslint:disable */ +/* eslint-disable */ +/** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { - d.__proto__ = b; - }) || - function (d, b) { - for (var p in b) { - if (Object.prototype.hasOwnProperty.call(b, p)) { - d[p] = b[p]; - } - } - }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== 'function' && b !== null) { - throw new TypeError('Class extends value ' + String(b) + ' is not a constructor or null'); - } - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -}()); + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); exports.__esModule = true; exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0; // Some imports not used depending on template conditions // @ts-ignore -exports.BASE_PATH = 'https://{subdomain}.{domain}'.replace(/\/+$/, ''); +exports.BASE_PATH = "https://{subdomain}.{domain}".replace(/\/+$/, ""); /** * * @export */ exports.COLLECTION_FORMATS = { - csv: ',', - ssv: ' ', - tsv: '\t', - pipes: '|' + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|" }; /** * @@ -46,21 +58,19 @@ exports.COLLECTION_FORMATS = { * @class BaseAPI */ var BaseAPI = /** @class */ (function () { - function BaseAPI(configuration, basePath, httpClient) { - if (basePath === void 0) { - basePath = exports.BASE_PATH; - } - this.basePath = basePath; - this.httpClient = httpClient; - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; + function BaseAPI(configuration, basePath, httpClient) { + if (basePath === void 0) { basePath = exports.BASE_PATH; } + this.basePath = basePath; + this.httpClient = httpClient; + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } } - } - return BaseAPI; + return BaseAPI; }()); exports.BaseAPI = BaseAPI; - +; /** * * @export @@ -68,13 +78,13 @@ exports.BaseAPI = BaseAPI; * @extends {Error} */ var RequiredError = /** @class */ (function (_super) { - __extends(RequiredError, _super); - function RequiredError(field, msg) { - var _this = _super.call(this, msg) || this; - _this.field = field; - _this.name = 'RequiredError'; - return _this; - } - return RequiredError; + __extends(RequiredError, _super); + function RequiredError(field, msg) { + var _this = _super.call(this, msg) || this; + _this.field = field; + _this.name = "RequiredError"; + return _this; + } + return RequiredError; }(Error)); exports.RequiredError = RequiredError; diff --git a/src/v3/models/user-type.js b/src/v3/models/user-type.js index a95632782..7e389ccf9 100644 --- a/src/v3/models/user-type.js +++ b/src/v3/models/user-type.js @@ -1,2 +1,37 @@ -'use strict'; +"use strict"; +/* tslint:disable */ +/* eslint-disable */ +/** + * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. + * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") + * + * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and limitations under the License. + * + * Okta API + * Allows customers to easily access the Okta API + * + * OpenAPI spec version: 2.10.0 + * Contact: devex-public@okta.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ exports.__esModule = true; +exports.UserType = void 0; +/** + * + * @export + * @class UserType + */ +var UserType = /** @class */ (function () { + function UserType() { + } + return UserType; +}()); +exports.UserType = UserType; diff --git a/templates/swagger-codegen/api.mustache b/templates/swagger-codegen/api.mustache index 7fdf1a233..281cd9332 100644 --- a/templates/swagger-codegen/api.mustache +++ b/templates/swagger-codegen/api.mustache @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{>licenseInfo}} + {{#apiInfo}} {{#apis}} {{#operations}} diff --git a/templates/swagger-codegen/model.mustache b/templates/swagger-codegen/model.mustache index f94509811..9e0e05c39 100644 --- a/templates/swagger-codegen/model.mustache +++ b/templates/swagger-codegen/model.mustache @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{>licenseInfo}} + {{#withSeparateModelsAndApi}}{{#hasAllOf}}{{#allOf}} import { {{class}} } from './{{filename}}';{{/allOf}}{{/hasAllOf}}{{#hasOneOf}}{{#oneOf}} import { {{class}} } from './{{filename}}';{{/oneOf}}{{/hasOneOf}}{{^hasAllOf}}{{^hasOneOf}}{{#imports}} diff --git a/templates/swagger-codegen/modelGeneric.mustache b/templates/swagger-codegen/modelGeneric.mustache index 6fbef046d..11b21c88e 100644 --- a/templates/swagger-codegen/modelGeneric.mustache +++ b/templates/swagger-codegen/modelGeneric.mustache @@ -1,9 +1,9 @@ /** * {{{description}}} * @export - * @interface {{classname}} + * @class {{classname}} */ -export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{#additionalPropertiesType}} [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; diff --git a/templates/swagger-codegen/modelIndex.mustache b/templates/swagger-codegen/modelIndex.mustache index 947111206..84d938eef 100644 --- a/templates/swagger-codegen/modelIndex.mustache +++ b/templates/swagger-codegen/modelIndex.mustache @@ -1,2 +1,4 @@ +{{>licenseInfo}} + {{#models}}{{#model}}export * from './{{classFilename}}';{{/model}} {{/models}} \ No newline at end of file From 42fcfb883f3a8d188654da53567d11ceafb4d63c Mon Sep 17 00:00:00 2001 From: Oleksandr Pravosudko Date: Tue, 15 Mar 2022 16:26:03 +0100 Subject: [PATCH 27/27] fix lint --- src/types/v3/models/user-type.d.ts | 40 +++++++++++++++--------------- src/v3/api.js | 28 ++++++++++++++------- src/v3/apis/user-type-api.js | 2 +- src/v3/base.js | 2 +- src/v3/configuration.js | 2 +- src/v3/index.js | 2 +- src/v3/models/user-type.js | 2 +- 7 files changed, 44 insertions(+), 34 deletions(-) diff --git a/src/types/v3/models/user-type.d.ts b/src/types/v3/models/user-type.d.ts index 7e379193c..68a00f89d 100644 --- a/src/types/v3/models/user-type.d.ts +++ b/src/types/v3/models/user-type.d.ts @@ -25,64 +25,64 @@ * @class UserType */ export declare class UserType { - /** + /** * * @type {{ [key, string]: any;}} * @memberof UserType */ - links?: any; - /** + links?: any; + /** * * @type {Date} * @memberof UserType */ - created?: any; - /** + created?: any; + /** * * @type {string} * @memberof UserType */ - createdBy?: any; - /** + createdBy?: any; + /** * * @type {boolean} * @memberof UserType */ - _default?: any; - /** + _default?: any; + /** * * @type {string} * @memberof UserType */ - description?: any; - /** + description?: any; + /** * * @type {string} * @memberof UserType */ - displayName?: any; - /** + displayName?: any; + /** * * @type {string} * @memberof UserType */ - id?: any; - /** + id?: any; + /** * * @type {Date} * @memberof UserType */ - lastUpdated?: any; - /** + lastUpdated?: any; + /** * * @type {string} * @memberof UserType */ - lastUpdatedBy?: any; - /** + lastUpdatedBy?: any; + /** * * @type {string} * @memberof UserType */ - name?: any; + name?: any; } diff --git a/src/v3/api.js b/src/v3/api.js index 9e03b135b..812594c18 100644 --- a/src/v3/api.js +++ b/src/v3/api.js @@ -1,13 +1,23 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +'use strict'; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + Object.defineProperty(o, k2, { enumerable: true, get: function () { + return m[k]; + } }); +}) : (function (o, m, k, k2) { + if (k2 === undefined) { + k2 = k; + } + o[k2] = m[k]; })); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +var __exportStar = (this && this.__exportStar) || function (m, exports) { + for (var p in m) { + if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) { + __createBinding(exports, m, p); + } + } }; exports.__esModule = true; /* tslint:disable */ diff --git a/src/v3/apis/user-type-api.js b/src/v3/apis/user-type-api.js index 9d1442bbe..249f5b23d 100644 --- a/src/v3/apis/user-type-api.js +++ b/src/v3/apis/user-type-api.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /** diff --git a/src/v3/base.js b/src/v3/base.js index 1933d507a..7c2b4c397 100644 --- a/src/v3/base.js +++ b/src/v3/base.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /** diff --git a/src/v3/configuration.js b/src/v3/configuration.js index 5b595dbc7..72af7eb81 100644 --- a/src/v3/configuration.js +++ b/src/v3/configuration.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /** diff --git a/src/v3/index.js b/src/v3/index.js index 122275195..6d2ec89fc 100644 --- a/src/v3/index.js +++ b/src/v3/index.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /** diff --git a/src/v3/models/user-type.js b/src/v3/models/user-type.js index 7e389ccf9..e8f6da4ce 100644 --- a/src/v3/models/user-type.js +++ b/src/v3/models/user-type.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* tslint:disable */ /* eslint-disable */ /**