Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
101 changes: 101 additions & 0 deletions rest/accounts/V1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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 AccountsBase from "../AccountsBase";
import Version from "../../base/Version";
import { AuthTokenPromotionListInstance } from "./v1/authTokenPromotion";
import { AwsListInstance } from "./v1/aws";
import { BulkConsentsListInstance } from "./v1/bulkConsents";
import { BulkContactsListInstance } from "./v1/bulkContacts";
import { MessagingGeopermissionsListInstance } from "./v1/messagingGeopermissions";
import { PublicKeyListInstance } from "./v1/publicKey";
import { SafelistListInstance } from "./v1/safelist";
import { SecondaryAuthTokenListInstance } from "./v1/secondaryAuthToken";

export default class V1 extends Version {
/**
* Initialize the V1 version of Accounts
*
* @param domain - The Twilio (Twilio.Accounts) domain
*/
constructor(domain: AccountsBase) {
super(domain, "v1");
}

/** authTokenPromotion - { Twilio.Accounts.V1.AuthTokenPromotionListInstance } resource */
protected _authTokenPromotion?: AuthTokenPromotionListInstance;
/** aws - { Twilio.Accounts.V1.AwsListInstance } resource */
protected _aws?: AwsListInstance;
/** bulkConsents - { Twilio.Accounts.V1.BulkConsentsListInstance } resource */
protected _bulkConsents?: BulkConsentsListInstance;
/** bulkContacts - { Twilio.Accounts.V1.BulkContactsListInstance } resource */
protected _bulkContacts?: BulkContactsListInstance;
/** messagingGeopermissions - { Twilio.Accounts.V1.MessagingGeopermissionsListInstance } resource */
protected _messagingGeopermissions?: MessagingGeopermissionsListInstance;
/** publicKey - { Twilio.Accounts.V1.PublicKeyListInstance } resource */
protected _publicKey?: PublicKeyListInstance;
/** safelist - { Twilio.Accounts.V1.SafelistListInstance } resource */
protected _safelist?: SafelistListInstance;
/** secondaryAuthToken - { Twilio.Accounts.V1.SecondaryAuthTokenListInstance } resource */
protected _secondaryAuthToken?: SecondaryAuthTokenListInstance;

/** Getter for authTokenPromotion resource */
get authTokenPromotion(): AuthTokenPromotionListInstance {
this._authTokenPromotion = this._authTokenPromotion || AuthTokenPromotionListInstance(this);
return this._authTokenPromotion;
}

/** Getter for aws resource */
get aws(): AwsListInstance {
this._aws = this._aws || AwsListInstance(this);
return this._aws;
}

/** Getter for bulkConsents resource */
get bulkConsents(): BulkConsentsListInstance {
this._bulkConsents = this._bulkConsents || BulkConsentsListInstance(this);
return this._bulkConsents;
}

/** Getter for bulkContacts resource */
get bulkContacts(): BulkContactsListInstance {
this._bulkContacts = this._bulkContacts || BulkContactsListInstance(this);
return this._bulkContacts;
}

/** Getter for messagingGeopermissions resource */
get messagingGeopermissions(): MessagingGeopermissionsListInstance {
this._messagingGeopermissions = this._messagingGeopermissions || MessagingGeopermissionsListInstance(this);
return this._messagingGeopermissions;
}

/** Getter for publicKey resource */
get publicKey(): PublicKeyListInstance {
this._publicKey = this._publicKey || PublicKeyListInstance(this);
return this._publicKey;
}

/** Getter for safelist resource */
get safelist(): SafelistListInstance {
this._safelist = this._safelist || SafelistListInstance(this);
return this._safelist;
}

/** Getter for secondaryAuthToken resource */
get secondaryAuthToken(): SecondaryAuthTokenListInstance {
this._secondaryAuthToken = this._secondaryAuthToken || SecondaryAuthTokenListInstance(this);
return this._secondaryAuthToken;
}

}
257 changes: 257 additions & 0 deletions rest/accounts/v1/authTokenPromotion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Accounts
* 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";
import { ApiResponse } from "../../../base/ApiResponse";




export interface AuthTokenPromotionContext {

/**
* Update a AuthTokenPromotionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance
*/
update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance>

/**
* Update a AuthTokenPromotionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>>

/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}

export interface AuthTokenPromotionContextSolution {
}

export class AuthTokenPromotionContextImpl implements AuthTokenPromotionContext {
protected _solution: AuthTokenPromotionContextSolution;
protected _uri: string;


constructor(protected _version: V1) {
this._solution = { };
this._uri = `/AuthTokens/Promote`;
}

update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance> {
const headers: any = {};
headers["Accept"] = "application/json"

const instance = this;
let operationVersion = instance._version,
operationPromise = operationVersion.update({ uri: instance._uri, method: "post", headers});

operationPromise = operationPromise.then(payload => new AuthTokenPromotionInstance(operationVersion, payload));


operationPromise = instance._version.setPromiseCallback(operationPromise,callback);
return operationPromise;


}

updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>> {
const headers: any = {};
headers["Accept"] = "application/json"

const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion.updateWithResponseInfo<AuthTokenPromotionResource>({ uri: instance._uri, method: "post", headers}).then((response) : ApiResponse<AuthTokenPromotionInstance> => ({
...response,
body: new AuthTokenPromotionInstance(operationVersion, response.body)
}));

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 AuthTokenPromotionPayload extends AuthTokenPromotionResource {}

interface AuthTokenPromotionResource {
account_sid: string;
auth_token: string;
date_created: Date;
date_updated: Date;
url: string;
}

export class AuthTokenPromotionInstance {
protected _solution: AuthTokenPromotionContextSolution;
protected _context?: AuthTokenPromotionContext;

constructor(protected _version: V1, payload: AuthTokenPromotionResource) {

this.accountSid = (payload.account_sid);
this.authToken = (payload.auth_token);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = (payload.url);

this._solution = { };
}

/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for.
*/
accountSid: string;
/**
* The promoted Auth Token that must be used to authenticate future API requests.
*/
authToken: string;
/**
* The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The URI for this resource, relative to `https://accounts.twilio.com`
*/
url: string;

private get _proxy(): AuthTokenPromotionContext {
this._context = this._context || new AuthTokenPromotionContextImpl(this._version);
return this._context;
}

/**
* Update a AuthTokenPromotionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance
*/
update(callback?: (error: Error | null, item?: AuthTokenPromotionInstance) => any): Promise<AuthTokenPromotionInstance>

{
return this._proxy.update(callback);
}

/**
* Update a AuthTokenPromotionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AuthTokenPromotionInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AuthTokenPromotionInstance>) => any): Promise<ApiResponse<AuthTokenPromotionInstance>>

{
return this._proxy.updateWithHttpInfo(callback);
}

/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
authToken: this.authToken,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}

[inspect.custom](_depth: any, options: InspectOptions) {
return inspect(this.toJSON(), options);
}
}


export interface AuthTokenPromotionSolution {
}

export interface AuthTokenPromotionListInstance {
_version: V1;
_solution: AuthTokenPromotionSolution;
_uri: string;

(): AuthTokenPromotionContext;
get(): AuthTokenPromotionContext;




/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}

export function AuthTokenPromotionListInstance(version: V1): AuthTokenPromotionListInstance {
const instance = (() => instance.get()) as AuthTokenPromotionListInstance;

instance.get = function get(): AuthTokenPromotionContext {
return new AuthTokenPromotionContextImpl(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;
}


Loading