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

50
node_modules/twilio/lib/rest/intelligence/V2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import IntelligenceBase from "../IntelligenceBase";
import Version from "../../base/Version";
import { CustomOperatorListInstance } from "./v2/customOperator";
import { OperatorListInstance } from "./v2/operator";
import { OperatorAttachmentListInstance } from "./v2/operatorAttachment";
import { OperatorAttachmentsListInstance } from "./v2/operatorAttachments";
import { OperatorTypeListInstance } from "./v2/operatorType";
import { PrebuiltOperatorListInstance } from "./v2/prebuiltOperator";
import { ServiceListInstance } from "./v2/service";
import { TranscriptListInstance } from "./v2/transcript";
export default class V2 extends Version {
/**
* Initialize the V2 version of Intelligence
*
* @param domain - The Twilio (Twilio.Intelligence) domain
*/
constructor(domain: IntelligenceBase);
/** customOperators - { Twilio.Intelligence.V2.CustomOperatorListInstance } resource */
protected _customOperators?: CustomOperatorListInstance;
/** operators - { Twilio.Intelligence.V2.OperatorListInstance } resource */
protected _operators?: OperatorListInstance;
/** operatorAttachment - { Twilio.Intelligence.V2.OperatorAttachmentListInstance } resource */
protected _operatorAttachment?: OperatorAttachmentListInstance;
/** operatorAttachments - { Twilio.Intelligence.V2.OperatorAttachmentsListInstance } resource */
protected _operatorAttachments?: OperatorAttachmentsListInstance;
/** operatorType - { Twilio.Intelligence.V2.OperatorTypeListInstance } resource */
protected _operatorType?: OperatorTypeListInstance;
/** prebuiltOperators - { Twilio.Intelligence.V2.PrebuiltOperatorListInstance } resource */
protected _prebuiltOperators?: PrebuiltOperatorListInstance;
/** services - { Twilio.Intelligence.V2.ServiceListInstance } resource */
protected _services?: ServiceListInstance;
/** transcripts - { Twilio.Intelligence.V2.TranscriptListInstance } resource */
protected _transcripts?: TranscriptListInstance;
/** Getter for customOperators resource */
get customOperators(): CustomOperatorListInstance;
/** Getter for operators resource */
get operators(): OperatorListInstance;
/** Getter for operatorAttachment resource */
get operatorAttachment(): OperatorAttachmentListInstance;
/** Getter for operatorAttachments resource */
get operatorAttachments(): OperatorAttachmentsListInstance;
/** Getter for operatorType resource */
get operatorType(): OperatorTypeListInstance;
/** Getter for prebuiltOperators resource */
get prebuiltOperators(): PrebuiltOperatorListInstance;
/** Getter for services resource */
get services(): ServiceListInstance;
/** Getter for transcripts resource */
get transcripts(): TranscriptListInstance;
}

82
node_modules/twilio/lib/rest/intelligence/V2.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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 customOperator_1 = require("./v2/customOperator");
const operator_1 = require("./v2/operator");
const operatorAttachment_1 = require("./v2/operatorAttachment");
const operatorAttachments_1 = require("./v2/operatorAttachments");
const operatorType_1 = require("./v2/operatorType");
const prebuiltOperator_1 = require("./v2/prebuiltOperator");
const service_1 = require("./v2/service");
const transcript_1 = require("./v2/transcript");
class V2 extends Version_1.default {
/**
* Initialize the V2 version of Intelligence
*
* @param domain - The Twilio (Twilio.Intelligence) domain
*/
constructor(domain) {
super(domain, "v2");
}
/** Getter for customOperators resource */
get customOperators() {
this._customOperators =
this._customOperators || (0, customOperator_1.CustomOperatorListInstance)(this);
return this._customOperators;
}
/** Getter for operators resource */
get operators() {
this._operators = this._operators || (0, operator_1.OperatorListInstance)(this);
return this._operators;
}
/** Getter for operatorAttachment resource */
get operatorAttachment() {
this._operatorAttachment =
this._operatorAttachment || (0, operatorAttachment_1.OperatorAttachmentListInstance)(this);
return this._operatorAttachment;
}
/** Getter for operatorAttachments resource */
get operatorAttachments() {
this._operatorAttachments =
this._operatorAttachments || (0, operatorAttachments_1.OperatorAttachmentsListInstance)(this);
return this._operatorAttachments;
}
/** Getter for operatorType resource */
get operatorType() {
this._operatorType = this._operatorType || (0, operatorType_1.OperatorTypeListInstance)(this);
return this._operatorType;
}
/** Getter for prebuiltOperators resource */
get prebuiltOperators() {
this._prebuiltOperators =
this._prebuiltOperators || (0, prebuiltOperator_1.PrebuiltOperatorListInstance)(this);
return this._prebuiltOperators;
}
/** Getter for services resource */
get services() {
this._services = this._services || (0, service_1.ServiceListInstance)(this);
return this._services;
}
/** Getter for transcripts resource */
get transcripts() {
this._transcripts = this._transcripts || (0, transcript_1.TranscriptListInstance)(this);
return this._transcripts;
}
}
exports.default = V2;

View File

@@ -0,0 +1,447 @@
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";
/**
* Custom Operator availability status. Possible values: internal, beta, public, retired.
*/
export type CustomOperatorAvailability = "internal" | "beta" | "public" | "retired" | "general-availability" | "deprecated";
/**
* Options to pass to update a CustomOperatorInstance
*/
export interface CustomOperatorContextUpdateOptions {
/** A human-readable name of this resource, up to 64 characters. */
friendlyName: string;
/** Operator configuration, following the schema defined by the Operator Type. */
config: any;
/** The If-Match HTTP request header */
ifMatch?: string;
}
/**
* Options to pass to create a CustomOperatorInstance
*/
export interface CustomOperatorListInstanceCreateOptions {
/** A human readable description of the new Operator, up to 64 characters. */
friendlyName: string;
/** Operator Type for this Operator. References an existing Operator Type resource. */
operatorType: string;
/** Operator configuration, following the schema defined by the Operator Type. */
config: any;
}
/**
* Options to pass to each
*/
export interface CustomOperatorListInstanceEachOptions {
/** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: CustomOperatorAvailability;
/** Returns Custom Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: CustomOperatorInstance, 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 CustomOperatorListInstanceOptions {
/** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: CustomOperatorAvailability;
/** Returns Custom Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface CustomOperatorListInstancePageOptions {
/** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: CustomOperatorAvailability;
/** Returns Custom Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface CustomOperatorContext {
/**
* Remove a CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomOperatorInstance 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 CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
fetch(callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
/**
* Fetch a CustomOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Update a CustomOperatorInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
/**
* Update a CustomOperatorInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance with HTTP metadata
*/
updateWithHttpInfo(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface CustomOperatorContextSolution {
sid: string;
}
export declare class CustomOperatorContextImpl implements CustomOperatorContext {
protected _version: V2;
protected _solution: CustomOperatorContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
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?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
updateWithHttpInfo(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): CustomOperatorContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface CustomOperatorPayload extends TwilioResponsePayload {
operators: CustomOperatorResource[];
}
interface CustomOperatorResource {
account_sid: string;
sid: string;
friendly_name: string;
description: string;
author: string;
operator_type: string;
version: number;
availability: CustomOperatorAvailability;
config: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class CustomOperatorInstance {
protected _version: V2;
protected _solution: CustomOperatorContextSolution;
protected _context?: CustomOperatorContext;
constructor(_version: V2, payload: CustomOperatorResource, sid?: string);
/**
* The unique SID identifier of the Account the Custom Operator belongs to.
*/
accountSid: string;
/**
* A 34 character string that uniquely identifies this Custom Operator.
*/
sid: string;
/**
* A human-readable name of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* A human-readable description of this resource, longer than the friendly name.
*/
description: string;
/**
* The creator of the Custom Operator. Custom Operators can only be created by a Twilio Account.
*/
author: string;
/**
* Operator Type for this Operator. References an existing Operator Type resource.
*/
operatorType: string;
/**
* Numeric Custom Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Custom Operator.
*/
version: number;
availability: CustomOperatorAvailability;
/**
* Operator configuration, following the schema defined by the Operator Type. Only available on Operators created by the Account.
*/
config: any;
/**
* The date that this Custom Operator was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Custom Operator was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Remove a CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a CustomOperatorInstance 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 CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
fetch(callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
/**
* Fetch a CustomOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Update a CustomOperatorInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
/**
* Update a CustomOperatorInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance with HTTP metadata
*/
updateWithHttpInfo(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
friendlyName: string;
description: string;
author: string;
operatorType: string;
version: number;
availability: CustomOperatorAvailability;
config: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface CustomOperatorSolution {
}
export interface CustomOperatorListInstance {
_version: V2;
_solution: CustomOperatorSolution;
_uri: string;
(sid: string): CustomOperatorContext;
get(sid: string): CustomOperatorContext;
/**
* Create a CustomOperatorInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
create(params: CustomOperatorListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>;
/**
* Create a CustomOperatorInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance with HTTP metadata
*/
createWithHttpInfo(params: CustomOperatorListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<CustomOperatorInstance>) => any): Promise<ApiResponse<CustomOperatorInstance>>;
/**
* Streams CustomOperatorInstance 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 { CustomOperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void;
each(params: CustomOperatorListInstanceEachOptions, callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Streams CustomOperatorInstance 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 { CustomOperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: CustomOperatorListInstanceEachOptions, callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of CustomOperatorInstance 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: CustomOperatorPage) => any): Promise<CustomOperatorPage>;
/**
* Retrieve a single target page of CustomOperatorInstance 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<CustomOperatorPage>) => any): Promise<ApiResponse<CustomOperatorPage>>;
/**
* Lists CustomOperatorInstance 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 { CustomOperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: CustomOperatorInstance[]) => any): Promise<CustomOperatorInstance[]>;
list(params: CustomOperatorListInstanceOptions, callback?: (error: Error | null, items: CustomOperatorInstance[]) => any): Promise<CustomOperatorInstance[]>;
/**
* Lists CustomOperatorInstance 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 { CustomOperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomOperatorInstance[]>) => any): Promise<ApiResponse<CustomOperatorInstance[]>>;
listWithHttpInfo(params: CustomOperatorListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<CustomOperatorInstance[]>) => any): Promise<ApiResponse<CustomOperatorInstance[]>>;
/**
* Retrieve a single page of CustomOperatorInstance 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 { CustomOperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: CustomOperatorPage) => any): Promise<CustomOperatorPage>;
page(params: CustomOperatorListInstancePageOptions, callback?: (error: Error | null, items: CustomOperatorPage) => any): Promise<CustomOperatorPage>;
/**
* Retrieve a single page of CustomOperatorInstance 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 { CustomOperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<CustomOperatorPage>) => any): Promise<ApiResponse<CustomOperatorPage>>;
pageWithHttpInfo(params: CustomOperatorListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<CustomOperatorPage>) => any): Promise<ApiResponse<CustomOperatorPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function CustomOperatorListInstance(version: V2): CustomOperatorListInstance;
export declare class CustomOperatorPage extends Page<V2, CustomOperatorPayload, CustomOperatorResource, CustomOperatorInstance> {
/**
* Initialize the CustomOperatorPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: CustomOperatorSolution);
/**
* Build an instance of CustomOperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: CustomOperatorResource): CustomOperatorInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,469 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.CustomOperatorPage = exports.CustomOperatorInstance = exports.CustomOperatorContextImpl = void 0;
exports.CustomOperatorListInstance = CustomOperatorListInstance;
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 CustomOperatorContextImpl {
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 = `/Operators/Custom/${sid}`;
}
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 CustomOperatorInstance(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 CustomOperatorInstance(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["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["config"] === null || params["config"] === undefined) {
throw new Error("Required parameter \"params['config']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Config"] = serialize.object(params["config"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["ifMatch"] !== undefined)
headers["If-Match"] = params["ifMatch"];
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new CustomOperatorInstance(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["friendlyName"] === null ||
params["friendlyName"] === undefined) {
throw new Error("Required parameter \"params['friendlyName']\" missing.");
}
if (params["config"] === null || params["config"] === undefined) {
throw new Error("Required parameter \"params['config']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["Config"] = serialize.object(params["config"]);
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["ifMatch"] !== undefined)
headers["If-Match"] = params["ifMatch"];
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 CustomOperatorInstance(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.CustomOperatorContextImpl = CustomOperatorContextImpl;
class CustomOperatorInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.author = payload.author;
this.operatorType = payload.operator_type;
this.version = deserialize.integer(payload.version);
this.availability = payload.availability;
this.config = payload.config;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new CustomOperatorContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a CustomOperatorInstance 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 CustomOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a CustomOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed CustomOperatorInstance 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 {
accountSid: this.accountSid,
sid: this.sid,
friendlyName: this.friendlyName,
description: this.description,
author: this.author,
operatorType: this.operatorType,
version: this.version,
availability: this.availability,
config: this.config,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomOperatorInstance = CustomOperatorInstance;
function CustomOperatorListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new CustomOperatorContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Operators/Custom`;
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["operatorType"] === null ||
params["operatorType"] === undefined) {
throw new Error("Required parameter \"params['operatorType']\" missing.");
}
if (params["config"] === null || params["config"] === undefined) {
throw new Error("Required parameter \"params['config']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["OperatorType"] = params["operatorType"];
data["Config"] = serialize.object(params["config"]);
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 CustomOperatorInstance(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["operatorType"] === null ||
params["operatorType"] === undefined) {
throw new Error("Required parameter \"params['operatorType']\" missing.");
}
if (params["config"] === null || params["config"] === undefined) {
throw new Error("Required parameter \"params['config']\" missing.");
}
let data = {};
data["FriendlyName"] = params["friendlyName"];
data["OperatorType"] = params["operatorType"];
data["Config"] = serialize.object(params["config"]);
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 CustomOperatorInstance(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["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 CustomOperatorPage(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 CustomOperatorPage(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["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 CustomOperatorPage(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 CustomOperatorPage(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 CustomOperatorPage extends Page_1.default {
/**
* Initialize the CustomOperatorPage
*
* @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 CustomOperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new CustomOperatorInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.CustomOperatorPage = CustomOperatorPage;

View File

@@ -0,0 +1,335 @@
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";
/**
* Operator availability status. Possible values: internal, beta, public, retired.
*/
export type OperatorAvailability = "internal" | "beta" | "public" | "deprecated" | "general-availability" | "retired";
/**
* Options to pass to each
*/
export interface OperatorListInstanceEachOptions {
/** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: OperatorAvailability;
/** Returns Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: OperatorInstance, 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 OperatorListInstanceOptions {
/** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: OperatorAvailability;
/** Returns Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface OperatorListInstancePageOptions {
/** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: OperatorAvailability;
/** Returns Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface OperatorContext {
/**
* Fetch a OperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>;
/**
* Fetch a OperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorInstance>) => any): Promise<ApiResponse<OperatorInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OperatorContextSolution {
sid: string;
}
export declare class OperatorContextImpl implements OperatorContext {
protected _version: V2;
protected _solution: OperatorContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorInstance>) => any): Promise<ApiResponse<OperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OperatorContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OperatorPayload extends TwilioResponsePayload {
operators: OperatorResource[];
}
interface OperatorResource {
account_sid: string;
sid: string;
friendly_name: string;
description: string;
author: string;
operator_type: string;
version: number;
availability: OperatorAvailability;
config: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class OperatorInstance {
protected _version: V2;
protected _solution: OperatorContextSolution;
protected _context?: OperatorContext;
constructor(_version: V2, payload: OperatorResource, sid?: string);
/**
* The unique SID identifier of the Account the Operator belongs to.
*/
accountSid: string;
/**
* A 34 character string that uniquely identifies this Operator.
*/
sid: string;
/**
* A human-readable name of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* A human-readable description of this resource, longer than the friendly name.
*/
description: string;
/**
* The creator of the Operator. Either Twilio or the creating Account.
*/
author: string;
/**
* Operator Type for this Operator. References an existing Operator Type resource.
*/
operatorType: string;
/**
* Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator.
*/
version: number;
availability: OperatorAvailability;
/**
* Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account.
*/
config: any;
/**
* The date that this Operator was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Operator was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a OperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>;
/**
* Fetch a OperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorInstance>) => any): Promise<ApiResponse<OperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
friendlyName: string;
description: string;
author: string;
operatorType: string;
version: number;
availability: OperatorAvailability;
config: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OperatorSolution {
}
export interface OperatorListInstance {
_version: V2;
_solution: OperatorSolution;
_uri: string;
(sid: string): OperatorContext;
get(sid: string): OperatorContext;
/**
* Streams OperatorInstance 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 { OperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void;
each(params: OperatorListInstanceEachOptions, callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Streams OperatorInstance 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 { OperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: OperatorListInstanceEachOptions, callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of OperatorInstance 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: OperatorPage) => any): Promise<OperatorPage>;
/**
* Retrieve a single target page of OperatorInstance 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<OperatorPage>) => any): Promise<ApiResponse<OperatorPage>>;
/**
* Lists OperatorInstance 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 { OperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: OperatorInstance[]) => any): Promise<OperatorInstance[]>;
list(params: OperatorListInstanceOptions, callback?: (error: Error | null, items: OperatorInstance[]) => any): Promise<OperatorInstance[]>;
/**
* Lists OperatorInstance 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 { OperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorInstance[]>) => any): Promise<ApiResponse<OperatorInstance[]>>;
listWithHttpInfo(params: OperatorListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<OperatorInstance[]>) => any): Promise<ApiResponse<OperatorInstance[]>>;
/**
* Retrieve a single page of OperatorInstance 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 { OperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: OperatorPage) => any): Promise<OperatorPage>;
page(params: OperatorListInstancePageOptions, callback?: (error: Error | null, items: OperatorPage) => any): Promise<OperatorPage>;
/**
* Retrieve a single page of OperatorInstance 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 { OperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorPage>) => any): Promise<ApiResponse<OperatorPage>>;
pageWithHttpInfo(params: OperatorListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<OperatorPage>) => any): Promise<ApiResponse<OperatorPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OperatorListInstance(version: V2): OperatorListInstance;
export declare class OperatorPage extends Page<V2, OperatorPayload, OperatorResource, OperatorInstance> {
/**
* Initialize the OperatorPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: OperatorSolution);
/**
* Build an instance of OperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: OperatorResource): OperatorInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,282 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.OperatorPage = exports.OperatorInstance = exports.OperatorContextImpl = void 0;
exports.OperatorListInstance = OperatorListInstance;
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 OperatorContextImpl {
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 = `/Operators/${sid}`;
}
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 OperatorInstance(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 OperatorInstance(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.OperatorContextImpl = OperatorContextImpl;
class OperatorInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.author = payload.author;
this.operatorType = payload.operator_type;
this.version = deserialize.integer(payload.version);
this.availability = payload.availability;
this.config = payload.config;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new OperatorContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a OperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a OperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
friendlyName: this.friendlyName,
description: this.description,
author: this.author,
operatorType: this.operatorType,
version: this.version,
availability: this.availability,
config: this.config,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorInstance = OperatorInstance;
function OperatorListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new OperatorContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Operators`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 OperatorPage(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 OperatorPage(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["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 OperatorPage(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 OperatorPage(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 OperatorPage extends Page_1.default {
/**
* Initialize the OperatorPage
*
* @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 OperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new OperatorInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorPage = OperatorPage;

View File

@@ -0,0 +1,146 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export interface OperatorAttachmentContext {
/**
* Create a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance
*/
create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>;
/**
* Create a OperatorAttachmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentInstance>) => any): Promise<ApiResponse<OperatorAttachmentInstance>>;
/**
* Remove a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a OperatorAttachmentInstance 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>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OperatorAttachmentContextSolution {
serviceSid: string;
operatorSid: string;
}
export declare class OperatorAttachmentContextImpl implements OperatorAttachmentContext {
protected _version: V2;
protected _solution: OperatorAttachmentContextSolution;
protected _uri: string;
constructor(_version: V2, serviceSid: string, operatorSid: string);
create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>;
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentInstance>) => any): Promise<ApiResponse<OperatorAttachmentInstance>>;
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
removeWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<boolean>) => any): Promise<ApiResponse<boolean>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OperatorAttachmentContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OperatorAttachmentResource {
service_sid: string;
operator_sid: string;
url: string;
}
export declare class OperatorAttachmentInstance {
protected _version: V2;
protected _solution: OperatorAttachmentContextSolution;
protected _context?: OperatorAttachmentContext;
constructor(_version: V2, payload: OperatorAttachmentResource, serviceSid?: string, operatorSid?: string);
/**
* The unique SID identifier of the Service.
*/
serviceSid: string;
/**
* The unique SID identifier of the Operator.
*/
operatorSid: string;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Create a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance
*/
create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>;
/**
* Create a OperatorAttachmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentInstance>) => any): Promise<ApiResponse<OperatorAttachmentInstance>>;
/**
* Remove a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a OperatorAttachmentInstance 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>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
serviceSid: string;
operatorSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OperatorAttachmentSolution {
}
export interface OperatorAttachmentListInstance {
_version: V2;
_solution: OperatorAttachmentSolution;
_uri: string;
(serviceSid: string, operatorSid: string): OperatorAttachmentContext;
get(serviceSid: string, operatorSid: string): OperatorAttachmentContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OperatorAttachmentListInstance(version: V2): OperatorAttachmentListInstance;
export {};

View File

@@ -0,0 +1,193 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.OperatorAttachmentInstance = exports.OperatorAttachmentContextImpl = void 0;
exports.OperatorAttachmentListInstance = OperatorAttachmentListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class OperatorAttachmentContextImpl {
constructor(_version, serviceSid, operatorSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(operatorSid)) {
throw new Error("Parameter 'operatorSid' is not valid.");
}
this._solution = { serviceSid, operatorSid };
this._uri = `/Services/${serviceSid}/Operators/${operatorSid}`;
}
create(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new OperatorAttachmentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.operatorSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(callback) {
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.createWithResponseInfo({
uri: instance._uri,
method: "post",
headers,
})
.then((response) => ({
...response,
body: new OperatorAttachmentInstance(operationVersion, response.body, instance._solution.serviceSid, instance._solution.operatorSid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
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;
}
/**
* 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.OperatorAttachmentContextImpl = OperatorAttachmentContextImpl;
class OperatorAttachmentInstance {
constructor(_version, payload, serviceSid, operatorSid) {
this._version = _version;
this.serviceSid = payload.service_sid;
this.operatorSid = payload.operator_sid;
this.url = payload.url;
this._solution = {
serviceSid: serviceSid || this.serviceSid,
operatorSid: operatorSid || this.operatorSid,
};
}
get _proxy() {
this._context =
this._context ||
new OperatorAttachmentContextImpl(this._version, this._solution.serviceSid, this._solution.operatorSid);
return this._context;
}
/**
* Create a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance
*/
create(callback) {
return this._proxy.create(callback);
}
/**
* Create a OperatorAttachmentInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentInstance with HTTP metadata
*/
createWithHttpInfo(callback) {
return this._proxy.createWithHttpInfo(callback);
}
/**
* Remove a OperatorAttachmentInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a OperatorAttachmentInstance 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);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
serviceSid: this.serviceSid,
operatorSid: this.operatorSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorAttachmentInstance = OperatorAttachmentInstance;
function OperatorAttachmentListInstance(version) {
const instance = ((serviceSid, operatorSid) => instance.get(serviceSid, operatorSid));
instance.get = function get(serviceSid, operatorSid) {
return new OperatorAttachmentContextImpl(version, serviceSid, operatorSid);
};
instance._version = version;
instance._solution = {};
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,111 @@
import { inspect, InspectOptions } from "util";
import V2 from "../V2";
import { ApiResponse } from "../../../base/ApiResponse";
export interface OperatorAttachmentsContext {
/**
* Fetch a OperatorAttachmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>;
/**
* Fetch a OperatorAttachmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentsInstance>) => any): Promise<ApiResponse<OperatorAttachmentsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OperatorAttachmentsContextSolution {
serviceSid: string;
}
export declare class OperatorAttachmentsContextImpl implements OperatorAttachmentsContext {
protected _version: V2;
protected _solution: OperatorAttachmentsContextSolution;
protected _uri: string;
constructor(_version: V2, serviceSid: string);
fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentsInstance>) => any): Promise<ApiResponse<OperatorAttachmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OperatorAttachmentsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OperatorAttachmentsResource {
service_sid: string;
operator_sids: Array<string>;
url: string;
}
export declare class OperatorAttachmentsInstance {
protected _version: V2;
protected _solution: OperatorAttachmentsContextSolution;
protected _context?: OperatorAttachmentsContext;
constructor(_version: V2, payload: OperatorAttachmentsResource, serviceSid?: string);
/**
* The unique SID identifier of the Service.
*/
serviceSid: string;
/**
* List of Operator SIDs attached to the service. Includes both Custom and Pre-built Operators.
*/
operatorSids: Array<string>;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a OperatorAttachmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>;
/**
* Fetch a OperatorAttachmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorAttachmentsInstance>) => any): Promise<ApiResponse<OperatorAttachmentsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
serviceSid: string;
operatorSids: string[];
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OperatorAttachmentsSolution {
}
export interface OperatorAttachmentsListInstance {
_version: V2;
_solution: OperatorAttachmentsSolution;
_uri: string;
(serviceSid: string): OperatorAttachmentsContext;
get(serviceSid: string): OperatorAttachmentsContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OperatorAttachmentsListInstance(version: V2): OperatorAttachmentsListInstance;
export {};

View File

@@ -0,0 +1,142 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.OperatorAttachmentsInstance = exports.OperatorAttachmentsContextImpl = void 0;
exports.OperatorAttachmentsListInstance = OperatorAttachmentsListInstance;
const util_1 = require("util");
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
const utility_1 = require("../../../base/utility");
class OperatorAttachmentsContextImpl {
constructor(_version, serviceSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(serviceSid)) {
throw new Error("Parameter 'serviceSid' is not valid.");
}
this._solution = { serviceSid };
this._uri = `/Services/${serviceSid}/Operators`;
}
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 OperatorAttachmentsInstance(operationVersion, payload, instance._solution.serviceSid));
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 OperatorAttachmentsInstance(operationVersion, response.body, instance._solution.serviceSid),
}));
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.OperatorAttachmentsContextImpl = OperatorAttachmentsContextImpl;
class OperatorAttachmentsInstance {
constructor(_version, payload, serviceSid) {
this._version = _version;
this.serviceSid = payload.service_sid;
this.operatorSids = payload.operator_sids;
this.url = payload.url;
this._solution = { serviceSid: serviceSid || this.serviceSid };
}
get _proxy() {
this._context =
this._context ||
new OperatorAttachmentsContextImpl(this._version, this._solution.serviceSid);
return this._context;
}
/**
* Fetch a OperatorAttachmentsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a OperatorAttachmentsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorAttachmentsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
serviceSid: this.serviceSid,
operatorSids: this.operatorSids,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorAttachmentsInstance = OperatorAttachmentsInstance;
function OperatorAttachmentsListInstance(version) {
const instance = ((serviceSid) => instance.get(serviceSid));
instance.get = function get(serviceSid) {
return new OperatorAttachmentsContextImpl(version, serviceSid);
};
instance._version = version;
instance._solution = {};
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,343 @@
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";
/**
* Operator Type availability status. Possible values: internal, beta, general-availability, retired, deprecated.
*/
export type OperatorTypeAvailability = "internal" | "beta" | "general-availability" | "retired" | "deprecated";
/**
* Operator Results for this Operator Type will follow this format. Possible values: text-classification, text-extraction, text-extraction-normalized, text-generation.
*/
export type OperatorTypeOutputType = "text-classification" | "text-extraction" | "text-extraction-normalized" | "text-generation" | "json";
/**
* Operators with this Operator Type are executed using this provider. Possible values: twilio, amazon, openai.
*/
export type OperatorTypeProvider = "twilio" | "amazon" | "openai";
/**
* Options to pass to each
*/
export interface OperatorTypeListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Returns Operator Types that support the provided language code. */
languageCode?: string;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: OperatorTypeInstance, 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 OperatorTypeListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Returns Operator Types that support the provided language code. */
languageCode?: string;
/** 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 OperatorTypeListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Returns Operator Types that support the provided language code. */
languageCode?: string;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface OperatorTypeContext {
/**
* Fetch a OperatorTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>;
/**
* Fetch a OperatorTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorTypeInstance>) => any): Promise<ApiResponse<OperatorTypeInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OperatorTypeContextSolution {
sid: string;
}
export declare class OperatorTypeContextImpl implements OperatorTypeContext {
protected _version: V2;
protected _solution: OperatorTypeContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorTypeInstance>) => any): Promise<ApiResponse<OperatorTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OperatorTypeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OperatorTypePayload extends TwilioResponsePayload {
operator_types: OperatorTypeResource[];
}
interface OperatorTypeResource {
name: string;
sid: string;
friendly_name: string;
description: string;
docs_link: string;
output_type: OperatorTypeOutputType;
supported_languages: Array<string>;
provider: OperatorTypeProvider;
availability: OperatorTypeAvailability;
configurable: boolean;
config_schema: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class OperatorTypeInstance {
protected _version: V2;
protected _solution: OperatorTypeContextSolution;
protected _context?: OperatorTypeContext;
constructor(_version: V2, payload: OperatorTypeResource, sid?: string);
/**
* A unique name that references an Operator\'s Operator Type.
*/
name: string;
/**
* A 34 character string that uniquely identifies this Operator Type.
*/
sid: string;
/**
* A human-readable name of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* A human-readable description of this resource, longer than the friendly name.
*/
description: string;
/**
* Additional documentation for the Operator Type.
*/
docsLink: string;
outputType: OperatorTypeOutputType;
/**
* List of languages this Operator Type supports.
*/
supportedLanguages: Array<string>;
provider: OperatorTypeProvider;
availability: OperatorTypeAvailability;
/**
* Operators can be created from configurable Operator Types.
*/
configurable: boolean;
/**
* JSON Schema for configuring an Operator with this Operator Type. Following https://json-schema.org/
*/
configSchema: any;
/**
* The date that this Operator Type was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Operator Type was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a OperatorTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>;
/**
* Fetch a OperatorTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorTypeInstance>) => any): Promise<ApiResponse<OperatorTypeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
name: string;
sid: string;
friendlyName: string;
description: string;
docsLink: string;
outputType: OperatorTypeOutputType;
supportedLanguages: string[];
provider: OperatorTypeProvider;
availability: OperatorTypeAvailability;
configurable: boolean;
configSchema: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OperatorTypeSolution {
}
export interface OperatorTypeListInstance {
_version: V2;
_solution: OperatorTypeSolution;
_uri: string;
(sid: string): OperatorTypeContext;
get(sid: string): OperatorTypeContext;
/**
* Streams OperatorTypeInstance 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 { OperatorTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void;
each(params: OperatorTypeListInstanceEachOptions, callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams OperatorTypeInstance 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 { OperatorTypeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: OperatorTypeListInstanceEachOptions, callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of OperatorTypeInstance 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: OperatorTypePage) => any): Promise<OperatorTypePage>;
/**
* Retrieve a single target page of OperatorTypeInstance 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<OperatorTypePage>) => any): Promise<ApiResponse<OperatorTypePage>>;
/**
* Lists OperatorTypeInstance 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 { OperatorTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: OperatorTypeInstance[]) => any): Promise<OperatorTypeInstance[]>;
list(params: OperatorTypeListInstanceOptions, callback?: (error: Error | null, items: OperatorTypeInstance[]) => any): Promise<OperatorTypeInstance[]>;
/**
* Lists OperatorTypeInstance 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 { OperatorTypeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorTypeInstance[]>) => any): Promise<ApiResponse<OperatorTypeInstance[]>>;
listWithHttpInfo(params: OperatorTypeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<OperatorTypeInstance[]>) => any): Promise<ApiResponse<OperatorTypeInstance[]>>;
/**
* Retrieve a single page of OperatorTypeInstance 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 { OperatorTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: OperatorTypePage) => any): Promise<OperatorTypePage>;
page(params: OperatorTypeListInstancePageOptions, callback?: (error: Error | null, items: OperatorTypePage) => any): Promise<OperatorTypePage>;
/**
* Retrieve a single page of OperatorTypeInstance 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 { OperatorTypeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorTypePage>) => any): Promise<ApiResponse<OperatorTypePage>>;
pageWithHttpInfo(params: OperatorTypeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<OperatorTypePage>) => any): Promise<ApiResponse<OperatorTypePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OperatorTypeListInstance(version: V2): OperatorTypeListInstance;
export declare class OperatorTypePage extends Page<V2, OperatorTypePayload, OperatorTypeResource, OperatorTypeInstance> {
/**
* Initialize the OperatorTypePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: OperatorTypeSolution);
/**
* Build an instance of OperatorTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: OperatorTypeResource): OperatorTypeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,282 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.OperatorTypePage = exports.OperatorTypeInstance = exports.OperatorTypeContextImpl = void 0;
exports.OperatorTypeListInstance = OperatorTypeListInstance;
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 OperatorTypeContextImpl {
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 = `/OperatorTypes/${sid}`;
}
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 OperatorTypeInstance(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 OperatorTypeInstance(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.OperatorTypeContextImpl = OperatorTypeContextImpl;
class OperatorTypeInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.name = payload.name;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.docsLink = payload.docs_link;
this.outputType = payload.output_type;
this.supportedLanguages = payload.supported_languages;
this.provider = payload.provider;
this.availability = payload.availability;
this.configurable = payload.configurable;
this.configSchema = payload.config_schema;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new OperatorTypeContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a OperatorTypeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a OperatorTypeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorTypeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
name: this.name,
sid: this.sid,
friendlyName: this.friendlyName,
description: this.description,
docsLink: this.docsLink,
outputType: this.outputType,
supportedLanguages: this.supportedLanguages,
provider: this.provider,
availability: this.availability,
configurable: this.configurable,
configSchema: this.configSchema,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorTypeInstance = OperatorTypeInstance;
function OperatorTypeListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new OperatorTypeContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/OperatorTypes`;
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["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 OperatorTypePage(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 OperatorTypePage(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["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 OperatorTypePage(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 OperatorTypePage(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 OperatorTypePage extends Page_1.default {
/**
* Initialize the OperatorTypePage
*
* @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 OperatorTypeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new OperatorTypeInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorTypePage = OperatorTypePage;

View File

@@ -0,0 +1,335 @@
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";
/**
* Operator availability status. Possible values: internal, beta, public, retired.
*/
export type PrebuiltOperatorAvailability = "internal" | "beta" | "public" | "retired" | "general-availability";
/**
* Options to pass to each
*/
export interface PrebuiltOperatorListInstanceEachOptions {
/** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: PrebuiltOperatorAvailability;
/** Returns Pre-built Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: PrebuiltOperatorInstance, 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 PrebuiltOperatorListInstanceOptions {
/** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: PrebuiltOperatorAvailability;
/** Returns Pre-built Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface PrebuiltOperatorListInstancePageOptions {
/** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */
availability?: PrebuiltOperatorAvailability;
/** Returns Pre-built Operators that support the provided language code. */
languageCode?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface PrebuiltOperatorContext {
/**
* Fetch a PrebuiltOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance
*/
fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>;
/**
* Fetch a PrebuiltOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PrebuiltOperatorInstance>) => any): Promise<ApiResponse<PrebuiltOperatorInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface PrebuiltOperatorContextSolution {
sid: string;
}
export declare class PrebuiltOperatorContextImpl implements PrebuiltOperatorContext {
protected _version: V2;
protected _solution: PrebuiltOperatorContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PrebuiltOperatorInstance>) => any): Promise<ApiResponse<PrebuiltOperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): PrebuiltOperatorContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface PrebuiltOperatorPayload extends TwilioResponsePayload {
operators: PrebuiltOperatorResource[];
}
interface PrebuiltOperatorResource {
account_sid: string;
sid: string;
friendly_name: string;
description: string;
author: string;
operator_type: string;
version: number;
availability: PrebuiltOperatorAvailability;
config: any;
date_created: Date;
date_updated: Date;
url: string;
}
export declare class PrebuiltOperatorInstance {
protected _version: V2;
protected _solution: PrebuiltOperatorContextSolution;
protected _context?: PrebuiltOperatorContext;
constructor(_version: V2, payload: PrebuiltOperatorResource, sid?: string);
/**
* The unique SID identifier of the Account the Pre-built Operator belongs to.
*/
accountSid: string;
/**
* A 34 character string that uniquely identifies this Pre-built Operator.
*/
sid: string;
/**
* A human-readable name of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* A human-readable description of this resource, longer than the friendly name.
*/
description: string;
/**
* The creator of the Operator. Pre-built Operators can only be created by Twilio.
*/
author: string;
/**
* Operator Type for this Operator. References an existing Operator Type resource.
*/
operatorType: string;
/**
* Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator.
*/
version: number;
availability: PrebuiltOperatorAvailability;
/**
* Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account, will be empty for Pre-Built Operators.
*/
config: any;
/**
* The date that this Pre-built Operator was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Pre-built Operator was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a PrebuiltOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance
*/
fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>;
/**
* Fetch a PrebuiltOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<PrebuiltOperatorInstance>) => any): Promise<ApiResponse<PrebuiltOperatorInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
sid: string;
friendlyName: string;
description: string;
author: string;
operatorType: string;
version: number;
availability: PrebuiltOperatorAvailability;
config: any;
dateCreated: Date;
dateUpdated: Date;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface PrebuiltOperatorSolution {
}
export interface PrebuiltOperatorListInstance {
_version: V2;
_solution: PrebuiltOperatorSolution;
_uri: string;
(sid: string): PrebuiltOperatorContext;
get(sid: string): PrebuiltOperatorContext;
/**
* Streams PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void;
each(params: PrebuiltOperatorListInstanceEachOptions, callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PrebuiltOperatorListInstanceEachOptions, callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PrebuiltOperatorInstance 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: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>;
/**
* Retrieve a single target page of PrebuiltOperatorInstance 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<PrebuiltOperatorPage>) => any): Promise<ApiResponse<PrebuiltOperatorPage>>;
/**
* Lists PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PrebuiltOperatorInstance[]) => any): Promise<PrebuiltOperatorInstance[]>;
list(params: PrebuiltOperatorListInstanceOptions, callback?: (error: Error | null, items: PrebuiltOperatorInstance[]) => any): Promise<PrebuiltOperatorInstance[]>;
/**
* Lists PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PrebuiltOperatorInstance[]>) => any): Promise<ApiResponse<PrebuiltOperatorInstance[]>>;
listWithHttpInfo(params: PrebuiltOperatorListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PrebuiltOperatorInstance[]>) => any): Promise<ApiResponse<PrebuiltOperatorInstance[]>>;
/**
* Retrieve a single page of PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>;
page(params: PrebuiltOperatorListInstancePageOptions, callback?: (error: Error | null, items: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>;
/**
* Retrieve a single page of PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PrebuiltOperatorPage>) => any): Promise<ApiResponse<PrebuiltOperatorPage>>;
pageWithHttpInfo(params: PrebuiltOperatorListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PrebuiltOperatorPage>) => any): Promise<ApiResponse<PrebuiltOperatorPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PrebuiltOperatorListInstance(version: V2): PrebuiltOperatorListInstance;
export declare class PrebuiltOperatorPage extends Page<V2, PrebuiltOperatorPayload, PrebuiltOperatorResource, PrebuiltOperatorInstance> {
/**
* Initialize the PrebuiltOperatorPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: PrebuiltOperatorSolution);
/**
* Build an instance of PrebuiltOperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PrebuiltOperatorResource): PrebuiltOperatorInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,282 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.PrebuiltOperatorPage = exports.PrebuiltOperatorInstance = exports.PrebuiltOperatorContextImpl = void 0;
exports.PrebuiltOperatorListInstance = PrebuiltOperatorListInstance;
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 PrebuiltOperatorContextImpl {
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 = `/Operators/PreBuilt/${sid}`;
}
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 PrebuiltOperatorInstance(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 PrebuiltOperatorInstance(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.PrebuiltOperatorContextImpl = PrebuiltOperatorContextImpl;
class PrebuiltOperatorInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.sid = payload.sid;
this.friendlyName = payload.friendly_name;
this.description = payload.description;
this.author = payload.author;
this.operatorType = payload.operator_type;
this.version = deserialize.integer(payload.version);
this.availability = payload.availability;
this.config = payload.config;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.url = payload.url;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new PrebuiltOperatorContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Fetch a PrebuiltOperatorInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a PrebuiltOperatorInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed PrebuiltOperatorInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
sid: this.sid,
friendlyName: this.friendlyName,
description: this.description,
author: this.author,
operatorType: this.operatorType,
version: this.version,
availability: this.availability,
config: this.config,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PrebuiltOperatorInstance = PrebuiltOperatorInstance;
function PrebuiltOperatorListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new PrebuiltOperatorContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Operators/PreBuilt`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 PrebuiltOperatorPage(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 PrebuiltOperatorPage(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["availability"] !== undefined)
data["Availability"] = params["availability"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
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 PrebuiltOperatorPage(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 PrebuiltOperatorPage(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 PrebuiltOperatorPage extends Page_1.default {
/**
* Initialize the PrebuiltOperatorPage
*
* @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 PrebuiltOperatorInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PrebuiltOperatorInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PrebuiltOperatorPage = PrebuiltOperatorPage;

View File

@@ -0,0 +1,525 @@
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 HTTP method for the Webhook. One of `GET` or `POST`.
*/
export type ServiceHttpMethod = "GET" | "POST" | "NULL";
/**
* Options to pass to update a ServiceInstance
*/
export interface ServiceContextUpdateOptions {
/** The If-Match HTTP request header */
ifMatch?: string;
/** Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. */
autoTranscribe?: boolean;
/** Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */
dataLogging?: boolean;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. */
uniqueName?: string;
/** Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. */
autoRedaction?: boolean;
/** Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. */
mediaRedaction?: boolean;
/** The URL Twilio will request when executing the Webhook. */
webhookUrl?: string;
/** */
webhookHttpMethod?: ServiceHttpMethod;
/** The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results. */
encryptionCredentialSid?: string;
}
/**
* Options to pass to create a ServiceInstance
*/
export interface ServiceListInstanceCreateOptions {
/** Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. */
uniqueName: string;
/** Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. */
autoTranscribe?: boolean;
/** Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */
dataLogging?: boolean;
/** A human readable description of this resource, up to 64 characters. */
friendlyName?: string;
/** The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it\\\'s set. */
languageCode?: string;
/** Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. */
autoRedaction?: boolean;
/** Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. */
mediaRedaction?: boolean;
/** The URL Twilio will request when executing the Webhook. */
webhookUrl?: string;
/** */
webhookHttpMethod?: ServiceHttpMethod;
/** The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results. */
encryptionCredentialSid?: string;
}
/**
* Options to pass to each
*/
export interface ServiceListInstanceEachOptions {
/** 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: ServiceInstance, 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 ServiceListInstanceOptions {
/** 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 ServiceListInstancePageOptions {
/** 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 ServiceContext {
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ServiceInstance 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 ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ServiceContextSolution {
sid: string;
}
export declare class ServiceContextImpl implements ServiceContext {
protected _version: V2;
protected _solution: ServiceContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
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?: ServiceInstance) => any): Promise<ServiceInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
updateWithHttpInfo(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ApiResponse<ServiceInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ServiceContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ServicePayload extends TwilioResponsePayload {
services: ServiceResource[];
}
interface ServiceResource {
account_sid: string;
auto_redaction: boolean;
media_redaction: boolean;
auto_transcribe: boolean;
data_logging: boolean;
date_created: Date;
date_updated: Date;
friendly_name: string;
language_code: string;
sid: string;
unique_name: string;
url: string;
webhook_url: string;
webhook_http_method: ServiceHttpMethod;
read_only_attached_operator_sids: Array<string>;
version: number;
encryption_credential_sid: string;
}
export declare class ServiceInstance {
protected _version: V2;
protected _solution: ServiceContextSolution;
protected _context?: ServiceContext;
constructor(_version: V2, payload: ServiceResource, sid?: string);
/**
* The unique SID identifier of the Account the Service belongs to.
*/
accountSid: string;
/**
* Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.
*/
autoRedaction: boolean;
/**
* Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.
*/
mediaRedaction: boolean;
/**
* Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.
*/
autoTranscribe: boolean;
/**
* Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
*/
dataLogging: boolean;
/**
* The date that this Service was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Service was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
/**
* A human readable description of this resource, up to 64 characters.
*/
friendlyName: string;
/**
* The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it\'s set.
*/
languageCode: string;
/**
* A 34 character string that uniquely identifies this Service.
*/
sid: string;
/**
* Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.
*/
uniqueName: string;
/**
* The URL of this resource.
*/
url: string;
/**
* The URL Twilio will request when executing the Webhook.
*/
webhookUrl: string;
webhookHttpMethod: ServiceHttpMethod;
/**
* Operator sids attached to this service, read only
*/
readOnlyAttachedOperatorSids: Array<string>;
/**
* The version number of this Service.
*/
version: number;
/**
* The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results.
*/
encryptionCredentialSid: string;
private get _proxy();
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ServiceInstance 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 ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Update a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
updateWithHttpInfo(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
autoRedaction: boolean;
mediaRedaction: boolean;
autoTranscribe: boolean;
dataLogging: boolean;
dateCreated: Date;
dateUpdated: Date;
friendlyName: string;
languageCode: string;
sid: string;
uniqueName: string;
url: string;
webhookUrl: string;
webhookHttpMethod: ServiceHttpMethod;
readOnlyAttachedOperatorSids: string[];
version: number;
encryptionCredentialSid: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ServiceSolution {
}
export interface ServiceListInstance {
_version: V2;
_solution: ServiceSolution;
_uri: string;
(sid: string): ServiceContext;
get(sid: string): ServiceContext;
/**
* Create a ServiceInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>;
/**
* Create a ServiceInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance with HTTP metadata
*/
createWithHttpInfo(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<ServiceInstance>) => any): Promise<ApiResponse<ServiceInstance>>;
/**
* Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>;
/**
* Retrieve a single target page of ServiceInstance 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<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
/**
* Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>;
/**
* Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
listWithHttpInfo(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ServiceInstance[]>) => any): Promise<ApiResponse<ServiceInstance[]>>;
/**
* Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>;
/**
* Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
pageWithHttpInfo(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ServicePage>) => any): Promise<ApiResponse<ServicePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ServiceListInstance(version: V2): ServiceListInstance;
export declare class ServicePage extends Page<V2, ServicePayload, ServiceResource, ServiceInstance> {
/**
* Initialize the ServicePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: ServiceSolution);
/**
* Build an instance of ServiceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ServiceResource): ServiceInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

514
node_modules/twilio/lib/rest/intelligence/v2/service.js generated vendored Normal file
View File

@@ -0,0 +1,514 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.ServicePage = exports.ServiceInstance = exports.ServiceContextImpl = void 0;
exports.ServiceListInstance = ServiceListInstance;
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 ServiceContextImpl {
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 = `/Services/${sid}`;
}
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 ServiceInstance(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 ServiceInstance(operationVersion, response.body, instance._solution.sid),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["autoTranscribe"] !== undefined)
data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]);
if (params["dataLogging"] !== undefined)
data["DataLogging"] = serialize.bool(params["dataLogging"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["autoRedaction"] !== undefined)
data["AutoRedaction"] = serialize.bool(params["autoRedaction"]);
if (params["mediaRedaction"] !== undefined)
data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]);
if (params["webhookUrl"] !== undefined)
data["WebhookUrl"] = params["webhookUrl"];
if (params["webhookHttpMethod"] !== undefined)
data["WebhookHttpMethod"] = params["webhookHttpMethod"];
if (params["encryptionCredentialSid"] !== undefined)
data["EncryptionCredentialSid"] = params["encryptionCredentialSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["ifMatch"] !== undefined)
headers["If-Match"] = params["ifMatch"];
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["autoTranscribe"] !== undefined)
data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]);
if (params["dataLogging"] !== undefined)
data["DataLogging"] = serialize.bool(params["dataLogging"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["uniqueName"] !== undefined)
data["UniqueName"] = params["uniqueName"];
if (params["autoRedaction"] !== undefined)
data["AutoRedaction"] = serialize.bool(params["autoRedaction"]);
if (params["mediaRedaction"] !== undefined)
data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]);
if (params["webhookUrl"] !== undefined)
data["WebhookUrl"] = params["webhookUrl"];
if (params["webhookHttpMethod"] !== undefined)
data["WebhookHttpMethod"] = params["webhookHttpMethod"];
if (params["encryptionCredentialSid"] !== undefined)
data["EncryptionCredentialSid"] = params["encryptionCredentialSid"];
const headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded";
headers["Accept"] = "application/json";
if (params["ifMatch"] !== undefined)
headers["If-Match"] = params["ifMatch"];
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 ServiceInstance(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.ServiceContextImpl = ServiceContextImpl;
class ServiceInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.autoRedaction = payload.auto_redaction;
this.mediaRedaction = payload.media_redaction;
this.autoTranscribe = payload.auto_transcribe;
this.dataLogging = payload.data_logging;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.friendlyName = payload.friendly_name;
this.languageCode = payload.language_code;
this.sid = payload.sid;
this.uniqueName = payload.unique_name;
this.url = payload.url;
this.webhookUrl = payload.webhook_url;
this.webhookHttpMethod = payload.webhook_http_method;
this.readOnlyAttachedOperatorSids =
payload.read_only_attached_operator_sids;
this.version = deserialize.integer(payload.version);
this.encryptionCredentialSid = payload.encryption_credential_sid;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new ServiceContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ServiceInstance 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 ServiceInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ServiceInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ServiceInstance 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 {
accountSid: this.accountSid,
autoRedaction: this.autoRedaction,
mediaRedaction: this.mediaRedaction,
autoTranscribe: this.autoTranscribe,
dataLogging: this.dataLogging,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
friendlyName: this.friendlyName,
languageCode: this.languageCode,
sid: this.sid,
uniqueName: this.uniqueName,
url: this.url,
webhookUrl: this.webhookUrl,
webhookHttpMethod: this.webhookHttpMethod,
readOnlyAttachedOperatorSids: this.readOnlyAttachedOperatorSids,
version: this.version,
encryptionCredentialSid: this.encryptionCredentialSid,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ServiceInstance = ServiceInstance;
function ServiceListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new ServiceContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Services`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["uniqueName"] === null || params["uniqueName"] === undefined) {
throw new Error("Required parameter \"params['uniqueName']\" missing.");
}
let data = {};
data["UniqueName"] = params["uniqueName"];
if (params["autoTranscribe"] !== undefined)
data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]);
if (params["dataLogging"] !== undefined)
data["DataLogging"] = serialize.bool(params["dataLogging"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
if (params["autoRedaction"] !== undefined)
data["AutoRedaction"] = serialize.bool(params["autoRedaction"]);
if (params["mediaRedaction"] !== undefined)
data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]);
if (params["webhookUrl"] !== undefined)
data["WebhookUrl"] = params["webhookUrl"];
if (params["webhookHttpMethod"] !== undefined)
data["WebhookHttpMethod"] = params["webhookHttpMethod"];
if (params["encryptionCredentialSid"] !== undefined)
data["EncryptionCredentialSid"] = params["encryptionCredentialSid"];
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 ServiceInstance(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["uniqueName"] === null || params["uniqueName"] === undefined) {
throw new Error("Required parameter \"params['uniqueName']\" missing.");
}
let data = {};
data["UniqueName"] = params["uniqueName"];
if (params["autoTranscribe"] !== undefined)
data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]);
if (params["dataLogging"] !== undefined)
data["DataLogging"] = serialize.bool(params["dataLogging"]);
if (params["friendlyName"] !== undefined)
data["FriendlyName"] = params["friendlyName"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
if (params["autoRedaction"] !== undefined)
data["AutoRedaction"] = serialize.bool(params["autoRedaction"]);
if (params["mediaRedaction"] !== undefined)
data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]);
if (params["webhookUrl"] !== undefined)
data["WebhookUrl"] = params["webhookUrl"];
if (params["webhookHttpMethod"] !== undefined)
data["WebhookHttpMethod"] = params["webhookHttpMethod"];
if (params["encryptionCredentialSid"] !== undefined)
data["EncryptionCredentialSid"] = params["encryptionCredentialSid"];
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 ServiceInstance(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 ServicePage(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 ServicePage(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 ServicePage(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 ServicePage(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 ServicePage extends Page_1.default {
/**
* Initialize the ServicePage
*
* @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 ServiceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ServiceInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ServicePage = ServicePage;

View File

@@ -0,0 +1,494 @@
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 { EncryptedOperatorResultsListInstance } from "./transcript/encryptedOperatorResults";
import { EncryptedSentencesListInstance } from "./transcript/encryptedSentences";
import { MediaListInstance } from "./transcript/media";
import { OperatorResultListInstance } from "./transcript/operatorResult";
import { SentenceListInstance } from "./transcript/sentence";
/**
* The Status of this Transcript. One of `queued`, `in-progress`, `completed`, `failed` or `canceled`.
*/
export type TranscriptStatus = "queued" | "in-progress" | "completed" | "new" | "failed" | "canceled" | "error";
/**
* Options to pass to create a TranscriptInstance
*/
export interface TranscriptListInstanceCreateOptions {
/** The unique SID identifier of the Service. */
serviceSid: string;
/** JSON object describing Media Channel including Source and Participants */
channel: any;
/** Used to store client provided metadata. Maximum of 64 double-byte UTF8 characters. */
customerKey?: string;
/** The date that this Transcript\\\'s media was started, given in ISO 8601 format. */
mediaStartTime?: Date;
}
/**
* Options to pass to each
*/
export interface TranscriptListInstanceEachOptions {
/** The unique SID identifier of the Service. */
serviceSid?: string;
/** Filter by before StartTime. */
beforeStartTime?: string;
/** Filter by after StartTime. */
afterStartTime?: string;
/** Filter by before DateCreated. */
beforeDateCreated?: string;
/** Filter by after DateCreated. */
afterDateCreated?: string;
/** Filter by status. */
status?: string;
/** Filter by Language Code. */
languageCode?: string;
/** Filter by SourceSid. */
sourceSid?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: TranscriptInstance, 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 TranscriptListInstanceOptions {
/** The unique SID identifier of the Service. */
serviceSid?: string;
/** Filter by before StartTime. */
beforeStartTime?: string;
/** Filter by after StartTime. */
afterStartTime?: string;
/** Filter by before DateCreated. */
beforeDateCreated?: string;
/** Filter by after DateCreated. */
afterDateCreated?: string;
/** Filter by status. */
status?: string;
/** Filter by Language Code. */
languageCode?: string;
/** Filter by SourceSid. */
sourceSid?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface TranscriptListInstancePageOptions {
/** The unique SID identifier of the Service. */
serviceSid?: string;
/** Filter by before StartTime. */
beforeStartTime?: string;
/** Filter by after StartTime. */
afterStartTime?: string;
/** Filter by before DateCreated. */
beforeDateCreated?: string;
/** Filter by after DateCreated. */
afterDateCreated?: string;
/** Filter by status. */
status?: string;
/** Filter by Language Code. */
languageCode?: string;
/** Filter by SourceSid. */
sourceSid?: string;
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface TranscriptContext {
encryptedOperatorResults: EncryptedOperatorResultsListInstance;
encryptedSentences: EncryptedSentencesListInstance;
media: MediaListInstance;
operatorResults: OperatorResultListInstance;
sentences: SentenceListInstance;
/**
* Remove a TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TranscriptInstance 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 TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance
*/
fetch(callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>;
/**
* Fetch a TranscriptInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TranscriptInstance>) => any): Promise<ApiResponse<TranscriptInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface TranscriptContextSolution {
sid: string;
}
export declare class TranscriptContextImpl implements TranscriptContext {
protected _version: V2;
protected _solution: TranscriptContextSolution;
protected _uri: string;
protected _encryptedOperatorResults?: EncryptedOperatorResultsListInstance;
protected _encryptedSentences?: EncryptedSentencesListInstance;
protected _media?: MediaListInstance;
protected _operatorResults?: OperatorResultListInstance;
protected _sentences?: SentenceListInstance;
constructor(_version: V2, sid: string);
get encryptedOperatorResults(): EncryptedOperatorResultsListInstance;
get encryptedSentences(): EncryptedSentencesListInstance;
get media(): MediaListInstance;
get operatorResults(): OperatorResultListInstance;
get sentences(): SentenceListInstance;
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?: TranscriptInstance) => any): Promise<TranscriptInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TranscriptInstance>) => any): Promise<ApiResponse<TranscriptInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): TranscriptContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface TranscriptPayload extends TwilioResponsePayload {
transcripts: TranscriptResource[];
}
interface TranscriptResource {
account_sid: string;
service_sid: string;
sid: string;
date_created: Date;
date_updated: Date;
status: TranscriptStatus;
channel: any;
data_logging: boolean;
language_code: string;
customer_key: string;
media_start_time: Date;
duration: number;
url: string;
redaction: boolean;
encryption_credential_sid: string;
links: Record<string, string>;
}
export declare class TranscriptInstance {
protected _version: V2;
protected _solution: TranscriptContextSolution;
protected _context?: TranscriptContext;
constructor(_version: V2, payload: TranscriptResource, sid?: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* The unique SID identifier of the Service.
*/
serviceSid: string;
/**
* A 34 character string that uniquely identifies this Transcript.
*/
sid: string;
/**
* The date that this Transcript was created, given in ISO 8601 format.
*/
dateCreated: Date;
/**
* The date that this Transcript was updated, given in ISO 8601 format.
*/
dateUpdated: Date;
status: TranscriptStatus;
/**
* Media Channel describing Transcript Source and Participant Mapping
*/
channel: any;
/**
* Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
*/
dataLogging: boolean;
/**
* The default language code of the audio.
*/
languageCode: string;
customerKey: string;
/**
* The date that this Transcript\'s media was started, given in ISO 8601 format.
*/
mediaStartTime: Date;
/**
* The duration of this Transcript\'s source
*/
duration: number;
/**
* The URL of this resource.
*/
url: string;
/**
* If the transcript has been redacted, a redacted alternative of the transcript will be available.
*/
redaction: boolean;
/**
* The unique SID identifier of the Public Key resource used to encrypt the sentences and operator results.
*/
encryptionCredentialSid: string;
links: Record<string, string>;
private get _proxy();
/**
* Remove a TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a TranscriptInstance 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 TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance
*/
fetch(callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>;
/**
* Fetch a TranscriptInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<TranscriptInstance>) => any): Promise<ApiResponse<TranscriptInstance>>;
/**
* Access the encryptedOperatorResults.
*/
encryptedOperatorResults(): EncryptedOperatorResultsListInstance;
/**
* Access the encryptedSentences.
*/
encryptedSentences(): EncryptedSentencesListInstance;
/**
* Access the media.
*/
media(): MediaListInstance;
/**
* Access the operatorResults.
*/
operatorResults(): OperatorResultListInstance;
/**
* Access the sentences.
*/
sentences(): SentenceListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
serviceSid: string;
sid: string;
dateCreated: Date;
dateUpdated: Date;
status: TranscriptStatus;
channel: any;
dataLogging: boolean;
languageCode: string;
customerKey: string;
mediaStartTime: Date;
duration: number;
url: string;
redaction: boolean;
encryptionCredentialSid: string;
links: Record<string, string>;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface TranscriptSolution {
}
export interface TranscriptListInstance {
_version: V2;
_solution: TranscriptSolution;
_uri: string;
(sid: string): TranscriptContext;
get(sid: string): TranscriptContext;
/**
* Create a TranscriptInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance
*/
create(params: TranscriptListInstanceCreateOptions, callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>;
/**
* Create a TranscriptInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance with HTTP metadata
*/
createWithHttpInfo(params: TranscriptListInstanceCreateOptions, callback?: (error: Error | null, item?: ApiResponse<TranscriptInstance>) => any): Promise<ApiResponse<TranscriptInstance>>;
/**
* Streams TranscriptInstance 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 { TranscriptListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void;
each(params: TranscriptListInstanceEachOptions, callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void;
/**
* Streams TranscriptInstance 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 { TranscriptListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: TranscriptListInstanceEachOptions, callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of TranscriptInstance 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: TranscriptPage) => any): Promise<TranscriptPage>;
/**
* Retrieve a single target page of TranscriptInstance 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<TranscriptPage>) => any): Promise<ApiResponse<TranscriptPage>>;
/**
* Lists TranscriptInstance 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 { TranscriptListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: TranscriptInstance[]) => any): Promise<TranscriptInstance[]>;
list(params: TranscriptListInstanceOptions, callback?: (error: Error | null, items: TranscriptInstance[]) => any): Promise<TranscriptInstance[]>;
/**
* Lists TranscriptInstance 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 { TranscriptListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TranscriptInstance[]>) => any): Promise<ApiResponse<TranscriptInstance[]>>;
listWithHttpInfo(params: TranscriptListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TranscriptInstance[]>) => any): Promise<ApiResponse<TranscriptInstance[]>>;
/**
* Retrieve a single page of TranscriptInstance 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 { TranscriptListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: TranscriptPage) => any): Promise<TranscriptPage>;
page(params: TranscriptListInstancePageOptions, callback?: (error: Error | null, items: TranscriptPage) => any): Promise<TranscriptPage>;
/**
* Retrieve a single page of TranscriptInstance 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 { TranscriptListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TranscriptPage>) => any): Promise<ApiResponse<TranscriptPage>>;
pageWithHttpInfo(params: TranscriptListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TranscriptPage>) => any): Promise<ApiResponse<TranscriptPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function TranscriptListInstance(version: V2): TranscriptListInstance;
export declare class TranscriptPage extends Page<V2, TranscriptPayload, TranscriptResource, TranscriptInstance> {
/**
* Initialize the TranscriptPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: TranscriptSolution);
/**
* Build an instance of TranscriptInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: TranscriptResource): TranscriptInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,489 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.TranscriptPage = exports.TranscriptInstance = exports.TranscriptContextImpl = void 0;
exports.TranscriptListInstance = TranscriptListInstance;
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 encryptedOperatorResults_1 = require("./transcript/encryptedOperatorResults");
const encryptedSentences_1 = require("./transcript/encryptedSentences");
const media_1 = require("./transcript/media");
const operatorResult_1 = require("./transcript/operatorResult");
const sentence_1 = require("./transcript/sentence");
class TranscriptContextImpl {
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 = `/Transcripts/${sid}`;
}
get encryptedOperatorResults() {
this._encryptedOperatorResults =
this._encryptedOperatorResults ||
(0, encryptedOperatorResults_1.EncryptedOperatorResultsListInstance)(this._version, this._solution.sid);
return this._encryptedOperatorResults;
}
get encryptedSentences() {
this._encryptedSentences =
this._encryptedSentences ||
(0, encryptedSentences_1.EncryptedSentencesListInstance)(this._version, this._solution.sid);
return this._encryptedSentences;
}
get media() {
this._media =
this._media || (0, media_1.MediaListInstance)(this._version, this._solution.sid);
return this._media;
}
get operatorResults() {
this._operatorResults =
this._operatorResults ||
(0, operatorResult_1.OperatorResultListInstance)(this._version, this._solution.sid);
return this._operatorResults;
}
get sentences() {
this._sentences =
this._sentences ||
(0, sentence_1.SentenceListInstance)(this._version, this._solution.sid);
return this._sentences;
}
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 TranscriptInstance(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 TranscriptInstance(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.TranscriptContextImpl = TranscriptContextImpl;
class TranscriptInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.serviceSid = payload.service_sid;
this.sid = payload.sid;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.status = payload.status;
this.channel = payload.channel;
this.dataLogging = payload.data_logging;
this.languageCode = payload.language_code;
this.customerKey = payload.customer_key;
this.mediaStartTime = deserialize.iso8601DateTime(payload.media_start_time);
this.duration = deserialize.integer(payload.duration);
this.url = payload.url;
this.redaction = payload.redaction;
this.encryptionCredentialSid = payload.encryption_credential_sid;
this.links = payload.links;
this._solution = { sid: sid || this.sid };
}
get _proxy() {
this._context =
this._context ||
new TranscriptContextImpl(this._version, this._solution.sid);
return this._context;
}
/**
* Remove a TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a TranscriptInstance 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 TranscriptInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a TranscriptInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed TranscriptInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the encryptedOperatorResults.
*/
encryptedOperatorResults() {
return this._proxy.encryptedOperatorResults;
}
/**
* Access the encryptedSentences.
*/
encryptedSentences() {
return this._proxy.encryptedSentences;
}
/**
* Access the media.
*/
media() {
return this._proxy.media;
}
/**
* Access the operatorResults.
*/
operatorResults() {
return this._proxy.operatorResults;
}
/**
* Access the sentences.
*/
sentences() {
return this._proxy.sentences;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
serviceSid: this.serviceSid,
sid: this.sid,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
status: this.status,
channel: this.channel,
dataLogging: this.dataLogging,
languageCode: this.languageCode,
customerKey: this.customerKey,
mediaStartTime: this.mediaStartTime,
duration: this.duration,
url: this.url,
redaction: this.redaction,
encryptionCredentialSid: this.encryptionCredentialSid,
links: this.links,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TranscriptInstance = TranscriptInstance;
function TranscriptListInstance(version) {
const instance = ((sid) => instance.get(sid));
instance.get = function get(sid) {
return new TranscriptContextImpl(version, sid);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Transcripts`;
instance.create = function create(params, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
if (params["serviceSid"] === null || params["serviceSid"] === undefined) {
throw new Error("Required parameter \"params['serviceSid']\" missing.");
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
let data = {};
data["ServiceSid"] = params["serviceSid"];
data["Channel"] = serialize.object(params["channel"]);
if (params["customerKey"] !== undefined)
data["CustomerKey"] = params["customerKey"];
if (params["mediaStartTime"] !== undefined)
data["MediaStartTime"] = serialize.iso8601DateTime(params["mediaStartTime"]);
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 TranscriptInstance(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["serviceSid"] === null || params["serviceSid"] === undefined) {
throw new Error("Required parameter \"params['serviceSid']\" missing.");
}
if (params["channel"] === null || params["channel"] === undefined) {
throw new Error("Required parameter \"params['channel']\" missing.");
}
let data = {};
data["ServiceSid"] = params["serviceSid"];
data["Channel"] = serialize.object(params["channel"]);
if (params["customerKey"] !== undefined)
data["CustomerKey"] = params["customerKey"];
if (params["mediaStartTime"] !== undefined)
data["MediaStartTime"] = serialize.iso8601DateTime(params["mediaStartTime"]);
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 TranscriptInstance(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["serviceSid"] !== undefined)
data["ServiceSid"] = params["serviceSid"];
if (params["beforeStartTime"] !== undefined)
data["BeforeStartTime"] = params["beforeStartTime"];
if (params["afterStartTime"] !== undefined)
data["AfterStartTime"] = params["afterStartTime"];
if (params["beforeDateCreated"] !== undefined)
data["BeforeDateCreated"] = params["beforeDateCreated"];
if (params["afterDateCreated"] !== undefined)
data["AfterDateCreated"] = params["afterDateCreated"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
if (params["sourceSid"] !== undefined)
data["SourceSid"] = params["sourceSid"];
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 TranscriptPage(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 TranscriptPage(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["serviceSid"] !== undefined)
data["ServiceSid"] = params["serviceSid"];
if (params["beforeStartTime"] !== undefined)
data["BeforeStartTime"] = params["beforeStartTime"];
if (params["afterStartTime"] !== undefined)
data["AfterStartTime"] = params["afterStartTime"];
if (params["beforeDateCreated"] !== undefined)
data["BeforeDateCreated"] = params["beforeDateCreated"];
if (params["afterDateCreated"] !== undefined)
data["AfterDateCreated"] = params["afterDateCreated"];
if (params["status"] !== undefined)
data["Status"] = params["status"];
if (params["languageCode"] !== undefined)
data["LanguageCode"] = params["languageCode"];
if (params["sourceSid"] !== undefined)
data["SourceSid"] = params["sourceSid"];
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 TranscriptPage(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 TranscriptPage(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 TranscriptPage extends Page_1.default {
/**
* Initialize the TranscriptPage
*
* @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 TranscriptInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new TranscriptInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.TranscriptPage = TranscriptPage;

View File

@@ -0,0 +1,149 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a EncryptedOperatorResultsInstance
*/
export interface EncryptedOperatorResultsContextFetchOptions {
/** Grant access to PII Redacted/Unredacted Operator Results. If redaction is enabled, the default is `true` to access redacted operator results. */
redacted?: boolean;
}
export interface EncryptedOperatorResultsContext {
/**
* Fetch a EncryptedOperatorResultsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance
*/
fetch(callback?: (error: Error | null, item?: EncryptedOperatorResultsInstance) => any): Promise<EncryptedOperatorResultsInstance>;
/**
* Fetch a EncryptedOperatorResultsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance
*/
fetch(params: EncryptedOperatorResultsContextFetchOptions, callback?: (error: Error | null, item?: EncryptedOperatorResultsInstance) => any): Promise<EncryptedOperatorResultsInstance>;
/**
* Fetch a EncryptedOperatorResultsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any): Promise<ApiResponse<EncryptedOperatorResultsInstance>>;
/**
* Fetch a EncryptedOperatorResultsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance with HTTP metadata
*/
fetchWithHttpInfo(params: EncryptedOperatorResultsContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any): Promise<ApiResponse<EncryptedOperatorResultsInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EncryptedOperatorResultsContextSolution {
transcriptSid: string;
}
export declare class EncryptedOperatorResultsContextImpl implements EncryptedOperatorResultsContext {
protected _version: V2;
protected _solution: EncryptedOperatorResultsContextSolution;
protected _uri: string;
constructor(_version: V2, transcriptSid: string);
fetch(params?: EncryptedOperatorResultsContextFetchOptions | ((error: Error | null, item?: EncryptedOperatorResultsInstance) => any), callback?: (error: Error | null, item?: EncryptedOperatorResultsInstance) => any): Promise<EncryptedOperatorResultsInstance>;
fetchWithHttpInfo(params?: EncryptedOperatorResultsContextFetchOptions | ((error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any): Promise<ApiResponse<EncryptedOperatorResultsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EncryptedOperatorResultsContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EncryptedOperatorResultsResource {
locations: Array<string>;
transcript_sid: string;
url: string;
}
export declare class EncryptedOperatorResultsInstance {
protected _version: V2;
protected _solution: EncryptedOperatorResultsContextSolution;
protected _context?: EncryptedOperatorResultsContext;
constructor(_version: V2, payload: EncryptedOperatorResultsResource, transcriptSid: string);
/**
* The locations of the encrypted operator results.
*/
locations: Array<string>;
transcriptSid: string;
url: string;
private get _proxy();
/**
* Fetch a EncryptedOperatorResultsInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance
*/
fetch(callback?: (error: Error | null, item?: EncryptedOperatorResultsInstance) => any): Promise<EncryptedOperatorResultsInstance>;
/**
* Fetch a EncryptedOperatorResultsInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance
*/
fetch(params: EncryptedOperatorResultsContextFetchOptions, callback?: (error: Error | null, item?: EncryptedOperatorResultsInstance) => any): Promise<EncryptedOperatorResultsInstance>;
/**
* Fetch a EncryptedOperatorResultsInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any): Promise<ApiResponse<EncryptedOperatorResultsInstance>>;
/**
* Fetch a EncryptedOperatorResultsInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedOperatorResultsInstance with HTTP metadata
*/
fetchWithHttpInfo(params: EncryptedOperatorResultsContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<EncryptedOperatorResultsInstance>) => any): Promise<ApiResponse<EncryptedOperatorResultsInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
locations: string[];
transcriptSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EncryptedOperatorResultsSolution {
transcriptSid: string;
}
export interface EncryptedOperatorResultsListInstance {
_version: V2;
_solution: EncryptedOperatorResultsSolution;
_uri: string;
(): EncryptedOperatorResultsContext;
get(): EncryptedOperatorResultsContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EncryptedOperatorResultsListInstance(version: V2, transcriptSid: string): EncryptedOperatorResultsListInstance;
export {};

View File

@@ -0,0 +1,153 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.EncryptedOperatorResultsInstance = exports.EncryptedOperatorResultsContextImpl = void 0;
exports.EncryptedOperatorResultsListInstance = EncryptedOperatorResultsListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class EncryptedOperatorResultsContextImpl {
constructor(_version, transcriptSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
this._solution = { transcriptSid };
this._uri = `/Transcripts/${transcriptSid}/OperatorResults/Encrypted`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new EncryptedOperatorResultsInstance(operationVersion, payload, instance._solution.transcriptSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new EncryptedOperatorResultsInstance(operationVersion, response.body, instance._solution.transcriptSid),
}));
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.EncryptedOperatorResultsContextImpl = EncryptedOperatorResultsContextImpl;
class EncryptedOperatorResultsInstance {
constructor(_version, payload, transcriptSid) {
this._version = _version;
this.locations = payload.locations;
this.transcriptSid = payload.transcript_sid;
this.url = payload.url;
this._solution = { transcriptSid };
}
get _proxy() {
this._context =
this._context ||
new EncryptedOperatorResultsContextImpl(this._version, this._solution.transcriptSid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
locations: this.locations,
transcriptSid: this.transcriptSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EncryptedOperatorResultsInstance = EncryptedOperatorResultsInstance;
function EncryptedOperatorResultsListInstance(version, transcriptSid) {
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new EncryptedOperatorResultsContextImpl(version, transcriptSid);
};
instance._version = version;
instance._solution = { transcriptSid };
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,149 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a EncryptedSentencesInstance
*/
export interface EncryptedSentencesContextFetchOptions {
/** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */
redacted?: boolean;
}
export interface EncryptedSentencesContext {
/**
* Fetch a EncryptedSentencesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance
*/
fetch(callback?: (error: Error | null, item?: EncryptedSentencesInstance) => any): Promise<EncryptedSentencesInstance>;
/**
* Fetch a EncryptedSentencesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance
*/
fetch(params: EncryptedSentencesContextFetchOptions, callback?: (error: Error | null, item?: EncryptedSentencesInstance) => any): Promise<EncryptedSentencesInstance>;
/**
* Fetch a EncryptedSentencesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any): Promise<ApiResponse<EncryptedSentencesInstance>>;
/**
* Fetch a EncryptedSentencesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance with HTTP metadata
*/
fetchWithHttpInfo(params: EncryptedSentencesContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any): Promise<ApiResponse<EncryptedSentencesInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface EncryptedSentencesContextSolution {
transcriptSid: string;
}
export declare class EncryptedSentencesContextImpl implements EncryptedSentencesContext {
protected _version: V2;
protected _solution: EncryptedSentencesContextSolution;
protected _uri: string;
constructor(_version: V2, transcriptSid: string);
fetch(params?: EncryptedSentencesContextFetchOptions | ((error: Error | null, item?: EncryptedSentencesInstance) => any), callback?: (error: Error | null, item?: EncryptedSentencesInstance) => any): Promise<EncryptedSentencesInstance>;
fetchWithHttpInfo(params?: EncryptedSentencesContextFetchOptions | ((error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any): Promise<ApiResponse<EncryptedSentencesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): EncryptedSentencesContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface EncryptedSentencesResource {
location: string;
transcript_sid: string;
url: string;
}
export declare class EncryptedSentencesInstance {
protected _version: V2;
protected _solution: EncryptedSentencesContextSolution;
protected _context?: EncryptedSentencesContext;
constructor(_version: V2, payload: EncryptedSentencesResource, transcriptSid: string);
/**
* The location of the encrypted sentences.
*/
location: string;
transcriptSid: string;
url: string;
private get _proxy();
/**
* Fetch a EncryptedSentencesInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance
*/
fetch(callback?: (error: Error | null, item?: EncryptedSentencesInstance) => any): Promise<EncryptedSentencesInstance>;
/**
* Fetch a EncryptedSentencesInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance
*/
fetch(params: EncryptedSentencesContextFetchOptions, callback?: (error: Error | null, item?: EncryptedSentencesInstance) => any): Promise<EncryptedSentencesInstance>;
/**
* Fetch a EncryptedSentencesInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any): Promise<ApiResponse<EncryptedSentencesInstance>>;
/**
* Fetch a EncryptedSentencesInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed EncryptedSentencesInstance with HTTP metadata
*/
fetchWithHttpInfo(params: EncryptedSentencesContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<EncryptedSentencesInstance>) => any): Promise<ApiResponse<EncryptedSentencesInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
location: string;
transcriptSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface EncryptedSentencesSolution {
transcriptSid: string;
}
export interface EncryptedSentencesListInstance {
_version: V2;
_solution: EncryptedSentencesSolution;
_uri: string;
(): EncryptedSentencesContext;
get(): EncryptedSentencesContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function EncryptedSentencesListInstance(version: V2, transcriptSid: string): EncryptedSentencesListInstance;
export {};

View File

@@ -0,0 +1,153 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.EncryptedSentencesInstance = exports.EncryptedSentencesContextImpl = void 0;
exports.EncryptedSentencesListInstance = EncryptedSentencesListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class EncryptedSentencesContextImpl {
constructor(_version, transcriptSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
this._solution = { transcriptSid };
this._uri = `/Transcripts/${transcriptSid}/Sentences/Encrypted`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new EncryptedSentencesInstance(operationVersion, payload, instance._solution.transcriptSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new EncryptedSentencesInstance(operationVersion, response.body, instance._solution.transcriptSid),
}));
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.EncryptedSentencesContextImpl = EncryptedSentencesContextImpl;
class EncryptedSentencesInstance {
constructor(_version, payload, transcriptSid) {
this._version = _version;
this.location = payload.location;
this.transcriptSid = payload.transcript_sid;
this.url = payload.url;
this._solution = { transcriptSid };
}
get _proxy() {
this._context =
this._context ||
new EncryptedSentencesContextImpl(this._version, this._solution.transcriptSid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
location: this.location,
transcriptSid: this.transcriptSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.EncryptedSentencesInstance = EncryptedSentencesInstance;
function EncryptedSentencesListInstance(version, transcriptSid) {
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new EncryptedSentencesContextImpl(version, transcriptSid);
};
instance._version = version;
instance._solution = { transcriptSid };
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,167 @@
import { inspect, InspectOptions } from "util";
import V2 from "../../V2";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to fetch a MediaInstance
*/
export interface MediaContextFetchOptions {
/** Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is `true` to access redacted media. */
redacted?: boolean;
}
export interface MediaContext {
/**
* Fetch a MediaInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance
*/
fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>;
/**
* Fetch a MediaInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance
*/
fetch(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>;
/**
* Fetch a MediaInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<MediaInstance>) => any): Promise<ApiResponse<MediaInstance>>;
/**
* Fetch a MediaInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance with HTTP metadata
*/
fetchWithHttpInfo(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<MediaInstance>) => any): Promise<ApiResponse<MediaInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface MediaContextSolution {
sid: string;
}
export declare class MediaContextImpl implements MediaContext {
protected _version: V2;
protected _solution: MediaContextSolution;
protected _uri: string;
constructor(_version: V2, sid: string);
fetch(params?: MediaContextFetchOptions | ((error: Error | null, item?: MediaInstance) => any), callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>;
fetchWithHttpInfo(params?: MediaContextFetchOptions | ((error: Error | null, item?: ApiResponse<MediaInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<MediaInstance>) => any): Promise<ApiResponse<MediaInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): MediaContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface MediaResource {
account_sid: string;
media_url: string;
service_sid: string;
sid: string;
url: string;
}
export declare class MediaInstance {
protected _version: V2;
protected _solution: MediaContextSolution;
protected _context?: MediaContext;
constructor(_version: V2, payload: MediaResource, sid: string);
/**
* The unique SID identifier of the Account.
*/
accountSid: string;
/**
* Downloadable URL for media, if stored in Twilio AI.
*/
mediaUrl: string;
/**
* The unique SID identifier of the Service.
*/
serviceSid: string;
/**
* The unique SID identifier of the Transcript.
*/
sid: string;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a MediaInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance
*/
fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>;
/**
* Fetch a MediaInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance
*/
fetch(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>;
/**
* Fetch a MediaInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<MediaInstance>) => any): Promise<ApiResponse<MediaInstance>>;
/**
* Fetch a MediaInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MediaInstance with HTTP metadata
*/
fetchWithHttpInfo(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<MediaInstance>) => any): Promise<ApiResponse<MediaInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
mediaUrl: string;
serviceSid: string;
sid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface MediaSolution {
sid: string;
}
export interface MediaListInstance {
_version: V2;
_solution: MediaSolution;
_uri: string;
(): MediaContext;
get(): MediaContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MediaListInstance(version: V2, sid: string): MediaListInstance;
export {};

View File

@@ -0,0 +1,156 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.MediaInstance = exports.MediaContextImpl = void 0;
exports.MediaListInstance = MediaListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class MediaContextImpl {
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 = `/Transcripts/${sid}/Media`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new MediaInstance(operationVersion, payload, instance._solution.sid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new MediaInstance(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.MediaContextImpl = MediaContextImpl;
class MediaInstance {
constructor(_version, payload, sid) {
this._version = _version;
this.accountSid = payload.account_sid;
this.mediaUrl = payload.media_url;
this.serviceSid = payload.service_sid;
this.sid = payload.sid;
this.url = payload.url;
this._solution = { sid };
}
get _proxy() {
this._context =
this._context || new MediaContextImpl(this._version, this._solution.sid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
mediaUrl: this.mediaUrl,
serviceSid: this.serviceSid,
sid: this.sid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MediaInstance = MediaInstance;
function MediaListInstance(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 MediaContextImpl(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,395 @@
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 type of the applied Language Understanding Operator. One of conversation-classify, utterance-classify, extract, extract-normalize, or pii-extract
*/
export type OperatorResultOperatorType = "conversation-classify" | "utterance-classify" | "extract" | "extract-normalize" | "pii-extract" | "text-generation" | "json";
/**
* Options to pass to fetch a OperatorResultInstance
*/
export interface OperatorResultContextFetchOptions {
/** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */
redacted?: boolean;
}
/**
* Options to pass to each
*/
export interface OperatorResultListInstanceEachOptions {
/** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */
redacted?: boolean;
/** 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: OperatorResultInstance, 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 OperatorResultListInstanceOptions {
/** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */
redacted?: boolean;
/** 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 OperatorResultListInstancePageOptions {
/** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */
redacted?: boolean;
/** 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 OperatorResultContext {
/**
* Fetch a OperatorResultInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>;
/**
* Fetch a OperatorResultInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance
*/
fetch(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>;
/**
* Fetch a OperatorResultInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any): Promise<ApiResponse<OperatorResultInstance>>;
/**
* Fetch a OperatorResultInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance with HTTP metadata
*/
fetchWithHttpInfo(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any): Promise<ApiResponse<OperatorResultInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface OperatorResultContextSolution {
transcriptSid: string;
operatorSid: string;
}
export declare class OperatorResultContextImpl implements OperatorResultContext {
protected _version: V2;
protected _solution: OperatorResultContextSolution;
protected _uri: string;
constructor(_version: V2, transcriptSid: string, operatorSid: string);
fetch(params?: OperatorResultContextFetchOptions | ((error: Error | null, item?: OperatorResultInstance) => any), callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>;
fetchWithHttpInfo(params?: OperatorResultContextFetchOptions | ((error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any), callback?: (error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any): Promise<ApiResponse<OperatorResultInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): OperatorResultContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface OperatorResultPayload extends TwilioResponsePayload {
operator_results: OperatorResultResource[];
}
interface OperatorResultResource {
operator_type: OperatorResultOperatorType;
name: string;
operator_sid: string;
extract_match: boolean;
match_probability: number;
normalized_result: string;
utterance_results: Array<any>;
utterance_match: boolean;
predicted_label: string;
predicted_probability: number;
label_probabilities: any;
extract_results: any;
text_generation_results: any;
json_results: any;
transcript_sid: string;
url: string;
}
export declare class OperatorResultInstance {
protected _version: V2;
protected _solution: OperatorResultContextSolution;
protected _context?: OperatorResultContext;
constructor(_version: V2, payload: OperatorResultResource, transcriptSid: string, operatorSid?: string);
operatorType: OperatorResultOperatorType;
/**
* The name of the applied Language Understanding.
*/
name: string;
/**
* A 34 character string that identifies this Language Understanding operator sid.
*/
operatorSid: string;
/**
* Boolean to tell if extract Language Understanding Processing model matches results.
*/
extractMatch: boolean;
/**
* Percentage of \'matching\' class needed to consider a sentence matches
*/
matchProbability: number;
/**
* Normalized output of extraction stage which matches Label.
*/
normalizedResult: string;
/**
* List of mapped utterance object which matches sentences.
*/
utteranceResults: Array<any>;
/**
* Boolean to tell if Utterance matches results.
*/
utteranceMatch: boolean;
/**
* The \'matching\' class. This might be available on conversation classify model outputs.
*/
predictedLabel: string;
/**
* Percentage of \'matching\' class needed to consider a sentence matches.
*/
predictedProbability: number;
/**
* The labels probabilities. This might be available on conversation classify model outputs.
*/
labelProbabilities: any;
/**
* List of text extraction results. This might be available on classify-extract model outputs.
*/
extractResults: any;
/**
* Output of a text generation operator for example Conversation Sumamary.
*/
textGenerationResults: any;
jsonResults: any;
/**
* A 34 character string that uniquely identifies this Transcript.
*/
transcriptSid: string;
/**
* The URL of this resource.
*/
url: string;
private get _proxy();
/**
* Fetch a OperatorResultInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance
*/
fetch(callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>;
/**
* Fetch a OperatorResultInstance
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance
*/
fetch(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>;
/**
* Fetch a OperatorResultInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any): Promise<ApiResponse<OperatorResultInstance>>;
/**
* Fetch a OperatorResultInstance and return HTTP info
*
* @param params - Parameter for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed OperatorResultInstance with HTTP metadata
*/
fetchWithHttpInfo(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: ApiResponse<OperatorResultInstance>) => any): Promise<ApiResponse<OperatorResultInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
operatorType: OperatorResultOperatorType;
name: string;
operatorSid: string;
extractMatch: boolean;
matchProbability: number;
normalizedResult: string;
utteranceResults: any[];
utteranceMatch: boolean;
predictedLabel: string;
predictedProbability: number;
labelProbabilities: any;
extractResults: any;
textGenerationResults: any;
jsonResults: any;
transcriptSid: string;
url: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface OperatorResultSolution {
transcriptSid: string;
}
export interface OperatorResultListInstance {
_version: V2;
_solution: OperatorResultSolution;
_uri: string;
(operatorSid: string): OperatorResultContext;
get(operatorSid: string): OperatorResultContext;
/**
* Streams OperatorResultInstance 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 { OperatorResultListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void;
each(params: OperatorResultListInstanceEachOptions, callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void;
/**
* Streams OperatorResultInstance 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 { OperatorResultListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: OperatorResultListInstanceEachOptions, callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of OperatorResultInstance 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: OperatorResultPage) => any): Promise<OperatorResultPage>;
/**
* Retrieve a single target page of OperatorResultInstance 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<OperatorResultPage>) => any): Promise<ApiResponse<OperatorResultPage>>;
/**
* Lists OperatorResultInstance 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 { OperatorResultListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: OperatorResultInstance[]) => any): Promise<OperatorResultInstance[]>;
list(params: OperatorResultListInstanceOptions, callback?: (error: Error | null, items: OperatorResultInstance[]) => any): Promise<OperatorResultInstance[]>;
/**
* Lists OperatorResultInstance 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 { OperatorResultListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorResultInstance[]>) => any): Promise<ApiResponse<OperatorResultInstance[]>>;
listWithHttpInfo(params: OperatorResultListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<OperatorResultInstance[]>) => any): Promise<ApiResponse<OperatorResultInstance[]>>;
/**
* Retrieve a single page of OperatorResultInstance 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 { OperatorResultListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: OperatorResultPage) => any): Promise<OperatorResultPage>;
page(params: OperatorResultListInstancePageOptions, callback?: (error: Error | null, items: OperatorResultPage) => any): Promise<OperatorResultPage>;
/**
* Retrieve a single page of OperatorResultInstance 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 { OperatorResultListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<OperatorResultPage>) => any): Promise<ApiResponse<OperatorResultPage>>;
pageWithHttpInfo(params: OperatorResultListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<OperatorResultPage>) => any): Promise<ApiResponse<OperatorResultPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function OperatorResultListInstance(version: V2, transcriptSid: string): OperatorResultListInstance;
export declare class OperatorResultPage extends Page<V2, OperatorResultPayload, OperatorResultResource, OperatorResultInstance> {
/**
* Initialize the OperatorResultPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: OperatorResultSolution);
/**
* Build an instance of OperatorResultInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: OperatorResultResource): OperatorResultInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,303 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.OperatorResultPage = exports.OperatorResultInstance = exports.OperatorResultContextImpl = void 0;
exports.OperatorResultListInstance = OperatorResultListInstance;
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 OperatorResultContextImpl {
constructor(_version, transcriptSid, operatorSid) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(operatorSid)) {
throw new Error("Parameter 'operatorSid' is not valid.");
}
this._solution = { transcriptSid, operatorSid };
this._uri = `/Transcripts/${transcriptSid}/OperatorResults/${operatorSid}`;
}
fetch(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
const headers = {};
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
uri: instance._uri,
method: "get",
params: data,
headers,
});
operationPromise = operationPromise.then((payload) => new OperatorResultInstance(operationVersion, payload, instance._solution.transcriptSid, instance._solution.operatorSid));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
fetchWithHttpInfo(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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",
params: data,
headers,
})
.then((response) => ({
...response,
body: new OperatorResultInstance(operationVersion, response.body, instance._solution.transcriptSid, instance._solution.operatorSid),
}));
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.OperatorResultContextImpl = OperatorResultContextImpl;
class OperatorResultInstance {
constructor(_version, payload, transcriptSid, operatorSid) {
this._version = _version;
this.operatorType = payload.operator_type;
this.name = payload.name;
this.operatorSid = payload.operator_sid;
this.extractMatch = payload.extract_match;
this.matchProbability = payload.match_probability;
this.normalizedResult = payload.normalized_result;
this.utteranceResults = payload.utterance_results;
this.utteranceMatch = payload.utterance_match;
this.predictedLabel = payload.predicted_label;
this.predictedProbability = payload.predicted_probability;
this.labelProbabilities = payload.label_probabilities;
this.extractResults = payload.extract_results;
this.textGenerationResults = payload.text_generation_results;
this.jsonResults = payload.json_results;
this.transcriptSid = payload.transcript_sid;
this.url = payload.url;
this._solution = {
transcriptSid,
operatorSid: operatorSid || this.operatorSid,
};
}
get _proxy() {
this._context =
this._context ||
new OperatorResultContextImpl(this._version, this._solution.transcriptSid, this._solution.operatorSid);
return this._context;
}
fetch(params, callback) {
return this._proxy.fetch(params, callback);
}
fetchWithHttpInfo(params, callback) {
return this._proxy.fetchWithHttpInfo(params, callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
operatorType: this.operatorType,
name: this.name,
operatorSid: this.operatorSid,
extractMatch: this.extractMatch,
matchProbability: this.matchProbability,
normalizedResult: this.normalizedResult,
utteranceResults: this.utteranceResults,
utteranceMatch: this.utteranceMatch,
predictedLabel: this.predictedLabel,
predictedProbability: this.predictedProbability,
labelProbabilities: this.labelProbabilities,
extractResults: this.extractResults,
textGenerationResults: this.textGenerationResults,
jsonResults: this.jsonResults,
transcriptSid: this.transcriptSid,
url: this.url,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorResultInstance = OperatorResultInstance;
function OperatorResultListInstance(version, transcriptSid) {
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
const instance = ((operatorSid) => instance.get(operatorSid));
instance.get = function get(operatorSid) {
return new OperatorResultContextImpl(version, transcriptSid, operatorSid);
};
instance._version = version;
instance._solution = { transcriptSid };
instance._uri = `/Transcripts/${transcriptSid}/OperatorResults`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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 OperatorResultPage(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 OperatorResultPage(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["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
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 OperatorResultPage(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 OperatorResultPage(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 OperatorResultPage extends Page_1.default {
/**
* Initialize the OperatorResultPage
*
* @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 OperatorResultInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new OperatorResultInstance(this._version, payload, this._solution.transcriptSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.OperatorResultPage = OperatorResultPage;

View File

@@ -0,0 +1,246 @@
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";
/**
* Options to pass to each
*/
export interface SentenceListInstanceEachOptions {
/** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */
redacted?: boolean;
/** Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. */
wordTimestamps?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 5000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: SentenceInstance, 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 SentenceListInstanceOptions {
/** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */
redacted?: boolean;
/** Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. */
wordTimestamps?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 5000. */
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 SentenceListInstancePageOptions {
/** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */
redacted?: boolean;
/** Returns word level timestamps information, if word_timestamps is enabled. The default is `false`. */
wordTimestamps?: boolean;
/** How many resources to return in each list page. The default is 50, and the maximum is 5000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface SentenceSolution {
transcriptSid: string;
}
export interface SentenceListInstance {
_version: V2;
_solution: SentenceSolution;
_uri: string;
/**
* Streams SentenceInstance 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 { SentenceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void;
each(params: SentenceListInstanceEachOptions, callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SentenceInstance 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 { SentenceListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SentenceListInstanceEachOptions, callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SentenceInstance 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: SentencePage) => any): Promise<SentencePage>;
/**
* Retrieve a single target page of SentenceInstance 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<SentencePage>) => any): Promise<ApiResponse<SentencePage>>;
/**
* Lists SentenceInstance 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 { SentenceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SentenceInstance[]) => any): Promise<SentenceInstance[]>;
list(params: SentenceListInstanceOptions, callback?: (error: Error | null, items: SentenceInstance[]) => any): Promise<SentenceInstance[]>;
/**
* Lists SentenceInstance 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 { SentenceListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SentenceInstance[]>) => any): Promise<ApiResponse<SentenceInstance[]>>;
listWithHttpInfo(params: SentenceListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SentenceInstance[]>) => any): Promise<ApiResponse<SentenceInstance[]>>;
/**
* Retrieve a single page of SentenceInstance 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 { SentenceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SentencePage) => any): Promise<SentencePage>;
page(params: SentenceListInstancePageOptions, callback?: (error: Error | null, items: SentencePage) => any): Promise<SentencePage>;
/**
* Retrieve a single page of SentenceInstance 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 { SentenceListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SentencePage>) => any): Promise<ApiResponse<SentencePage>>;
pageWithHttpInfo(params: SentenceListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SentencePage>) => any): Promise<ApiResponse<SentencePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SentenceListInstance(version: V2, transcriptSid: string): SentenceListInstance;
interface SentencePayload extends TwilioResponsePayload {
sentences: SentenceResource[];
}
interface SentenceResource {
media_channel: number;
sentence_index: number;
start_time: string;
end_time: string;
transcript: string;
sid: string;
confidence: string;
words: Array<any>;
}
export declare class SentenceInstance {
protected _version: V2;
constructor(_version: V2, payload: SentenceResource, transcriptSid: string);
/**
* The channel number.
*/
mediaChannel: number;
/**
* The index of the sentence in the transcript.
*/
sentenceIndex: number;
/**
* Offset from the beginning of the transcript when this sentence starts.
*/
startTime: string;
/**
* Offset from the beginning of the transcript when this sentence ends.
*/
endTime: string;
/**
* Transcript text.
*/
transcript: string;
/**
* A 34 character string that uniquely identifies this Sentence.
*/
sid: string;
confidence: string;
/**
* Detailed information for each of the words of the given Sentence.
*/
words: Array<any>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
mediaChannel: number;
sentenceIndex: number;
startTime: string;
endTime: string;
transcript: string;
sid: string;
confidence: string;
words: any[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class SentencePage extends Page<V2, SentencePayload, SentenceResource, SentenceInstance> {
/**
* Initialize the SentencePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V2, response: Response<string>, solution: SentenceSolution);
/**
* Build an instance of SentenceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SentenceResource): SentenceInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,193 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Intelligence
* 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.SentencePage = exports.SentenceInstance = void 0;
exports.SentenceListInstance = SentenceListInstance;
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");
function SentenceListInstance(version, transcriptSid) {
if (!(0, utility_1.isValidPathParam)(transcriptSid)) {
throw new Error("Parameter 'transcriptSid' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { transcriptSid };
instance._uri = `/Transcripts/${transcriptSid}/Sentences`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
if (params["wordTimestamps"] !== undefined)
data["WordTimestamps"] = serialize.bool(params["wordTimestamps"]);
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 SentencePage(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 SentencePage(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["redacted"] !== undefined)
data["Redacted"] = serialize.bool(params["redacted"]);
if (params["wordTimestamps"] !== undefined)
data["WordTimestamps"] = serialize.bool(params["wordTimestamps"]);
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 SentencePage(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 SentencePage(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 SentenceInstance {
constructor(_version, payload, transcriptSid) {
this._version = _version;
this.mediaChannel = deserialize.integer(payload.media_channel);
this.sentenceIndex = deserialize.integer(payload.sentence_index);
this.startTime = payload.start_time;
this.endTime = payload.end_time;
this.transcript = payload.transcript;
this.sid = payload.sid;
this.confidence = payload.confidence;
this.words = payload.words;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
mediaChannel: this.mediaChannel,
sentenceIndex: this.sentenceIndex,
startTime: this.startTime,
endTime: this.endTime,
transcript: this.transcript,
sid: this.sid,
confidence: this.confidence,
words: this.words,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SentenceInstance = SentenceInstance;
class SentencePage extends Page_1.default {
/**
* Initialize the SentencePage
*
* @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 SentenceInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SentenceInstance(this._version, payload, this._solution.transcriptSid);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SentencePage = SentencePage;