diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index f2c06b2e34..ad07a0db9a 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -33,20 +33,20 @@ jobs: - name: Run Unit Tests run: npm run ci -# - name: Run Cluster Tests -# if: (!github.event.pull_request.head.repo.fork) -# env: -# TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} -# TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}} -# TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }} -# TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} -# TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} -# run: | -# npm pack -# tar -xzf twilio*.tgz -# cd spec/cluster -# npm install -# npm run test + - name: Run Cluster Tests + if: (!github.event.pull_request.head.repo.fork) + env: + TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }} + TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}} + TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }} + TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }} + TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} + run: | + npm pack + tar -xzf twilio*.tgz + cd spec/cluster + npm install + npm run test - name: SonarCloud Scan if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.node == '18' && !github.event.pull_request.head.repo.fork }} diff --git a/src/rest/Autopilot.ts b/src/rest/Autopilot.ts deleted file mode 100644 index 6eaa2fb586..0000000000 --- a/src/rest/Autopilot.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { AssistantListInstance } from "./autopilot/v1/assistant"; -import { RestoreAssistantListInstance } from "./autopilot/v1/restoreAssistant"; -import AutopilotBase from "./AutopilotBase"; - -class Autopilot extends AutopilotBase { - /** - * @deprecated - Use v1.assistants instead - */ - get assistants(): AssistantListInstance { - console.warn("assistants is deprecated. Use v1.assistants instead."); - return this.v1.assistants; - } - - /** - * @deprecated - Use v1.restoreAssistant instead - */ - get restoreAssistant(): RestoreAssistantListInstance { - console.warn( - "restoreAssistant is deprecated. Use v1.restoreAssistant instead." - ); - return this.v1.restoreAssistant; - } -} - -export = Autopilot; diff --git a/src/rest/AutopilotBase.ts b/src/rest/AutopilotBase.ts deleted file mode 100644 index 59242a4497..0000000000 --- a/src/rest/AutopilotBase.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 "./autopilot/V1"; - -class AutopilotBase extends Domain { - _v1?: V1; - - /** - * Initialize autopilot domain - * - * @param twilio - The twilio client - */ - constructor(twilio: any) { - super(twilio, "https://autopilot.twilio.com"); - } - - get v1(): V1 { - this._v1 = this._v1 || new V1(this); - return this._v1; - } -} - -export = AutopilotBase; diff --git a/src/rest/Twilio.ts b/src/rest/Twilio.ts index 5502c54528..d8c5b45544 100644 --- a/src/rest/Twilio.ts +++ b/src/rest/Twilio.ts @@ -12,7 +12,6 @@ import { Client, ClientOpts, RequestOpts } from "../base/BaseTwilio"; import Accounts from "./Accounts"; import Api from "./Api"; -import Autopilot from "./Autopilot"; import Bulkexports from "./Bulkexports"; import Chat from "./Chat"; import Content from "./Content"; @@ -82,8 +81,6 @@ class Twilio extends Client { _accounts?: Accounts; /** (Twilio.Api) - api domain */ _api?: Api; - /** (Twilio.Autopilot) - autopilot domain */ - _autopilot?: Autopilot; /** (Twilio.Bulkexports) - bulkexports domain */ _bulkexports?: Bulkexports; /** (Twilio.Chat) - chat domain */ @@ -170,7 +167,6 @@ class Twilio extends Client { if (this.opts?.lazyLoading === false) { this.accounts; this.api; - this.autopilot; this.bulkexports; this.chat; this.content; @@ -218,12 +214,6 @@ class Twilio extends Client { get api(): Api { return this._api ?? (this._api = new (require("./Api"))(this)); } - /** Getter for (Twilio.Autopilot) domain */ - get autopilot(): Autopilot { - return ( - this._autopilot ?? (this._autopilot = new (require("./Autopilot"))(this)) - ); - } /** Getter for (Twilio.Bulkexports) domain */ get bulkexports(): Bulkexports { return ( diff --git a/src/rest/autopilot/V1.ts b/src/rest/autopilot/V1.ts deleted file mode 100644 index cc10686e37..0000000000 --- a/src/rest/autopilot/V1.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 AutopilotBase from "../AutopilotBase"; -import Version from "../../base/Version"; -import { AssistantListInstance } from "./v1/assistant"; -import { RestoreAssistantListInstance } from "./v1/restoreAssistant"; - -export default class V1 extends Version { - /** - * Initialize the V1 version of Autopilot - * - * @param domain - The Twilio (Twilio.Autopilot) domain - */ - constructor(domain: AutopilotBase) { - super(domain, "v1"); - } - - /** assistants - { Twilio.Autopilot.V1.AssistantListInstance } resource */ - protected _assistants?: AssistantListInstance; - /** restoreAssistant - { Twilio.Autopilot.V1.RestoreAssistantListInstance } resource */ - protected _restoreAssistant?: RestoreAssistantListInstance; - - /** Getter for assistants resource */ - get assistants(): AssistantListInstance { - this._assistants = this._assistants || AssistantListInstance(this); - return this._assistants; - } - - /** Getter for restoreAssistant resource */ - get restoreAssistant(): RestoreAssistantListInstance { - this._restoreAssistant = - this._restoreAssistant || RestoreAssistantListInstance(this); - return this._restoreAssistant; - } -} diff --git a/src/rest/autopilot/v1/assistant.ts b/src/rest/autopilot/v1/assistant.ts deleted file mode 100644 index 516ea6472f..0000000000 --- a/src/rest/autopilot/v1/assistant.ts +++ /dev/null @@ -1,890 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../base/Page"; -import Response from "../../../http/response"; -import V1 from "../V1"; -const deserialize = require("../../../base/deserialize"); -const serialize = require("../../../base/serialize"); -import { isValidPathParam } from "../../../base/utility"; -import { DefaultsListInstance } from "./assistant/defaults"; -import { DialogueListInstance } from "./assistant/dialogue"; -import { FieldTypeListInstance } from "./assistant/fieldType"; -import { ModelBuildListInstance } from "./assistant/modelBuild"; -import { QueryListInstance } from "./assistant/query"; -import { StyleSheetListInstance } from "./assistant/styleSheet"; -import { TaskListInstance } from "./assistant/task"; -import { WebhookListInstance } from "./assistant/webhook"; - -/** - * Options to pass to update a AssistantInstance - */ -export interface AssistantContextUpdateOptions { - /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; - /** Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. */ - logQueries?: boolean; - /** An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. */ - uniqueName?: string; - /** Reserved. */ - callbackUrl?: string; - /** Reserved. */ - callbackEvents?: string; - /** The JSON string that defines the Assistant\\\'s [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) */ - styleSheet?: any; - /** A JSON object that defines the Assistant\\\'s [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. */ - defaults?: any; - /** A string describing the state of the assistant. */ - developmentStage?: string; -} - -/** - * Options to pass to create a AssistantInstance - */ -export interface AssistantListInstanceCreateOptions { - /** A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; - /** Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. */ - logQueries?: boolean; - /** An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. */ - uniqueName?: string; - /** Reserved. */ - callbackUrl?: string; - /** Reserved. */ - callbackEvents?: string; - /** The JSON string that defines the Assistant\\\'s [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) */ - styleSheet?: any; - /** A JSON object that defines the Assistant\\\'s [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. */ - defaults?: any; -} -/** - * Options to pass to each - */ -export interface AssistantListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: AssistantInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface AssistantListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface AssistantListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface AssistantContext { - defaults: DefaultsListInstance; - dialogues: DialogueListInstance; - fieldTypes: FieldTypeListInstance; - modelBuilds: ModelBuildListInstance; - queries: QueryListInstance; - styleSheet: StyleSheetListInstance; - tasks: TaskListInstance; - webhooks: WebhookListInstance; - - /** - * Remove a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - fetch( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - - /** - * Update a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - update( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - /** - * Update a AssistantInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - update( - params: AssistantContextUpdateOptions, - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface AssistantContextSolution { - sid: string; -} - -export class AssistantContextImpl implements AssistantContext { - protected _solution: AssistantContextSolution; - protected _uri: string; - - protected _defaults?: DefaultsListInstance; - protected _dialogues?: DialogueListInstance; - protected _fieldTypes?: FieldTypeListInstance; - protected _modelBuilds?: ModelBuildListInstance; - protected _queries?: QueryListInstance; - protected _styleSheet?: StyleSheetListInstance; - protected _tasks?: TaskListInstance; - protected _webhooks?: WebhookListInstance; - - constructor(protected _version: V1, sid: string) { - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { sid }; - this._uri = `/Assistants/${sid}`; - } - - get defaults(): DefaultsListInstance { - this._defaults = - this._defaults || DefaultsListInstance(this._version, this._solution.sid); - return this._defaults; - } - - get dialogues(): DialogueListInstance { - this._dialogues = - this._dialogues || - DialogueListInstance(this._version, this._solution.sid); - return this._dialogues; - } - - get fieldTypes(): FieldTypeListInstance { - this._fieldTypes = - this._fieldTypes || - FieldTypeListInstance(this._version, this._solution.sid); - return this._fieldTypes; - } - - get modelBuilds(): ModelBuildListInstance { - this._modelBuilds = - this._modelBuilds || - ModelBuildListInstance(this._version, this._solution.sid); - return this._modelBuilds; - } - - get queries(): QueryListInstance { - this._queries = - this._queries || QueryListInstance(this._version, this._solution.sid); - return this._queries; - } - - get styleSheet(): StyleSheetListInstance { - this._styleSheet = - this._styleSheet || - StyleSheetListInstance(this._version, this._solution.sid); - return this._styleSheet; - } - - get tasks(): TaskListInstance { - this._tasks = - this._tasks || TaskListInstance(this._version, this._solution.sid); - return this._tasks; - } - - get webhooks(): WebhookListInstance { - this._webhooks = - this._webhooks || WebhookListInstance(this._version, this._solution.sid); - return this._webhooks; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new AssistantInstance(operationVersion, payload, instance._solution.sid) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | AssistantContextUpdateOptions - | ((error: Error | null, item?: AssistantInstance) => any), - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["logQueries"] !== undefined) - data["LogQueries"] = serialize.bool(params["logQueries"]); - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - if (params["callbackUrl"] !== undefined) - data["CallbackUrl"] = params["callbackUrl"]; - if (params["callbackEvents"] !== undefined) - data["CallbackEvents"] = params["callbackEvents"]; - if (params["styleSheet"] !== undefined) - data["StyleSheet"] = serialize.object(params["styleSheet"]); - if (params["defaults"] !== undefined) - data["Defaults"] = serialize.object(params["defaults"]); - if (params["developmentStage"] !== undefined) - data["DevelopmentStage"] = params["developmentStage"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new AssistantInstance(operationVersion, payload, instance._solution.sid) - ); - - 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 AssistantPayload extends TwilioResponsePayload { - assistants: AssistantResource[]; -} - -interface AssistantResource { - account_sid: string; - date_created: Date; - date_updated: Date; - friendly_name: string; - latest_model_build_sid: string; - links: Record; - log_queries: boolean; - development_stage: string; - needs_model_build: boolean; - sid: string; - unique_name: string; - url: string; - callback_url: string; - callback_events: string; -} - -export class AssistantInstance { - protected _solution: AssistantContextSolution; - protected _context?: AssistantContext; - - constructor( - protected _version: V1, - payload: AssistantResource, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.friendlyName = payload.friendly_name; - this.latestModelBuildSid = payload.latest_model_build_sid; - this.links = payload.links; - this.logQueries = payload.log_queries; - this.developmentStage = payload.development_stage; - this.needsModelBuild = payload.needs_model_build; - this.sid = payload.sid; - this.uniqueName = payload.unique_name; - this.url = payload.url; - this.callbackUrl = payload.callback_url; - this.callbackEvents = payload.callback_events; - - this._solution = { sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - */ - friendlyName: string; - /** - * Reserved. - */ - latestModelBuildSid: string; - /** - * A list of the URLs of the Assistant\'s related resources. - */ - links: Record; - /** - * Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - */ - logQueries: boolean; - /** - * A string describing the state of the assistant. - */ - developmentStage: string; - /** - * Whether model needs to be rebuilt. - */ - needsModelBuild: boolean; - /** - * The unique string that we created to identify the Assistant resource. - */ - sid: string; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. It can be up to 64 characters long. - */ - uniqueName: string; - /** - * The absolute URL of the Assistant resource. - */ - url: string; - /** - * Reserved. - */ - callbackUrl: string; - /** - * Reserved. - */ - callbackEvents: string; - - private get _proxy(): AssistantContext { - this._context = - this._context || - new AssistantContextImpl(this._version, this._solution.sid); - return this._context; - } - - /** - * Remove a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - fetch( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - update( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - /** - * Update a AssistantInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - update( - params: AssistantContextUpdateOptions, - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Access the defaults. - */ - defaults(): DefaultsListInstance { - return this._proxy.defaults; - } - - /** - * Access the dialogues. - */ - dialogues(): DialogueListInstance { - return this._proxy.dialogues; - } - - /** - * Access the fieldTypes. - */ - fieldTypes(): FieldTypeListInstance { - return this._proxy.fieldTypes; - } - - /** - * Access the modelBuilds. - */ - modelBuilds(): ModelBuildListInstance { - return this._proxy.modelBuilds; - } - - /** - * Access the queries. - */ - queries(): QueryListInstance { - return this._proxy.queries; - } - - /** - * Access the styleSheet. - */ - styleSheet(): StyleSheetListInstance { - return this._proxy.styleSheet; - } - - /** - * Access the tasks. - */ - tasks(): TaskListInstance { - return this._proxy.tasks; - } - - /** - * Access the webhooks. - */ - webhooks(): WebhookListInstance { - return this._proxy.webhooks; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - friendlyName: this.friendlyName, - latestModelBuildSid: this.latestModelBuildSid, - links: this.links, - logQueries: this.logQueries, - developmentStage: this.developmentStage, - needsModelBuild: this.needsModelBuild, - sid: this.sid, - uniqueName: this.uniqueName, - url: this.url, - callbackUrl: this.callbackUrl, - callbackEvents: this.callbackEvents, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface AssistantSolution {} - -export interface AssistantListInstance { - _version: V1; - _solution: AssistantSolution; - _uri: string; - - (sid: string): AssistantContext; - get(sid: string): AssistantContext; - - /** - * Create a AssistantInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - create( - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - /** - * Create a AssistantInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed AssistantInstance - */ - create( - params: AssistantListInstanceCreateOptions, - callback?: (error: Error | null, item?: AssistantInstance) => any - ): Promise; - - /** - * Streams AssistantInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { AssistantListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: AssistantInstance, done: (err?: Error) => void) => void - ): void; - each( - params: AssistantListInstanceEachOptions, - callback?: (item: AssistantInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of AssistantInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: AssistantPage) => any - ): Promise; - /** - * Lists AssistantInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { AssistantListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: AssistantInstance[]) => any - ): Promise; - list( - params: AssistantListInstanceOptions, - callback?: (error: Error | null, items: AssistantInstance[]) => any - ): Promise; - /** - * Retrieve a single page of AssistantInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { AssistantListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: AssistantPage) => any - ): Promise; - page( - params: AssistantListInstancePageOptions, - callback?: (error: Error | null, items: AssistantPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function AssistantListInstance(version: V1): AssistantListInstance { - const instance = ((sid) => instance.get(sid)) as AssistantListInstance; - - instance.get = function get(sid): AssistantContext { - return new AssistantContextImpl(version, sid); - }; - - instance._version = version; - instance._solution = {}; - instance._uri = `/Assistants`; - - instance.create = function create( - params?: - | AssistantListInstanceCreateOptions - | ((error: Error | null, items: AssistantInstance) => any), - callback?: (error: Error | null, items: AssistantInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["logQueries"] !== undefined) - data["LogQueries"] = serialize.bool(params["logQueries"]); - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - if (params["callbackUrl"] !== undefined) - data["CallbackUrl"] = params["callbackUrl"]; - if (params["callbackEvents"] !== undefined) - data["CallbackEvents"] = params["callbackEvents"]; - if (params["styleSheet"] !== undefined) - data["StyleSheet"] = serialize.object(params["styleSheet"]); - if (params["defaults"] !== undefined) - data["Defaults"] = serialize.object(params["defaults"]); - - 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 AssistantInstance(operationVersion, payload) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | AssistantListInstancePageOptions - | ((error: Error | null, items: AssistantPage) => any), - callback?: (error: Error | null, items: AssistantPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new AssistantPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: AssistantPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new AssistantPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class AssistantPage extends Page< - V1, - AssistantPayload, - AssistantResource, - AssistantInstance -> { - /** - * Initialize the AssistantPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: AssistantSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of AssistantInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: AssistantResource): AssistantInstance { - return new AssistantInstance(this._version, payload); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/defaults.ts b/src/rest/autopilot/v1/assistant/defaults.ts deleted file mode 100644 index b234dcaeba..0000000000 --- a/src/rest/autopilot/v1/assistant/defaults.ts +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 update a DefaultsInstance - */ -export interface DefaultsContextUpdateOptions { - /** A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. */ - defaults?: any; -} - -export interface DefaultsContext { - /** - * Fetch a DefaultsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - fetch( - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise; - - /** - * Update a DefaultsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - update( - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise; - /** - * Update a DefaultsInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - update( - params: DefaultsContextUpdateOptions, - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface DefaultsContextSolution { - assistantSid: string; -} - -export class DefaultsContextImpl implements DefaultsContext { - protected _solution: DefaultsContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - this._solution = { assistantSid }; - this._uri = `/Assistants/${assistantSid}/Defaults`; - } - - fetch( - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new DefaultsInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | DefaultsContextUpdateOptions - | ((error: Error | null, item?: DefaultsInstance) => any), - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["defaults"] !== undefined) - data["Defaults"] = serialize.object(params["defaults"]); - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new DefaultsInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - 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 DefaultsPayload extends DefaultsResource {} - -interface DefaultsResource { - account_sid: string; - assistant_sid: string; - url: string; - data: any; -} - -export class DefaultsInstance { - protected _solution: DefaultsContextSolution; - protected _context?: DefaultsContext; - - constructor( - protected _version: V1, - payload: DefaultsResource, - assistantSid: string - ) { - this.accountSid = payload.account_sid; - this.assistantSid = payload.assistant_sid; - this.url = payload.url; - this.data = payload.data; - - this._solution = { assistantSid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. - */ - accountSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The absolute URL of the Defaults resource. - */ - url: string; - /** - * The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - */ - data: any; - - private get _proxy(): DefaultsContext { - this._context = - this._context || - new DefaultsContextImpl(this._version, this._solution.assistantSid); - return this._context; - } - - /** - * Fetch a DefaultsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - fetch( - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a DefaultsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - update( - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise; - /** - * Update a DefaultsInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DefaultsInstance - */ - update( - params: DefaultsContextUpdateOptions, - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: DefaultsInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - assistantSid: this.assistantSid, - url: this.url, - data: this.data, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface DefaultsSolution { - assistantSid: string; -} - -export interface DefaultsListInstance { - _version: V1; - _solution: DefaultsSolution; - _uri: string; - - (): DefaultsContext; - get(): DefaultsContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DefaultsListInstance( - version: V1, - assistantSid: string -): DefaultsListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = (() => instance.get()) as DefaultsListInstance; - - instance.get = function get(): DefaultsContext { - return new DefaultsContextImpl(version, assistantSid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - 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/autopilot/v1/assistant/dialogue.ts b/src/rest/autopilot/v1/assistant/dialogue.ts deleted file mode 100644 index 484d5c592a..0000000000 --- a/src/rest/autopilot/v1/assistant/dialogue.ts +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 DialogueContext { - /** - * Fetch a DialogueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DialogueInstance - */ - fetch( - callback?: (error: Error | null, item?: DialogueInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface DialogueContextSolution { - assistantSid: string; - sid: string; -} - -export class DialogueContextImpl implements DialogueContext { - protected _solution: DialogueContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/Dialogues/${sid}`; - } - - fetch( - callback?: (error: Error | null, item?: DialogueInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new DialogueInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 DialoguePayload extends DialogueResource {} - -interface DialogueResource { - account_sid: string; - assistant_sid: string; - sid: string; - data: any; - url: string; -} - -export class DialogueInstance { - protected _solution: DialogueContextSolution; - protected _context?: DialogueContext; - - constructor( - protected _version: V1, - payload: DialogueResource, - assistantSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.data = payload.data; - this.url = payload.url; - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. - */ - accountSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Dialogue resource. - */ - sid: string; - /** - * The JSON string that describes the dialogue session object. - */ - data: any; - /** - * The absolute URL of the Dialogue resource. - */ - url: string; - - private get _proxy(): DialogueContext { - this._context = - this._context || - new DialogueContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Fetch a DialogueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DialogueInstance - */ - fetch( - callback?: (error: Error | null, item?: DialogueInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - assistantSid: this.assistantSid, - sid: this.sid, - data: this.data, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface DialogueSolution { - assistantSid: string; -} - -export interface DialogueListInstance { - _version: V1; - _solution: DialogueSolution; - _uri: string; - - (sid: string): DialogueContext; - get(sid: string): DialogueContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DialogueListInstance( - version: V1, - assistantSid: string -): DialogueListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as DialogueListInstance; - - instance.get = function get(sid): DialogueContext { - return new DialogueContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - 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/autopilot/v1/assistant/fieldType.ts b/src/rest/autopilot/v1/assistant/fieldType.ts deleted file mode 100644 index 567db552e3..0000000000 --- a/src/rest/autopilot/v1/assistant/fieldType.ts +++ /dev/null @@ -1,726 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import V1 from "../../V1"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; -import { FieldValueListInstance } from "./fieldType/fieldValue"; - -/** - * Options to pass to update a FieldTypeInstance - */ -export interface FieldTypeContextUpdateOptions { - /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; - /** An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. */ - uniqueName?: string; -} - -/** - * Options to pass to create a FieldTypeInstance - */ -export interface FieldTypeListInstanceCreateOptions { - /** An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. */ - uniqueName: string; - /** A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; -} -/** - * Options to pass to each - */ -export interface FieldTypeListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: FieldTypeInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface FieldTypeListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface FieldTypeListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface FieldTypeContext { - fieldValues: FieldValueListInstance; - - /** - * Remove a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - - /** - * Update a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - update( - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - /** - * Update a FieldTypeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - update( - params: FieldTypeContextUpdateOptions, - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface FieldTypeContextSolution { - assistantSid: string; - sid: string; -} - -export class FieldTypeContextImpl implements FieldTypeContext { - protected _solution: FieldTypeContextSolution; - protected _uri: string; - - protected _fieldValues?: FieldValueListInstance; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/FieldTypes/${sid}`; - } - - get fieldValues(): FieldValueListInstance { - this._fieldValues = - this._fieldValues || - FieldValueListInstance( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._fieldValues; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldTypeInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | FieldTypeContextUpdateOptions - | ((error: Error | null, item?: FieldTypeInstance) => any), - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldTypeInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 FieldTypePayload extends TwilioResponsePayload { - field_types: FieldTypeResource[]; -} - -interface FieldTypeResource { - account_sid: string; - date_created: Date; - date_updated: Date; - friendly_name: string; - links: Record; - assistant_sid: string; - sid: string; - unique_name: string; - url: string; -} - -export class FieldTypeInstance { - protected _solution: FieldTypeContextSolution; - protected _context?: FieldTypeContext; - - constructor( - protected _version: V1, - payload: FieldTypeResource, - assistantSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.friendlyName = payload.friendly_name; - this.links = payload.links; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.uniqueName = payload.unique_name; - this.url = payload.url; - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - */ - friendlyName: string; - /** - * A list of the URLs of related resources. - */ - links: Record; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the FieldType resource. - */ - sid: string; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. - */ - uniqueName: string; - /** - * The absolute URL of the FieldType resource. - */ - url: string; - - private get _proxy(): FieldTypeContext { - this._context = - this._context || - new FieldTypeContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a FieldTypeInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - update( - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - /** - * Update a FieldTypeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - update( - params: FieldTypeContextUpdateOptions, - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Access the fieldValues. - */ - fieldValues(): FieldValueListInstance { - return this._proxy.fieldValues; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - friendlyName: this.friendlyName, - links: this.links, - assistantSid: this.assistantSid, - sid: this.sid, - uniqueName: this.uniqueName, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface FieldTypeSolution { - assistantSid: string; -} - -export interface FieldTypeListInstance { - _version: V1; - _solution: FieldTypeSolution; - _uri: string; - - (sid: string): FieldTypeContext; - get(sid: string): FieldTypeContext; - - /** - * Create a FieldTypeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldTypeInstance - */ - create( - params: FieldTypeListInstanceCreateOptions, - callback?: (error: Error | null, item?: FieldTypeInstance) => any - ): Promise; - - /** - * Streams FieldTypeInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldTypeListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: FieldTypeInstance, done: (err?: Error) => void) => void - ): void; - each( - params: FieldTypeListInstanceEachOptions, - callback?: (item: FieldTypeInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of FieldTypeInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldTypePage) => any - ): Promise; - /** - * Lists FieldTypeInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldTypeListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: FieldTypeInstance[]) => any - ): Promise; - list( - params: FieldTypeListInstanceOptions, - callback?: (error: Error | null, items: FieldTypeInstance[]) => any - ): Promise; - /** - * Retrieve a single page of FieldTypeInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldTypeListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: FieldTypePage) => any - ): Promise; - page( - params: FieldTypeListInstancePageOptions, - callback?: (error: Error | null, items: FieldTypePage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function FieldTypeListInstance( - version: V1, - assistantSid: string -): FieldTypeListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as FieldTypeListInstance; - - instance.get = function get(sid): FieldTypeContext { - return new FieldTypeContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - instance._uri = `/Assistants/${assistantSid}/FieldTypes`; - - instance.create = function create( - params: FieldTypeListInstanceCreateOptions, - callback?: (error: Error | null, items: FieldTypeInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["uniqueName"] === null || params["uniqueName"] === undefined) { - throw new Error("Required parameter \"params['uniqueName']\" missing."); - } - - let data: any = {}; - - data["UniqueName"] = params["uniqueName"]; - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - - 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 FieldTypeInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | FieldTypeListInstancePageOptions - | ((error: Error | null, items: FieldTypePage) => any), - callback?: (error: Error | null, items: FieldTypePage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldTypePage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldTypePage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new FieldTypePage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class FieldTypePage extends Page< - V1, - FieldTypePayload, - FieldTypeResource, - FieldTypeInstance -> { - /** - * Initialize the FieldTypePage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: FieldTypeSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of FieldTypeInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: FieldTypeResource): FieldTypeInstance { - return new FieldTypeInstance( - this._version, - payload, - this._solution.assistantSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/fieldType/fieldValue.ts b/src/rest/autopilot/v1/assistant/fieldType/fieldValue.ts deleted file mode 100644 index 00c0aec730..0000000000 --- a/src/rest/autopilot/v1/assistant/fieldType/fieldValue.ts +++ /dev/null @@ -1,634 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../../base/Page"; -import Response from "../../../../../http/response"; -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 FieldValueInstance - */ -export interface FieldValueListInstanceCreateOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` */ - language: string; - /** The Field Value data. */ - value: string; - /** The string value that indicates which word the field value is a synonym of. */ - synonymOf?: string; -} -/** - * Options to pass to each - */ -export interface FieldValueListInstanceEachOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: FieldValueInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface FieldValueListInstanceOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface FieldValueListInstancePageOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface FieldValueContext { - /** - * Remove a FieldValueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a FieldValueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldValueInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldValueInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface FieldValueContextSolution { - assistantSid: string; - fieldTypeSid: string; - sid: string; -} - -export class FieldValueContextImpl implements FieldValueContext { - protected _solution: FieldValueContextSolution; - protected _uri: string; - - constructor( - protected _version: V1, - assistantSid: string, - fieldTypeSid: string, - sid: string - ) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(fieldTypeSid)) { - throw new Error("Parameter 'fieldTypeSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, fieldTypeSid, sid }; - this._uri = `/Assistants/${assistantSid}/FieldTypes/${fieldTypeSid}/FieldValues/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: FieldValueInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldValueInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.fieldTypeSid, - instance._solution.sid - ) - ); - - 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 FieldValuePayload extends TwilioResponsePayload { - field_values: FieldValueResource[]; -} - -interface FieldValueResource { - account_sid: string; - date_created: Date; - date_updated: Date; - field_type_sid: string; - language: string; - assistant_sid: string; - sid: string; - value: string; - url: string; - synonym_of: string; -} - -export class FieldValueInstance { - protected _solution: FieldValueContextSolution; - protected _context?: FieldValueContext; - - constructor( - protected _version: V1, - payload: FieldValueResource, - assistantSid: string, - fieldTypeSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.fieldTypeSid = payload.field_type_sid; - this.language = payload.language; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.value = payload.value; - this.url = payload.url; - this.synonymOf = payload.synonym_of; - - this._solution = { assistantSid, fieldTypeSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The SID of the Field Type associated with the Field Value. - */ - fieldTypeSid: string; - /** - * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - */ - language: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the FieldValue resource. - */ - sid: string; - /** - * The Field Value data. - */ - value: string; - /** - * The absolute URL of the FieldValue resource. - */ - url: string; - /** - * The word for which the field value is a synonym of. - */ - synonymOf: string; - - private get _proxy(): FieldValueContext { - this._context = - this._context || - new FieldValueContextImpl( - this._version, - this._solution.assistantSid, - this._solution.fieldTypeSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a FieldValueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a FieldValueInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldValueInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldValueInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - fieldTypeSid: this.fieldTypeSid, - language: this.language, - assistantSid: this.assistantSid, - sid: this.sid, - value: this.value, - url: this.url, - synonymOf: this.synonymOf, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface FieldValueSolution { - assistantSid: string; - fieldTypeSid: string; -} - -export interface FieldValueListInstance { - _version: V1; - _solution: FieldValueSolution; - _uri: string; - - (sid: string): FieldValueContext; - get(sid: string): FieldValueContext; - - /** - * Create a FieldValueInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldValueInstance - */ - create( - params: FieldValueListInstanceCreateOptions, - callback?: (error: Error | null, item?: FieldValueInstance) => any - ): Promise; - - /** - * Streams FieldValueInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldValueListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: FieldValueInstance, done: (err?: Error) => void) => void - ): void; - each( - params: FieldValueListInstanceEachOptions, - callback?: (item: FieldValueInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of FieldValueInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldValuePage) => any - ): Promise; - /** - * Lists FieldValueInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldValueListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: FieldValueInstance[]) => any - ): Promise; - list( - params: FieldValueListInstanceOptions, - callback?: (error: Error | null, items: FieldValueInstance[]) => any - ): Promise; - /** - * Retrieve a single page of FieldValueInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldValueListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: FieldValuePage) => any - ): Promise; - page( - params: FieldValueListInstancePageOptions, - callback?: (error: Error | null, items: FieldValuePage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function FieldValueListInstance( - version: V1, - assistantSid: string, - fieldTypeSid: string -): FieldValueListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(fieldTypeSid)) { - throw new Error("Parameter 'fieldTypeSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as FieldValueListInstance; - - instance.get = function get(sid): FieldValueContext { - return new FieldValueContextImpl(version, assistantSid, fieldTypeSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid, fieldTypeSid }; - instance._uri = `/Assistants/${assistantSid}/FieldTypes/${fieldTypeSid}/FieldValues`; - - instance.create = function create( - params: FieldValueListInstanceCreateOptions, - callback?: (error: Error | null, items: FieldValueInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["language"] === null || params["language"] === undefined) { - throw new Error("Required parameter \"params['language']\" missing."); - } - - if (params["value"] === null || params["value"] === undefined) { - throw new Error("Required parameter \"params['value']\" missing."); - } - - let data: any = {}; - - data["Language"] = params["language"]; - - data["Value"] = params["value"]; - if (params["synonymOf"] !== undefined) - data["SynonymOf"] = params["synonymOf"]; - - 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 FieldValueInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.fieldTypeSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | FieldValueListInstancePageOptions - | ((error: Error | null, items: FieldValuePage) => any), - callback?: (error: Error | null, items: FieldValuePage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["language"] !== undefined) data["Language"] = params["language"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldValuePage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldValuePage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new FieldValuePage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class FieldValuePage extends Page< - V1, - FieldValuePayload, - FieldValueResource, - FieldValueInstance -> { - /** - * Initialize the FieldValuePage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: FieldValueSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of FieldValueInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: FieldValueResource): FieldValueInstance { - return new FieldValueInstance( - this._version, - payload, - this._solution.assistantSid, - this._solution.fieldTypeSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/modelBuild.ts b/src/rest/autopilot/v1/assistant/modelBuild.ts deleted file mode 100644 index 19140b39e5..0000000000 --- a/src/rest/autopilot/v1/assistant/modelBuild.ts +++ /dev/null @@ -1,722 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import V1 from "../../V1"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -export type ModelBuildStatus = - | "enqueued" - | "building" - | "completed" - | "failed" - | "canceled"; - -/** - * Options to pass to update a ModelBuildInstance - */ -export interface ModelBuildContextUpdateOptions { - /** An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. */ - uniqueName?: string; -} - -/** - * Options to pass to create a ModelBuildInstance - */ -export interface ModelBuildListInstanceCreateOptions { - /** The URL we should call using a POST method to send status information to your application. */ - statusCallback?: string; - /** An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. */ - uniqueName?: string; -} -/** - * Options to pass to each - */ -export interface ModelBuildListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: ModelBuildInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface ModelBuildListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface ModelBuildListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface ModelBuildContext { - /** - * Remove a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - fetch( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - - /** - * Update a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - update( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - /** - * Update a ModelBuildInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - update( - params: ModelBuildContextUpdateOptions, - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface ModelBuildContextSolution { - assistantSid: string; - sid: string; -} - -export class ModelBuildContextImpl implements ModelBuildContext { - protected _solution: ModelBuildContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/ModelBuilds/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new ModelBuildInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | ModelBuildContextUpdateOptions - | ((error: Error | null, item?: ModelBuildInstance) => any), - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new ModelBuildInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 ModelBuildPayload extends TwilioResponsePayload { - model_builds: ModelBuildResource[]; -} - -interface ModelBuildResource { - account_sid: string; - date_created: Date; - date_updated: Date; - assistant_sid: string; - sid: string; - status: ModelBuildStatus; - unique_name: string; - url: string; - build_duration: number; - error_code: number; -} - -export class ModelBuildInstance { - protected _solution: ModelBuildContextSolution; - protected _context?: ModelBuildContext; - - constructor( - protected _version: V1, - payload: ModelBuildResource, - assistantSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.status = payload.status; - this.uniqueName = payload.unique_name; - this.url = payload.url; - this.buildDuration = deserialize.integer(payload.build_duration); - this.errorCode = deserialize.integer(payload.error_code); - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the ModelBuild resource. - */ - sid: string; - status: ModelBuildStatus; - /** - * An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. - */ - uniqueName: string; - /** - * The absolute URL of the ModelBuild resource. - */ - url: string; - /** - * The time in seconds it took to build the model. - */ - buildDuration: number; - /** - * If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. - */ - errorCode: number; - - private get _proxy(): ModelBuildContext { - this._context = - this._context || - new ModelBuildContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - fetch( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - update( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - /** - * Update a ModelBuildInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - update( - params: ModelBuildContextUpdateOptions, - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - assistantSid: this.assistantSid, - sid: this.sid, - status: this.status, - uniqueName: this.uniqueName, - url: this.url, - buildDuration: this.buildDuration, - errorCode: this.errorCode, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface ModelBuildSolution { - assistantSid: string; -} - -export interface ModelBuildListInstance { - _version: V1; - _solution: ModelBuildSolution; - _uri: string; - - (sid: string): ModelBuildContext; - get(sid: string): ModelBuildContext; - - /** - * Create a ModelBuildInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - create( - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - /** - * Create a ModelBuildInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed ModelBuildInstance - */ - create( - params: ModelBuildListInstanceCreateOptions, - callback?: (error: Error | null, item?: ModelBuildInstance) => any - ): Promise; - - /** - * Streams ModelBuildInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { ModelBuildListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: ModelBuildInstance, done: (err?: Error) => void) => void - ): void; - each( - params: ModelBuildListInstanceEachOptions, - callback?: (item: ModelBuildInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of ModelBuildInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: ModelBuildPage) => any - ): Promise; - /** - * Lists ModelBuildInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { ModelBuildListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: ModelBuildInstance[]) => any - ): Promise; - list( - params: ModelBuildListInstanceOptions, - callback?: (error: Error | null, items: ModelBuildInstance[]) => any - ): Promise; - /** - * Retrieve a single page of ModelBuildInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { ModelBuildListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: ModelBuildPage) => any - ): Promise; - page( - params: ModelBuildListInstancePageOptions, - callback?: (error: Error | null, items: ModelBuildPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function ModelBuildListInstance( - version: V1, - assistantSid: string -): ModelBuildListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as ModelBuildListInstance; - - instance.get = function get(sid): ModelBuildContext { - return new ModelBuildContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - instance._uri = `/Assistants/${assistantSid}/ModelBuilds`; - - instance.create = function create( - params?: - | ModelBuildListInstanceCreateOptions - | ((error: Error | null, items: ModelBuildInstance) => any), - callback?: (error: Error | null, items: ModelBuildInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["statusCallback"] !== undefined) - data["StatusCallback"] = params["statusCallback"]; - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - - 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 ModelBuildInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | ModelBuildListInstancePageOptions - | ((error: Error | null, items: ModelBuildPage) => any), - callback?: (error: Error | null, items: ModelBuildPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new ModelBuildPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: ModelBuildPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new ModelBuildPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class ModelBuildPage extends Page< - V1, - ModelBuildPayload, - ModelBuildResource, - ModelBuildInstance -> { - /** - * Initialize the ModelBuildPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: ModelBuildSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of ModelBuildInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: ModelBuildResource): ModelBuildInstance { - return new ModelBuildInstance( - this._version, - payload, - this._solution.assistantSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/query.ts b/src/rest/autopilot/v1/assistant/query.ts deleted file mode 100644 index b124853f6a..0000000000 --- a/src/rest/autopilot/v1/assistant/query.ts +++ /dev/null @@ -1,776 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import V1 from "../../V1"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a QueryInstance - */ -export interface QueryContextUpdateOptions { - /** The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. */ - sampleSid?: string; - /** The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` */ - status?: string; -} - -/** - * Options to pass to create a QueryInstance - */ -export interface QueryListInstanceCreateOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. */ - language: string; - /** The end-user\\\'s natural language input. It can be up to 2048 characters long. */ - query: string; - /** The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. */ - tasks?: string; - /** The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. */ - modelBuild?: string; -} -/** - * Options to pass to each - */ -export interface QueryListInstanceEachOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. */ - language?: string; - /** The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. */ - modelBuild?: string; - /** The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` */ - status?: string; - /** The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). */ - dialogueSid?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: QueryInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface QueryListInstanceOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. */ - language?: string; - /** The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. */ - modelBuild?: string; - /** The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` */ - status?: string; - /** The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). */ - dialogueSid?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface QueryListInstancePageOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. */ - language?: string; - /** The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. */ - modelBuild?: string; - /** The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` */ - status?: string; - /** The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). */ - dialogueSid?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface QueryContext { - /** - * Remove a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - fetch( - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - - /** - * Update a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - update( - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - /** - * Update a QueryInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - update( - params: QueryContextUpdateOptions, - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface QueryContextSolution { - assistantSid: string; - sid: string; -} - -export class QueryContextImpl implements QueryContext { - protected _solution: QueryContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/Queries/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new QueryInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | QueryContextUpdateOptions - | ((error: Error | null, item?: QueryInstance) => any), - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["sampleSid"] !== undefined) - data["SampleSid"] = params["sampleSid"]; - if (params["status"] !== undefined) data["Status"] = params["status"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new QueryInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 QueryPayload extends TwilioResponsePayload { - queries: QueryResource[]; -} - -interface QueryResource { - account_sid: string; - date_created: Date; - date_updated: Date; - results: any; - language: string; - model_build_sid: string; - query: string; - sample_sid: string; - assistant_sid: string; - sid: string; - status: string; - url: string; - source_channel: string; - dialogue_sid: string; -} - -export class QueryInstance { - protected _solution: QueryContextSolution; - protected _context?: QueryContext; - - constructor( - protected _version: V1, - payload: QueryResource, - assistantSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.results = payload.results; - this.language = payload.language; - this.modelBuildSid = payload.model_build_sid; - this.query = payload.query; - this.sampleSid = payload.sample_sid; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.status = payload.status; - this.url = payload.url; - this.sourceChannel = payload.source_channel; - this.dialogueSid = payload.dialogue_sid; - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). - */ - results: any; - /** - * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. - */ - language: string; - /** - * The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. - */ - modelBuildSid: string; - /** - * The end-user\'s natural language input. - */ - query: string; - /** - * The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - */ - sampleSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Query resource. - */ - sid: string; - /** - * The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` - */ - status: string; - /** - * The absolute URL of the Query resource. - */ - url: string; - /** - * The communication channel from where the end-user input came. - */ - sourceChannel: string; - /** - * The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - */ - dialogueSid: string; - - private get _proxy(): QueryContext { - this._context = - this._context || - new QueryContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - fetch( - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a QueryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - update( - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - /** - * Update a QueryInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - update( - params: QueryContextUpdateOptions, - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - results: this.results, - language: this.language, - modelBuildSid: this.modelBuildSid, - query: this.query, - sampleSid: this.sampleSid, - assistantSid: this.assistantSid, - sid: this.sid, - status: this.status, - url: this.url, - sourceChannel: this.sourceChannel, - dialogueSid: this.dialogueSid, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface QuerySolution { - assistantSid: string; -} - -export interface QueryListInstance { - _version: V1; - _solution: QuerySolution; - _uri: string; - - (sid: string): QueryContext; - get(sid: string): QueryContext; - - /** - * Create a QueryInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed QueryInstance - */ - create( - params: QueryListInstanceCreateOptions, - callback?: (error: Error | null, item?: QueryInstance) => any - ): Promise; - - /** - * Streams QueryInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { QueryListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: QueryInstance, done: (err?: Error) => void) => void - ): void; - each( - params: QueryListInstanceEachOptions, - callback?: (item: QueryInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of QueryInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: QueryPage) => any - ): Promise; - /** - * Lists QueryInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { QueryListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: QueryInstance[]) => any - ): Promise; - list( - params: QueryListInstanceOptions, - callback?: (error: Error | null, items: QueryInstance[]) => any - ): Promise; - /** - * Retrieve a single page of QueryInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { QueryListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: QueryPage) => any - ): Promise; - page( - params: QueryListInstancePageOptions, - callback?: (error: Error | null, items: QueryPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function QueryListInstance( - version: V1, - assistantSid: string -): QueryListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as QueryListInstance; - - instance.get = function get(sid): QueryContext { - return new QueryContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - instance._uri = `/Assistants/${assistantSid}/Queries`; - - instance.create = function create( - params: QueryListInstanceCreateOptions, - callback?: (error: Error | null, items: QueryInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["language"] === null || params["language"] === undefined) { - throw new Error("Required parameter \"params['language']\" missing."); - } - - if (params["query"] === null || params["query"] === undefined) { - throw new Error("Required parameter \"params['query']\" missing."); - } - - let data: any = {}; - - data["Language"] = params["language"]; - - data["Query"] = params["query"]; - if (params["tasks"] !== undefined) data["Tasks"] = params["tasks"]; - if (params["modelBuild"] !== undefined) - data["ModelBuild"] = params["modelBuild"]; - - 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 QueryInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | QueryListInstancePageOptions - | ((error: Error | null, items: QueryPage) => any), - callback?: (error: Error | null, items: QueryPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["language"] !== undefined) data["Language"] = params["language"]; - if (params["modelBuild"] !== undefined) - data["ModelBuild"] = params["modelBuild"]; - if (params["status"] !== undefined) data["Status"] = params["status"]; - if (params["dialogueSid"] !== undefined) - data["DialogueSid"] = params["dialogueSid"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new QueryPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: QueryPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => new QueryPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class QueryPage extends Page< - V1, - QueryPayload, - QueryResource, - QueryInstance -> { - /** - * Initialize the QueryPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: QuerySolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of QueryInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: QueryResource): QueryInstance { - return new QueryInstance( - this._version, - payload, - this._solution.assistantSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/styleSheet.ts b/src/rest/autopilot/v1/assistant/styleSheet.ts deleted file mode 100644 index b6da0cbed7..0000000000 --- a/src/rest/autopilot/v1/assistant/styleSheet.ts +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 update a StyleSheetInstance - */ -export interface StyleSheetContextUpdateOptions { - /** The JSON string that describes the style sheet object. */ - styleSheet?: any; -} - -export interface StyleSheetContext { - /** - * Fetch a StyleSheetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - fetch( - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise; - - /** - * Update a StyleSheetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - update( - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise; - /** - * Update a StyleSheetInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - update( - params: StyleSheetContextUpdateOptions, - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface StyleSheetContextSolution { - assistantSid: string; -} - -export class StyleSheetContextImpl implements StyleSheetContext { - protected _solution: StyleSheetContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - this._solution = { assistantSid }; - this._uri = `/Assistants/${assistantSid}/StyleSheet`; - } - - fetch( - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new StyleSheetInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | StyleSheetContextUpdateOptions - | ((error: Error | null, item?: StyleSheetInstance) => any), - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["styleSheet"] !== undefined) - data["StyleSheet"] = serialize.object(params["styleSheet"]); - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new StyleSheetInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - 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 StyleSheetPayload extends StyleSheetResource {} - -interface StyleSheetResource { - account_sid: string; - assistant_sid: string; - url: string; - data: any; -} - -export class StyleSheetInstance { - protected _solution: StyleSheetContextSolution; - protected _context?: StyleSheetContext; - - constructor( - protected _version: V1, - payload: StyleSheetResource, - assistantSid: string - ) { - this.accountSid = payload.account_sid; - this.assistantSid = payload.assistant_sid; - this.url = payload.url; - this.data = payload.data; - - this._solution = { assistantSid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. - */ - accountSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The absolute URL of the StyleSheet resource. - */ - url: string; - /** - * The JSON string that describes the style sheet object. - */ - data: any; - - private get _proxy(): StyleSheetContext { - this._context = - this._context || - new StyleSheetContextImpl(this._version, this._solution.assistantSid); - return this._context; - } - - /** - * Fetch a StyleSheetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - fetch( - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a StyleSheetInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - update( - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise; - /** - * Update a StyleSheetInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed StyleSheetInstance - */ - update( - params: StyleSheetContextUpdateOptions, - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: StyleSheetInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - assistantSid: this.assistantSid, - url: this.url, - data: this.data, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface StyleSheetSolution { - assistantSid: string; -} - -export interface StyleSheetListInstance { - _version: V1; - _solution: StyleSheetSolution; - _uri: string; - - (): StyleSheetContext; - get(): StyleSheetContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function StyleSheetListInstance( - version: V1, - assistantSid: string -): StyleSheetListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = (() => instance.get()) as StyleSheetListInstance; - - instance.get = function get(): StyleSheetContext { - return new StyleSheetContextImpl(version, assistantSid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - 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/autopilot/v1/assistant/task.ts b/src/rest/autopilot/v1/assistant/task.ts deleted file mode 100644 index 48858c661d..0000000000 --- a/src/rest/autopilot/v1/assistant/task.ts +++ /dev/null @@ -1,806 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import V1 from "../../V1"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; -import { FieldListInstance } from "./task/field"; -import { SampleListInstance } from "./task/sample"; -import { TaskActionsListInstance } from "./task/taskActions"; -import { TaskStatisticsListInstance } from "./task/taskStatistics"; - -/** - * Options to pass to update a TaskInstance - */ -export interface TaskContextUpdateOptions { - /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; - /** An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. */ - uniqueName?: string; - /** The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. */ - actions?: any; - /** The URL from which the Assistant can fetch actions. */ - actionsUrl?: string; -} - -/** - * Options to pass to create a TaskInstance - */ -export interface TaskListInstanceCreateOptions { - /** An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. */ - uniqueName: string; - /** A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. */ - friendlyName?: string; - /** The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. */ - actions?: any; - /** The URL from which the Assistant can fetch actions. */ - actionsUrl?: string; -} -/** - * Options to pass to each - */ -export interface TaskListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: TaskInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface TaskListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface TaskListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface TaskContext { - fields: FieldListInstance; - samples: SampleListInstance; - taskActions: TaskActionsListInstance; - statistics: TaskStatisticsListInstance; - - /** - * Remove a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - - /** - * Update a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - update( - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - /** - * Update a TaskInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - update( - params: TaskContextUpdateOptions, - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface TaskContextSolution { - assistantSid: string; - sid: string; -} - -export class TaskContextImpl implements TaskContext { - protected _solution: TaskContextSolution; - protected _uri: string; - - protected _fields?: FieldListInstance; - protected _samples?: SampleListInstance; - protected _taskActions?: TaskActionsListInstance; - protected _statistics?: TaskStatisticsListInstance; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/Tasks/${sid}`; - } - - get fields(): FieldListInstance { - this._fields = - this._fields || - FieldListInstance( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._fields; - } - - get samples(): SampleListInstance { - this._samples = - this._samples || - SampleListInstance( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._samples; - } - - get taskActions(): TaskActionsListInstance { - this._taskActions = - this._taskActions || - TaskActionsListInstance( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._taskActions; - } - - get statistics(): TaskStatisticsListInstance { - this._statistics = - this._statistics || - TaskStatisticsListInstance( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._statistics; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new TaskInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | TaskContextUpdateOptions - | ((error: Error | null, item?: TaskInstance) => any), - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - if (params["actions"] !== undefined) - data["Actions"] = serialize.object(params["actions"]); - if (params["actionsUrl"] !== undefined) - data["ActionsUrl"] = params["actionsUrl"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new TaskInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 TaskPayload extends TwilioResponsePayload { - tasks: TaskResource[]; -} - -interface TaskResource { - account_sid: string; - date_created: Date; - date_updated: Date; - friendly_name: string; - links: Record; - assistant_sid: string; - sid: string; - unique_name: string; - actions_url: string; - url: string; -} - -export class TaskInstance { - protected _solution: TaskContextSolution; - protected _context?: TaskContext; - - constructor( - protected _version: V1, - payload: TaskResource, - assistantSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.friendlyName = payload.friendly_name; - this.links = payload.links; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.uniqueName = payload.unique_name; - this.actionsUrl = payload.actions_url; - this.url = payload.url; - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - */ - friendlyName: string; - /** - * A list of the URLs of related resources. - */ - links: Record; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Task resource. - */ - sid: string; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. - */ - uniqueName: string; - /** - * The URL from which the Assistant can fetch actions. - */ - actionsUrl: string; - /** - * The absolute URL of the Task resource. - */ - url: string; - - private get _proxy(): TaskContext { - this._context = - this._context || - new TaskContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a TaskInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - update( - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - /** - * Update a TaskInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - update( - params: TaskContextUpdateOptions, - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Access the fields. - */ - fields(): FieldListInstance { - return this._proxy.fields; - } - - /** - * Access the samples. - */ - samples(): SampleListInstance { - return this._proxy.samples; - } - - /** - * Access the taskActions. - */ - taskActions(): TaskActionsListInstance { - return this._proxy.taskActions; - } - - /** - * Access the statistics. - */ - statistics(): TaskStatisticsListInstance { - return this._proxy.statistics; - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - friendlyName: this.friendlyName, - links: this.links, - assistantSid: this.assistantSid, - sid: this.sid, - uniqueName: this.uniqueName, - actionsUrl: this.actionsUrl, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface TaskSolution { - assistantSid: string; -} - -export interface TaskListInstance { - _version: V1; - _solution: TaskSolution; - _uri: string; - - (sid: string): TaskContext; - get(sid: string): TaskContext; - - /** - * Create a TaskInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskInstance - */ - create( - params: TaskListInstanceCreateOptions, - callback?: (error: Error | null, item?: TaskInstance) => any - ): Promise; - - /** - * Streams TaskInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { TaskListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: TaskInstance, done: (err?: Error) => void) => void - ): void; - each( - params: TaskListInstanceEachOptions, - callback?: (item: TaskInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of TaskInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: TaskPage) => any - ): Promise; - /** - * Lists TaskInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { TaskListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: TaskInstance[]) => any - ): Promise; - list( - params: TaskListInstanceOptions, - callback?: (error: Error | null, items: TaskInstance[]) => any - ): Promise; - /** - * Retrieve a single page of TaskInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { TaskListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: TaskPage) => any - ): Promise; - page( - params: TaskListInstancePageOptions, - callback?: (error: Error | null, items: TaskPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TaskListInstance( - version: V1, - assistantSid: string -): TaskListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as TaskListInstance; - - instance.get = function get(sid): TaskContext { - return new TaskContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - instance._uri = `/Assistants/${assistantSid}/Tasks`; - - instance.create = function create( - params: TaskListInstanceCreateOptions, - callback?: (error: Error | null, items: TaskInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["uniqueName"] === null || params["uniqueName"] === undefined) { - throw new Error("Required parameter \"params['uniqueName']\" missing."); - } - - let data: any = {}; - - data["UniqueName"] = params["uniqueName"]; - if (params["friendlyName"] !== undefined) - data["FriendlyName"] = params["friendlyName"]; - if (params["actions"] !== undefined) - data["Actions"] = serialize.object(params["actions"]); - if (params["actionsUrl"] !== undefined) - data["ActionsUrl"] = params["actionsUrl"]; - - 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 TaskInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | TaskListInstancePageOptions - | ((error: Error | null, items: TaskPage) => any), - callback?: (error: Error | null, items: TaskPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new TaskPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: TaskPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => new TaskPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class TaskPage extends Page< - V1, - TaskPayload, - TaskResource, - TaskInstance -> { - /** - * Initialize the TaskPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor(version: V1, response: Response, solution: TaskSolution) { - super(version, response, solution); - } - - /** - * Build an instance of TaskInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: TaskResource): TaskInstance { - return new TaskInstance( - this._version, - payload, - this._solution.assistantSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/task/field.ts b/src/rest/autopilot/v1/assistant/task/field.ts deleted file mode 100644 index c46a280a40..0000000000 --- a/src/rest/autopilot/v1/assistant/task/field.ts +++ /dev/null @@ -1,614 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../../base/Page"; -import Response from "../../../../../http/response"; -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 FieldInstance - */ -export interface FieldListInstanceCreateOptions { - /** The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. */ - fieldType: string; - /** An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. */ - uniqueName: string; -} -/** - * Options to pass to each - */ -export interface FieldListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: FieldInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface FieldListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface FieldListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface FieldContext { - /** - * Remove a FieldInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a FieldInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface FieldContextSolution { - assistantSid: string; - taskSid: string; - sid: string; -} - -export class FieldContextImpl implements FieldContext { - protected _solution: FieldContextSolution; - protected _uri: string; - - constructor( - protected _version: V1, - assistantSid: string, - taskSid: string, - sid: string - ) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, taskSid, sid }; - this._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Fields/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: FieldInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new FieldInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid, - instance._solution.sid - ) - ); - - 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 FieldPayload extends TwilioResponsePayload { - fields: FieldResource[]; -} - -interface FieldResource { - account_sid: string; - date_created: Date; - date_updated: Date; - field_type: string; - task_sid: string; - assistant_sid: string; - sid: string; - unique_name: string; - url: string; -} - -export class FieldInstance { - protected _solution: FieldContextSolution; - protected _context?: FieldContext; - - constructor( - protected _version: V1, - payload: FieldResource, - assistantSid: string, - taskSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.fieldType = payload.field_type; - this.taskSid = payload.task_sid; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.uniqueName = payload.unique_name; - this.url = payload.url; - - this._solution = { assistantSid, taskSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. - */ - fieldType: string; - /** - * The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. - */ - taskSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Field resource. - */ - sid: string; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. - */ - uniqueName: string; - /** - * The absolute URL of the Field resource. - */ - url: string; - - private get _proxy(): FieldContext { - this._context = - this._context || - new FieldContextImpl( - this._version, - this._solution.assistantSid, - this._solution.taskSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a FieldInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a FieldInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldInstance - */ - fetch( - callback?: (error: Error | null, item?: FieldInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - fieldType: this.fieldType, - taskSid: this.taskSid, - assistantSid: this.assistantSid, - sid: this.sid, - uniqueName: this.uniqueName, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface FieldSolution { - assistantSid: string; - taskSid: string; -} - -export interface FieldListInstance { - _version: V1; - _solution: FieldSolution; - _uri: string; - - (sid: string): FieldContext; - get(sid: string): FieldContext; - - /** - * Create a FieldInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed FieldInstance - */ - create( - params: FieldListInstanceCreateOptions, - callback?: (error: Error | null, item?: FieldInstance) => any - ): Promise; - - /** - * Streams FieldInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: FieldInstance, done: (err?: Error) => void) => void - ): void; - each( - params: FieldListInstanceEachOptions, - callback?: (item: FieldInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of FieldInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldPage) => any - ): Promise; - /** - * Lists FieldInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: FieldInstance[]) => any - ): Promise; - list( - params: FieldListInstanceOptions, - callback?: (error: Error | null, items: FieldInstance[]) => any - ): Promise; - /** - * Retrieve a single page of FieldInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { FieldListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: FieldPage) => any - ): Promise; - page( - params: FieldListInstancePageOptions, - callback?: (error: Error | null, items: FieldPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function FieldListInstance( - version: V1, - assistantSid: string, - taskSid: string -): FieldListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as FieldListInstance; - - instance.get = function get(sid): FieldContext { - return new FieldContextImpl(version, assistantSid, taskSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid, taskSid }; - instance._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Fields`; - - instance.create = function create( - params: FieldListInstanceCreateOptions, - callback?: (error: Error | null, items: FieldInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["fieldType"] === null || params["fieldType"] === undefined) { - throw new Error("Required parameter \"params['fieldType']\" missing."); - } - - if (params["uniqueName"] === null || params["uniqueName"] === undefined) { - throw new Error("Required parameter \"params['uniqueName']\" missing."); - } - - let data: any = {}; - - data["FieldType"] = params["fieldType"]; - - data["UniqueName"] = params["uniqueName"]; - - 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 FieldInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | FieldListInstancePageOptions - | ((error: Error | null, items: FieldPage) => any), - callback?: (error: Error | null, items: FieldPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new FieldPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: FieldPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => new FieldPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class FieldPage extends Page< - V1, - FieldPayload, - FieldResource, - FieldInstance -> { - /** - * Initialize the FieldPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: FieldSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of FieldInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: FieldResource): FieldInstance { - return new FieldInstance( - this._version, - payload, - this._solution.assistantSid, - this._solution.taskSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/task/sample.ts b/src/rest/autopilot/v1/assistant/task/sample.ts deleted file mode 100644 index 7770b05881..0000000000 --- a/src/rest/autopilot/v1/assistant/task/sample.ts +++ /dev/null @@ -1,749 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../../base/Page"; -import Response from "../../../../../http/response"; -import V1 from "../../../V1"; -const deserialize = require("../../../../../base/deserialize"); -const serialize = require("../../../../../base/serialize"); -import { isValidPathParam } from "../../../../../base/utility"; - -/** - * Options to pass to update a SampleInstance - */ -export interface SampleContextUpdateOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. */ - language?: string; - /** The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). */ - taggedText?: string; - /** The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. */ - sourceChannel?: string; -} - -/** - * Options to pass to create a SampleInstance - */ -export interface SampleListInstanceCreateOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. */ - language: string; - /** The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). */ - taggedText: string; - /** The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. */ - sourceChannel?: string; -} -/** - * Options to pass to each - */ -export interface SampleListInstanceEachOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: SampleInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface SampleListInstanceOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface SampleListInstancePageOptions { - /** The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. */ - language?: string; - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface SampleContext { - /** - * Remove a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - fetch( - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - - /** - * Update a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - update( - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - /** - * Update a SampleInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - update( - params: SampleContextUpdateOptions, - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface SampleContextSolution { - assistantSid: string; - taskSid: string; - sid: string; -} - -export class SampleContextImpl implements SampleContext { - protected _solution: SampleContextSolution; - protected _uri: string; - - constructor( - protected _version: V1, - assistantSid: string, - taskSid: string, - sid: string - ) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, taskSid, sid }; - this._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Samples/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new SampleInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | SampleContextUpdateOptions - | ((error: Error | null, item?: SampleInstance) => any), - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["language"] !== undefined) data["Language"] = params["language"]; - if (params["taggedText"] !== undefined) - data["TaggedText"] = params["taggedText"]; - if (params["sourceChannel"] !== undefined) - data["SourceChannel"] = params["sourceChannel"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new SampleInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid, - instance._solution.sid - ) - ); - - 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 SamplePayload extends TwilioResponsePayload { - samples: SampleResource[]; -} - -interface SampleResource { - account_sid: string; - date_created: Date; - date_updated: Date; - task_sid: string; - language: string; - assistant_sid: string; - sid: string; - tagged_text: string; - url: string; - source_channel: string; -} - -export class SampleInstance { - protected _solution: SampleContextSolution; - protected _context?: SampleContext; - - constructor( - protected _version: V1, - payload: SampleResource, - assistantSid: string, - taskSid: string, - sid?: string - ) { - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.taskSid = payload.task_sid; - this.language = payload.language; - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.taggedText = payload.tagged_text; - this.url = payload.url; - this.sourceChannel = payload.source_channel; - - this._solution = { assistantSid, taskSid, sid: sid || this.sid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - */ - taskSid: string; - /** - * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - */ - language: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Sample resource. - */ - sid: string; - /** - * The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - */ - taggedText: string; - /** - * The absolute URL of the Sample resource. - */ - url: string; - /** - * The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - */ - sourceChannel: string; - - private get _proxy(): SampleContext { - this._context = - this._context || - new SampleContextImpl( - this._version, - this._solution.assistantSid, - this._solution.taskSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - fetch( - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a SampleInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - update( - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - /** - * Update a SampleInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - update( - params: SampleContextUpdateOptions, - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - taskSid: this.taskSid, - language: this.language, - assistantSid: this.assistantSid, - sid: this.sid, - taggedText: this.taggedText, - url: this.url, - sourceChannel: this.sourceChannel, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface SampleSolution { - assistantSid: string; - taskSid: string; -} - -export interface SampleListInstance { - _version: V1; - _solution: SampleSolution; - _uri: string; - - (sid: string): SampleContext; - get(sid: string): SampleContext; - - /** - * Create a SampleInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed SampleInstance - */ - create( - params: SampleListInstanceCreateOptions, - callback?: (error: Error | null, item?: SampleInstance) => any - ): Promise; - - /** - * Streams SampleInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { SampleListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: SampleInstance, done: (err?: Error) => void) => void - ): void; - each( - params: SampleListInstanceEachOptions, - callback?: (item: SampleInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of SampleInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: SamplePage) => any - ): Promise; - /** - * Lists SampleInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { SampleListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: SampleInstance[]) => any - ): Promise; - list( - params: SampleListInstanceOptions, - callback?: (error: Error | null, items: SampleInstance[]) => any - ): Promise; - /** - * Retrieve a single page of SampleInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { SampleListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: SamplePage) => any - ): Promise; - page( - params: SampleListInstancePageOptions, - callback?: (error: Error | null, items: SamplePage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function SampleListInstance( - version: V1, - assistantSid: string, - taskSid: string -): SampleListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as SampleListInstance; - - instance.get = function get(sid): SampleContext { - return new SampleContextImpl(version, assistantSid, taskSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid, taskSid }; - instance._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Samples`; - - instance.create = function create( - params: SampleListInstanceCreateOptions, - callback?: (error: Error | null, items: SampleInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["language"] === null || params["language"] === undefined) { - throw new Error("Required parameter \"params['language']\" missing."); - } - - if (params["taggedText"] === null || params["taggedText"] === undefined) { - throw new Error("Required parameter \"params['taggedText']\" missing."); - } - - let data: any = {}; - - data["Language"] = params["language"]; - - data["TaggedText"] = params["taggedText"]; - if (params["sourceChannel"] !== undefined) - data["SourceChannel"] = params["sourceChannel"]; - - 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 SampleInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | SampleListInstancePageOptions - | ((error: Error | null, items: SamplePage) => any), - callback?: (error: Error | null, items: SamplePage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["language"] !== undefined) data["Language"] = params["language"]; - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new SamplePage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: SamplePage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new SamplePage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class SamplePage extends Page< - V1, - SamplePayload, - SampleResource, - SampleInstance -> { - /** - * Initialize the SamplePage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: SampleSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of SampleInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: SampleResource): SampleInstance { - return new SampleInstance( - this._version, - payload, - this._solution.assistantSid, - this._solution.taskSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/assistant/task/taskActions.ts b/src/rest/autopilot/v1/assistant/task/taskActions.ts deleted file mode 100644 index ace8cb3aeb..0000000000 --- a/src/rest/autopilot/v1/assistant/task/taskActions.ts +++ /dev/null @@ -1,360 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 update a TaskActionsInstance - */ -export interface TaskActionsContextUpdateOptions { - /** The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. */ - actions?: any; -} - -export interface TaskActionsContext { - /** - * Fetch a TaskActionsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise; - - /** - * Update a TaskActionsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - update( - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise; - /** - * Update a TaskActionsInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - update( - params: TaskActionsContextUpdateOptions, - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface TaskActionsContextSolution { - assistantSid: string; - taskSid: string; -} - -export class TaskActionsContextImpl implements TaskActionsContext { - protected _solution: TaskActionsContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, taskSid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - this._solution = { assistantSid, taskSid }; - this._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Actions`; - } - - fetch( - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new TaskActionsInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | TaskActionsContextUpdateOptions - | ((error: Error | null, item?: TaskActionsInstance) => any), - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["actions"] !== undefined) - data["Actions"] = serialize.object(params["actions"]); - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new TaskActionsInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid - ) - ); - - 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 TaskActionsPayload extends TaskActionsResource {} - -interface TaskActionsResource { - account_sid: string; - assistant_sid: string; - task_sid: string; - url: string; - data: any; -} - -export class TaskActionsInstance { - protected _solution: TaskActionsContextSolution; - protected _context?: TaskActionsContext; - - constructor( - protected _version: V1, - payload: TaskActionsResource, - assistantSid: string, - taskSid: string - ) { - this.accountSid = payload.account_sid; - this.assistantSid = payload.assistant_sid; - this.taskSid = payload.task_sid; - this.url = payload.url; - this.data = payload.data; - - this._solution = { assistantSid, taskSid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. - */ - accountSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - */ - assistantSid: string; - /** - * The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - */ - taskSid: string; - /** - * The absolute URL of the TaskActions resource. - */ - url: string; - /** - * The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - */ - data: any; - - private get _proxy(): TaskActionsContext { - this._context = - this._context || - new TaskActionsContextImpl( - this._version, - this._solution.assistantSid, - this._solution.taskSid - ); - return this._context; - } - - /** - * Fetch a TaskActionsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a TaskActionsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - update( - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise; - /** - * Update a TaskActionsInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskActionsInstance - */ - update( - params: TaskActionsContextUpdateOptions, - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: TaskActionsInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - assistantSid: this.assistantSid, - taskSid: this.taskSid, - url: this.url, - data: this.data, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface TaskActionsSolution { - assistantSid: string; - taskSid: string; -} - -export interface TaskActionsListInstance { - _version: V1; - _solution: TaskActionsSolution; - _uri: string; - - (): TaskActionsContext; - get(): TaskActionsContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TaskActionsListInstance( - version: V1, - assistantSid: string, - taskSid: string -): TaskActionsListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - const instance = (() => instance.get()) as TaskActionsListInstance; - - instance.get = function get(): TaskActionsContext { - return new TaskActionsContextImpl(version, assistantSid, taskSid); - }; - - instance._version = version; - instance._solution = { assistantSid, taskSid }; - 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/autopilot/v1/assistant/task/taskStatistics.ts b/src/rest/autopilot/v1/assistant/task/taskStatistics.ts deleted file mode 100644 index 7916aad6e2..0000000000 --- a/src/rest/autopilot/v1/assistant/task/taskStatistics.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 TaskStatisticsContext { - /** - * Fetch a TaskStatisticsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskStatisticsInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskStatisticsInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface TaskStatisticsContextSolution { - assistantSid: string; - taskSid: string; -} - -export class TaskStatisticsContextImpl implements TaskStatisticsContext { - protected _solution: TaskStatisticsContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, taskSid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - this._solution = { assistantSid, taskSid }; - this._uri = `/Assistants/${assistantSid}/Tasks/${taskSid}/Statistics`; - } - - fetch( - callback?: (error: Error | null, item?: TaskStatisticsInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new TaskStatisticsInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.taskSid - ) - ); - - 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 TaskStatisticsPayload extends TaskStatisticsResource {} - -interface TaskStatisticsResource { - account_sid: string; - assistant_sid: string; - task_sid: string; - samples_count: number; - fields_count: number; - url: string; -} - -export class TaskStatisticsInstance { - protected _solution: TaskStatisticsContextSolution; - protected _context?: TaskStatisticsContext; - - constructor( - protected _version: V1, - payload: TaskStatisticsResource, - assistantSid: string, - taskSid: string - ) { - this.accountSid = payload.account_sid; - this.assistantSid = payload.assistant_sid; - this.taskSid = payload.task_sid; - this.samplesCount = deserialize.integer(payload.samples_count); - this.fieldsCount = deserialize.integer(payload.fields_count); - this.url = payload.url; - - this._solution = { assistantSid, taskSid }; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. - */ - accountSid: string; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - */ - assistantSid: string; - /** - * The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. - */ - taskSid: string; - /** - * The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. - */ - samplesCount: number; - /** - * The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. - */ - fieldsCount: number; - /** - * The absolute URL of the TaskStatistics resource. - */ - url: string; - - private get _proxy(): TaskStatisticsContext { - this._context = - this._context || - new TaskStatisticsContextImpl( - this._version, - this._solution.assistantSid, - this._solution.taskSid - ); - return this._context; - } - - /** - * Fetch a TaskStatisticsInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TaskStatisticsInstance - */ - fetch( - callback?: (error: Error | null, item?: TaskStatisticsInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - assistantSid: this.assistantSid, - taskSid: this.taskSid, - samplesCount: this.samplesCount, - fieldsCount: this.fieldsCount, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface TaskStatisticsSolution { - assistantSid: string; - taskSid: string; -} - -export interface TaskStatisticsListInstance { - _version: V1; - _solution: TaskStatisticsSolution; - _uri: string; - - (): TaskStatisticsContext; - get(): TaskStatisticsContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TaskStatisticsListInstance( - version: V1, - assistantSid: string, - taskSid: string -): TaskStatisticsListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(taskSid)) { - throw new Error("Parameter 'taskSid' is not valid."); - } - - const instance = (() => instance.get()) as TaskStatisticsListInstance; - - instance.get = function get(): TaskStatisticsContext { - return new TaskStatisticsContextImpl(version, assistantSid, taskSid); - }; - - instance._version = version; - instance._solution = { assistantSid, taskSid }; - 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/autopilot/v1/assistant/webhook.ts b/src/rest/autopilot/v1/assistant/webhook.ts deleted file mode 100644 index 5666c2df29..0000000000 --- a/src/rest/autopilot/v1/assistant/webhook.ts +++ /dev/null @@ -1,733 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 Page, { TwilioResponsePayload } from "../../../../base/Page"; -import Response from "../../../../http/response"; -import V1 from "../../V1"; -const deserialize = require("../../../../base/deserialize"); -const serialize = require("../../../../base/serialize"); -import { isValidPathParam } from "../../../../base/utility"; - -/** - * Options to pass to update a WebhookInstance - */ -export interface WebhookContextUpdateOptions { - /** An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. */ - uniqueName?: string; - /** The list of space-separated events that this Webhook will subscribe to. */ - events?: string; - /** The URL associated with this Webhook. */ - webhookUrl?: string; - /** The method to be used when calling the webhook\\\'s URL. */ - webhookMethod?: string; -} - -/** - * Options to pass to create a WebhookInstance - */ -export interface WebhookListInstanceCreateOptions { - /** An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. */ - uniqueName: string; - /** The list of space-separated events that this Webhook will subscribe to. */ - events: string; - /** The URL associated with this Webhook. */ - webhookUrl: string; - /** The method to be used when calling the webhook\\\'s URL. */ - webhookMethod?: string; -} -/** - * Options to pass to each - */ -export interface WebhookListInstanceEachOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Function to process each record. If this and a positional callback are passed, this one will be used */ - callback?: (item: WebhookInstance, done: (err?: Error) => void) => void; - /** Function to be called upon completion of streaming */ - done?: Function; - /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to list - */ -export interface WebhookListInstanceOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ - limit?: number; -} - -/** - * Options to pass to page - */ -export interface WebhookListInstancePageOptions { - /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ - pageSize?: number; - /** Page Number, this value is simply for client state */ - pageNumber?: number; - /** PageToken provided by the API */ - pageToken?: string; -} - -export interface WebhookContext { - /** - * Remove a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise; - - /** - * Fetch a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - fetch( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - - /** - * Update a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - update( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - /** - * Update a WebhookInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - update( - params: WebhookContextUpdateOptions, - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface WebhookContextSolution { - assistantSid: string; - sid: string; -} - -export class WebhookContextImpl implements WebhookContext { - protected _solution: WebhookContextSolution; - protected _uri: string; - - constructor(protected _version: V1, assistantSid: string, sid: string) { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - if (!isValidPathParam(sid)) { - throw new Error("Parameter 'sid' is not valid."); - } - - this._solution = { assistantSid, sid }; - this._uri = `/Assistants/${assistantSid}/Webhooks/${sid}`; - } - - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.remove({ - uri: instance._uri, - method: "delete", - }); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - fetch( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => - new WebhookInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - } - - update( - params?: - | WebhookContextUpdateOptions - | ((error: Error | null, item?: WebhookInstance) => any), - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["uniqueName"] !== undefined) - data["UniqueName"] = params["uniqueName"]; - if (params["events"] !== undefined) data["Events"] = params["events"]; - if (params["webhookUrl"] !== undefined) - data["WebhookUrl"] = params["webhookUrl"]; - if (params["webhookMethod"] !== undefined) - data["WebhookMethod"] = params["webhookMethod"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new WebhookInstance( - operationVersion, - payload, - instance._solution.assistantSid, - instance._solution.sid - ) - ); - - 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 WebhookPayload extends TwilioResponsePayload { - webhooks: WebhookResource[]; -} - -interface WebhookResource { - url: string; - account_sid: string; - date_created: Date; - date_updated: Date; - assistant_sid: string; - sid: string; - unique_name: string; - events: string; - webhook_url: string; - webhook_method: string; -} - -export class WebhookInstance { - protected _solution: WebhookContextSolution; - protected _context?: WebhookContext; - - constructor( - protected _version: V1, - payload: WebhookResource, - assistantSid: string, - sid?: string - ) { - this.url = payload.url; - this.accountSid = payload.account_sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.assistantSid = payload.assistant_sid; - this.sid = payload.sid; - this.uniqueName = payload.unique_name; - this.events = payload.events; - this.webhookUrl = payload.webhook_url; - this.webhookMethod = payload.webhook_method; - - this._solution = { assistantSid, sid: sid || this.sid }; - } - - /** - * The absolute URL of the Webhook resource. - */ - url: string; - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. - */ - accountSid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - */ - assistantSid: string; - /** - * The unique string that we created to identify the Webhook resource. - */ - sid: string; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. - */ - uniqueName: string; - /** - * The list of space-separated events that this Webhook is subscribed to. - */ - events: string; - /** - * The URL associated with this Webhook. - */ - webhookUrl: string; - /** - * The method used when calling the webhook\'s URL. - */ - webhookMethod: string; - - private get _proxy(): WebhookContext { - this._context = - this._context || - new WebhookContextImpl( - this._version, - this._solution.assistantSid, - this._solution.sid - ); - return this._context; - } - - /** - * Remove a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed boolean - */ - remove( - callback?: (error: Error | null, item?: boolean) => any - ): Promise { - return this._proxy.remove(callback); - } - - /** - * Fetch a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - fetch( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Update a WebhookInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - update( - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - /** - * Update a WebhookInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - update( - params: WebhookContextUpdateOptions, - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - - update( - params?: any, - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise { - return this._proxy.update(params, callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - url: this.url, - accountSid: this.accountSid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - assistantSid: this.assistantSid, - sid: this.sid, - uniqueName: this.uniqueName, - events: this.events, - webhookUrl: this.webhookUrl, - webhookMethod: this.webhookMethod, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface WebhookSolution { - assistantSid: string; -} - -export interface WebhookListInstance { - _version: V1; - _solution: WebhookSolution; - _uri: string; - - (sid: string): WebhookContext; - get(sid: string): WebhookContext; - - /** - * Create a WebhookInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed WebhookInstance - */ - create( - params: WebhookListInstanceCreateOptions, - callback?: (error: Error | null, item?: WebhookInstance) => any - ): Promise; - - /** - * Streams WebhookInstance records from the API. - * - * This operation lazily loads records as efficiently as possible until the limit - * is reached. - * - * The results are passed into the callback function, so this operation is memory - * efficient. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { WebhookListInstanceEachOptions } [params] - Options for request - * @param { function } [callback] - Function to process each record - */ - each( - callback?: (item: WebhookInstance, done: (err?: Error) => void) => void - ): void; - each( - params: WebhookListInstanceEachOptions, - callback?: (item: WebhookInstance, done: (err?: Error) => void) => void - ): void; - /** - * Retrieve a single target page of WebhookInstance records from the API. - * - * The request is executed immediately. - * - * @param { string } [targetUrl] - API-generated URL for the requested results page - * @param { function } [callback] - Callback to handle list of records - */ - getPage( - targetUrl: string, - callback?: (error: Error | null, items: WebhookPage) => any - ): Promise; - /** - * Lists WebhookInstance records from the API as a list. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { WebhookListInstanceOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - list( - callback?: (error: Error | null, items: WebhookInstance[]) => any - ): Promise; - list( - params: WebhookListInstanceOptions, - callback?: (error: Error | null, items: WebhookInstance[]) => any - ): Promise; - /** - * Retrieve a single page of WebhookInstance records from the API. - * - * The request is executed immediately. - * - * If a function is passed as the first argument, it will be used as the callback - * function. - * - * @param { WebhookListInstancePageOptions } [params] - Options for request - * @param { function } [callback] - Callback to handle list of records - */ - page( - callback?: (error: Error | null, items: WebhookPage) => any - ): Promise; - page( - params: WebhookListInstancePageOptions, - callback?: (error: Error | null, items: WebhookPage) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function WebhookListInstance( - version: V1, - assistantSid: string -): WebhookListInstance { - if (!isValidPathParam(assistantSid)) { - throw new Error("Parameter 'assistantSid' is not valid."); - } - - const instance = ((sid) => instance.get(sid)) as WebhookListInstance; - - instance.get = function get(sid): WebhookContext { - return new WebhookContextImpl(version, assistantSid, sid); - }; - - instance._version = version; - instance._solution = { assistantSid }; - instance._uri = `/Assistants/${assistantSid}/Webhooks`; - - instance.create = function create( - params: WebhookListInstanceCreateOptions, - callback?: (error: Error | null, items: WebhookInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["uniqueName"] === null || params["uniqueName"] === undefined) { - throw new Error("Required parameter \"params['uniqueName']\" missing."); - } - - if (params["events"] === null || params["events"] === undefined) { - throw new Error("Required parameter \"params['events']\" missing."); - } - - if (params["webhookUrl"] === null || params["webhookUrl"] === undefined) { - throw new Error("Required parameter \"params['webhookUrl']\" missing."); - } - - let data: any = {}; - - data["UniqueName"] = params["uniqueName"]; - - data["Events"] = params["events"]; - - data["WebhookUrl"] = params["webhookUrl"]; - if (params["webhookMethod"] !== undefined) - data["WebhookMethod"] = params["webhookMethod"]; - - 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 WebhookInstance( - operationVersion, - payload, - instance._solution.assistantSid - ) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - - instance.page = function page( - params?: - | WebhookListInstancePageOptions - | ((error: Error | null, items: WebhookPage) => any), - callback?: (error: Error | null, items: WebhookPage) => any - ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; - - if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; - if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; - - const headers: any = {}; - - let operationVersion = version, - operationPromise = operationVersion.page({ - uri: instance._uri, - method: "get", - params: data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => - new WebhookPage(operationVersion, payload, instance._solution) - ); - - operationPromise = instance._version.setPromiseCallback( - operationPromise, - callback - ); - return operationPromise; - }; - instance.each = instance._version.each; - instance.list = instance._version.list; - - instance.getPage = function getPage( - targetUrl: string, - callback?: (error: Error | null, items: WebhookPage) => any - ): Promise { - const operationPromise = instance._version._domain.twilio.request({ - method: "get", - uri: targetUrl, - }); - - let pagePromise = operationPromise.then( - (payload) => - new WebhookPage(instance._version, payload, instance._solution) - ); - pagePromise = instance._version.setPromiseCallback(pagePromise, callback); - return pagePromise; - }; - - instance.toJSON = function toJSON() { - return instance._solution; - }; - - instance[inspect.custom] = function inspectImpl( - _depth: any, - options: InspectOptions - ) { - return inspect(instance.toJSON(), options); - }; - - return instance; -} - -export class WebhookPage extends Page< - V1, - WebhookPayload, - WebhookResource, - WebhookInstance -> { - /** - * Initialize the WebhookPage - * - * @param version - Version of the resource - * @param response - Response from the API - * @param solution - Path solution - */ - constructor( - version: V1, - response: Response, - solution: WebhookSolution - ) { - super(version, response, solution); - } - - /** - * Build an instance of WebhookInstance - * - * @param payload - Payload response from the API - */ - getInstance(payload: WebhookResource): WebhookInstance { - return new WebhookInstance( - this._version, - payload, - this._solution.assistantSid - ); - } - - [inspect.custom](depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/autopilot/v1/restoreAssistant.ts b/src/rest/autopilot/v1/restoreAssistant.ts deleted file mode 100644 index ddd75b6802..0000000000 --- a/src/rest/autopilot/v1/restoreAssistant.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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 update a RestoreAssistantInstance - */ -export interface RestoreAssistantListInstanceUpdateOptions { - /** The Twilio-provided string that uniquely identifies the Assistant resource to restore. */ - assistant: string; -} - -export interface RestoreAssistantSolution {} - -export interface RestoreAssistantListInstance { - _version: V1; - _solution: RestoreAssistantSolution; - _uri: string; - - /** - * Update a RestoreAssistantInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed RestoreAssistantInstance - */ - update( - params: RestoreAssistantListInstanceUpdateOptions, - callback?: (error: Error | null, item?: RestoreAssistantInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function RestoreAssistantListInstance( - version: V1 -): RestoreAssistantListInstance { - const instance = {} as RestoreAssistantListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/Assistants/Restore`; - - instance.update = function update( - params: RestoreAssistantListInstanceUpdateOptions, - callback?: (error: Error | null, items: RestoreAssistantInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["assistant"] === null || params["assistant"] === undefined) { - throw new Error("Required parameter \"params['assistant']\" missing."); - } - - let data: any = {}; - - data["Assistant"] = params["assistant"]; - - const headers: any = {}; - headers["Content-Type"] = "application/x-www-form-urlencoded"; - - let operationVersion = version, - operationPromise = operationVersion.update({ - uri: instance._uri, - method: "post", - data, - headers, - }); - - operationPromise = operationPromise.then( - (payload) => new RestoreAssistantInstance(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 RestoreAssistantPayload extends RestoreAssistantResource {} - -interface RestoreAssistantResource { - account_sid: string; - sid: string; - date_created: Date; - date_updated: Date; - unique_name: string; - friendly_name: string; - needs_model_build: boolean; - latest_model_build_sid: string; - log_queries: boolean; - development_stage: string; - callback_url: string; - callback_events: string; -} - -export class RestoreAssistantInstance { - constructor(protected _version: V1, payload: RestoreAssistantResource) { - this.accountSid = payload.account_sid; - this.sid = payload.sid; - this.dateCreated = deserialize.iso8601DateTime(payload.date_created); - this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); - this.uniqueName = payload.unique_name; - this.friendlyName = payload.friendly_name; - this.needsModelBuild = payload.needs_model_build; - this.latestModelBuildSid = payload.latest_model_build_sid; - this.logQueries = payload.log_queries; - this.developmentStage = payload.development_stage; - this.callbackUrl = payload.callback_url; - this.callbackEvents = payload.callback_events; - } - - /** - * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - */ - accountSid: string; - /** - * The unique string that we created to identify the Assistant resource. - */ - sid: string; - /** - * The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateCreated: Date; - /** - * The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - dateUpdated: Date; - /** - * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. - */ - uniqueName: string; - /** - * The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - */ - friendlyName: string; - /** - * Whether model needs to be rebuilt. - */ - needsModelBuild: boolean; - /** - * Reserved. - */ - latestModelBuildSid: string; - /** - * Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - */ - logQueries: boolean; - /** - * A string describing the state of the assistant. - */ - developmentStage: string; - /** - * Reserved. - */ - callbackUrl: string; - /** - * Reserved. - */ - callbackEvents: string; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accountSid: this.accountSid, - sid: this.sid, - dateCreated: this.dateCreated, - dateUpdated: this.dateUpdated, - uniqueName: this.uniqueName, - friendlyName: this.friendlyName, - needsModelBuild: this.needsModelBuild, - latestModelBuildSid: this.latestModelBuildSid, - logQueries: this.logQueries, - developmentStage: this.developmentStage, - callbackUrl: this.callbackUrl, - callbackEvents: this.callbackEvents, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -}