Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

15
node_modules/twilio/lib/rest/studio/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import StudioBase from "../StudioBase";
import Version from "../../base/Version";
import { FlowListInstance } from "./v1/flow";
export default class V1 extends Version {
/**
* Initialize the V1 version of Studio
*
* @param domain - The Twilio (Twilio.Studio) domain
*/
constructor(domain: StudioBase);
/** flows - { Twilio.Studio.V1.FlowListInstance } resource */
protected _flows?: FlowListInstance;
/** Getter for flows resource */
get flows(): FlowListInstance;
}

36
node_modules/twilio/lib/rest/studio/V1.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const flow_1 = require("./v1/flow");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Studio
*
* @param domain - The Twilio (Twilio.Studio) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for flows resource */
get flows() {
this._flows = this._flows || (0, flow_1.FlowListInstance)(this);
return this._flows;
}
}
exports.default = V1;

20
node_modules/twilio/lib/rest/studio/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import StudioBase from "../StudioBase";
import Version from "../../base/Version";
import { FlowListInstance } from "./v2/flow";
import { FlowValidateListInstance } from "./v2/flowValidate";
export default class V2 extends Version {
/**
* Initialize the V2 version of Studio
*
* @param domain - The Twilio (Twilio.Studio) domain
*/
constructor(domain: StudioBase);
/** flows - { Twilio.Studio.V2.FlowListInstance } resource */
protected _flows?: FlowListInstance;
/** flowValidate - { Twilio.Studio.V2.FlowValidateListInstance } resource */
protected _flowValidate?: FlowValidateListInstance;
/** Getter for flows resource */
get flows(): FlowListInstance;
/** Getter for flowValidate resource */
get flowValidate(): FlowValidateListInstance;
}

42
node_modules/twilio/lib/rest/studio/V2.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Version_1 = __importDefault(require("../../base/Version"));
const flow_1 = require("./v2/flow");
const flowValidate_1 = require("./v2/flowValidate");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Studio
*
* @param domain - The Twilio (Twilio.Studio) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for flows resource */
get flows() {
this._flows = this._flows || (0, flow_1.FlowListInstance)(this);
return this._flows;
}
/** Getter for flowValidate resource */
get flowValidate() {
this._flowValidate = this._flowValidate || (0, flowValidate_1.FlowValidateListInstance)(this);
return this._flowValidate;
}
}
exports.default = V2;

355
node_modules/twilio/lib/rest/studio/v1/flow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,355 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { EngagementListInstance } from "./flow/engagement";
import { ExecutionListInstance } from "./flow/execution";
/**
* The status of the Flow. Can be: `draft` or `published`.
*/
export type FlowStatus = "draft" | "published";
/**
* Options to pass to each
*/
export interface FlowListInstanceEachOptions {
/** 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: FlowInstance, 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 FlowListInstanceOptions {
/** 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 FlowListInstancePageOptions {
/** 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 FlowContext {
engagements: EngagementListInstance;
executions: ExecutionListInstance;
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface FlowContextSolution {
sid: string;
}
export declare class FlowContextImpl implements FlowContext {
protected _version: V1;
protected _solution: FlowContextSolution;
protected _uri: string;
protected _engagements?: EngagementListInstance;
protected _executions?: ExecutionListInstance;
constructor(_version: V1, sid: string);
get engagements(): EngagementListInstance;
get executions(): ExecutionListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): FlowContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface FlowPayload extends TwilioResponsePayload {
flows: FlowResource[];
}
interface FlowResource {
sid: string;
account_sid: string;
friendly_name: string;
status: FlowStatus;
version: number;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class FlowInstance {
protected _version: V1;
protected _solution: FlowContextSolution;
protected _context?: FlowContext;
constructor(_version: V1, payload: FlowResource, sid?: string);
/**
* The unique string that we created to identify the Flow resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource.
*/
accountSid: string;
/**
* The string that you assigned to describe the Flow.
*/
friendlyName: string;
status: FlowStatus;
/**
* The latest version number of the Flow\'s definition.
*/
version: number;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of the Flow\'s nested resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Access the engagements.
*/
engagements(): EngagementListInstance;
/**
* Access the executions.
*/
executions(): ExecutionListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
friendlyName: string;
status: FlowStatus;
version: number;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface FlowSolution {
}
export interface FlowListInstance {
_version: V1;
_solution: FlowSolution;
_uri: string;
(sid: string): FlowContext;
get(sid: string): FlowContext;
/**
* Streams FlowInstance 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 { FlowListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
each(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
/**
* Streams FlowInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { FlowListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of FlowInstance 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: FlowPage) => any): Promise<FlowPage>;
/**
* Retrieve a single target page of FlowInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
/**
* Lists FlowInstance 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 { FlowListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>;
list(params: FlowListInstanceOptions, callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>;
/**
* Lists FlowInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowInstance[]>) => any): Promise<ApiResponse<FlowInstance[]>>;
listWithHttpInfo(params: FlowListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FlowInstance[]>) => any): Promise<ApiResponse<FlowInstance[]>>;
/**
* Retrieve a single page of FlowInstance 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 { FlowListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>;
page(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>;
/**
* Retrieve a single page of FlowInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
pageWithHttpInfo(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FlowListInstance(version: V1): FlowListInstance;
export declare class FlowPage extends Page<V1, FlowPayload, FlowResource, FlowInstance> {
/**
* Initialize the FlowPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: FlowSolution);
/**
* Build an instance of FlowInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: FlowResource): FlowInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

338
node_modules/twilio/lib/rest/studio/v1/flow.js generated vendored Normal file
View File

@@ -0,0 +1,338 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowPage = exports.FlowInstance = exports.FlowContextImpl = void 0;
exports.FlowListInstance = FlowListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const engagement_1 = require("./flow/engagement");
const execution_1 = require("./flow/execution");
class FlowContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Flows/${sid}`;
}
get engagements() {
this._engagements =
this._engagements ||
(0, engagement_1.EngagementListInstance)(this._version, this._solution.sid);
return this._engagements;
}
get executions() {
this._executions =
this._executions ||
(0, execution_1.ExecutionListInstance)(this._version, this._solution.sid);
return this._executions;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new FlowInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowContextImpl = FlowContextImpl;
class FlowInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.friendlyName = payload.friendly_name;
this.status = payload.status;
this.version = deserialize.integer(payload.version);
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new FlowContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the engagements.
*/
engagements() {
return this._proxy.engagements;
}
/**
* Access the executions.
*/
executions() {
return this._proxy.executions;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
friendlyName: this.friendlyName,
status: this.status,
version: this.version,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowInstance = FlowInstance;
function FlowListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new FlowContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Flows`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new FlowPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class FlowPage extends Page_1.default {
/**
* Initialize the FlowPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of FlowInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new FlowInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowPage = FlowPage;

View File

@@ -0,0 +1,398 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
import { EngagementContextListInstance } from "./engagement/engagementContext";
import { StepListInstance } from "./engagement/step";
/**
* The status of the Engagement. Can be: `active` or `ended`.
*/
export type EngagementStatus = "active" | "ended";
/**
* Options to pass to create a EngagementInstance
*/
export interface EngagementListInstanceCreateOptions {
/** The Contact phone number to start a Studio Flow Engagement, available as variable `{{contact.channel.address}}`. */
to: string;
/** The Twilio phone number to send messages or initiate calls from during the Flow Engagement. Available as variable `{{flow.channel.address}}` */
from: string;
/** A JSON string we will add to your flow\\\'s context and that you can access as variables inside your flow. For example, if you pass in `Parameters={\\\'name\\\':\\\'Zeke\\\'}` then inside a widget you can reference the variable `{{flow.data.name}}` which will return the string \\\'Zeke\\\'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. */
parameters?: any;
}
/**
* Options to pass to each
*/
export interface EngagementListInstanceEachOptions {
/** 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: EngagementInstance, 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 EngagementListInstanceOptions {
/** 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 EngagementListInstancePageOptions {
/** 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 EngagementContext {
engagementContext: EngagementContextListInstance;
steps: StepListInstance;
/**
* Remove a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance
*/
fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>;
/**
* Fetch a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementInstance>) => any): Promise<ApiResponse<EngagementInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EngagementContextSolution {
flowSid: string;
sid: string;
}
export declare class EngagementContextImpl implements EngagementContext {
protected _version: V1;
protected _solution: EngagementContextSolution;
protected _uri: string;
protected _engagementContext?: EngagementContextListInstance;
protected _steps?: StepListInstance;
constructor(_version: V1, flowSid: string, sid: string);
get engagementContext(): EngagementContextListInstance;
get steps(): StepListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementInstance>) => any): Promise<ApiResponse<EngagementInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EngagementContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EngagementPayload extends TwilioResponsePayload {
engagements: EngagementResource[];
}
interface EngagementResource {
sid: string;
account_sid: string;
flow_sid: string;
contact_sid: string;
contact_channel_address: string;
context: any;
status: EngagementStatus;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class EngagementInstance {
protected _version: V1;
protected _solution: EngagementContextSolution;
protected _context?: EngagementContext;
constructor(_version: V1, payload: EngagementResource, flowSid: string, sid?: string);
/**
* The unique string that we created to identify the Engagement resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Contact.
*/
contactSid: string;
/**
* The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`.
*/
contactChannelAddress: string;
/**
* The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution.
*/
context: any;
status: EngagementStatus;
/**
* The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of the Engagement\'s nested resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance
*/
fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>;
/**
* Fetch a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementInstance>) => any): Promise<ApiResponse<EngagementInstance>>;
/**
* Access the engagementContext.
*/
engagementContext(): EngagementContextListInstance;
/**
* Access the steps.
*/
steps(): StepListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
contactSid: string;
contactChannelAddress: string;
context: any;
status: EngagementStatus;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EngagementSolution {
flowSid: string;
}
export interface EngagementListInstance {
_version: V1;
_solution: EngagementSolution;
_uri: string;
(sid: string): EngagementContext;
get(sid: string): EngagementContext;
/**
* Create a EngagementInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance
*/
create(params: EngagementListInstanceCreateOptions, callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>;
/**
* Create a EngagementInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance with HTTP metadata
*/
createWithHttpInfo(params: EngagementListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<EngagementInstance>) => any): Promise<ApiResponse<EngagementInstance>>;
/**
* Streams EngagementInstance 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 { EngagementListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void;
each(params: EngagementListInstanceEachOptions, callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void;
/**
* Streams EngagementInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { EngagementListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: EngagementListInstanceEachOptions, callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of EngagementInstance 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: EngagementPage) => any): Promise<EngagementPage>;
/**
* Retrieve a single target page of EngagementInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<EngagementPage>) => any): Promise<ApiResponse<EngagementPage>>;
/**
* Lists EngagementInstance 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 { EngagementListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: EngagementInstance[]) => any): Promise<EngagementInstance[]>;
list(params: EngagementListInstanceOptions, callback?: (error: Error | null, items: EngagementInstance[]) => any): Promise<EngagementInstance[]>;
/**
* Lists EngagementInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EngagementListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EngagementInstance[]>) => any): Promise<ApiResponse<EngagementInstance[]>>;
listWithHttpInfo(params: EngagementListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<EngagementInstance[]>) => any): Promise<ApiResponse<EngagementInstance[]>>;
/**
* Retrieve a single page of EngagementInstance 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 { EngagementListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: EngagementPage) => any): Promise<EngagementPage>;
page(params: EngagementListInstancePageOptions, callback?: (error: Error | null, items: EngagementPage) => any): Promise<EngagementPage>;
/**
* Retrieve a single page of EngagementInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { EngagementListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<EngagementPage>) => any): Promise<ApiResponse<EngagementPage>>;
pageWithHttpInfo(params: EngagementListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<EngagementPage>) => any): Promise<ApiResponse<EngagementPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EngagementListInstance(version: V1, flowSid: string): EngagementListInstance;
export declare class EngagementPage extends Page<V1, EngagementPayload, EngagementResource, EngagementInstance> {
/**
* Initialize the EngagementPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: EngagementSolution);
/**
* Build an instance of EngagementInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: EngagementResource): EngagementInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,411 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EngagementPage = exports.EngagementInstance = exports.EngagementContextImpl = void 0;
exports.EngagementListInstance = EngagementListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
const engagementContext_1 = require("./engagement/engagementContext");
const step_1 = require("./engagement/step");
class EngagementContextImpl {
constructor(_version, flowSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, sid };
this._uri = `/Flows/${flowSid}/Engagements/${sid}`;
}
get engagementContext() {
this._engagementContext =
this._engagementContext ||
(0, engagementContext_1.EngagementContextListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._engagementContext;
}
get steps() {
this._steps =
this._steps ||
(0, step_1.StepListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._steps;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new EngagementInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new EngagementInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EngagementContextImpl = EngagementContextImpl;
class EngagementInstance {
constructor(_version, payload, flowSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.contactSid = payload.contact_sid;
this.contactChannelAddress = payload.contact_channel_address;
this.context = payload.context;
this.status = payload.status;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new EngagementContextImpl(this._version, this._solution.flowSid, this._solution.sid);
return this._context;
}
/**
* Remove a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a EngagementInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a EngagementInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the engagementContext.
*/
engagementContext() {
return this._proxy.engagementContext;
}
/**
* Access the steps.
*/
steps() {
return this._proxy.steps;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
contactSid: this.contactSid,
contactChannelAddress: this.contactChannelAddress,
context: this.context,
status: this.status,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EngagementInstance = EngagementInstance;
function EngagementListInstance(version, flowSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new EngagementContextImpl(version, flowSid, sid);
};
instance._version = version;
instance._solution = { flowSid };
instance._uri = `/Flows/${flowSid}/Engagements`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new EngagementInstance(operationVersion, payload, instance._solution.flowSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new EngagementInstance(operationVersion, response.body, instance._solution.flowSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new EngagementPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new EngagementPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new EngagementPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new EngagementPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class EngagementPage extends Page_1.default {
/**
* Initialize the EngagementPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of EngagementInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new EngagementInstance(this._version, payload, this._solution.flowSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EngagementPage = EngagementPage;

View File

@@ -0,0 +1,126 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../../V1";
import { ApiResponse } from "../../../../../base/ApiResponse";
export interface EngagementContextContext {
/**
* Fetch a EngagementContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance
*/
fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>;
/**
* Fetch a EngagementContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementContextInstance>) => any): Promise<ApiResponse<EngagementContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EngagementContextContextSolution {
flowSid: string;
engagementSid: string;
}
export declare class EngagementContextContextImpl implements EngagementContextContext {
protected _version: V1;
protected _solution: EngagementContextContextSolution;
protected _uri: string;
constructor(_version: V1, flowSid: string, engagementSid: string);
fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementContextInstance>) => any): Promise<ApiResponse<EngagementContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EngagementContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EngagementContextResource {
account_sid: string;
context: any;
engagement_sid: string;
flow_sid: string;
url: string;
}
export declare class EngagementContextInstance {
protected _version: V1;
protected _solution: EngagementContextContextSolution;
protected _context?: EngagementContextContext;
constructor(_version: V1, payload: EngagementContextResource, flowSid: string, engagementSid: string);
/**
* The SID of the Account.
*/
accountSid: string;
/**
* As your flow executes, we save the state in what\'s called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the Engagement.
*/
engagementSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a EngagementContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance
*/
fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>;
/**
* Fetch a EngagementContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EngagementContextInstance>) => any): Promise<ApiResponse<EngagementContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
engagementSid: string;
flowSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EngagementContextSolution {
flowSid: string;
engagementSid: string;
}
export interface EngagementContextListInstance {
_version: V1;
_solution: EngagementContextSolution;
_uri: string;
(): EngagementContextContext;
get(): EngagementContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EngagementContextListInstance(version: V1, flowSid: string, engagementSid: string): EngagementContextListInstance;
export {};

View File

@@ -0,0 +1,155 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.EngagementContextInstance = exports.EngagementContextContextImpl = void 0;
exports.EngagementContextListInstance = EngagementContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
class EngagementContextContextImpl {
constructor(_version, flowSid, engagementSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
this._solution = { flowSid, engagementSid };
this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new EngagementContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new EngagementContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.engagementSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EngagementContextContextImpl = EngagementContextContextImpl;
class EngagementContextInstance {
constructor(_version, payload, flowSid, engagementSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.engagementSid = payload.engagement_sid;
this.flowSid = payload.flow_sid;
this.url = payload.url;
this._solution = { flowSid, engagementSid };
}
get _proxy() {
this._context =
this._context ||
new EngagementContextContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid);
return this._context;
}
/**
* Fetch a EngagementContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a EngagementContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EngagementContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
engagementSid: this.engagementSid,
flowSid: this.flowSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EngagementContextInstance = EngagementContextInstance;
function EngagementContextListInstance(version, flowSid, engagementSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new EngagementContextContextImpl(version, flowSid, engagementSid);
};
instance._version = version;
instance._solution = { flowSid, engagementSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,346 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
import Response from "../../../../../http/response";
import V1 from "../../../V1";
import { ApiResponse } from "../../../../../base/ApiResponse";
import { StepContextListInstance } from "./step/stepContext";
/**
* Options to pass to each
*/
export interface StepListInstanceEachOptions {
/** 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: StepInstance, 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 StepListInstanceOptions {
/** 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 StepListInstancePageOptions {
/** 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 StepContext {
stepContext: StepContextListInstance;
/**
* Fetch a StepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance
*/
fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>;
/**
* Fetch a StepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepInstance>) => any): Promise<ApiResponse<StepInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface StepContextSolution {
flowSid: string;
engagementSid: string;
sid: string;
}
export declare class StepContextImpl implements StepContext {
protected _version: V1;
protected _solution: StepContextSolution;
protected _uri: string;
protected _stepContext?: StepContextListInstance;
constructor(_version: V1, flowSid: string, engagementSid: string, sid: string);
get stepContext(): StepContextListInstance;
fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepInstance>) => any): Promise<ApiResponse<StepInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): StepContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface StepPayload extends TwilioResponsePayload {
steps: StepResource[];
}
interface StepResource {
sid: string;
account_sid: string;
flow_sid: string;
engagement_sid: string;
name: string;
context: any;
parent_step_sid: string;
transitioned_from: string;
transitioned_to: string;
type: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class StepInstance {
protected _version: V1;
protected _solution: StepContextSolution;
protected _context?: StepContext;
constructor(_version: V1, payload: StepResource, flowSid: string, engagementSid: string, sid?: string);
/**
* The unique string that we created to identify the Step resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Engagement.
*/
engagementSid: string;
/**
* The event that caused the Flow to transition to the Step.
*/
name: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the parent Step.
*/
parentStepSid: string;
/**
* The Widget that preceded the Widget for the Step.
*/
transitionedFrom: string;
/**
* The Widget that will follow the Widget for the Step.
*/
transitionedTo: string;
/**
* The type of the widget that was executed.
*/
type: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a StepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance
*/
fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>;
/**
* Fetch a StepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepInstance>) => any): Promise<ApiResponse<StepInstance>>;
/**
* Access the stepContext.
*/
stepContext(): StepContextListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
engagementSid: string;
name: string;
context: any;
parentStepSid: string;
transitionedFrom: string;
transitionedTo: string;
type: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface StepSolution {
flowSid: string;
engagementSid: string;
}
export interface StepListInstance {
_version: V1;
_solution: StepSolution;
_uri: string;
(sid: string): StepContext;
get(sid: string): StepContext;
/**
* Streams StepInstance 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 { StepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: StepInstance, done: (err?: Error) => void) => void): void;
each(params: StepListInstanceEachOptions, callback?: (item: StepInstance, done: (err?: Error) => void) => void): void;
/**
* Streams StepInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { StepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: StepInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: StepListInstanceEachOptions, callback?: (item: StepInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of StepInstance 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: StepPage) => any): Promise<StepPage>;
/**
* Retrieve a single target page of StepInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<StepPage>) => any): Promise<ApiResponse<StepPage>>;
/**
* Lists StepInstance 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 { StepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: StepInstance[]) => any): Promise<StepInstance[]>;
list(params: StepListInstanceOptions, callback?: (error: Error | null, items: StepInstance[]) => any): Promise<StepInstance[]>;
/**
* Lists StepInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { StepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<StepInstance[]>) => any): Promise<ApiResponse<StepInstance[]>>;
listWithHttpInfo(params: StepListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<StepInstance[]>) => any): Promise<ApiResponse<StepInstance[]>>;
/**
* Retrieve a single page of StepInstance 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 { StepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: StepPage) => any): Promise<StepPage>;
page(params: StepListInstancePageOptions, callback?: (error: Error | null, items: StepPage) => any): Promise<StepPage>;
/**
* Retrieve a single page of StepInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { StepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<StepPage>) => any): Promise<ApiResponse<StepPage>>;
pageWithHttpInfo(params: StepListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<StepPage>) => any): Promise<ApiResponse<StepPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function StepListInstance(version: V1, flowSid: string, engagementSid: string): StepListInstance;
export declare class StepPage extends Page<V1, StepPayload, StepResource, StepInstance> {
/**
* Initialize the StepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: StepSolution);
/**
* Build an instance of StepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: StepResource): StepInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,303 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepPage = exports.StepInstance = exports.StepContextImpl = void 0;
exports.StepListInstance = StepListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../../base/Page"));
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
const stepContext_1 = require("./step/stepContext");
class StepContextImpl {
constructor(_version, flowSid, engagementSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, engagementSid, sid };
this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps/${sid}`;
}
get stepContext() {
this._stepContext =
this._stepContext ||
(0, stepContext_1.StepContextListInstance)(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.sid);
return this._stepContext;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new StepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new StepInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.engagementSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.StepContextImpl = StepContextImpl;
class StepInstance {
constructor(_version, payload, flowSid, engagementSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.engagementSid = payload.engagement_sid;
this.name = payload.name;
this.context = payload.context;
this.parentStepSid = payload.parent_step_sid;
this.transitionedFrom = payload.transitioned_from;
this.transitionedTo = payload.transitioned_to;
this.type = payload.type;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, engagementSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new StepContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.sid);
return this._context;
}
/**
* Fetch a StepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a StepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the stepContext.
*/
stepContext() {
return this._proxy.stepContext;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
engagementSid: this.engagementSid,
name: this.name,
context: this.context,
parentStepSid: this.parentStepSid,
transitionedFrom: this.transitionedFrom,
transitionedTo: this.transitionedTo,
type: this.type,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.StepInstance = StepInstance;
function StepListInstance(version, flowSid, engagementSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new StepContextImpl(version, flowSid, engagementSid, sid);
};
instance._version = version;
instance._solution = { flowSid, engagementSid };
instance._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new StepPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new StepPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new StepPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new StepPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class StepPage extends Page_1.default {
/**
* Initialize the StepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of StepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new StepInstance(this._version, payload, this._solution.flowSid, this._solution.engagementSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.StepPage = StepPage;

View File

@@ -0,0 +1,134 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../../../V1";
import { ApiResponse } from "../../../../../../base/ApiResponse";
export interface StepContextContext {
/**
* Fetch a StepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance
*/
fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>;
/**
* Fetch a StepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepContextInstance>) => any): Promise<ApiResponse<StepContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface StepContextContextSolution {
flowSid: string;
engagementSid: string;
stepSid: string;
}
export declare class StepContextContextImpl implements StepContextContext {
protected _version: V1;
protected _solution: StepContextContextSolution;
protected _uri: string;
constructor(_version: V1, flowSid: string, engagementSid: string, stepSid: string);
fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepContextInstance>) => any): Promise<ApiResponse<StepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): StepContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface StepContextResource {
account_sid: string;
context: any;
engagement_sid: string;
flow_sid: string;
step_sid: string;
url: string;
}
export declare class StepContextInstance {
protected _version: V1;
protected _solution: StepContextContextSolution;
protected _context?: StepContextContext;
constructor(_version: V1, payload: StepContextResource, flowSid: string, engagementSid: string, stepSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource.
*/
accountSid: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the Engagement.
*/
engagementSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Step the context is associated with.
*/
stepSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a StepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance
*/
fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>;
/**
* Fetch a StepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<StepContextInstance>) => any): Promise<ApiResponse<StepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
engagementSid: string;
flowSid: string;
stepSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface StepContextSolution {
flowSid: string;
engagementSid: string;
stepSid: string;
}
export interface StepContextListInstance {
_version: V1;
_solution: StepContextSolution;
_uri: string;
(): StepContextContext;
get(): StepContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function StepContextListInstance(version: V1, flowSid: string, engagementSid: string, stepSid: string): StepContextListInstance;
export {};

View File

@@ -0,0 +1,163 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepContextInstance = exports.StepContextContextImpl = void 0;
exports.StepContextListInstance = StepContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../../base/deserialize");
const serialize = require("../../../../../../base/serialize");
const utility_1 = require("../../../../../../base/utility");
class StepContextContextImpl {
constructor(_version, flowSid, engagementSid, stepSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
this._solution = { flowSid, engagementSid, stepSid };
this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps/${stepSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new StepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid, instance._solution.stepSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new StepContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.engagementSid, instance._solution.stepSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.StepContextContextImpl = StepContextContextImpl;
class StepContextInstance {
constructor(_version, payload, flowSid, engagementSid, stepSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.engagementSid = payload.engagement_sid;
this.flowSid = payload.flow_sid;
this.stepSid = payload.step_sid;
this.url = payload.url;
this._solution = { flowSid, engagementSid, stepSid };
}
get _proxy() {
this._context =
this._context ||
new StepContextContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.stepSid);
return this._context;
}
/**
* Fetch a StepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a StepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed StepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
engagementSid: this.engagementSid,
flowSid: this.flowSid,
stepSid: this.stepSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.StepContextInstance = StepContextInstance;
function StepContextListInstance(version, flowSid, engagementSid, stepSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(engagementSid)) {
throw new Error("Parameter 'engagementSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new StepContextContextImpl(version, flowSid, engagementSid, stepSid);
};
instance._version = version;
instance._solution = { flowSid, engagementSid, stepSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,455 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
import { ExecutionContextListInstance } from "./execution/executionContext";
import { ExecutionStepListInstance } from "./execution/executionStep";
/**
* The status of the Execution. Can be: `active` or `ended`.
*/
export type ExecutionStatus = "active" | "ended";
/**
* Options to pass to update a ExecutionInstance
*/
export interface ExecutionContextUpdateOptions {
/** */
status: ExecutionStatus;
}
/**
* Options to pass to create a ExecutionInstance
*/
export interface ExecutionListInstanceCreateOptions {
/** The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. */
to: string;
/** The Twilio phone number to send messages or initiate calls from during the Flow\\\'s Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. */
from: string;
/** JSON data that will be added to the Flow\\\'s context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. */
parameters?: any;
}
/**
* Options to pass to each
*/
export interface ExecutionListInstanceEachOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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: ExecutionInstance, 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 ExecutionListInstanceOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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 ExecutionListInstancePageOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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 ExecutionContext {
executionContext: ExecutionContextListInstance;
steps: ExecutionStepListInstance;
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Update a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Update a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionContextSolution {
flowSid: string;
sid: string;
}
export declare class ExecutionContextImpl implements ExecutionContext {
protected _version: V1;
protected _solution: ExecutionContextSolution;
protected _uri: string;
protected _executionContext?: ExecutionContextListInstance;
protected _steps?: ExecutionStepListInstance;
constructor(_version: V1, flowSid: string, sid: string);
get executionContext(): ExecutionContextListInstance;
get steps(): ExecutionStepListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionPayload extends TwilioResponsePayload {
executions: ExecutionResource[];
}
interface ExecutionResource {
sid: string;
account_sid: string;
flow_sid: string;
contact_sid: string;
contact_channel_address: string;
context: any;
status: ExecutionStatus;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class ExecutionInstance {
protected _version: V1;
protected _solution: ExecutionContextSolution;
protected _context?: ExecutionContext;
constructor(_version: V1, payload: ExecutionResource, flowSid: string, sid?: string);
/**
* The unique string that we created to identify the Execution resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Contact.
*/
contactSid: string;
/**
* The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`.
*/
contactChannelAddress: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
status: ExecutionStatus;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of nested resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Update a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Update a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Access the executionContext.
*/
executionContext(): ExecutionContextListInstance;
/**
* Access the steps.
*/
steps(): ExecutionStepListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
contactSid: string;
contactChannelAddress: string;
context: any;
status: ExecutionStatus;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionSolution {
flowSid: string;
}
export interface ExecutionListInstance {
_version: V1;
_solution: ExecutionSolution;
_uri: string;
(sid: string): ExecutionContext;
get(sid: string): ExecutionContext;
/**
* Create a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
create(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Create a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
createWithHttpInfo(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Streams ExecutionInstance 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 { ExecutionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
each(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ExecutionInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { ExecutionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ExecutionInstance 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: ExecutionPage) => any): Promise<ExecutionPage>;
/**
* Retrieve a single target page of ExecutionInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
/**
* Lists ExecutionInstance 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 { ExecutionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>;
list(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>;
/**
* Lists ExecutionInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionInstance[]>) => any): Promise<ApiResponse<ExecutionInstance[]>>;
listWithHttpInfo(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionInstance[]>) => any): Promise<ApiResponse<ExecutionInstance[]>>;
/**
* Retrieve a single page of ExecutionInstance 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 { ExecutionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>;
page(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>;
/**
* Retrieve a single page of ExecutionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
pageWithHttpInfo(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionListInstance(version: V1, flowSid: string): ExecutionListInstance;
export declare class ExecutionPage extends Page<V1, ExecutionPayload, ExecutionResource, ExecutionInstance> {
/**
* Initialize the ExecutionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ExecutionSolution);
/**
* Build an instance of ExecutionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ExecutionResource): ExecutionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,477 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionPage = exports.ExecutionInstance = exports.ExecutionContextImpl = void 0;
exports.ExecutionListInstance = ExecutionListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
const executionContext_1 = require("./execution/executionContext");
const executionStep_1 = require("./execution/executionStep");
class ExecutionContextImpl {
constructor(_version, flowSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, sid };
this._uri = `/Flows/${flowSid}/Executions/${sid}`;
}
get executionContext() {
this._executionContext =
this._executionContext ||
(0, executionContext_1.ExecutionContextListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._executionContext;
}
get steps() {
this._steps =
this._steps ||
(0, executionStep_1.ExecutionStepListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._steps;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextImpl = ExecutionContextImpl;
class ExecutionInstance {
constructor(_version, payload, flowSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.contactSid = payload.contact_sid;
this.contactChannelAddress = payload.contact_channel_address;
this.context = payload.context;
this.status = payload.status;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionContextImpl(this._version, this._solution.flowSid, this._solution.sid);
return this._context;
}
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the executionContext.
*/
executionContext() {
return this._proxy.executionContext;
}
/**
* Access the steps.
*/
steps() {
return this._proxy.steps;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
contactSid: this.contactSid,
contactChannelAddress: this.contactChannelAddress,
context: this.context,
status: this.status,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionInstance = ExecutionInstance;
function ExecutionListInstance(version, flowSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ExecutionContextImpl(version, flowSid, sid);
};
instance._version = version;
instance._solution = { flowSid };
instance._uri = `/Flows/${flowSid}/Executions`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["dateCreatedFrom"] !== undefined)
data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]);
if (params["dateCreatedTo"] !== undefined)
data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]);
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ExecutionPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["dateCreatedFrom"] !== undefined)
data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]);
if (params["dateCreatedTo"] !== undefined)
data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]);
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ExecutionPage extends Page_1.default {
/**
* Initialize the ExecutionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ExecutionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ExecutionInstance(this._version, payload, this._solution.flowSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionPage = ExecutionPage;

View File

@@ -0,0 +1,126 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../../V1";
import { ApiResponse } from "../../../../../base/ApiResponse";
export interface ExecutionContextContext {
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionContextContextSolution {
flowSid: string;
executionSid: string;
}
export declare class ExecutionContextContextImpl implements ExecutionContextContext {
protected _version: V1;
protected _solution: ExecutionContextContextSolution;
protected _uri: string;
constructor(_version: V1, flowSid: string, executionSid: string);
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionContextResource {
account_sid: string;
context: any;
flow_sid: string;
execution_sid: string;
url: string;
}
export declare class ExecutionContextInstance {
protected _version: V1;
protected _solution: ExecutionContextContextSolution;
protected _context?: ExecutionContextContext;
constructor(_version: V1, payload: ExecutionContextResource, flowSid: string, executionSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource.
*/
accountSid: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the context\'s Execution resource.
*/
executionSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
flowSid: string;
executionSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionContextSolution {
flowSid: string;
executionSid: string;
}
export interface ExecutionContextListInstance {
_version: V1;
_solution: ExecutionContextSolution;
_uri: string;
(): ExecutionContextContext;
get(): ExecutionContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionContextListInstance(version: V1, flowSid: string, executionSid: string): ExecutionContextListInstance;
export {};

View File

@@ -0,0 +1,155 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionContextInstance = exports.ExecutionContextContextImpl = void 0;
exports.ExecutionContextListInstance = ExecutionContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
class ExecutionContextContextImpl {
constructor(_version, flowSid, executionSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
this._solution = { flowSid, executionSid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextContextImpl = ExecutionContextContextImpl;
class ExecutionContextInstance {
constructor(_version, payload, flowSid, executionSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.flowSid = payload.flow_sid;
this.executionSid = payload.execution_sid;
this.url = payload.url;
this._solution = { flowSid, executionSid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid);
return this._context;
}
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
flowSid: this.flowSid,
executionSid: this.executionSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextInstance = ExecutionContextInstance;
function ExecutionContextListInstance(version, flowSid, executionSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new ExecutionContextContextImpl(version, flowSid, executionSid);
};
instance._version = version;
instance._solution = { flowSid, executionSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,346 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
import Response from "../../../../../http/response";
import V1 from "../../../V1";
import { ApiResponse } from "../../../../../base/ApiResponse";
import { ExecutionStepContextListInstance } from "./executionStep/executionStepContext";
/**
* Options to pass to each
*/
export interface ExecutionStepListInstanceEachOptions {
/** 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: ExecutionStepInstance, 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 ExecutionStepListInstanceOptions {
/** 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 ExecutionStepListInstancePageOptions {
/** 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 ExecutionStepContext {
stepContext: ExecutionStepContextListInstance;
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionStepContextSolution {
flowSid: string;
executionSid: string;
sid: string;
}
export declare class ExecutionStepContextImpl implements ExecutionStepContext {
protected _version: V1;
protected _solution: ExecutionStepContextSolution;
protected _uri: string;
protected _stepContext?: ExecutionStepContextListInstance;
constructor(_version: V1, flowSid: string, executionSid: string, sid: string);
get stepContext(): ExecutionStepContextListInstance;
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionStepContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionStepPayload extends TwilioResponsePayload {
steps: ExecutionStepResource[];
}
interface ExecutionStepResource {
sid: string;
account_sid: string;
flow_sid: string;
execution_sid: string;
parent_step_sid: string;
name: string;
context: any;
transitioned_from: string;
transitioned_to: string;
type: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class ExecutionStepInstance {
protected _version: V1;
protected _solution: ExecutionStepContextSolution;
protected _context?: ExecutionStepContext;
constructor(_version: V1, payload: ExecutionStepResource, flowSid: string, executionSid: string, sid?: string);
/**
* The unique string that we created to identify the ExecutionStep resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Step\'s Execution resource.
*/
executionSid: string;
/**
* This field shows the Step SID of the Widget in the parent Flow that started the Subflow. If this Step is not part of a Subflow execution, the value is null.
*/
parentStepSid: string;
/**
* The event that caused the Flow to transition to the Step.
*/
name: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The Widget that preceded the Widget for the Step.
*/
transitionedFrom: string;
/**
* The Widget that will follow the Widget for the Step.
*/
transitionedTo: string;
/**
* The type of the widget that was executed.
*/
type: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Access the stepContext.
*/
stepContext(): ExecutionStepContextListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
executionSid: string;
parentStepSid: string;
name: string;
context: any;
transitionedFrom: string;
transitionedTo: string;
type: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionStepSolution {
flowSid: string;
executionSid: string;
}
export interface ExecutionStepListInstance {
_version: V1;
_solution: ExecutionStepSolution;
_uri: string;
(sid: string): ExecutionStepContext;
get(sid: string): ExecutionStepContext;
/**
* Streams ExecutionStepInstance 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
each(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ExecutionStepInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ExecutionStepInstance 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: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
/**
* Retrieve a single target page of ExecutionStepInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
/**
* Lists ExecutionStepInstance 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 { ExecutionStepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>;
list(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>;
/**
* Lists ExecutionStepInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionStepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionStepInstance[]>) => any): Promise<ApiResponse<ExecutionStepInstance[]>>;
listWithHttpInfo(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionStepInstance[]>) => any): Promise<ApiResponse<ExecutionStepInstance[]>>;
/**
* Retrieve a single page of ExecutionStepInstance 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 { ExecutionStepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
page(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
/**
* Retrieve a single page of ExecutionStepInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionStepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
pageWithHttpInfo(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionStepListInstance(version: V1, flowSid: string, executionSid: string): ExecutionStepListInstance;
export declare class ExecutionStepPage extends Page<V1, ExecutionStepPayload, ExecutionStepResource, ExecutionStepInstance> {
/**
* Initialize the ExecutionStepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ExecutionStepSolution);
/**
* Build an instance of ExecutionStepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ExecutionStepResource): ExecutionStepInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,303 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionStepPage = exports.ExecutionStepInstance = exports.ExecutionStepContextImpl = void 0;
exports.ExecutionStepListInstance = ExecutionStepListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../../base/Page"));
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
const executionStepContext_1 = require("./executionStep/executionStepContext");
class ExecutionStepContextImpl {
constructor(_version, flowSid, executionSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, executionSid, sid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${sid}`;
}
get stepContext() {
this._stepContext =
this._stepContext ||
(0, executionStepContext_1.ExecutionStepContextListInstance)(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid);
return this._stepContext;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionStepInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextImpl = ExecutionStepContextImpl;
class ExecutionStepInstance {
constructor(_version, payload, flowSid, executionSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.executionSid = payload.execution_sid;
this.parentStepSid = payload.parent_step_sid;
this.name = payload.name;
this.context = payload.context;
this.transitionedFrom = payload.transitioned_from;
this.transitionedTo = payload.transitioned_to;
this.type = payload.type;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, executionSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionStepContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid);
return this._context;
}
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the stepContext.
*/
stepContext() {
return this._proxy.stepContext;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
executionSid: this.executionSid,
parentStepSid: this.parentStepSid,
name: this.name,
context: this.context,
transitionedFrom: this.transitionedFrom,
transitionedTo: this.transitionedTo,
type: this.type,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepInstance = ExecutionStepInstance;
function ExecutionStepListInstance(version, flowSid, executionSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ExecutionStepContextImpl(version, flowSid, executionSid, sid);
};
instance._version = version;
instance._solution = { flowSid, executionSid };
instance._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ExecutionStepPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionStepPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionStepPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ExecutionStepPage extends Page_1.default {
/**
* Initialize the ExecutionStepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ExecutionStepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ExecutionStepInstance(this._version, payload, this._solution.flowSid, this._solution.executionSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepPage = ExecutionStepPage;

View File

@@ -0,0 +1,134 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../../../V1";
import { ApiResponse } from "../../../../../../base/ApiResponse";
export interface ExecutionStepContextContext {
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionStepContextContextSolution {
flowSid: string;
executionSid: string;
stepSid: string;
}
export declare class ExecutionStepContextContextImpl implements ExecutionStepContextContext {
protected _version: V1;
protected _solution: ExecutionStepContextContextSolution;
protected _uri: string;
constructor(_version: V1, flowSid: string, executionSid: string, stepSid: string);
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionStepContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionStepContextResource {
account_sid: string;
context: any;
execution_sid: string;
flow_sid: string;
step_sid: string;
url: string;
}
export declare class ExecutionStepContextInstance {
protected _version: V1;
protected _solution: ExecutionStepContextContextSolution;
protected _context?: ExecutionStepContextContext;
constructor(_version: V1, payload: ExecutionStepContextResource, flowSid: string, executionSid: string, stepSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource.
*/
accountSid: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the context\'s Execution resource.
*/
executionSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Step that the context is associated with.
*/
stepSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
executionSid: string;
flowSid: string;
stepSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionStepContextSolution {
flowSid: string;
executionSid: string;
stepSid: string;
}
export interface ExecutionStepContextListInstance {
_version: V1;
_solution: ExecutionStepContextSolution;
_uri: string;
(): ExecutionStepContextContext;
get(): ExecutionStepContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionStepContextListInstance(version: V1, flowSid: string, executionSid: string, stepSid: string): ExecutionStepContextListInstance;
export {};

View File

@@ -0,0 +1,163 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionStepContextInstance = exports.ExecutionStepContextContextImpl = void 0;
exports.ExecutionStepContextListInstance = ExecutionStepContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../../base/deserialize");
const serialize = require("../../../../../../base/serialize");
const utility_1 = require("../../../../../../base/utility");
class ExecutionStepContextContextImpl {
constructor(_version, flowSid, executionSid, stepSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
this._solution = { flowSid, executionSid, stepSid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${stepSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionStepContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextContextImpl = ExecutionStepContextContextImpl;
class ExecutionStepContextInstance {
constructor(_version, payload, flowSid, executionSid, stepSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.executionSid = payload.execution_sid;
this.flowSid = payload.flow_sid;
this.stepSid = payload.step_sid;
this.url = payload.url;
this._solution = { flowSid, executionSid, stepSid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionStepContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.stepSid);
return this._context;
}
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
executionSid: this.executionSid,
flowSid: this.flowSid,
stepSid: this.stepSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextInstance = ExecutionStepContextInstance;
function ExecutionStepContextListInstance(version, flowSid, executionSid, stepSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new ExecutionStepContextContextImpl(version, flowSid, executionSid, stepSid);
};
instance._version = version;
instance._solution = { flowSid, executionSid, stepSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

484
node_modules/twilio/lib/rest/studio/v2/flow.d.ts generated vendored Normal file
View File

@@ -0,0 +1,484 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
import { ExecutionListInstance } from "./flow/execution";
import { FlowRevisionListInstance } from "./flow/flowRevision";
import { FlowTestUserListInstance } from "./flow/flowTestUser";
/**
* The status of the Flow. Can be: `draft` or `published`.
*/
export type FlowStatus = "draft" | "published";
/**
* Options to pass to update a FlowInstance
*/
export interface FlowContextUpdateOptions {
/** */
status: FlowStatus;
/** The string that you assigned to describe the Flow. */
friendlyName?: string;
/** JSON representation of flow definition. */
definition?: any;
/** Description of change made in the revision. */
commitMessage?: string;
}
/**
* Options to pass to create a FlowInstance
*/
export interface FlowListInstanceCreateOptions {
/** The string that you assigned to describe the Flow. */
friendlyName: string;
/** */
status: FlowStatus;
/** JSON representation of flow definition. */
definition: any;
/** Description of change made in the revision. */
commitMessage?: string;
}
/**
* Options to pass to each
*/
export interface FlowListInstanceEachOptions {
/** 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: FlowInstance, 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 FlowListInstanceOptions {
/** 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 FlowListInstancePageOptions {
/** 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 FlowContext {
executions: ExecutionListInstance;
revisions: FlowRevisionListInstance;
testUsers: FlowTestUserListInstance;
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Update a FlowInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Update a FlowInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
updateWithHttpInfo(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface FlowContextSolution {
sid: string;
}
export declare class FlowContextImpl implements FlowContext {
protected _version: V2;
protected _solution: FlowContextSolution;
protected _uri: string;
protected _executions?: ExecutionListInstance;
protected _revisions?: FlowRevisionListInstance;
protected _testUsers?: FlowTestUserListInstance;
constructor(_version: V2, sid: string);
get executions(): ExecutionListInstance;
get revisions(): FlowRevisionListInstance;
get testUsers(): FlowTestUserListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
updateWithHttpInfo(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): FlowContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface FlowPayload extends TwilioResponsePayload {
flows: FlowResource[];
}
interface FlowResource {
sid: string;
account_sid: string;
author_sid: string;
friendly_name: string;
definition: any;
status: FlowStatus;
revision: number;
commit_message: string;
valid: boolean;
errors: Array<any>;
warnings: Array<any>;
date_created: Date;
date_updated: Date;
webhook_url: string;
url: string;
links: Record<string, string>;
}
export declare class FlowInstance {
protected _version: V2;
protected _solution: FlowContextSolution;
protected _context?: FlowContext;
constructor(_version: V2, payload: FlowResource, sid?: string);
/**
* The unique string that we created to identify the Flow resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource.
*/
accountSid: string;
/**
* The SID of the User that created or last updated the Flow.
*/
authorSid: string;
/**
* The string that you assigned to describe the Flow.
*/
friendlyName: string;
/**
* JSON representation of flow definition.
*/
definition: any;
status: FlowStatus;
/**
* The latest revision number of the Flow\'s definition.
*/
revision: number;
/**
* Description of change made in the revision.
*/
commitMessage: string;
/**
* Boolean if the flow definition is valid.
*/
valid: boolean;
/**
* List of error in the flow definition.
*/
errors: Array<any>;
/**
* List of warnings in the flow definition.
*/
warnings: Array<any>;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
webhookUrl: string;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of the Flow\'s nested resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Update a FlowInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Update a FlowInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
updateWithHttpInfo(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Access the executions.
*/
executions(): ExecutionListInstance;
/**
* Access the revisions.
*/
revisions(): FlowRevisionListInstance;
/**
* Access the testUsers.
*/
testUsers(): FlowTestUserListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
authorSid: string;
friendlyName: string;
definition: any;
status: FlowStatus;
revision: number;
commitMessage: string;
valid: boolean;
errors: any[];
warnings: any[];
dateCreated: Date;
dateUpdated: Date;
webhookUrl: string;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface FlowSolution {
}
export interface FlowListInstance {
_version: V2;
_solution: FlowSolution;
_uri: string;
(sid: string): FlowContext;
get(sid: string): FlowContext;
/**
* Create a FlowInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
create(params: FlowListInstanceCreateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>;
/**
* Create a FlowInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
createWithHttpInfo(params: FlowListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowInstance>) => any): Promise<ApiResponse<FlowInstance>>;
/**
* Streams FlowInstance 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 { FlowListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
each(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
/**
* Streams FlowInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { FlowListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of FlowInstance 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: FlowPage) => any): Promise<FlowPage>;
/**
* Retrieve a single target page of FlowInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
/**
* Lists FlowInstance 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 { FlowListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>;
list(params: FlowListInstanceOptions, callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>;
/**
* Lists FlowInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowInstance[]>) => any): Promise<ApiResponse<FlowInstance[]>>;
listWithHttpInfo(params: FlowListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FlowInstance[]>) => any): Promise<ApiResponse<FlowInstance[]>>;
/**
* Retrieve a single page of FlowInstance 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 { FlowListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>;
page(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>;
/**
* Retrieve a single page of FlowInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
pageWithHttpInfo(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FlowPage>) => any): Promise<ApiResponse<FlowPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FlowListInstance(version: V2): FlowListInstance;
export declare class FlowPage extends Page<V2, FlowPayload, FlowResource, FlowInstance> {
/**
* Initialize the FlowPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: FlowSolution);
/**
* Build an instance of FlowInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: FlowResource): FlowInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

507
node_modules/twilio/lib/rest/studio/v2/flow.js generated vendored Normal file
View File

@@ -0,0 +1,507 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowPage = exports.FlowInstance = exports.FlowContextImpl = void 0;
exports.FlowListInstance = FlowListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
const execution_1 = require("./flow/execution");
const flowRevision_1 = require("./flow/flowRevision");
const flowTestUser_1 = require("./flow/flowTestUser");
class FlowContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Flows/${sid}`;
}
get executions() {
this._executions =
this._executions ||
(0, execution_1.ExecutionListInstance)(this._version, this._solution.sid);
return this._executions;
}
get revisions() {
this._revisions =
this._revisions ||
(0, flowRevision_1.FlowRevisionListInstance)(this._version, this._solution.sid);
return this._revisions;
}
get testUsers() {
this._testUsers =
this._testUsers ||
(0, flowTestUser_1.FlowTestUserListInstance)(this._version, this._solution.sid);
return this._testUsers;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new FlowInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["definition"] !== undefined)
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["definition"] !== undefined)
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new FlowInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowContextImpl = FlowContextImpl;
class FlowInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.authorSid = payload.author_sid;
this.friendlyName = payload.friendly_name;
this.definition = payload.definition;
this.status = payload.status;
this.revision = deserialize.integer(payload.revision);
this.commitMessage = payload.commit_message;
this.valid = payload.valid;
this.errors = payload.errors;
this.warnings = payload.warnings;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.webhookUrl = payload.webhook_url;
this.url = payload.url;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context || new FlowContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a FlowInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a FlowInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the executions.
*/
executions() {
return this._proxy.executions;
}
/**
* Access the revisions.
*/
revisions() {
return this._proxy.revisions;
}
/**
* Access the testUsers.
*/
testUsers() {
return this._proxy.testUsers;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
authorSid: this.authorSid,
friendlyName: this.friendlyName,
definition: this.definition,
status: this.status,
revision: this.revision,
commitMessage: this.commitMessage,
valid: this.valid,
errors: this.errors,
warnings: this.warnings,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
webhookUrl: this.webhookUrl,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowInstance = FlowInstance;
function FlowListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new FlowContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Flows`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
if (params["definition"] === null || params["definition"] === undefined) {
throw new Error("Required parameter \"params['definition']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Status"] = params["status"];
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
if (params["definition"] === null || params["definition"] === undefined) {
throw new Error("Required parameter \"params['definition']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Status"] = params["status"];
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new FlowInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new FlowPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class FlowPage extends Page_1.default {
/**
* Initialize the FlowPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of FlowInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new FlowInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowPage = FlowPage;

View File

@@ -0,0 +1,461 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
import { ExecutionContextListInstance } from "./execution/executionContext";
import { ExecutionStepListInstance } from "./execution/executionStep";
/**
* The status of the Execution. Can be: `active` or `ended`.
*/
export type ExecutionStatus = "active" | "ended";
/**
* Options to pass to update a ExecutionInstance
*/
export interface ExecutionContextUpdateOptions {
/** */
status: ExecutionStatus;
}
/**
* Options to pass to create a ExecutionInstance
*/
export interface ExecutionListInstanceCreateOptions {
/** The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. */
to: string;
/** The Twilio phone number to send messages or initiate calls from during the Flow\\\'s Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. */
from: string;
/** JSON data that will be added to the Flow\\\'s context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. */
parameters?: any;
}
/**
* Options to pass to each
*/
export interface ExecutionListInstanceEachOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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: ExecutionInstance, 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 ExecutionListInstanceOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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 ExecutionListInstancePageOptions {
/** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedFrom?: Date;
/** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */
dateCreatedTo?: Date;
/** 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 ExecutionContext {
executionContext: ExecutionContextListInstance;
steps: ExecutionStepListInstance;
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Update a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Update a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionContextSolution {
flowSid: string;
sid: string;
}
export declare class ExecutionContextImpl implements ExecutionContext {
protected _version: V2;
protected _solution: ExecutionContextSolution;
protected _uri: string;
protected _executionContext?: ExecutionContextListInstance;
protected _steps?: ExecutionStepListInstance;
constructor(_version: V2, flowSid: string, sid: string);
get executionContext(): ExecutionContextListInstance;
get steps(): ExecutionStepListInstance;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionPayload extends TwilioResponsePayload {
executions: ExecutionResource[];
}
interface ExecutionResource {
sid: string;
account_sid: string;
flow_sid: string;
contact_channel_address: string;
contact_sid: string;
flow_version: number;
context: any;
status: ExecutionStatus;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class ExecutionInstance {
protected _version: V2;
protected _solution: ExecutionContextSolution;
protected _context?: ExecutionContext;
constructor(_version: V2, payload: ExecutionResource, flowSid: string, sid?: string);
/**
* The unique string that we created to identify the Execution resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`.
*/
contactChannelAddress: string;
/**
* The SID of the Contact.
*/
contactSid: string;
/**
* The Flow version number at the time of Execution creation.
*/
flowVersion: number;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
status: ExecutionStatus;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of nested resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Update a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Update a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
updateWithHttpInfo(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Access the executionContext.
*/
executionContext(): ExecutionContextListInstance;
/**
* Access the steps.
*/
steps(): ExecutionStepListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
contactChannelAddress: string;
contactSid: string;
flowVersion: number;
context: any;
status: ExecutionStatus;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionSolution {
flowSid: string;
}
export interface ExecutionListInstance {
_version: V2;
_solution: ExecutionSolution;
_uri: string;
(sid: string): ExecutionContext;
get(sid: string): ExecutionContext;
/**
* Create a ExecutionInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
create(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>;
/**
* Create a ExecutionInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
createWithHttpInfo(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ExecutionInstance>) => any): Promise<ApiResponse<ExecutionInstance>>;
/**
* Streams ExecutionInstance 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 { ExecutionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
each(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ExecutionInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { ExecutionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ExecutionInstance 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: ExecutionPage) => any): Promise<ExecutionPage>;
/**
* Retrieve a single target page of ExecutionInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
/**
* Lists ExecutionInstance 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 { ExecutionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>;
list(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>;
/**
* Lists ExecutionInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionInstance[]>) => any): Promise<ApiResponse<ExecutionInstance[]>>;
listWithHttpInfo(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionInstance[]>) => any): Promise<ApiResponse<ExecutionInstance[]>>;
/**
* Retrieve a single page of ExecutionInstance 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 { ExecutionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>;
page(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>;
/**
* Retrieve a single page of ExecutionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
pageWithHttpInfo(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionPage>) => any): Promise<ApiResponse<ExecutionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionListInstance(version: V2, flowSid: string): ExecutionListInstance;
export declare class ExecutionPage extends Page<V2, ExecutionPayload, ExecutionResource, ExecutionInstance> {
/**
* Initialize the ExecutionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ExecutionSolution);
/**
* Build an instance of ExecutionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ExecutionResource): ExecutionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,479 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionPage = exports.ExecutionInstance = exports.ExecutionContextImpl = void 0;
exports.ExecutionListInstance = ExecutionListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
const executionContext_1 = require("./execution/executionContext");
const executionStep_1 = require("./execution/executionStep");
class ExecutionContextImpl {
constructor(_version, flowSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, sid };
this._uri = `/Flows/${flowSid}/Executions/${sid}`;
}
get executionContext() {
this._executionContext =
this._executionContext ||
(0, executionContext_1.ExecutionContextListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._executionContext;
}
get steps() {
this._steps =
this._steps ||
(0, executionStep_1.ExecutionStepListInstance)(this._version, this._solution.flowSid, this._solution.sid);
return this._steps;
}
remove(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.remove({
uri: instance._uri,
method: "delete",
headers,
});
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
removeWithHttpInfo(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version;
// DELETE operation - returns boolean based on status code
let operationPromise = operationVersion
.removeWithResponseInfo({ uri: instance._uri, method: "delete", headers })
.then((response) => ({
...response,
body: response.statusCode === 204,
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
let data = {};
data["Status"] = params["status"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextImpl = ExecutionContextImpl;
class ExecutionInstance {
constructor(_version, payload, flowSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.contactChannelAddress = payload.contact_channel_address;
this.contactSid = payload.contact_sid;
this.flowVersion = deserialize.integer(payload.flow_version);
this.context = payload.context;
this.status = payload.status;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionContextImpl(this._version, this._solution.flowSid, this._solution.sid);
return this._context;
}
/**
* Remove a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean with HTTP metadata
*/
removeWithHttpInfo(callback) {
return this._proxy.removeWithHttpInfo(callback);
}
/**
* Fetch a ExecutionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the executionContext.
*/
executionContext() {
return this._proxy.executionContext;
}
/**
* Access the steps.
*/
steps() {
return this._proxy.steps;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
contactChannelAddress: this.contactChannelAddress,
contactSid: this.contactSid,
flowVersion: this.flowVersion,
context: this.context,
status: this.status,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionInstance = ExecutionInstance;
function ExecutionListInstance(version, flowSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ExecutionContextImpl(version, flowSid, sid);
};
instance._version = version;
instance._solution = { flowSid };
instance._uri = `/Flows/${flowSid}/Executions`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["to"] === null || params["to"] === undefined) {
throw new Error("Required parameter \"params['to']\" missing.");
}
if (params["from"] === null || params["from"] === undefined) {
throw new Error("Required parameter \"params['from']\" missing.");
}
let data = {};
data["To"] = params["to"];
data["From"] = params["from"];
if (params["parameters"] !== undefined)
data["Parameters"] = serialize.object(params["parameters"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new ExecutionInstance(operationVersion, response.body, instance._solution.flowSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["dateCreatedFrom"] !== undefined)
data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]);
if (params["dateCreatedTo"] !== undefined)
data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]);
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ExecutionPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["dateCreatedFrom"] !== undefined)
data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]);
if (params["dateCreatedTo"] !== undefined)
data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]);
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ExecutionPage extends Page_1.default {
/**
* Initialize the ExecutionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ExecutionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ExecutionInstance(this._version, payload, this._solution.flowSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionPage = ExecutionPage;

View File

@@ -0,0 +1,126 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../../V2";
import { ApiResponse } from "../../../../../base/ApiResponse";
export interface ExecutionContextContext {
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionContextContextSolution {
flowSid: string;
executionSid: string;
}
export declare class ExecutionContextContextImpl implements ExecutionContextContext {
protected _version: V2;
protected _solution: ExecutionContextContextSolution;
protected _uri: string;
constructor(_version: V2, flowSid: string, executionSid: string);
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionContextResource {
account_sid: string;
context: any;
flow_sid: string;
execution_sid: string;
url: string;
}
export declare class ExecutionContextInstance {
protected _version: V2;
protected _solution: ExecutionContextContextSolution;
protected _context?: ExecutionContextContext;
constructor(_version: V2, payload: ExecutionContextResource, flowSid: string, executionSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource.
*/
accountSid: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the context\'s Execution resource.
*/
executionSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>;
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionContextInstance>) => any): Promise<ApiResponse<ExecutionContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
flowSid: string;
executionSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionContextSolution {
flowSid: string;
executionSid: string;
}
export interface ExecutionContextListInstance {
_version: V2;
_solution: ExecutionContextSolution;
_uri: string;
(): ExecutionContextContext;
get(): ExecutionContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionContextListInstance(version: V2, flowSid: string, executionSid: string): ExecutionContextListInstance;
export {};

View File

@@ -0,0 +1,155 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionContextInstance = exports.ExecutionContextContextImpl = void 0;
exports.ExecutionContextListInstance = ExecutionContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
class ExecutionContextContextImpl {
constructor(_version, flowSid, executionSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
this._solution = { flowSid, executionSid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextContextImpl = ExecutionContextContextImpl;
class ExecutionContextInstance {
constructor(_version, payload, flowSid, executionSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.flowSid = payload.flow_sid;
this.executionSid = payload.execution_sid;
this.url = payload.url;
this._solution = { flowSid, executionSid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid);
return this._context;
}
/**
* Fetch a ExecutionContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
flowSid: this.flowSid,
executionSid: this.executionSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionContextInstance = ExecutionContextInstance;
function ExecutionContextListInstance(version, flowSid, executionSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new ExecutionContextContextImpl(version, flowSid, executionSid);
};
instance._version = version;
instance._solution = { flowSid, executionSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,346 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../../base/Page";
import Response from "../../../../../http/response";
import V2 from "../../../V2";
import { ApiResponse } from "../../../../../base/ApiResponse";
import { ExecutionStepContextListInstance } from "./executionStep/executionStepContext";
/**
* Options to pass to each
*/
export interface ExecutionStepListInstanceEachOptions {
/** 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: ExecutionStepInstance, 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 ExecutionStepListInstanceOptions {
/** 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 ExecutionStepListInstancePageOptions {
/** 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 ExecutionStepContext {
stepContext: ExecutionStepContextListInstance;
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionStepContextSolution {
flowSid: string;
executionSid: string;
sid: string;
}
export declare class ExecutionStepContextImpl implements ExecutionStepContext {
protected _version: V2;
protected _solution: ExecutionStepContextSolution;
protected _uri: string;
protected _stepContext?: ExecutionStepContextListInstance;
constructor(_version: V2, flowSid: string, executionSid: string, sid: string);
get stepContext(): ExecutionStepContextListInstance;
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionStepContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionStepPayload extends TwilioResponsePayload {
steps: ExecutionStepResource[];
}
interface ExecutionStepResource {
sid: string;
account_sid: string;
flow_sid: string;
execution_sid: string;
parent_step_sid: string;
name: string;
context: any;
transitioned_from: string;
transitioned_to: string;
type: string;
date_created: Date;
date_updated: Date;
url: string;
links: Record<string, string>;
}
export declare class ExecutionStepInstance {
protected _version: V2;
protected _solution: ExecutionStepContextSolution;
protected _context?: ExecutionStepContext;
constructor(_version: V2, payload: ExecutionStepResource, flowSid: string, executionSid: string, sid?: string);
/**
* The unique string that we created to identify the ExecutionStep resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource.
*/
accountSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Step\'s Execution resource.
*/
executionSid: string;
/**
* The SID of the parent Step.
*/
parentStepSid: string;
/**
* The event that caused the Flow to transition to the Step.
*/
name: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The Widget that preceded the Widget for the Step.
*/
transitionedFrom: string;
/**
* The Widget that will follow the Widget for the Step.
*/
transitionedTo: string;
/**
* The type of the widget that was executed.
*/
type: string;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
/**
* The URLs of related resources.
*/
links: Record<string, string>;
private get _proxy();
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>;
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepInstance>) => any): Promise<ApiResponse<ExecutionStepInstance>>;
/**
* Access the stepContext.
*/
stepContext(): ExecutionStepContextListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
flowSid: string;
executionSid: string;
parentStepSid: string;
name: string;
context: any;
transitionedFrom: string;
transitionedTo: string;
type: string;
dateCreated: Date;
dateUpdated: Date;
url: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionStepSolution {
flowSid: string;
executionSid: string;
}
export interface ExecutionStepListInstance {
_version: V2;
_solution: ExecutionStepSolution;
_uri: string;
(sid: string): ExecutionStepContext;
get(sid: string): ExecutionStepContext;
/**
* Streams ExecutionStepInstance 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
each(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ExecutionStepInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ExecutionStepInstance 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: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
/**
* Retrieve a single target page of ExecutionStepInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
/**
* Lists ExecutionStepInstance 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 { ExecutionStepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>;
list(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>;
/**
* Lists ExecutionStepInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionStepListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionStepInstance[]>) => any): Promise<ApiResponse<ExecutionStepInstance[]>>;
listWithHttpInfo(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionStepInstance[]>) => any): Promise<ApiResponse<ExecutionStepInstance[]>>;
/**
* Retrieve a single page of ExecutionStepInstance 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 { ExecutionStepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
page(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>;
/**
* Retrieve a single page of ExecutionStepInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { ExecutionStepListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
pageWithHttpInfo(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ExecutionStepPage>) => any): Promise<ApiResponse<ExecutionStepPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionStepListInstance(version: V2, flowSid: string, executionSid: string): ExecutionStepListInstance;
export declare class ExecutionStepPage extends Page<V2, ExecutionStepPayload, ExecutionStepResource, ExecutionStepInstance> {
/**
* Initialize the ExecutionStepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ExecutionStepSolution);
/**
* Build an instance of ExecutionStepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ExecutionStepResource): ExecutionStepInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,303 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionStepPage = exports.ExecutionStepInstance = exports.ExecutionStepContextImpl = void 0;
exports.ExecutionStepListInstance = ExecutionStepListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../../base/Page"));
const deserialize = require("../../../../../base/deserialize");
const serialize = require("../../../../../base/serialize");
const utility_1 = require("../../../../../base/utility");
const executionStepContext_1 = require("./executionStep/executionStepContext");
class ExecutionStepContextImpl {
constructor(_version, flowSid, executionSid, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { flowSid, executionSid, sid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${sid}`;
}
get stepContext() {
this._stepContext =
this._stepContext ||
(0, executionStepContext_1.ExecutionStepContextListInstance)(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid);
return this._stepContext;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionStepInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextImpl = ExecutionStepContextImpl;
class ExecutionStepInstance {
constructor(_version, payload, flowSid, executionSid, sid) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.flowSid = payload.flow_sid;
this.executionSid = payload.execution_sid;
this.parentStepSid = payload.parent_step_sid;
this.name = payload.name;
this.context = payload.context;
this.transitionedFrom = payload.transitioned_from;
this.transitionedTo = payload.transitioned_to;
this.type = payload.type;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this.links = payload.links;
this._solution = { flowSid, executionSid, sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionStepContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid);
return this._context;
}
/**
* Fetch a ExecutionStepInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionStepInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the stepContext.
*/
stepContext() {
return this._proxy.stepContext;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
flowSid: this.flowSid,
executionSid: this.executionSid,
parentStepSid: this.parentStepSid,
name: this.name,
context: this.context,
transitionedFrom: this.transitionedFrom,
transitionedTo: this.transitionedTo,
type: this.type,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepInstance = ExecutionStepInstance;
function ExecutionStepListInstance(version, flowSid, executionSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ExecutionStepContextImpl(version, flowSid, executionSid, sid);
};
instance._version = version;
instance._solution = { flowSid, executionSid };
instance._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new ExecutionStepPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionStepPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new ExecutionStepPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class ExecutionStepPage extends Page_1.default {
/**
* Initialize the ExecutionStepPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of ExecutionStepInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ExecutionStepInstance(this._version, payload, this._solution.flowSid, this._solution.executionSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepPage = ExecutionStepPage;

View File

@@ -0,0 +1,134 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../../../V2";
import { ApiResponse } from "../../../../../../base/ApiResponse";
export interface ExecutionStepContextContext {
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ExecutionStepContextContextSolution {
flowSid: string;
executionSid: string;
stepSid: string;
}
export declare class ExecutionStepContextContextImpl implements ExecutionStepContextContext {
protected _version: V2;
protected _solution: ExecutionStepContextContextSolution;
protected _uri: string;
constructor(_version: V2, flowSid: string, executionSid: string, stepSid: string);
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ExecutionStepContextContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ExecutionStepContextResource {
account_sid: string;
context: any;
execution_sid: string;
flow_sid: string;
step_sid: string;
url: string;
}
export declare class ExecutionStepContextInstance {
protected _version: V2;
protected _solution: ExecutionStepContextContextSolution;
protected _context?: ExecutionStepContextContext;
constructor(_version: V2, payload: ExecutionStepContextResource, flowSid: string, executionSid: string, stepSid: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource.
*/
accountSid: string;
/**
* The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.
*/
context: any;
/**
* The SID of the context\'s Execution resource.
*/
executionSid: string;
/**
* The SID of the Flow.
*/
flowSid: string;
/**
* The SID of the Step that the context is associated with.
*/
stepSid: string;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>;
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ExecutionStepContextInstance>) => any): Promise<ApiResponse<ExecutionStepContextInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
context: any;
executionSid: string;
flowSid: string;
stepSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ExecutionStepContextSolution {
flowSid: string;
executionSid: string;
stepSid: string;
}
export interface ExecutionStepContextListInstance {
_version: V2;
_solution: ExecutionStepContextSolution;
_uri: string;
(): ExecutionStepContextContext;
get(): ExecutionStepContextContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ExecutionStepContextListInstance(version: V2, flowSid: string, executionSid: string, stepSid: string): ExecutionStepContextListInstance;
export {};

View File

@@ -0,0 +1,163 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionStepContextInstance = exports.ExecutionStepContextContextImpl = void 0;
exports.ExecutionStepContextListInstance = ExecutionStepContextListInstance;
const util_1 = require("util");
const deserialize = require("../../../../../../base/deserialize");
const serialize = require("../../../../../../base/serialize");
const utility_1 = require("../../../../../../base/utility");
class ExecutionStepContextContextImpl {
constructor(_version, flowSid, executionSid, stepSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
this._solution = { flowSid, executionSid, stepSid };
this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${stepSid}/Context`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new ExecutionStepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new ExecutionStepContextInstance(operationVersion, response.body, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextContextImpl = ExecutionStepContextContextImpl;
class ExecutionStepContextInstance {
constructor(_version, payload, flowSid, executionSid, stepSid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.context = payload.context;
this.executionSid = payload.execution_sid;
this.flowSid = payload.flow_sid;
this.stepSid = payload.step_sid;
this.url = payload.url;
this._solution = { flowSid, executionSid, stepSid };
}
get _proxy() {
this._context =
this._context ||
new ExecutionStepContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.stepSid);
return this._context;
}
/**
* Fetch a ExecutionStepContextInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ExecutionStepContextInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ExecutionStepContextInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
context: this.context,
executionSid: this.executionSid,
flowSid: this.flowSid,
stepSid: this.stepSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ExecutionStepContextInstance = ExecutionStepContextInstance;
function ExecutionStepContextListInstance(version, flowSid, executionSid, stepSid) {
if (!(0, utility_1.isValidPathParam)(flowSid)) {
throw new Error("Parameter 'flowSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(executionSid)) {
throw new Error("Parameter 'executionSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(stepSid)) {
throw new Error("Parameter 'stepSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new ExecutionStepContextContextImpl(version, flowSid, executionSid, stepSid);
};
instance._version = version;
instance._solution = { flowSid, executionSid, stepSid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,331 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* The status of the Flow. Can be: `draft` or `published`.
*/
export type FlowRevisionStatus = "draft" | "published";
/**
* Options to pass to each
*/
export interface FlowRevisionListInstanceEachOptions {
/** 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: FlowRevisionInstance, 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 FlowRevisionListInstanceOptions {
/** 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 FlowRevisionListInstancePageOptions {
/** 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 FlowRevisionContext {
/**
* Fetch a FlowRevisionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance
*/
fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>;
/**
* Fetch a FlowRevisionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowRevisionInstance>) => any): Promise<ApiResponse<FlowRevisionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface FlowRevisionContextSolution {
sid: string;
revision: string;
}
export declare class FlowRevisionContextImpl implements FlowRevisionContext {
protected _version: V2;
protected _solution: FlowRevisionContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string, revision: string);
fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowRevisionInstance>) => any): Promise<ApiResponse<FlowRevisionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): FlowRevisionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface FlowRevisionPayload extends TwilioResponsePayload {
revisions: FlowRevisionResource[];
}
interface FlowRevisionResource {
sid: string;
account_sid: string;
author_sid: string;
friendly_name: string;
definition: any;
status: FlowRevisionStatus;
revision: number;
commit_message: string;
valid: boolean;
errors: Array<any>;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class FlowRevisionInstance {
protected _version: V2;
protected _solution: FlowRevisionContextSolution;
protected _context?: FlowRevisionContext;
constructor(_version: V2, payload: FlowRevisionResource, sid: string, revision?: string);
/**
* The unique string that we created to identify the Flow resource.
*/
sid: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource.
*/
accountSid: string;
/**
* The SID of the User that created or last updated the Flow.
*/
authorSid: string;
/**
* The string that you assigned to describe the Flow.
*/
friendlyName: string;
/**
* JSON representation of flow definition.
*/
definition: any;
status: FlowRevisionStatus;
/**
* The latest revision number of the Flow\'s definition.
*/
revision: number;
/**
* Description of change made in the revision.
*/
commitMessage: string;
/**
* Boolean if the flow definition is valid.
*/
valid: boolean;
/**
* List of error in the flow definition.
*/
errors: Array<any>;
/**
* The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The absolute URL of the resource.
*/
url: string;
private get _proxy();
/**
* Fetch a FlowRevisionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance
*/
fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>;
/**
* Fetch a FlowRevisionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowRevisionInstance>) => any): Promise<ApiResponse<FlowRevisionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
accountSid: string;
authorSid: string;
friendlyName: string;
definition: any;
status: FlowRevisionStatus;
revision: number;
commitMessage: string;
valid: boolean;
errors: any[];
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface FlowRevisionSolution {
sid: string;
}
export interface FlowRevisionListInstance {
_version: V2;
_solution: FlowRevisionSolution;
_uri: string;
(revision: string): FlowRevisionContext;
get(revision: string): FlowRevisionContext;
/**
* Streams FlowRevisionInstance 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 { FlowRevisionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void;
each(params: FlowRevisionListInstanceEachOptions, callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams FlowRevisionInstance records from the API with HTTP metadata captured per page.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached. HTTP metadata (status code, headers) is captured for each page request.
*
* 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 { FlowRevisionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: FlowRevisionListInstanceEachOptions, callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of FlowRevisionInstance 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: FlowRevisionPage) => any): Promise<FlowRevisionPage>;
/**
* Retrieve a single target page of FlowRevisionInstance records from the API with HTTP metadata.
*
* 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 with metadata
*/
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<FlowRevisionPage>) => any): Promise<ApiResponse<FlowRevisionPage>>;
/**
* Lists FlowRevisionInstance 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 { FlowRevisionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: FlowRevisionInstance[]) => any): Promise<FlowRevisionInstance[]>;
list(params: FlowRevisionListInstanceOptions, callback?: (error: Error | null, items: FlowRevisionInstance[]) => any): Promise<FlowRevisionInstance[]>;
/**
* Lists FlowRevisionInstance records from the API as a list with HTTP metadata.
*
* Returns all records along with HTTP metadata from the first page fetched.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowRevisionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowRevisionInstance[]>) => any): Promise<ApiResponse<FlowRevisionInstance[]>>;
listWithHttpInfo(params: FlowRevisionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FlowRevisionInstance[]>) => any): Promise<ApiResponse<FlowRevisionInstance[]>>;
/**
* Retrieve a single page of FlowRevisionInstance 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 { FlowRevisionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: FlowRevisionPage) => any): Promise<FlowRevisionPage>;
page(params: FlowRevisionListInstancePageOptions, callback?: (error: Error | null, items: FlowRevisionPage) => any): Promise<FlowRevisionPage>;
/**
* Retrieve a single page of FlowRevisionInstance records from the API with HTTP metadata.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { FlowRevisionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FlowRevisionPage>) => any): Promise<ApiResponse<FlowRevisionPage>>;
pageWithHttpInfo(params: FlowRevisionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FlowRevisionPage>) => any): Promise<ApiResponse<FlowRevisionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FlowRevisionListInstance(version: V2, sid: string): FlowRevisionListInstance;
export declare class FlowRevisionPage extends Page<V2, FlowRevisionPayload, FlowRevisionResource, FlowRevisionInstance> {
/**
* Initialize the FlowRevisionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: FlowRevisionSolution);
/**
* Build an instance of FlowRevisionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: FlowRevisionResource): FlowRevisionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,282 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowRevisionPage = exports.FlowRevisionInstance = exports.FlowRevisionContextImpl = void 0;
exports.FlowRevisionListInstance = FlowRevisionListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../../base/Page"));
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class FlowRevisionContextImpl {
constructor(_version, sid, revision) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(revision)) {
throw new Error("Parameter 'revision' is not valid.");
}
this._solution = { sid, revision };
this._uri = `/Flows/${sid}/Revisions/${revision}`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new FlowRevisionInstance(operationVersion, payload, instance._solution.sid, instance._solution.revision));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new FlowRevisionInstance(operationVersion, response.body, instance._solution.sid, instance._solution.revision),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowRevisionContextImpl = FlowRevisionContextImpl;
class FlowRevisionInstance {
constructor(_version, payload, sid, revision) {
this._version = _version;
this.sid = payload.sid;
this.accountSid = payload.account_sid;
this.authorSid = payload.author_sid;
this.friendlyName = payload.friendly_name;
this.definition = payload.definition;
this.status = payload.status;
this.revision = deserialize.integer(payload.revision);
this.commitMessage = payload.commit_message;
this.valid = payload.valid;
this.errors = payload.errors;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid, revision: revision || this.revision.toString() };
}
get _proxy() {
this._context =
this._context ||
new FlowRevisionContextImpl(this._version, this._solution.sid, this._solution.revision);
return this._context;
}
/**
* Fetch a FlowRevisionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a FlowRevisionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowRevisionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
accountSid: this.accountSid,
authorSid: this.authorSid,
friendlyName: this.friendlyName,
definition: this.definition,
status: this.status,
revision: this.revision,
commitMessage: this.commitMessage,
valid: this.valid,
errors: this.errors,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowRevisionInstance = FlowRevisionInstance;
function FlowRevisionListInstance(version, sid) {
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
const instance = ((revision) => instance.get(revision));
instance.get = function get(revision) {
return new FlowRevisionContextImpl(version, sid, revision);
};
instance._version = version;
instance._solution = { sid };
instance._uri = `/Flows/${sid}/Revisions`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.page({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowRevisionPage(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, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new FlowRevisionPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
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 = {};
headers["Accept"] = "application/json";
let operationVersion = version;
// For page operations, use page() directly as it already returns { statusCode, body, headers }
// IMPORTANT: Pass full response to Page constructor, not response.body
let operationPromise = operationVersion
.page({ uri: instance._uri, method: "get", params: data, headers })
.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowRevisionPage(operationVersion, response, instance._solution),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
instance.list = instance._version.list;
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
// Use request() directly as it already returns { statusCode, body, headers }
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((response) => ({
statusCode: response.statusCode,
headers: response.headers,
body: new FlowRevisionPage(instance._version, response, instance._solution),
}));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class FlowRevisionPage extends Page_1.default {
/**
* Initialize the FlowRevisionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version, response, solution) {
super(version, response, solution);
}
/**
* Build an instance of FlowRevisionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new FlowRevisionInstance(this._version, payload, this._solution.sid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowRevisionPage = FlowRevisionPage;

View File

@@ -0,0 +1,157 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to update a FlowTestUserInstance
*/
export interface FlowTestUserContextUpdateOptions {
/** List of test user identities that can test draft versions of the flow. */
testUsers: Array<string>;
}
export interface FlowTestUserContext {
/**
* Fetch a FlowTestUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance
*/
fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
/**
* Fetch a FlowTestUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
/**
* Update a FlowTestUserInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance
*/
update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
/**
* Update a FlowTestUserInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance with HTTP metadata
*/
updateWithHttpInfo(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface FlowTestUserContextSolution {
sid: string;
}
export declare class FlowTestUserContextImpl implements FlowTestUserContext {
protected _version: V2;
protected _solution: FlowTestUserContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
updateWithHttpInfo(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): FlowTestUserContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface FlowTestUserResource {
sid: string;
test_users: Array<string>;
url: string;
}
export declare class FlowTestUserInstance {
protected _version: V2;
protected _solution: FlowTestUserContextSolution;
protected _context?: FlowTestUserContext;
constructor(_version: V2, payload: FlowTestUserResource, sid: string);
/**
* Unique identifier of the flow.
*/
sid: string;
/**
* List of test user identities that can test draft versions of the flow.
*/
testUsers: Array<string>;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a FlowTestUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance
*/
fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
/**
* Fetch a FlowTestUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
/**
* Update a FlowTestUserInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance
*/
update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>;
/**
* Update a FlowTestUserInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance with HTTP metadata
*/
updateWithHttpInfo(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowTestUserInstance>) => any): Promise<ApiResponse<FlowTestUserInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
sid: string;
testUsers: string[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface FlowTestUserSolution {
sid: string;
}
export interface FlowTestUserListInstance {
_version: V2;
_solution: FlowTestUserSolution;
_uri: string;
(): FlowTestUserContext;
get(): FlowTestUserContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FlowTestUserListInstance(version: V2, sid: string): FlowTestUserListInstance;
export {};

View File

@@ -0,0 +1,203 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowTestUserInstance = exports.FlowTestUserContextImpl = void 0;
exports.FlowTestUserListInstance = FlowTestUserListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class FlowTestUserContextImpl {
constructor(_version, sid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
this._solution = { sid };
this._uri = `/Flows/${sid}/TestUsers`;
}
fetch(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
headers,
});
operationPromise = operationPromise.then((payload) => new FlowTestUserInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.fetchWithResponseInfo({
uri: instance._uri,
method: "get",
headers,
})
.then((response) => ({
...response,
body: new FlowTestUserInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["testUsers"] === null || params["testUsers"] === undefined) {
throw new Error("Required parameter \"params['testUsers']\" missing.");
}
let data = {};
data["TestUsers"] = serialize.map(params["testUsers"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowTestUserInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["testUsers"] === null || params["testUsers"] === undefined) {
throw new Error("Required parameter \"params['testUsers']\" missing.");
}
let data = {};
data["TestUsers"] = serialize.map(params["testUsers"], (e) => e);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new FlowTestUserInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return this._solution;
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowTestUserContextImpl = FlowTestUserContextImpl;
class FlowTestUserInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.sid = payload.sid;
this.testUsers = payload.test_users;
this.url = payload.url;
this._solution = { sid };
}
get _proxy() {
this._context =
this._context ||
new FlowTestUserContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a FlowTestUserInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a FlowTestUserInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowTestUserInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
sid: this.sid,
testUsers: this.testUsers,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowTestUserInstance = FlowTestUserInstance;
function FlowTestUserListInstance(version, sid) {
if (!(0, utility_1.isValidPathParam)(sid)) {
throw new Error("Parameter 'sid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new FlowTestUserContextImpl(version, sid);
};
instance._version = version;
instance._solution = { sid };
instance._uri = ``;
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}

View File

@@ -0,0 +1,72 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* The status of the Flow. Can be: `draft` or `published`.
*/
export type FlowValidateStatus = "draft" | "published";
/**
* Options to pass to update a FlowValidateInstance
*/
export interface FlowValidateListInstanceUpdateOptions {
/** The string that you assigned to describe the Flow. */
friendlyName: string;
/** */
status: FlowValidateStatus;
/** JSON representation of flow definition. */
definition: any;
/** Description of change made in the revision. */
commitMessage?: string;
}
export interface FlowValidateSolution {
}
export interface FlowValidateListInstance {
_version: V2;
_solution: FlowValidateSolution;
_uri: string;
/**
* Update a FlowValidateInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowValidateInstance
*/
update(params: FlowValidateListInstanceUpdateOptions, callback?: (error: Error | null, item?: FlowValidateInstance) => any): Promise<FlowValidateInstance>;
/**
* Update a FlowValidateInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FlowValidateInstance with HTTP metadata
*/
updateWithHttpInfo(params: FlowValidateListInstanceUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<FlowValidateInstance>) => any): Promise<ApiResponse<FlowValidateInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FlowValidateListInstance(version: V2): FlowValidateListInstance;
interface FlowValidateResource {
valid: boolean;
}
export declare class FlowValidateInstance {
protected _version: V2;
constructor(_version: V2, payload: FlowValidateResource);
/**
* Boolean if the flow definition is valid.
*/
valid: boolean;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
valid: boolean;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

125
node_modules/twilio/lib/rest/studio/v2/flowValidate.js generated vendored Normal file
View File

@@ -0,0 +1,125 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Studio
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowValidateInstance = void 0;
exports.FlowValidateListInstance = FlowValidateListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function FlowValidateListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Flows/Validate`;
instance.update = function update(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
if (params["definition"] === null || params["definition"] === undefined) {
throw new Error("Required parameter \"params['definition']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Status"] = params["status"];
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new FlowValidateInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.updateWithHttpInfo = function updateWithHttpInfo(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["status"] === null || params["status"] === undefined) {
throw new Error("Required parameter \"params['status']\" missing.");
}
if (params["definition"] === null || params["definition"] === undefined) {
throw new Error("Required parameter \"params['definition']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Status"] = params["status"];
data["Definition"] = serialize.object(params["definition"]);
if (params["commitMessage"] !== undefined)
data["CommitMessage"] = params["commitMessage"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
let operationVersion = version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "post",
data,
headers,
})
.then((response) => ({
...response,
body: new FlowValidateInstance(operationVersion, response.body),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class FlowValidateInstance {
constructor(_version, payload) {
this._version = _version;
this.valid = payload.valid;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
valid: this.valid,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FlowValidateInstance = FlowValidateInstance;