diff --git a/src/rest/Oauth.ts b/src/rest/Oauth.ts deleted file mode 100644 index 5e0708b239..0000000000 --- a/src/rest/Oauth.ts +++ /dev/null @@ -1,52 +0,0 @@ -import OauthBase from "./OauthBase"; -import { OauthListInstance } from "./oauth/v1/oauth"; -import { DeviceCodeListInstance } from "./oauth/v1/deviceCode"; -import { OpenidDiscoveryListInstance } from "./oauth/v1/openidDiscovery"; -import { TokenListInstance } from "./oauth/v1/token"; -import { UserInfoListInstance } from "./oauth/v1/userInfo"; - -class Oauth extends OauthBase { - /** - * @deprecated - Use v1.deviceCode instead - */ - get deviceCode(): DeviceCodeListInstance { - console.warn("deviceCode is deprecated. Use v1.deviceCode instead."); - return this.v1.deviceCode; - } - - /** - * @deprecated - Use v1.oauth instead - */ - get oauth(): OauthListInstance { - console.warn("oauth is deprecated. Use v1.oauth instead."); - return this.v1.oauth; - } - - /** - * @deprecated - Use v1.openidDiscovery instead - */ - get openidDiscovery(): OpenidDiscoveryListInstance { - console.warn( - "openidDiscovery is deprecated. Use v1.openidDiscovery instead." - ); - return this.v1.openidDiscovery; - } - - /** - * @deprecated - Use v1.token instead - */ - get token(): TokenListInstance { - console.warn("token is deprecated. Use v1.token instead."); - return this.v1.token; - } - - /** - * @deprecated - Use v1.userInfo instead - */ - get userInfo(): UserInfoListInstance { - console.warn("userInfo is deprecated. Use v1.userInfo instead."); - return this.v1.userInfo; - } -} - -export = Oauth; diff --git a/src/rest/OauthBase.ts b/src/rest/OauthBase.ts deleted file mode 100644 index 513dd037f3..0000000000 --- a/src/rest/OauthBase.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import Domain from "../base/Domain"; -import V1 from "./oauth/V1"; - -class OauthBase extends Domain { - _v1?: V1; - - /** - * Initialize oauth domain - * - * @param twilio - The twilio client - */ - constructor(twilio: any) { - super(twilio, "https://oauth.twilio.com"); - } - - get v1(): V1 { - this._v1 = this._v1 || new V1(this); - return this._v1; - } -} - -export = OauthBase; diff --git a/src/rest/Twilio.ts b/src/rest/Twilio.ts index 1a21d3a500..3543d11e94 100644 --- a/src/rest/Twilio.ts +++ b/src/rest/Twilio.ts @@ -30,7 +30,6 @@ import Microvisor from "./Microvisor"; import Monitor from "./Monitor"; import Notify from "./Notify"; import Numbers from "./Numbers"; -import Oauth from "./Oauth"; import Preview from "./Preview"; import Pricing from "./Pricing"; import Proxy from "./Proxy"; @@ -118,8 +117,6 @@ class Twilio extends Client { _notify?: Notify; /** (Twilio.Numbers) - numbers domain */ _numbers?: Numbers; - /** (Twilio.Oauth) - oauth domain */ - _oauth?: Oauth; /** (Twilio.Preview) - preview domain */ _preview?: Preview; /** (Twilio.Pricing) - pricing domain */ @@ -188,7 +185,6 @@ class Twilio extends Client { this.monitor; this.notify; this.numbers; - this.oauth; this.preview; this.pricing; this.proxy; @@ -314,10 +310,6 @@ class Twilio extends Client { get numbers(): Numbers { return this._numbers ?? (this._numbers = new (require("./Numbers"))(this)); } - /** Getter for (Twilio.Oauth) domain */ - get oauth(): Oauth { - return this._oauth ?? (this._oauth = new (require("./Oauth"))(this)); - } /** Getter for (Twilio.Preview) domain */ get preview(): Preview { return this._preview ?? (this._preview = new (require("./Preview"))(this)); diff --git a/src/rest/oauth/V1.ts b/src/rest/oauth/V1.ts deleted file mode 100644 index ab2759f368..0000000000 --- a/src/rest/oauth/V1.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import OauthBase from "../OauthBase"; -import Version from "../../base/Version"; -import { DeviceCodeListInstance } from "./v1/deviceCode"; -import { OauthListInstance } from "./v1/oauth"; -import { OpenidDiscoveryListInstance } from "./v1/openidDiscovery"; -import { TokenListInstance } from "./v1/token"; -import { UserInfoListInstance } from "./v1/userInfo"; - -export default class V1 extends Version { - /** - * Initialize the V1 version of Oauth - * - * @param domain - The Twilio (Twilio.Oauth) domain - */ - constructor(domain: OauthBase) { - super(domain, "v1"); - } - - /** deviceCode - { Twilio.Oauth.V1.DeviceCodeListInstance } resource */ - protected _deviceCode?: DeviceCodeListInstance; - /** oauth - { Twilio.Oauth.V1.OauthListInstance } resource */ - protected _oauth?: OauthListInstance; - /** openidDiscovery - { Twilio.Oauth.V1.OpenidDiscoveryListInstance } resource */ - protected _openidDiscovery?: OpenidDiscoveryListInstance; - /** token - { Twilio.Oauth.V1.TokenListInstance } resource */ - protected _token?: TokenListInstance; - /** userInfo - { Twilio.Oauth.V1.UserInfoListInstance } resource */ - protected _userInfo?: UserInfoListInstance; - - /** Getter for deviceCode resource */ - get deviceCode(): DeviceCodeListInstance { - this._deviceCode = this._deviceCode || DeviceCodeListInstance(this); - return this._deviceCode; - } - - /** Getter for oauth resource */ - get oauth(): OauthListInstance { - this._oauth = this._oauth || OauthListInstance(this); - return this._oauth; - } - - /** Getter for openidDiscovery resource */ - get openidDiscovery(): OpenidDiscoveryListInstance { - this._openidDiscovery = - this._openidDiscovery || OpenidDiscoveryListInstance(this); - return this._openidDiscovery; - } - - /** Getter for token resource */ - get token(): TokenListInstance { - this._token = this._token || TokenListInstance(this); - return this._token; - } - - /** Getter for userInfo resource */ - get userInfo(): UserInfoListInstance { - this._userInfo = this._userInfo || UserInfoListInstance(this); - return this._userInfo; - } -} diff --git a/src/rest/oauth/v1/deviceCode.ts b/src/rest/oauth/v1/deviceCode.ts deleted file mode 100644 index da60047a46..0000000000 --- a/src/rest/oauth/v1/deviceCode.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { inspect, InspectOptions } from "util"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; - -/** - * Options to pass to create a DeviceCodeInstance - */ -export interface DeviceCodeListInstanceCreateOptions { - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** An Array of scopes for authorization request */ - scopes: Array; - /** An array of intended audiences for token requests */ - audiences?: Array; -} - -export interface DeviceCodeSolution {} - -export interface DeviceCodeListInstance { - _version: V1; - _solution: DeviceCodeSolution; - _uri: string; - - /** - * Create a DeviceCodeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceCodeInstance - */ - create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, item?: DeviceCodeInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DeviceCodeListInstance(version: V1): DeviceCodeListInstance { - const instance = {} as DeviceCodeListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/device/code`; - - instance.create = function create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, items: DeviceCodeInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - if (params["scopes"] === null || params["scopes"] === undefined) { - throw new Error("Required parameter \"params['scopes']\" missing."); - } - - let data: any = {}; - - data["ClientSid"] = params["clientSid"]; - - data["Scopes"] = serialize.map(params["scopes"], (e: string) => e); - if (params["audiences"] !== undefined) - data["Audiences"] = serialize.map(params["audiences"], (e: string) => e); - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - let operationVersion = version, - operationPromise = operationVersion.create({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new DeviceCodeInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -interface DeviceCodePayload extends DeviceCodeResource {} - -interface DeviceCodeResource { - device_code: string; - user_code: string; - verification_uri: string; - verification_uri_complete: string; - expires_in: number; - interval: number; -} - -export class DeviceCodeInstance { - constructor(protected _version: V1, payload: DeviceCodeResource) { - this.deviceCode = payload.device_code; - this.userCode = payload.user_code; - this.verificationUri = payload.verification_uri; - this.verificationUriComplete = payload.verification_uri_complete; - this.expiresIn = payload.expires_in; - this.interval = deserialize.integer(payload.interval); - } - - /** - * The device verification code. - */ - deviceCode: string; - /** - * The verification code which end user uses to verify authorization request. - */ - userCode: string; - /** - * The URI that the end user visits to verify authorization request. - */ - verificationUri: string; - /** - * The URI with user_code that the end-user alternatively visits to verify authorization request. - */ - verificationUriComplete: string; - /** - * The expiration time of the device_code and user_code in seconds. - */ - expiresIn: number; - /** - * The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. - */ - interval: number; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - deviceCode: this.deviceCode, - userCode: this.userCode, - verificationUri: this.verificationUri, - verificationUriComplete: this.verificationUriComplete, - expiresIn: this.expiresIn, - interval: this.interval, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/oauth.ts b/src/rest/oauth/v1/oauth.ts deleted file mode 100644 index 7752f30008..0000000000 --- a/src/rest/oauth/v1/oauth.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { inspect, InspectOptions } from "util"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; - -export interface OauthContext { - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OauthContextSolution {} - -export class OauthContextImpl implements OauthContext { - protected _solution: OauthContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/certs`; - } - - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OauthInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return this._solution; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -interface OauthPayload extends OauthResource {} - -interface OauthResource { - keys: any; - url: string; -} - -export class OauthInstance { - protected _solution: OauthContextSolution; - protected _context?: OauthContext; - - constructor(protected _version: V1, payload: OauthResource) { - this.keys = payload.keys; - this.url = payload.url; - - this._solution = {}; - } - - /** - * A collection of certificates where are signed Twilio-issued tokens. - */ - keys: any; - url: string; - - private get _proxy(): OauthContext { - this._context = this._context || new OauthContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - keys: this.keys, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OauthSolution {} - -export interface OauthListInstance { - _version: V1; - _solution: OauthSolution; - _uri: string; - - (): OauthContext; - get(): OauthContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OauthListInstance(version: V1): OauthListInstance { - const instance = (() => instance.get()) as OauthListInstance; - - instance.get = function get(): OauthContext { - return new OauthContextImpl(version); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = ``; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} diff --git a/src/rest/oauth/v1/openidDiscovery.ts b/src/rest/oauth/v1/openidDiscovery.ts deleted file mode 100644 index 24b8aa9a9f..0000000000 --- a/src/rest/oauth/v1/openidDiscovery.ts +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { inspect, InspectOptions } from "util"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; - -export interface OpenidDiscoveryContext { - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OpenidDiscoveryContextSolution {} - -export class OpenidDiscoveryContextImpl implements OpenidDiscoveryContext { - protected _solution: OpenidDiscoveryContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/.well-known/openid-configuration`; - } - - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OpenidDiscoveryInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return this._solution; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -interface OpenidDiscoveryPayload extends OpenidDiscoveryResource {} - -interface OpenidDiscoveryResource { - issuer: string; - authorization_endpoint: string; - device_authorization_endpoint: string; - token_endpoint: string; - userinfo_endpoint: string; - revocation_endpoint: string; - jwk_uri: string; - response_type_supported: Array; - subject_type_supported: Array; - id_token_signing_alg_values_supported: Array; - scopes_supported: Array; - claims_supported: Array; - url: string; -} - -export class OpenidDiscoveryInstance { - protected _solution: OpenidDiscoveryContextSolution; - protected _context?: OpenidDiscoveryContext; - - constructor(protected _version: V1, payload: OpenidDiscoveryResource) { - this.issuer = payload.issuer; - this.authorizationEndpoint = payload.authorization_endpoint; - this.deviceAuthorizationEndpoint = payload.device_authorization_endpoint; - this.tokenEndpoint = payload.token_endpoint; - this.userinfoEndpoint = payload.userinfo_endpoint; - this.revocationEndpoint = payload.revocation_endpoint; - this.jwkUri = payload.jwk_uri; - this.responseTypeSupported = payload.response_type_supported; - this.subjectTypeSupported = payload.subject_type_supported; - this.idTokenSigningAlgValuesSupported = - payload.id_token_signing_alg_values_supported; - this.scopesSupported = payload.scopes_supported; - this.claimsSupported = payload.claims_supported; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - issuer: string; - /** - * The endpoint that validates all authorization requests. - */ - authorizationEndpoint: string; - /** - * The endpoint that validates all device code related authorization requests. - */ - deviceAuthorizationEndpoint: string; - /** - * The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. - */ - tokenEndpoint: string; - /** - * The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. - */ - userinfoEndpoint: string; - /** - * The endpoint used to revoke access or refresh tokens issued by the authorization server. - */ - revocationEndpoint: string; - /** - * The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. - */ - jwkUri: string; - /** - * A collection of response type supported by authorization server. - */ - responseTypeSupported: Array; - /** - * A collection of subject by authorization server. - */ - subjectTypeSupported: Array; - /** - * A collection of JWS signing algorithms supported by authorization server to sign identity token. - */ - idTokenSigningAlgValuesSupported: Array; - /** - * A collection of scopes supported by authorization server for identity token - */ - scopesSupported: Array; - /** - * A collection of claims supported by authorization server for identity token - */ - claimsSupported: Array; - url: string; - - private get _proxy(): OpenidDiscoveryContext { - this._context = - this._context || new OpenidDiscoveryContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - issuer: this.issuer, - authorizationEndpoint: this.authorizationEndpoint, - deviceAuthorizationEndpoint: this.deviceAuthorizationEndpoint, - tokenEndpoint: this.tokenEndpoint, - userinfoEndpoint: this.userinfoEndpoint, - revocationEndpoint: this.revocationEndpoint, - jwkUri: this.jwkUri, - responseTypeSupported: this.responseTypeSupported, - subjectTypeSupported: this.subjectTypeSupported, - idTokenSigningAlgValuesSupported: this.idTokenSigningAlgValuesSupported, - scopesSupported: this.scopesSupported, - claimsSupported: this.claimsSupported, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OpenidDiscoverySolution {} - -export interface OpenidDiscoveryListInstance { - _version: V1; - _solution: OpenidDiscoverySolution; - _uri: string; - - (): OpenidDiscoveryContext; - get(): OpenidDiscoveryContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OpenidDiscoveryListInstance( - version: V1 -): OpenidDiscoveryListInstance { - const instance = (() => instance.get()) as OpenidDiscoveryListInstance; - - instance.get = function get(): OpenidDiscoveryContext { - return new OpenidDiscoveryContextImpl(version); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = ``; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} diff --git a/src/rest/oauth/v1/token.ts b/src/rest/oauth/v1/token.ts deleted file mode 100644 index 918bb2576b..0000000000 --- a/src/rest/oauth/v1/token.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { inspect, InspectOptions } from "util"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; - -/** - * Options to pass to create a TokenInstance - */ -export interface TokenListInstanceCreateOptions { - /** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */ - grantType: string; - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** The credential for confidential OAuth App. */ - clientSecret?: string; - /** JWT token related to the authorization code grant type. */ - code?: string; - /** A code which is generation cryptographically. */ - codeVerifier?: string; - /** JWT token related to the device code grant type. */ - deviceCode?: string; - /** JWT token related to the refresh token grant type. */ - refreshToken?: string; - /** The Id of the device associated with the token (refresh token). */ - deviceId?: string; -} - -export interface TokenSolution {} - -export interface TokenListInstance { - _version: V1; - _solution: TokenSolution; - _uri: string; - - /** - * Create a TokenInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TokenInstance - */ - create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, item?: TokenInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TokenListInstance(version: V1): TokenListInstance { - const instance = {} as TokenListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/token`; - - instance.create = function create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, items: TokenInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["grantType"] === null || params["grantType"] === undefined) { - throw new Error("Required parameter \"params['grantType']\" missing."); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - let data: any = {}; - - data["GrantType"] = params["grantType"]; - - data["ClientSid"] = params["clientSid"]; - if (params["clientSecret"] !== undefined) - data["ClientSecret"] = params["clientSecret"]; - if (params["code"] !== undefined) data["Code"] = params["code"]; - if (params["codeVerifier"] !== undefined) - data["CodeVerifier"] = params["codeVerifier"]; - if (params["deviceCode"] !== undefined) - data["DeviceCode"] = params["deviceCode"]; - if (params["refreshToken"] !== undefined) - data["RefreshToken"] = params["refreshToken"]; - if (params["deviceId"] !== undefined) data["DeviceId"] = params["deviceId"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - let operationVersion = version, - operationPromise = operationVersion.create({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new TokenInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -interface TokenPayload extends TokenResource {} - -interface TokenResource { - access_token: string; - refresh_token: string; - id_token: string; - refresh_token_expires_at: Date; - access_token_expires_at: Date; -} - -export class TokenInstance { - constructor(protected _version: V1, payload: TokenResource) { - this.accessToken = payload.access_token; - this.refreshToken = payload.refresh_token; - this.idToken = payload.id_token; - this.refreshTokenExpiresAt = deserialize.iso8601DateTime( - payload.refresh_token_expires_at - ); - this.accessTokenExpiresAt = deserialize.iso8601DateTime( - payload.access_token_expires_at - ); - } - - /** - * Token which carries the necessary information to access a Twilio resource directly. - */ - accessToken: string; - /** - * Token which carries the information necessary to get a new access token. - */ - refreshToken: string; - idToken: string; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - refreshTokenExpiresAt: Date; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - accessTokenExpiresAt: Date; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accessToken: this.accessToken, - refreshToken: this.refreshToken, - idToken: this.idToken, - refreshTokenExpiresAt: this.refreshTokenExpiresAt, - accessTokenExpiresAt: this.accessTokenExpiresAt, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/userInfo.ts b/src/rest/oauth/v1/userInfo.ts deleted file mode 100644 index 5b974309b8..0000000000 --- a/src/rest/oauth/v1/userInfo.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import { inspect, InspectOptions } from "util"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; - -export interface UserInfoContext { - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface UserInfoContextSolution {} - -export class UserInfoContextImpl implements UserInfoContext { - protected _solution: UserInfoContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/userinfo`; - } - - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new UserInfoInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return this._solution; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -interface UserInfoPayload extends UserInfoResource {} - -interface UserInfoResource { - user_sid: string; - first_name: string; - last_name: string; - friendly_name: string; - email: string; - url: string; -} - -export class UserInfoInstance { - protected _solution: UserInfoContextSolution; - protected _context?: UserInfoContext; - - constructor(protected _version: V1, payload: UserInfoResource) { - this.userSid = payload.user_sid; - this.firstName = payload.first_name; - this.lastName = payload.last_name; - this.friendlyName = payload.friendly_name; - this.email = payload.email; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - userSid: string; - /** - * The first name of the end-user. - */ - firstName: string; - /** - * The last name of the end-user. - */ - lastName: string; - /** - * The friendly name of the end-user. - */ - friendlyName: string; - /** - * The end-user\'s preferred email address. - */ - email: string; - url: string; - - private get _proxy(): UserInfoContext { - this._context = this._context || new UserInfoContextImpl(this._version); - return this._context; - } - - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - userSid: this.userSid, - firstName: this.firstName, - lastName: this.lastName, - friendlyName: this.friendlyName, - email: this.email, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface UserInfoSolution {} - -export interface UserInfoListInstance { - _version: V1; - _solution: UserInfoSolution; - _uri: string; - - (): UserInfoContext; - get(): UserInfoContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function UserInfoListInstance(version: V1): UserInfoListInstance { - const instance = (() => instance.get()) as UserInfoListInstance; - - instance.get = function get(): UserInfoContext { - return new UserInfoContextImpl(version); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = ``; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -}