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

35
node_modules/twilio/lib/rest/assistants/V1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import AssistantsBase from "../AssistantsBase";
import Version from "../../base/Version";
import { AssistantListInstance } from "./v1/assistant";
import { KnowledgeListInstance } from "./v1/knowledge";
import { PolicyListInstance } from "./v1/policy";
import { SessionListInstance } from "./v1/session";
import { ToolListInstance } from "./v1/tool";
export default class V1 extends Version {
/**
* Initialize the V1 version of Assistants
*
* @param domain - The Twilio (Twilio.Assistants) domain
*/
constructor(domain: AssistantsBase);
/** assistants - { Twilio.Assistants.V1.AssistantListInstance } resource */
protected _assistants?: AssistantListInstance;
/** knowledge - { Twilio.Assistants.V1.KnowledgeListInstance } resource */
protected _knowledge?: KnowledgeListInstance;
/** policies - { Twilio.Assistants.V1.PolicyListInstance } resource */
protected _policies?: PolicyListInstance;
/** sessions - { Twilio.Assistants.V1.SessionListInstance } resource */
protected _sessions?: SessionListInstance;
/** tools - { Twilio.Assistants.V1.ToolListInstance } resource */
protected _tools?: ToolListInstance;
/** Getter for assistants resource */
get assistants(): AssistantListInstance;
/** Getter for knowledge resource */
get knowledge(): KnowledgeListInstance;
/** Getter for policies resource */
get policies(): PolicyListInstance;
/** Getter for sessions resource */
get sessions(): SessionListInstance;
/** Getter for tools resource */
get tools(): ToolListInstance;
}

60
node_modules/twilio/lib/rest/assistants/V1.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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 assistant_1 = require("./v1/assistant");
const knowledge_1 = require("./v1/knowledge");
const policy_1 = require("./v1/policy");
const session_1 = require("./v1/session");
const tool_1 = require("./v1/tool");
class V1 extends Version_1.default {
/**
* Initialize the V1 version of Assistants
*
* @param domain - The Twilio (Twilio.Assistants) domain
*/
constructor(domain) {
super(domain, "v1");
}
/** Getter for assistants resource */
get assistants() {
this._assistants = this._assistants || (0, assistant_1.AssistantListInstance)(this);
return this._assistants;
}
/** Getter for knowledge resource */
get knowledge() {
this._knowledge = this._knowledge || (0, knowledge_1.KnowledgeListInstance)(this);
return this._knowledge;
}
/** Getter for policies resource */
get policies() {
this._policies = this._policies || (0, policy_1.PolicyListInstance)(this);
return this._policies;
}
/** Getter for sessions resource */
get sessions() {
this._sessions = this._sessions || (0, session_1.SessionListInstance)(this);
return this._sessions;
}
/** Getter for tools resource */
get tools() {
this._tools = this._tools || (0, tool_1.ToolListInstance)(this);
return this._tools;
}
}
exports.default = V1;

View File

@@ -0,0 +1,650 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { AssistantsKnowledgeListInstance } from "./assistant/assistantsKnowledge";
import { AssistantsToolListInstance } from "./assistant/assistantsTool";
import { FeedbackListInstance } from "./assistant/feedback";
import { MessageListInstance } from "./assistant/message";
export declare class AssistantsV1ServiceCreateAssistantRequest {
"customerAi"?: AssistantsV1ServiceCustomerAi;
/**
* The name of the assistant.
*/
"name": string;
/**
* The owner/company of the assistant.
*/
"owner"?: string;
/**
* The personality prompt to be used for assistant.
*/
"personalityPrompt"?: string;
"segmentCredential"?: AssistantsV1ServiceSegmentCredential;
constructor(payload: any);
}
export declare class AssistantsV1ServiceCustomerAi {
/**
* True if the perception engine is enabled.
*/
"perceptionEngineEnabled": boolean;
/**
* True if the personalization engine is enabled.
*/
"personalizationEngineEnabled": boolean;
constructor(payload: any);
}
export declare class AssistantsV1ServiceKnowledge {
/**
* The type of knowledge source.
*/
"description"?: string;
/**
* The description of knowledge.
*/
"id": string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
*/
"accountSid"?: string;
/**
* The details of the knowledge source based on the type.
*/
"knowledgeSourceDetails"?: Record<string, object>;
/**
* The name of the knowledge source.
*/
"name": string;
/**
* The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
*/
"status"?: string;
/**
* The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\')
*/
"type": string;
/**
* The url of the knowledge resource.
*/
"url"?: string;
/**
* The embedding model to be used for the knowledge source.
*/
"embeddingModel"?: string;
/**
* The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateCreated": Date;
/**
* The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateUpdated": Date;
constructor(payload: any);
}
export declare class AssistantsV1ServiceSegmentCredential {
/**
* The profile API key.
*/
"profileApiKey"?: string;
/**
* The space ID.
*/
"spaceId"?: string;
/**
* The write key.
*/
"writeKey"?: string;
constructor(payload: any);
}
export declare class AssistantsV1ServiceTool {
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
*/
"accountSid"?: string;
/**
* The description of the tool.
*/
"description": string;
/**
* True if the tool is enabled.
*/
"enabled": boolean;
/**
* The tool ID.
*/
"id": string;
/**
* The metadata related to method, url, input_schema to used with the Tool.
*/
"meta": Record<string, object>;
/**
* The name of the tool.
*/
"name": string;
/**
* The authentication requirement for the tool.
*/
"requiresAuth": boolean;
/**
* The type of the tool. (\'WEBHOOK\')
*/
"type": string;
/**
* The url of the tool resource.
*/
"url"?: string;
/**
* The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateCreated": Date;
/**
* The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateUpdated": Date;
constructor(payload: any);
}
export declare class AssistantsV1ServiceUpdateAssistantRequest {
"customerAi"?: AssistantsV1ServiceCustomerAi;
/**
* The name of the assistant.
*/
"name"?: string;
/**
* The owner/company of the assistant.
*/
"owner"?: string;
/**
* The personality prompt to be used for assistant.
*/
"personalityPrompt"?: string;
"segmentCredential"?: AssistantsV1ServiceSegmentCredential;
constructor(payload: any);
}
/**
* Options to pass to update a AssistantInstance
*/
export interface AssistantContextUpdateOptions {
/** */
assistantsV1ServiceUpdateAssistantRequest?: AssistantsV1ServiceUpdateAssistantRequest;
}
/**
* Options to pass to create a AssistantInstance
*/
export interface AssistantListInstanceCreateOptions {
/** */
assistantsV1ServiceCreateAssistantRequest: AssistantsV1ServiceCreateAssistantRequest;
}
/**
* Options to pass to each
*/
export interface AssistantListInstanceEachOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Function to process each record. If this and a positional callback are passed, this one will be used */
callback?: (item: AssistantInstance, done: (err?: Error) => void) => void;
/** Function to be called upon completion of streaming */
done?: Function;
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to list
*/
export interface AssistantListInstanceOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
limit?: number;
}
/**
* Options to pass to page
*/
export interface AssistantListInstancePageOptions {
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
pageSize?: number;
/** Page Number, this value is simply for client state */
pageNumber?: number;
/** PageToken provided by the API */
pageToken?: string;
}
export interface AssistantContext {
assistantsKnowledge: AssistantsKnowledgeListInstance;
assistantsTools: AssistantsToolListInstance;
feedbacks: FeedbackListInstance;
messages: MessageListInstance;
/**
* Remove a AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantInstance 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 AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
fetch(callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Fetch a AssistantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Update a AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
update(callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Update a AssistantInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
update(params: AssistantsV1ServiceUpdateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Update a AssistantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Update a AssistantInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface AssistantContextSolution {
id: string;
}
export declare class AssistantContextImpl implements AssistantContext {
protected _version: V1;
protected _solution: AssistantContextSolution;
protected _uri: string;
protected _assistantsKnowledge?: AssistantsKnowledgeListInstance;
protected _assistantsTools?: AssistantsToolListInstance;
protected _feedbacks?: FeedbackListInstance;
protected _messages?: MessageListInstance;
constructor(_version: V1, id: string);
get assistantsKnowledge(): AssistantsKnowledgeListInstance;
get assistantsTools(): AssistantsToolListInstance;
get feedbacks(): FeedbackListInstance;
get messages(): MessageListInstance;
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?: AssistantInstance) => any): Promise<AssistantInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
update(params?: AssistantsV1ServiceUpdateAssistantRequest | ((error: Error | null, item?: AssistantInstance) => any), headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
updateWithHttpInfo(params?: AssistantsV1ServiceUpdateAssistantRequest | ((error: Error | null, item?: ApiResponse<AssistantInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): AssistantContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AssistantPayload extends TwilioResponsePayload {
assistants: AssistantResource[];
}
interface AssistantResource {
account_sid: string;
customer_ai: Record<string, object>;
id: string;
model: string;
name: string;
owner: string;
url: string;
personality_prompt: string;
date_created: Date;
date_updated: Date;
knowledge: Array<AssistantsV1ServiceKnowledge>;
tools: Array<AssistantsV1ServiceTool>;
}
export declare class AssistantInstance {
protected _version: V1;
protected _solution: AssistantContextSolution;
protected _context?: AssistantContext;
constructor(_version: V1, payload: AssistantResource, id?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource.
*/
accountSid: string;
/**
* The Personalization and Perception Engine settings.
*/
customerAi: Record<string, object>;
/**
* The Assistant ID.
*/
id: string;
/**
* The default model used by the assistant.
*/
model: string;
/**
* The name of the assistant.
*/
name: string;
/**
* The owner/company of the assistant.
*/
owner: string;
/**
* The url of the assistant resource.
*/
url: string;
/**
* The personality prompt to be used for assistant.
*/
personalityPrompt: string;
/**
* The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The list of knowledge sources associated with the assistant.
*/
knowledge: Array<AssistantsV1ServiceKnowledge>;
/**
* The list of tools associated with the assistant.
*/
tools: Array<AssistantsV1ServiceTool>;
private get _proxy();
/**
* Remove a AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantInstance 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 AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
fetch(callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Fetch a AssistantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Update a AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
update(callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Update a AssistantInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
update(params: AssistantsV1ServiceUpdateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Update a AssistantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Update a AssistantInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Access the assistantsKnowledge.
*/
assistantsKnowledge(): AssistantsKnowledgeListInstance;
/**
* Access the assistantsTools.
*/
assistantsTools(): AssistantsToolListInstance;
/**
* Access the feedbacks.
*/
feedbacks(): FeedbackListInstance;
/**
* Access the messages.
*/
messages(): MessageListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
customerAi: Record<string, object>;
id: string;
model: string;
name: string;
owner: string;
url: string;
personalityPrompt: string;
dateCreated: Date;
dateUpdated: Date;
knowledge: AssistantsV1ServiceKnowledge[];
tools: AssistantsV1ServiceTool[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AssistantSolution {
}
export interface AssistantListInstance {
_version: V1;
_solution: AssistantSolution;
_uri: string;
(id: string): AssistantContext;
get(id: string): AssistantContext;
/**
* Create a AssistantInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
create(params: AssistantsV1ServiceCreateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: AssistantInstance) => any): Promise<AssistantInstance>;
/**
* Create a AssistantInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
createWithHttpInfo(params: AssistantsV1ServiceCreateAssistantRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<AssistantInstance>) => any): Promise<ApiResponse<AssistantInstance>>;
/**
* Streams AssistantInstance records from the API.
*
* This operation lazily loads records as efficiently as possible until the limit
* is reached.
*
* The results are passed into the callback function, so this operation is memory
* efficient.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AssistantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AssistantInstance, done: (err?: Error) => void) => void): void;
each(params: AssistantListInstanceEachOptions, callback?: (item: AssistantInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AssistantInstance 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 { AssistantListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AssistantInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AssistantListInstanceEachOptions, callback?: (item: AssistantInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AssistantInstance records from the API.
*
* The request is executed immediately.
*
* @param { string } [targetUrl] - API-generated URL for the requested results page
* @param { function } [callback] - Callback to handle list of records
*/
getPage(targetUrl: string, callback?: (error: Error | null, items: AssistantPage) => any): Promise<AssistantPage>;
/**
* Retrieve a single target page of AssistantInstance 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<AssistantPage>) => any): Promise<ApiResponse<AssistantPage>>;
/**
* Lists AssistantInstance records from the API as a list.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AssistantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AssistantInstance[]) => any): Promise<AssistantInstance[]>;
list(params: AssistantListInstanceOptions, callback?: (error: Error | null, items: AssistantInstance[]) => any): Promise<AssistantInstance[]>;
/**
* Lists AssistantInstance 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 { AssistantListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantInstance[]>) => any): Promise<ApiResponse<AssistantInstance[]>>;
listWithHttpInfo(params: AssistantListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AssistantInstance[]>) => any): Promise<ApiResponse<AssistantInstance[]>>;
/**
* Retrieve a single page of AssistantInstance records from the API.
*
* The request is executed immediately.
*
* If a function is passed as the first argument, it will be used as the callback
* function.
*
* @param { AssistantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AssistantPage) => any): Promise<AssistantPage>;
page(params: AssistantListInstancePageOptions, callback?: (error: Error | null, items: AssistantPage) => any): Promise<AssistantPage>;
/**
* Retrieve a single page of AssistantInstance 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 { AssistantListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantPage>) => any): Promise<ApiResponse<AssistantPage>>;
pageWithHttpInfo(params: AssistantListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AssistantPage>) => any): Promise<ApiResponse<AssistantPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AssistantListInstance(version: V1): AssistantListInstance;
export declare class AssistantPage extends Page<V1, AssistantPayload, AssistantResource, AssistantInstance> {
/**
* Initialize the AssistantPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: AssistantSolution);
/**
* Build an instance of AssistantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AssistantResource): AssistantInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

555
node_modules/twilio/lib/rest/assistants/v1/assistant.js generated vendored Normal file
View File

@@ -0,0 +1,555 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.AssistantPage = exports.AssistantInstance = exports.AssistantContextImpl = exports.AssistantsV1ServiceUpdateAssistantRequest = exports.AssistantsV1ServiceTool = exports.AssistantsV1ServiceSegmentCredential = exports.AssistantsV1ServiceKnowledge = exports.AssistantsV1ServiceCustomerAi = exports.AssistantsV1ServiceCreateAssistantRequest = void 0;
exports.AssistantListInstance = AssistantListInstance;
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 assistantsKnowledge_1 = require("./assistant/assistantsKnowledge");
const assistantsTool_1 = require("./assistant/assistantsTool");
const feedback_1 = require("./assistant/feedback");
const message_1 = require("./assistant/message");
class AssistantsV1ServiceCreateAssistantRequest {
constructor(payload) {
this.customerAi = payload["customer_ai"];
this.name = payload["name"];
this.owner = payload["owner"];
this.personalityPrompt = payload["personality_prompt"];
this.segmentCredential = payload["segment_credential"];
}
}
exports.AssistantsV1ServiceCreateAssistantRequest = AssistantsV1ServiceCreateAssistantRequest;
class AssistantsV1ServiceCustomerAi {
constructor(payload) {
this.perceptionEngineEnabled = payload["perception_engine_enabled"];
this.personalizationEngineEnabled =
payload["personalization_engine_enabled"];
}
}
exports.AssistantsV1ServiceCustomerAi = AssistantsV1ServiceCustomerAi;
class AssistantsV1ServiceKnowledge {
constructor(payload) {
this.description = payload["description"];
this.id = payload["id"];
this.accountSid = payload["account_sid"];
this.knowledgeSourceDetails = payload["knowledge_source_details"];
this.name = payload["name"];
this.status = payload["status"];
this.type = payload["type"];
this.url = payload["url"];
this.embeddingModel = payload["embedding_model"];
this.dateCreated = payload["date_created"];
this.dateUpdated = payload["date_updated"];
}
}
exports.AssistantsV1ServiceKnowledge = AssistantsV1ServiceKnowledge;
class AssistantsV1ServiceSegmentCredential {
constructor(payload) {
this.profileApiKey = payload["profile_api_key"];
this.spaceId = payload["space_id"];
this.writeKey = payload["write_key"];
}
}
exports.AssistantsV1ServiceSegmentCredential = AssistantsV1ServiceSegmentCredential;
class AssistantsV1ServiceTool {
constructor(payload) {
this.accountSid = payload["account_sid"];
this.description = payload["description"];
this.enabled = payload["enabled"];
this.id = payload["id"];
this.meta = payload["meta"];
this.name = payload["name"];
this.requiresAuth = payload["requires_auth"];
this.type = payload["type"];
this.url = payload["url"];
this.dateCreated = payload["date_created"];
this.dateUpdated = payload["date_updated"];
}
}
exports.AssistantsV1ServiceTool = AssistantsV1ServiceTool;
class AssistantsV1ServiceUpdateAssistantRequest {
constructor(payload) {
this.customerAi = payload["customer_ai"];
this.name = payload["name"];
this.owner = payload["owner"];
this.personalityPrompt = payload["personality_prompt"];
this.segmentCredential = payload["segment_credential"];
}
}
exports.AssistantsV1ServiceUpdateAssistantRequest = AssistantsV1ServiceUpdateAssistantRequest;
class AssistantContextImpl {
constructor(_version, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { id };
this._uri = `/Assistants/${id}`;
}
get assistantsKnowledge() {
this._assistantsKnowledge =
this._assistantsKnowledge ||
(0, assistantsKnowledge_1.AssistantsKnowledgeListInstance)(this._version, this._solution.id);
return this._assistantsKnowledge;
}
get assistantsTools() {
this._assistantsTools =
this._assistantsTools ||
(0, assistantsTool_1.AssistantsToolListInstance)(this._version, this._solution.id);
return this._assistantsTools;
}
get feedbacks() {
this._feedbacks =
this._feedbacks || (0, feedback_1.FeedbackListInstance)(this._version, this._solution.id);
return this._feedbacks;
}
get messages() {
this._messages =
this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.id);
return this._messages;
}
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 AssistantInstance(operationVersion, payload, instance._solution.id));
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 AssistantInstance(operationVersion, response.body, instance._solution.id),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AssistantInstance(operationVersion, payload, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new AssistantInstance(operationVersion, response.body, instance._solution.id),
}));
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.AssistantContextImpl = AssistantContextImpl;
class AssistantInstance {
constructor(_version, payload, id) {
this._version = _version;
this.accountSid = payload.account_sid;
this.customerAi = payload.customer_ai;
this.id = payload.id;
this.model = payload.model;
this.name = payload.name;
this.owner = payload.owner;
this.url = payload.url;
this.personalityPrompt = payload.personality_prompt;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.knowledge =
payload.knowledge !== null && payload.knowledge !== undefined
? payload.knowledge.map((payload) => new AssistantsV1ServiceKnowledge(payload))
: null;
this.tools =
payload.tools !== null && payload.tools !== undefined
? payload.tools.map((payload) => new AssistantsV1ServiceTool(payload))
: null;
this._solution = { id: id || this.id };
}
get _proxy() {
this._context =
this._context ||
new AssistantContextImpl(this._version, this._solution.id);
return this._context;
}
/**
* Remove a AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a AssistantInstance 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 AssistantInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a AssistantInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the assistantsKnowledge.
*/
assistantsKnowledge() {
return this._proxy.assistantsKnowledge;
}
/**
* Access the assistantsTools.
*/
assistantsTools() {
return this._proxy.assistantsTools;
}
/**
* Access the feedbacks.
*/
feedbacks() {
return this._proxy.feedbacks;
}
/**
* Access the messages.
*/
messages() {
return this._proxy.messages;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
customerAi: this.customerAi,
id: this.id,
model: this.model,
name: this.name,
owner: this.owner,
url: this.url,
personalityPrompt: this.personalityPrompt,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
knowledge: this.knowledge,
tools: this.tools,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantInstance = AssistantInstance;
function AssistantListInstance(version) {
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new AssistantContextImpl(version, id);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Assistants`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new AssistantInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
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 AssistantInstance(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 AssistantPage(operationVersion, payload, instance._solution));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.each = instance._version.each;
instance.list = instance._version.list;
instance.getPage = function getPage(targetUrl, callback) {
const operationPromise = instance._version._domain.twilio.request({
method: "get",
uri: targetUrl,
});
let pagePromise = operationPromise.then((payload) => new AssistantPage(instance._version, payload, instance._solution));
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
return pagePromise;
};
instance.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 AssistantPage(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 AssistantPage(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 AssistantPage extends Page_1.default {
/**
* Initialize the AssistantPage
*
* @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 AssistantInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AssistantInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantPage = AssistantPage;

View File

@@ -0,0 +1,352 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface AssistantsKnowledgeListInstanceEachOptions {
/** 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: AssistantsKnowledgeInstance, 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 AssistantsKnowledgeListInstanceOptions {
/** 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 AssistantsKnowledgeListInstancePageOptions {
/** 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 AssistantsKnowledgeContext {
/**
* Create a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance
*/
create(callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any): Promise<AssistantsKnowledgeInstance>;
/**
* Create a AssistantsKnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsKnowledgeInstance>) => any): Promise<ApiResponse<AssistantsKnowledgeInstance>>;
/**
* Remove a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantsKnowledgeInstance 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 AssistantsKnowledgeContextSolution {
assistantId: string;
id: string;
}
export declare class AssistantsKnowledgeContextImpl implements AssistantsKnowledgeContext {
protected _version: V1;
protected _solution: AssistantsKnowledgeContextSolution;
protected _uri: string;
constructor(_version: V1, assistantId: string, id: string);
create(callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any): Promise<AssistantsKnowledgeInstance>;
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsKnowledgeInstance>) => any): Promise<ApiResponse<AssistantsKnowledgeInstance>>;
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(): AssistantsKnowledgeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AssistantsKnowledgePayload extends TwilioResponsePayload {
knowledge: AssistantsKnowledgeResource[];
}
interface AssistantsKnowledgeResource {
description: string;
id: string;
account_sid: string;
knowledge_source_details: Record<string, object>;
name: string;
status: string;
type: string;
url: string;
embedding_model: string;
date_created: Date;
date_updated: Date;
}
export declare class AssistantsKnowledgeInstance {
protected _version: V1;
protected _solution: AssistantsKnowledgeContextSolution;
protected _context?: AssistantsKnowledgeContext;
constructor(_version: V1, payload: AssistantsKnowledgeResource, assistantId: string, id?: string);
/**
* The type of knowledge source.
*/
description: string;
/**
* The description of knowledge.
*/
id: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
*/
accountSid: string;
/**
* The details of the knowledge source based on the type.
*/
knowledgeSourceDetails: Record<string, object>;
/**
* The name of the knowledge source.
*/
name: string;
/**
* The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
*/
status: string;
/**
* The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\')
*/
type: string;
/**
* The url of the knowledge resource.
*/
url: string;
/**
* The embedding model to be used for the knowledge source.
*/
embeddingModel: string;
/**
* The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
private get _proxy();
/**
* Create a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance
*/
create(callback?: (error: Error | null, item?: AssistantsKnowledgeInstance) => any): Promise<AssistantsKnowledgeInstance>;
/**
* Create a AssistantsKnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsKnowledgeInstance>) => any): Promise<ApiResponse<AssistantsKnowledgeInstance>>;
/**
* Remove a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantsKnowledgeInstance 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(): {
description: string;
id: string;
accountSid: string;
knowledgeSourceDetails: Record<string, object>;
name: string;
status: string;
type: string;
url: string;
embeddingModel: string;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AssistantsKnowledgeSolution {
assistantId: string;
}
export interface AssistantsKnowledgeListInstance {
_version: V1;
_solution: AssistantsKnowledgeSolution;
_uri: string;
(id: string): AssistantsKnowledgeContext;
get(id: string): AssistantsKnowledgeContext;
/**
* Streams AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AssistantsKnowledgeInstance, done: (err?: Error) => void) => void): void;
each(params: AssistantsKnowledgeListInstanceEachOptions, callback?: (item: AssistantsKnowledgeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AssistantsKnowledgeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AssistantsKnowledgeListInstanceEachOptions, callback?: (item: AssistantsKnowledgeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AssistantsKnowledgeInstance 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: AssistantsKnowledgePage) => any): Promise<AssistantsKnowledgePage>;
/**
* Retrieve a single target page of AssistantsKnowledgeInstance 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<AssistantsKnowledgePage>) => any): Promise<ApiResponse<AssistantsKnowledgePage>>;
/**
* Lists AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AssistantsKnowledgeInstance[]) => any): Promise<AssistantsKnowledgeInstance[]>;
list(params: AssistantsKnowledgeListInstanceOptions, callback?: (error: Error | null, items: AssistantsKnowledgeInstance[]) => any): Promise<AssistantsKnowledgeInstance[]>;
/**
* Lists AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantsKnowledgeInstance[]>) => any): Promise<ApiResponse<AssistantsKnowledgeInstance[]>>;
listWithHttpInfo(params: AssistantsKnowledgeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AssistantsKnowledgeInstance[]>) => any): Promise<ApiResponse<AssistantsKnowledgeInstance[]>>;
/**
* Retrieve a single page of AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AssistantsKnowledgePage) => any): Promise<AssistantsKnowledgePage>;
page(params: AssistantsKnowledgeListInstancePageOptions, callback?: (error: Error | null, items: AssistantsKnowledgePage) => any): Promise<AssistantsKnowledgePage>;
/**
* Retrieve a single page of AssistantsKnowledgeInstance 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 { AssistantsKnowledgeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantsKnowledgePage>) => any): Promise<ApiResponse<AssistantsKnowledgePage>>;
pageWithHttpInfo(params: AssistantsKnowledgeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AssistantsKnowledgePage>) => any): Promise<ApiResponse<AssistantsKnowledgePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AssistantsKnowledgeListInstance(version: V1, assistantId: string): AssistantsKnowledgeListInstance;
export declare class AssistantsKnowledgePage extends Page<V1, AssistantsKnowledgePayload, AssistantsKnowledgeResource, AssistantsKnowledgeInstance> {
/**
* Initialize the AssistantsKnowledgePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: AssistantsKnowledgeSolution);
/**
* Build an instance of AssistantsKnowledgeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AssistantsKnowledgeResource): AssistantsKnowledgeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,321 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.AssistantsKnowledgePage = exports.AssistantsKnowledgeInstance = exports.AssistantsKnowledgeContextImpl = void 0;
exports.AssistantsKnowledgeListInstance = AssistantsKnowledgeListInstance;
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 AssistantsKnowledgeContextImpl {
constructor(_version, assistantId, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(assistantId)) {
throw new Error("Parameter 'assistantId' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { assistantId, id };
this._uri = `/Assistants/${assistantId}/Knowledge/${id}`;
}
create(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new AssistantsKnowledgeInstance(operationVersion, payload, instance._solution.assistantId, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(callback) {
const headers = {};
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 AssistantsKnowledgeInstance(operationVersion, response.body, instance._solution.assistantId, instance._solution.id),
}));
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.AssistantsKnowledgeContextImpl = AssistantsKnowledgeContextImpl;
class AssistantsKnowledgeInstance {
constructor(_version, payload, assistantId, id) {
this._version = _version;
this.description = payload.description;
this.id = payload.id;
this.accountSid = payload.account_sid;
this.knowledgeSourceDetails = payload.knowledge_source_details;
this.name = payload.name;
this.status = payload.status;
this.type = payload.type;
this.url = payload.url;
this.embeddingModel = payload.embedding_model;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this._solution = { assistantId, id: id || this.id };
}
get _proxy() {
this._context =
this._context ||
new AssistantsKnowledgeContextImpl(this._version, this._solution.assistantId, this._solution.id);
return this._context;
}
/**
* Create a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance
*/
create(callback) {
return this._proxy.create(callback);
}
/**
* Create a AssistantsKnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsKnowledgeInstance with HTTP metadata
*/
createWithHttpInfo(callback) {
return this._proxy.createWithHttpInfo(callback);
}
/**
* Remove a AssistantsKnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a AssistantsKnowledgeInstance 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 {
description: this.description,
id: this.id,
accountSid: this.accountSid,
knowledgeSourceDetails: this.knowledgeSourceDetails,
name: this.name,
status: this.status,
type: this.type,
url: this.url,
embeddingModel: this.embeddingModel,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantsKnowledgeInstance = AssistantsKnowledgeInstance;
function AssistantsKnowledgeListInstance(version, assistantId) {
if (!(0, utility_1.isValidPathParam)(assistantId)) {
throw new Error("Parameter 'assistantId' is not valid.");
}
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new AssistantsKnowledgeContextImpl(version, assistantId, id);
};
instance._version = version;
instance._solution = { assistantId };
instance._uri = `/Assistants/${assistantId}/Knowledge`;
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 AssistantsKnowledgePage(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 AssistantsKnowledgePage(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 AssistantsKnowledgePage(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 AssistantsKnowledgePage(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 AssistantsKnowledgePage extends Page_1.default {
/**
* Initialize the AssistantsKnowledgePage
*
* @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 AssistantsKnowledgeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AssistantsKnowledgeInstance(this._version, payload, this._solution.assistantId);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantsKnowledgePage = AssistantsKnowledgePage;

View File

@@ -0,0 +1,352 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface AssistantsToolListInstanceEachOptions {
/** 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: AssistantsToolInstance, 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 AssistantsToolListInstanceOptions {
/** 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 AssistantsToolListInstancePageOptions {
/** 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 AssistantsToolContext {
/**
* Create a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance
*/
create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
/**
* Create a AssistantsToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsToolInstance>) => any): Promise<ApiResponse<AssistantsToolInstance>>;
/**
* Remove a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantsToolInstance 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 AssistantsToolContextSolution {
assistantId: string;
id: string;
}
export declare class AssistantsToolContextImpl implements AssistantsToolContext {
protected _version: V1;
protected _solution: AssistantsToolContextSolution;
protected _uri: string;
constructor(_version: V1, assistantId: string, id: string);
create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsToolInstance>) => any): Promise<ApiResponse<AssistantsToolInstance>>;
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(): AssistantsToolContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface AssistantsToolPayload extends TwilioResponsePayload {
tools: AssistantsToolResource[];
}
interface AssistantsToolResource {
account_sid: string;
description: string;
enabled: boolean;
id: string;
meta: Record<string, object>;
name: string;
requires_auth: boolean;
type: string;
url: string;
date_created: Date;
date_updated: Date;
}
export declare class AssistantsToolInstance {
protected _version: V1;
protected _solution: AssistantsToolContextSolution;
protected _context?: AssistantsToolContext;
constructor(_version: V1, payload: AssistantsToolResource, assistantId: string, id?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
*/
accountSid: string;
/**
* The description of the tool.
*/
description: string;
/**
* True if the tool is enabled.
*/
enabled: boolean;
/**
* The tool ID.
*/
id: string;
/**
* The metadata related to method, url, input_schema to used with the Tool.
*/
meta: Record<string, object>;
/**
* The name of the tool.
*/
name: string;
/**
* The authentication requirement for the tool.
*/
requiresAuth: boolean;
/**
* The type of the tool. (\'WEBHOOK\')
*/
type: string;
/**
* The url of the tool resource.
*/
url: string;
/**
* The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
private get _proxy();
/**
* Create a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance
*/
create(callback?: (error: Error | null, item?: AssistantsToolInstance) => any): Promise<AssistantsToolInstance>;
/**
* Create a AssistantsToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance with HTTP metadata
*/
createWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<AssistantsToolInstance>) => any): Promise<ApiResponse<AssistantsToolInstance>>;
/**
* Remove a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a AssistantsToolInstance 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(): {
accountSid: string;
description: string;
enabled: boolean;
id: string;
meta: Record<string, object>;
name: string;
requiresAuth: boolean;
type: string;
url: string;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface AssistantsToolSolution {
assistantId: string;
}
export interface AssistantsToolListInstance {
_version: V1;
_solution: AssistantsToolSolution;
_uri: string;
(id: string): AssistantsToolContext;
get(id: string): AssistantsToolContext;
/**
* Streams AssistantsToolInstance 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 { AssistantsToolListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
each(params: AssistantsToolListInstanceEachOptions, callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
/**
* Streams AssistantsToolInstance 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 { AssistantsToolListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: AssistantsToolListInstanceEachOptions, callback?: (item: AssistantsToolInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of AssistantsToolInstance 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: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
/**
* Retrieve a single target page of AssistantsToolInstance 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<AssistantsToolPage>) => any): Promise<ApiResponse<AssistantsToolPage>>;
/**
* Lists AssistantsToolInstance 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 { AssistantsToolListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: AssistantsToolInstance[]) => any): Promise<AssistantsToolInstance[]>;
list(params: AssistantsToolListInstanceOptions, callback?: (error: Error | null, items: AssistantsToolInstance[]) => any): Promise<AssistantsToolInstance[]>;
/**
* Lists AssistantsToolInstance 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 { AssistantsToolListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantsToolInstance[]>) => any): Promise<ApiResponse<AssistantsToolInstance[]>>;
listWithHttpInfo(params: AssistantsToolListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<AssistantsToolInstance[]>) => any): Promise<ApiResponse<AssistantsToolInstance[]>>;
/**
* Retrieve a single page of AssistantsToolInstance 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 { AssistantsToolListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
page(params: AssistantsToolListInstancePageOptions, callback?: (error: Error | null, items: AssistantsToolPage) => any): Promise<AssistantsToolPage>;
/**
* Retrieve a single page of AssistantsToolInstance 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 { AssistantsToolListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<AssistantsToolPage>) => any): Promise<ApiResponse<AssistantsToolPage>>;
pageWithHttpInfo(params: AssistantsToolListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<AssistantsToolPage>) => any): Promise<ApiResponse<AssistantsToolPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function AssistantsToolListInstance(version: V1, assistantId: string): AssistantsToolListInstance;
export declare class AssistantsToolPage extends Page<V1, AssistantsToolPayload, AssistantsToolResource, AssistantsToolInstance> {
/**
* Initialize the AssistantsToolPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: AssistantsToolSolution);
/**
* Build an instance of AssistantsToolInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: AssistantsToolResource): AssistantsToolInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,321 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.AssistantsToolPage = exports.AssistantsToolInstance = exports.AssistantsToolContextImpl = void 0;
exports.AssistantsToolListInstance = AssistantsToolListInstance;
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 AssistantsToolContextImpl {
constructor(_version, assistantId, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(assistantId)) {
throw new Error("Parameter 'assistantId' is not valid.");
}
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { assistantId, id };
this._uri = `/Assistants/${assistantId}/Tools/${id}`;
}
create(callback) {
const headers = {};
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
headers,
});
operationPromise = operationPromise.then((payload) => new AssistantsToolInstance(operationVersion, payload, instance._solution.assistantId, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
createWithHttpInfo(callback) {
const headers = {};
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 AssistantsToolInstance(operationVersion, response.body, instance._solution.assistantId, instance._solution.id),
}));
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.AssistantsToolContextImpl = AssistantsToolContextImpl;
class AssistantsToolInstance {
constructor(_version, payload, assistantId, id) {
this._version = _version;
this.accountSid = payload.account_sid;
this.description = payload.description;
this.enabled = payload.enabled;
this.id = payload.id;
this.meta = payload.meta;
this.name = payload.name;
this.requiresAuth = payload.requires_auth;
this.type = payload.type;
this.url = payload.url;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this._solution = { assistantId, id: id || this.id };
}
get _proxy() {
this._context =
this._context ||
new AssistantsToolContextImpl(this._version, this._solution.assistantId, this._solution.id);
return this._context;
}
/**
* Create a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance
*/
create(callback) {
return this._proxy.create(callback);
}
/**
* Create a AssistantsToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed AssistantsToolInstance with HTTP metadata
*/
createWithHttpInfo(callback) {
return this._proxy.createWithHttpInfo(callback);
}
/**
* Remove a AssistantsToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a AssistantsToolInstance 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 {
accountSid: this.accountSid,
description: this.description,
enabled: this.enabled,
id: this.id,
meta: this.meta,
name: this.name,
requiresAuth: this.requiresAuth,
type: this.type,
url: this.url,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantsToolInstance = AssistantsToolInstance;
function AssistantsToolListInstance(version, assistantId) {
if (!(0, utility_1.isValidPathParam)(assistantId)) {
throw new Error("Parameter 'assistantId' is not valid.");
}
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new AssistantsToolContextImpl(version, assistantId, id);
};
instance._version = version;
instance._solution = { assistantId };
instance._uri = `/Assistants/${assistantId}/Tools`;
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 AssistantsToolPage(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 AssistantsToolPage(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 AssistantsToolPage(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 AssistantsToolPage(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 AssistantsToolPage extends Page_1.default {
/**
* Initialize the AssistantsToolPage
*
* @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 AssistantsToolInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new AssistantsToolInstance(this._version, payload, this._solution.assistantId);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.AssistantsToolPage = AssistantsToolPage;

View File

@@ -0,0 +1,295 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export declare class AssistantsV1ServiceCreateFeedbackRequest {
/**
* The message ID.
*/
"messageId"?: string;
/**
* The score to be given(0-1).
*/
"score"?: number;
/**
* The Session ID.
*/
"sessionId": string;
/**
* The text to be given as feedback.
*/
"text"?: string;
constructor(payload: any);
}
/**
* Options to pass to create a FeedbackInstance
*/
export interface FeedbackListInstanceCreateOptions {
/** */
assistantsV1ServiceCreateFeedbackRequest: AssistantsV1ServiceCreateFeedbackRequest;
}
/**
* Options to pass to each
*/
export interface FeedbackListInstanceEachOptions {
/** 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: FeedbackInstance, 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 FeedbackListInstanceOptions {
/** 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 FeedbackListInstancePageOptions {
/** 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 FeedbackSolution {
id: string;
}
export interface FeedbackListInstance {
_version: V1;
_solution: FeedbackSolution;
_uri: string;
/**
* Create a FeedbackInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FeedbackInstance
*/
create(params: AssistantsV1ServiceCreateFeedbackRequest, headers?: any, callback?: (error: Error | null, item?: FeedbackInstance) => any): Promise<FeedbackInstance>;
/**
* Create a FeedbackInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed FeedbackInstance with HTTP metadata
*/
createWithHttpInfo(params: AssistantsV1ServiceCreateFeedbackRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<FeedbackInstance>) => any): Promise<ApiResponse<FeedbackInstance>>;
/**
* Streams FeedbackInstance 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 { FeedbackListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
each(params: FeedbackListInstanceEachOptions, callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
/**
* Streams FeedbackInstance 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 { FeedbackListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: FeedbackListInstanceEachOptions, callback?: (item: FeedbackInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of FeedbackInstance 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: FeedbackPage) => any): Promise<FeedbackPage>;
/**
* Retrieve a single target page of FeedbackInstance 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<FeedbackPage>) => any): Promise<ApiResponse<FeedbackPage>>;
/**
* Lists FeedbackInstance 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 { FeedbackListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: FeedbackInstance[]) => any): Promise<FeedbackInstance[]>;
list(params: FeedbackListInstanceOptions, callback?: (error: Error | null, items: FeedbackInstance[]) => any): Promise<FeedbackInstance[]>;
/**
* Lists FeedbackInstance 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 { FeedbackListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FeedbackInstance[]>) => any): Promise<ApiResponse<FeedbackInstance[]>>;
listWithHttpInfo(params: FeedbackListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<FeedbackInstance[]>) => any): Promise<ApiResponse<FeedbackInstance[]>>;
/**
* Retrieve a single page of FeedbackInstance 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 { FeedbackListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: FeedbackPage) => any): Promise<FeedbackPage>;
page(params: FeedbackListInstancePageOptions, callback?: (error: Error | null, items: FeedbackPage) => any): Promise<FeedbackPage>;
/**
* Retrieve a single page of FeedbackInstance 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 { FeedbackListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<FeedbackPage>) => any): Promise<ApiResponse<FeedbackPage>>;
pageWithHttpInfo(params: FeedbackListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<FeedbackPage>) => any): Promise<ApiResponse<FeedbackPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function FeedbackListInstance(version: V1, id: string): FeedbackListInstance;
interface FeedbackPayload extends TwilioResponsePayload {
feedbacks: FeedbackResource[];
}
interface FeedbackResource {
assistant_id: string;
id: string;
account_sid: string;
user_sid: string;
message_id: string;
score: number;
session_id: string;
text: string;
date_created: Date;
date_updated: Date;
}
export declare class FeedbackInstance {
protected _version: V1;
constructor(_version: V1, payload: FeedbackResource, id: string);
/**
* The Assistant ID.
*/
assistantId: string;
/**
* The Feedback ID.
*/
id: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Feedback.
*/
accountSid: string;
/**
* The SID of the User created the Feedback.
*/
userSid: string;
/**
* The Message ID.
*/
messageId: string;
/**
* The Score to provide as Feedback (0-1)
*/
score: number;
/**
* The Session ID.
*/
sessionId: string;
/**
* The text to be given as feedback.
*/
text: string;
/**
* The date and time in GMT when the Feedback was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Feedback was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
assistantId: string;
id: string;
accountSid: string;
userSid: string;
messageId: string;
score: number;
sessionId: string;
text: string;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class FeedbackPage extends Page<V1, FeedbackPayload, FeedbackResource, FeedbackInstance> {
/**
* Initialize the FeedbackPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: FeedbackSolution);
/**
* Build an instance of FeedbackInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: FeedbackResource): FeedbackInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,246 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.FeedbackPage = exports.FeedbackInstance = exports.AssistantsV1ServiceCreateFeedbackRequest = void 0;
exports.FeedbackListInstance = FeedbackListInstance;
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 AssistantsV1ServiceCreateFeedbackRequest {
constructor(payload) {
this.messageId = payload["message_id"];
this.score = payload["score"];
this.sessionId = payload["session_id"];
this.text = payload["text"];
}
}
exports.AssistantsV1ServiceCreateFeedbackRequest = AssistantsV1ServiceCreateFeedbackRequest;
function FeedbackListInstance(version, id) {
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { id };
instance._uri = `/Assistants/${id}/Feedbacks`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new FeedbackInstance(operationVersion, payload, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
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 FeedbackInstance(operationVersion, response.body, instance._solution.id),
}));
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 FeedbackPage(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 FeedbackPage(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 FeedbackPage(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 FeedbackPage(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 FeedbackInstance {
constructor(_version, payload, id) {
this._version = _version;
this.assistantId = payload.assistant_id;
this.id = payload.id;
this.accountSid = payload.account_sid;
this.userSid = payload.user_sid;
this.messageId = payload.message_id;
this.score = payload.score;
this.sessionId = payload.session_id;
this.text = payload.text;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
assistantId: this.assistantId,
id: this.id,
accountSid: this.accountSid,
userSid: this.userSid,
messageId: this.messageId,
score: this.score,
sessionId: this.sessionId,
text: this.text,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FeedbackInstance = FeedbackInstance;
class FeedbackPage extends Page_1.default {
/**
* Initialize the FeedbackPage
*
* @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 FeedbackInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new FeedbackInstance(this._version, payload, this._solution.id);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.FeedbackPage = FeedbackPage;

View File

@@ -0,0 +1,124 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export declare class AssistantsV1ServiceAssistantSendMessageRequest {
/**
* The unique identity of user for the session.
*/
"identity": string;
/**
* The unique name for the session.
*/
"sessionId"?: string;
/**
* The query to ask the assistant.
*/
"body": string;
/**
* The webhook url to call after the assistant has generated a response or report an error.
*/
"webhook"?: string;
/**
* one of the modes \'chat\', \'email\' or \'voice\'
*/
"mode"?: string;
constructor(payload: any);
}
/**
* Options to pass to create a MessageInstance
*/
export interface MessageListInstanceCreateOptions {
/** */
assistantsV1ServiceAssistantSendMessageRequest: AssistantsV1ServiceAssistantSendMessageRequest;
}
export interface MessageSolution {
id: string;
}
export interface MessageListInstance {
_version: V1;
_solution: MessageSolution;
_uri: string;
/**
* Create a MessageInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessageInstance
*/
create(params: AssistantsV1ServiceAssistantSendMessageRequest, headers?: any, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>;
/**
* Create a MessageInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed MessageInstance with HTTP metadata
*/
createWithHttpInfo(params: AssistantsV1ServiceAssistantSendMessageRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<MessageInstance>) => any): Promise<ApiResponse<MessageInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MessageListInstance(version: V1, id: string): MessageListInstance;
interface MessageResource {
status: string;
flagged: boolean;
aborted: boolean;
session_id: string;
account_sid: string;
body: string;
error: string;
}
export declare class MessageInstance {
protected _version: V1;
constructor(_version: V1, payload: MessageResource, id: string);
/**
* success or failure based on whether the request successfully generated a response.
*/
status: string;
/**
* If successful, this property will denote whether the response was flagged or not.
*/
flagged: boolean;
/**
* This property will denote whether the request was aborted or not.
*/
aborted: boolean;
/**
* The unique name for the session.
*/
sessionId: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the Message.
*/
accountSid: string;
/**
* If successful, the body of the generated response
*/
body: string;
/**
* The error message if generation was not successful
*/
error: string;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
status: string;
flagged: boolean;
aborted: boolean;
sessionId: string;
accountSid: string;
body: string;
error: string;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,127 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.MessageInstance = exports.AssistantsV1ServiceAssistantSendMessageRequest = void 0;
exports.MessageListInstance = MessageListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class AssistantsV1ServiceAssistantSendMessageRequest {
constructor(payload) {
this.identity = payload["identity"];
this.sessionId = payload["session_id"];
this.body = payload["body"];
this.webhook = payload["webhook"];
this.mode = payload["mode"];
}
}
exports.AssistantsV1ServiceAssistantSendMessageRequest = AssistantsV1ServiceAssistantSendMessageRequest;
function MessageListInstance(version, id) {
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { id };
instance._uri = `/Assistants/${id}/Messages`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
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 MessageInstance(operationVersion, response.body, instance._solution.id),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.toJSON = function toJSON() {
return instance._solution;
};
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
return (0, util_1.inspect)(instance.toJSON(), options);
};
return instance;
}
class MessageInstance {
constructor(_version, payload, id) {
this._version = _version;
this.status = payload.status;
this.flagged = payload.flagged;
this.aborted = payload.aborted;
this.sessionId = payload.session_id;
this.accountSid = payload.account_sid;
this.body = payload.body;
this.error = payload.error;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
status: this.status,
flagged: this.flagged,
aborted: this.aborted,
sessionId: this.sessionId,
accountSid: this.accountSid,
body: this.body,
error: this.error,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MessageInstance = MessageInstance;

View File

@@ -0,0 +1,552 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { ChunkListInstance } from "./knowledge/chunk";
import { KnowledgeStatusListInstance } from "./knowledge/knowledgeStatus";
export declare class AssistantsV1ServiceCreateKnowledgeRequest {
/**
* The Assistant ID.
*/
"assistantId"?: string;
/**
* The description of the knowledge source.
*/
"description"?: string;
/**
* The details of the knowledge source based on the type.
*/
"knowledgeSourceDetails"?: Record<string, object>;
/**
* The name of the tool.
*/
"name": string;
"policy"?: AssistantsV1ServiceCreatePolicyRequest;
/**
* The type of the knowledge source.
*/
"type": string;
/**
* The embedding model to be used for the knowledge source. It\'s required for \'Database\' type but disallowed for other types.
*/
"embeddingModel"?: string;
constructor(payload: any);
}
export declare class AssistantsV1ServiceCreatePolicyRequest {
/**
* The description of the policy.
*/
"description"?: string;
/**
* The Policy ID.
*/
"id"?: string;
/**
* The name of the policy.
*/
"name"?: string;
"policyDetails": any | null;
/**
* The description of the policy.
*/
"type"?: string;
constructor(payload: any);
}
export declare class AssistantsV1ServiceUpdateKnowledgeRequest {
/**
* The description of the knowledge source.
*/
"description"?: string;
/**
* The details of the knowledge source based on the type.
*/
"knowledgeSourceDetails"?: Record<string, object>;
/**
* The name of the knowledge source.
*/
"name"?: string;
"policy"?: AssistantsV1ServiceCreatePolicyRequest;
/**
* The description of the knowledge source.
*/
"type"?: string;
/**
* The embedding model to be used for the knowledge source. It\'s only applicable to \'Database\' type.
*/
"embeddingModel"?: string;
constructor(payload: any);
}
/**
* Options to pass to update a KnowledgeInstance
*/
export interface KnowledgeContextUpdateOptions {
/** */
assistantsV1ServiceUpdateKnowledgeRequest?: AssistantsV1ServiceUpdateKnowledgeRequest;
}
/**
* Options to pass to create a KnowledgeInstance
*/
export interface KnowledgeListInstanceCreateOptions {
/** */
assistantsV1ServiceCreateKnowledgeRequest: AssistantsV1ServiceCreateKnowledgeRequest;
}
/**
* Options to pass to each
*/
export interface KnowledgeListInstanceEachOptions {
/** */
assistantId?: 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: KnowledgeInstance, 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 KnowledgeListInstanceOptions {
/** */
assistantId?: 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 KnowledgeListInstancePageOptions {
/** */
assistantId?: 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 KnowledgeContext {
chunks: ChunkListInstance;
knowledgeStatus: KnowledgeStatusListInstance;
/**
* Remove a KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a KnowledgeInstance 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 KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
fetch(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Fetch a KnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Update a KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
update(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Update a KnowledgeInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
update(params: AssistantsV1ServiceUpdateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Update a KnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Update a KnowledgeInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface KnowledgeContextSolution {
id: string;
}
export declare class KnowledgeContextImpl implements KnowledgeContext {
protected _version: V1;
protected _solution: KnowledgeContextSolution;
protected _uri: string;
protected _chunks?: ChunkListInstance;
protected _knowledgeStatus?: KnowledgeStatusListInstance;
constructor(_version: V1, id: string);
get chunks(): ChunkListInstance;
get knowledgeStatus(): KnowledgeStatusListInstance;
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?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
update(params?: AssistantsV1ServiceUpdateKnowledgeRequest | ((error: Error | null, item?: KnowledgeInstance) => any), headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
updateWithHttpInfo(params?: AssistantsV1ServiceUpdateKnowledgeRequest | ((error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): KnowledgeContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface KnowledgePayload extends TwilioResponsePayload {
knowledge: KnowledgeResource[];
}
interface KnowledgeResource {
description: string;
id: string;
account_sid: string;
knowledge_source_details: Record<string, object>;
name: string;
status: string;
type: string;
url: string;
embedding_model: string;
date_created: Date;
date_updated: Date;
}
export declare class KnowledgeInstance {
protected _version: V1;
protected _solution: KnowledgeContextSolution;
protected _context?: KnowledgeContext;
constructor(_version: V1, payload: KnowledgeResource, id?: string);
/**
* The type of knowledge source.
*/
description: string;
/**
* The description of knowledge.
*/
id: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
*/
accountSid: string;
/**
* The details of the knowledge source based on the type.
*/
knowledgeSourceDetails: Record<string, object>;
/**
* The name of the knowledge source.
*/
name: string;
/**
* The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
*/
status: string;
/**
* The type of knowledge source (\'Web\', \'Database\', \'Text\', \'File\')
*/
type: string;
/**
* The url of the knowledge resource.
*/
url: string;
/**
* The embedding model to be used for the knowledge source.
*/
embeddingModel: string;
/**
* The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
private get _proxy();
/**
* Remove a KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a KnowledgeInstance 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 KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
fetch(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Fetch a KnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Update a KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
update(callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Update a KnowledgeInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
update(params: AssistantsV1ServiceUpdateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Update a KnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Update a KnowledgeInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Access the chunks.
*/
chunks(): ChunkListInstance;
/**
* Access the knowledgeStatus.
*/
knowledgeStatus(): KnowledgeStatusListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
description: string;
id: string;
accountSid: string;
knowledgeSourceDetails: Record<string, object>;
name: string;
status: string;
type: string;
url: string;
embeddingModel: string;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface KnowledgeSolution {
}
export interface KnowledgeListInstance {
_version: V1;
_solution: KnowledgeSolution;
_uri: string;
(id: string): KnowledgeContext;
get(id: string): KnowledgeContext;
/**
* Create a KnowledgeInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
create(params: AssistantsV1ServiceCreateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: KnowledgeInstance) => any): Promise<KnowledgeInstance>;
/**
* Create a KnowledgeInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
createWithHttpInfo(params: AssistantsV1ServiceCreateKnowledgeRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<KnowledgeInstance>) => any): Promise<ApiResponse<KnowledgeInstance>>;
/**
* Streams KnowledgeInstance 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 { KnowledgeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
each(params: KnowledgeListInstanceEachOptions, callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
/**
* Streams KnowledgeInstance 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 { KnowledgeListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: KnowledgeListInstanceEachOptions, callback?: (item: KnowledgeInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of KnowledgeInstance 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: KnowledgePage) => any): Promise<KnowledgePage>;
/**
* Retrieve a single target page of KnowledgeInstance 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<KnowledgePage>) => any): Promise<ApiResponse<KnowledgePage>>;
/**
* Lists KnowledgeInstance 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 { KnowledgeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: KnowledgeInstance[]) => any): Promise<KnowledgeInstance[]>;
list(params: KnowledgeListInstanceOptions, callback?: (error: Error | null, items: KnowledgeInstance[]) => any): Promise<KnowledgeInstance[]>;
/**
* Lists KnowledgeInstance 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 { KnowledgeListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<KnowledgeInstance[]>) => any): Promise<ApiResponse<KnowledgeInstance[]>>;
listWithHttpInfo(params: KnowledgeListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<KnowledgeInstance[]>) => any): Promise<ApiResponse<KnowledgeInstance[]>>;
/**
* Retrieve a single page of KnowledgeInstance 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 { KnowledgeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: KnowledgePage) => any): Promise<KnowledgePage>;
page(params: KnowledgeListInstancePageOptions, callback?: (error: Error | null, items: KnowledgePage) => any): Promise<KnowledgePage>;
/**
* Retrieve a single page of KnowledgeInstance 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 { KnowledgeListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<KnowledgePage>) => any): Promise<ApiResponse<KnowledgePage>>;
pageWithHttpInfo(params: KnowledgeListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<KnowledgePage>) => any): Promise<ApiResponse<KnowledgePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function KnowledgeListInstance(version: V1): KnowledgeListInstance;
export declare class KnowledgePage extends Page<V1, KnowledgePayload, KnowledgeResource, KnowledgeInstance> {
/**
* Initialize the KnowledgePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: KnowledgeSolution);
/**
* Build an instance of KnowledgeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: KnowledgeResource): KnowledgeInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

491
node_modules/twilio/lib/rest/assistants/v1/knowledge.js generated vendored Normal file
View File

@@ -0,0 +1,491 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.KnowledgePage = exports.KnowledgeInstance = exports.KnowledgeContextImpl = exports.AssistantsV1ServiceUpdateKnowledgeRequest = exports.AssistantsV1ServiceCreatePolicyRequest = exports.AssistantsV1ServiceCreateKnowledgeRequest = void 0;
exports.KnowledgeListInstance = KnowledgeListInstance;
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 chunk_1 = require("./knowledge/chunk");
const knowledgeStatus_1 = require("./knowledge/knowledgeStatus");
class AssistantsV1ServiceCreateKnowledgeRequest {
constructor(payload) {
this.assistantId = payload["assistant_id"];
this.description = payload["description"];
this.knowledgeSourceDetails = payload["knowledge_source_details"];
this.name = payload["name"];
this.policy = payload["policy"];
this.type = payload["type"];
this.embeddingModel = payload["embedding_model"];
}
}
exports.AssistantsV1ServiceCreateKnowledgeRequest = AssistantsV1ServiceCreateKnowledgeRequest;
class AssistantsV1ServiceCreatePolicyRequest {
constructor(payload) {
this.description = payload["description"];
this.id = payload["id"];
this.name = payload["name"];
this.policyDetails = payload["policy_details"];
this.type = payload["type"];
}
}
exports.AssistantsV1ServiceCreatePolicyRequest = AssistantsV1ServiceCreatePolicyRequest;
class AssistantsV1ServiceUpdateKnowledgeRequest {
constructor(payload) {
this.description = payload["description"];
this.knowledgeSourceDetails = payload["knowledge_source_details"];
this.name = payload["name"];
this.policy = payload["policy"];
this.type = payload["type"];
this.embeddingModel = payload["embedding_model"];
}
}
exports.AssistantsV1ServiceUpdateKnowledgeRequest = AssistantsV1ServiceUpdateKnowledgeRequest;
class KnowledgeContextImpl {
constructor(_version, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { id };
this._uri = `/Knowledge/${id}`;
}
get chunks() {
this._chunks =
this._chunks || (0, chunk_1.ChunkListInstance)(this._version, this._solution.id);
return this._chunks;
}
get knowledgeStatus() {
this._knowledgeStatus =
this._knowledgeStatus ||
(0, knowledgeStatus_1.KnowledgeStatusListInstance)(this._version, this._solution.id);
return this._knowledgeStatus;
}
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 KnowledgeInstance(operationVersion, payload, instance._solution.id));
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 KnowledgeInstance(operationVersion, response.body, instance._solution.id),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new KnowledgeInstance(operationVersion, payload, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new KnowledgeInstance(operationVersion, response.body, instance._solution.id),
}));
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.KnowledgeContextImpl = KnowledgeContextImpl;
class KnowledgeInstance {
constructor(_version, payload, id) {
this._version = _version;
this.description = payload.description;
this.id = payload.id;
this.accountSid = payload.account_sid;
this.knowledgeSourceDetails = payload.knowledge_source_details;
this.name = payload.name;
this.status = payload.status;
this.type = payload.type;
this.url = payload.url;
this.embeddingModel = payload.embedding_model;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this._solution = { id: id || this.id };
}
get _proxy() {
this._context =
this._context ||
new KnowledgeContextImpl(this._version, this._solution.id);
return this._context;
}
/**
* Remove a KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a KnowledgeInstance 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 KnowledgeInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a KnowledgeInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
update(params, callback) {
return this._proxy.update(params, callback);
}
updateWithHttpInfo(params, callback) {
return this._proxy.updateWithHttpInfo(params, callback);
}
/**
* Access the chunks.
*/
chunks() {
return this._proxy.chunks;
}
/**
* Access the knowledgeStatus.
*/
knowledgeStatus() {
return this._proxy.knowledgeStatus;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
description: this.description,
id: this.id,
accountSid: this.accountSid,
knowledgeSourceDetails: this.knowledgeSourceDetails,
name: this.name,
status: this.status,
type: this.type,
url: this.url,
embeddingModel: this.embeddingModel,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.KnowledgeInstance = KnowledgeInstance;
function KnowledgeListInstance(version) {
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new KnowledgeContextImpl(version, id);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Knowledge`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new KnowledgeInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
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 KnowledgeInstance(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["assistantId"] !== undefined)
data["AssistantId"] = params["assistantId"];
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 KnowledgePage(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 KnowledgePage(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["assistantId"] !== undefined)
data["AssistantId"] = params["assistantId"];
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 KnowledgePage(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 KnowledgePage(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 KnowledgePage extends Page_1.default {
/**
* Initialize the KnowledgePage
*
* @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 KnowledgeInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new KnowledgeInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.KnowledgePage = KnowledgePage;

View File

@@ -0,0 +1,219 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface ChunkListInstanceEachOptions {
/** 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: ChunkInstance, 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 ChunkListInstanceOptions {
/** 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 ChunkListInstancePageOptions {
/** 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 ChunkSolution {
id: string;
}
export interface ChunkListInstance {
_version: V1;
_solution: ChunkSolution;
_uri: string;
/**
* Streams ChunkInstance 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 { ChunkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
each(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ChunkInstance 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 { ChunkListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ChunkListInstanceEachOptions, callback?: (item: ChunkInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ChunkInstance 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: ChunkPage) => any): Promise<ChunkPage>;
/**
* Retrieve a single target page of ChunkInstance 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<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
/**
* Lists ChunkInstance 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 { ChunkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
list(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ChunkInstance[]) => any): Promise<ChunkInstance[]>;
/**
* Lists ChunkInstance 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 { ChunkListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChunkInstance[]>) => any): Promise<ApiResponse<ChunkInstance[]>>;
listWithHttpInfo(params: ChunkListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ChunkInstance[]>) => any): Promise<ApiResponse<ChunkInstance[]>>;
/**
* Retrieve a single page of ChunkInstance 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 { ChunkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
page(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ChunkPage) => any): Promise<ChunkPage>;
/**
* Retrieve a single page of ChunkInstance 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 { ChunkListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
pageWithHttpInfo(params: ChunkListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ChunkPage>) => any): Promise<ApiResponse<ChunkPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ChunkListInstance(version: V1, id: string): ChunkListInstance;
interface ChunkPayload extends TwilioResponsePayload {
chunks: ChunkResource[];
}
interface ChunkResource {
account_sid: string;
content: string;
metadata: Record<string, object>;
date_created: Date;
date_updated: Date;
}
export declare class ChunkInstance {
protected _version: V1;
constructor(_version: V1, payload: ChunkResource, id: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
*/
accountSid: string;
/**
* The chunk content.
*/
content: string;
/**
* The metadata of the chunk.
*/
metadata: Record<string, object>;
/**
* The date and time in GMT when the Chunk was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Chunk was updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
content: string;
metadata: Record<string, object>;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class ChunkPage extends Page<V1, ChunkPayload, ChunkResource, ChunkInstance> {
/**
* Initialize the ChunkPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ChunkSolution);
/**
* Build an instance of ChunkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ChunkResource): ChunkInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,179 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.ChunkPage = exports.ChunkInstance = void 0;
exports.ChunkListInstance = ChunkListInstance;
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 ChunkListInstance(version, id) {
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { id };
instance._uri = `/Knowledge/${id}/Chunks`;
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 ChunkPage(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 ChunkPage(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 ChunkPage(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 ChunkPage(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 ChunkInstance {
constructor(_version, payload, id) {
this._version = _version;
this.accountSid = payload.account_sid;
this.content = payload.content;
this.metadata = payload.metadata;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
content: this.content,
metadata: this.metadata,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChunkInstance = ChunkInstance;
class ChunkPage extends Page_1.default {
/**
* Initialize the ChunkPage
*
* @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 ChunkInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ChunkInstance(this._version, payload, this._solution.id);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ChunkPage = ChunkPage;

View File

@@ -0,0 +1,118 @@
import { inspect, InspectOptions } from "util";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
export interface KnowledgeStatusContext {
/**
* Fetch a KnowledgeStatusInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance
*/
fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
/**
* Fetch a KnowledgeStatusInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeStatusInstance>) => any): Promise<ApiResponse<KnowledgeStatusInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface KnowledgeStatusContextSolution {
id: string;
}
export declare class KnowledgeStatusContextImpl implements KnowledgeStatusContext {
protected _version: V1;
protected _solution: KnowledgeStatusContextSolution;
protected _uri: string;
constructor(_version: V1, id: string);
fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeStatusInstance>) => any): Promise<ApiResponse<KnowledgeStatusInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): KnowledgeStatusContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface KnowledgeStatusResource {
account_sid: string;
status: string;
last_status: string;
date_updated: Date;
}
export declare class KnowledgeStatusInstance {
protected _version: V1;
protected _solution: KnowledgeStatusContextSolution;
protected _context?: KnowledgeStatusContext;
constructor(_version: V1, payload: KnowledgeStatusResource, id: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
*/
accountSid: string;
/**
* The status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
*/
status: string;
/**
* The last status of processing the knowledge source (\'QUEUED\', \'PROCESSING\', \'COMPLETED\', \'FAILED\')
*/
lastStatus: string;
/**
* The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
private get _proxy();
/**
* Fetch a KnowledgeStatusInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance
*/
fetch(callback?: (error: Error | null, item?: KnowledgeStatusInstance) => any): Promise<KnowledgeStatusInstance>;
/**
* Fetch a KnowledgeStatusInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<KnowledgeStatusInstance>) => any): Promise<ApiResponse<KnowledgeStatusInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
status: string;
lastStatus: string;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface KnowledgeStatusSolution {
id: string;
}
export interface KnowledgeStatusListInstance {
_version: V1;
_solution: KnowledgeStatusSolution;
_uri: string;
(): KnowledgeStatusContext;
get(): KnowledgeStatusContext;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function KnowledgeStatusListInstance(version: V1, id: string): KnowledgeStatusListInstance;
export {};

View File

@@ -0,0 +1,147 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.KnowledgeStatusInstance = exports.KnowledgeStatusContextImpl = void 0;
exports.KnowledgeStatusListInstance = KnowledgeStatusListInstance;
const util_1 = require("util");
const deserialize = require("../../../../base/deserialize");
const serialize = require("../../../../base/serialize");
const utility_1 = require("../../../../base/utility");
class KnowledgeStatusContextImpl {
constructor(_version, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { id };
this._uri = `/Knowledge/${id}/Status`;
}
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 KnowledgeStatusInstance(operationVersion, payload, instance._solution.id));
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 KnowledgeStatusInstance(operationVersion, response.body, instance._solution.id),
}));
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.KnowledgeStatusContextImpl = KnowledgeStatusContextImpl;
class KnowledgeStatusInstance {
constructor(_version, payload, id) {
this._version = _version;
this.accountSid = payload.account_sid;
this.status = payload.status;
this.lastStatus = payload.last_status;
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this._solution = { id };
}
get _proxy() {
this._context =
this._context ||
new KnowledgeStatusContextImpl(this._version, this._solution.id);
return this._context;
}
/**
* Fetch a KnowledgeStatusInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a KnowledgeStatusInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed KnowledgeStatusInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
accountSid: this.accountSid,
status: this.status,
lastStatus: this.lastStatus,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.KnowledgeStatusInstance = KnowledgeStatusInstance;
function KnowledgeStatusListInstance(version, id) {
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
const instance = (() => instance.get());
instance.get = function get() {
return new KnowledgeStatusContextImpl(version, id);
};
instance._version = version;
instance._solution = { id };
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;
}

254
node_modules/twilio/lib/rest/assistants/v1/policy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,254 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface PolicyListInstanceEachOptions {
/** The tool ID. */
toolId?: string;
/** The knowledge ID. */
knowledgeId?: 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: PolicyInstance, 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 PolicyListInstanceOptions {
/** The tool ID. */
toolId?: string;
/** The knowledge ID. */
knowledgeId?: 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 PolicyListInstancePageOptions {
/** The tool ID. */
toolId?: string;
/** The knowledge ID. */
knowledgeId?: 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 PolicySolution {
}
export interface PolicyListInstance {
_version: V1;
_solution: PolicySolution;
_uri: string;
/**
* Streams PolicyInstance 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 { PolicyListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
each(params: PolicyListInstanceEachOptions, callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
/**
* Streams PolicyInstance 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 { PolicyListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: PolicyListInstanceEachOptions, callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of PolicyInstance 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: PolicyPage) => any): Promise<PolicyPage>;
/**
* Retrieve a single target page of PolicyInstance 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<PolicyPage>) => any): Promise<ApiResponse<PolicyPage>>;
/**
* Lists PolicyInstance 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 { PolicyListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: PolicyInstance[]) => any): Promise<PolicyInstance[]>;
list(params: PolicyListInstanceOptions, callback?: (error: Error | null, items: PolicyInstance[]) => any): Promise<PolicyInstance[]>;
/**
* Lists PolicyInstance 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 { PolicyListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PolicyInstance[]>) => any): Promise<ApiResponse<PolicyInstance[]>>;
listWithHttpInfo(params: PolicyListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<PolicyInstance[]>) => any): Promise<ApiResponse<PolicyInstance[]>>;
/**
* Retrieve a single page of PolicyInstance 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 { PolicyListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: PolicyPage) => any): Promise<PolicyPage>;
page(params: PolicyListInstancePageOptions, callback?: (error: Error | null, items: PolicyPage) => any): Promise<PolicyPage>;
/**
* Retrieve a single page of PolicyInstance 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 { PolicyListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<PolicyPage>) => any): Promise<ApiResponse<PolicyPage>>;
pageWithHttpInfo(params: PolicyListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<PolicyPage>) => any): Promise<ApiResponse<PolicyPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function PolicyListInstance(version: V1): PolicyListInstance;
interface PolicyPayload extends TwilioResponsePayload {
policies: PolicyResource[];
}
interface PolicyResource {
id: string;
name: string;
description: string;
account_sid: string;
user_sid: string;
type: string;
policy_details: Record<string, object>;
date_created: Date;
date_updated: Date;
}
export declare class PolicyInstance {
protected _version: V1;
constructor(_version: V1, payload: PolicyResource);
/**
* The Policy ID.
*/
id: string;
/**
* The name of the policy.
*/
name: string;
/**
* The description of the policy.
*/
description: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Policy resource.
*/
accountSid: string;
/**
* The SID of the User that created the Policy resource.
*/
userSid: string;
/**
* The type of the policy.
*/
type: string;
/**
* The details of the policy based on the type.
*/
policyDetails: Record<string, object>;
/**
* The date and time in GMT when the Policy was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Policy was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
id: string;
name: string;
description: string;
accountSid: string;
userSid: string;
type: string;
policyDetails: Record<string, object>;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class PolicyPage extends Page<V1, PolicyPayload, PolicyResource, PolicyInstance> {
/**
* Initialize the PolicyPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: PolicySolution);
/**
* Build an instance of PolicyInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: PolicyResource): PolicyInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

191
node_modules/twilio/lib/rest/assistants/v1/policy.js generated vendored Normal file
View File

@@ -0,0 +1,191 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.PolicyPage = exports.PolicyInstance = void 0;
exports.PolicyListInstance = PolicyListInstance;
const util_1 = require("util");
const Page_1 = __importDefault(require("../../../base/Page"));
const deserialize = require("../../../base/deserialize");
const serialize = require("../../../base/serialize");
function PolicyListInstance(version) {
const instance = {};
instance._version = version;
instance._solution = {};
instance._uri = `/Policies`;
instance.page = function page(params, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
if (params["toolId"] !== undefined)
data["ToolId"] = params["toolId"];
if (params["knowledgeId"] !== undefined)
data["KnowledgeId"] = params["knowledgeId"];
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 PolicyPage(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 PolicyPage(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["toolId"] !== undefined)
data["ToolId"] = params["toolId"];
if (params["knowledgeId"] !== undefined)
data["KnowledgeId"] = params["knowledgeId"];
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 PolicyPage(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 PolicyPage(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 PolicyInstance {
constructor(_version, payload) {
this._version = _version;
this.id = payload.id;
this.name = payload.name;
this.description = payload.description;
this.accountSid = payload.account_sid;
this.userSid = payload.user_sid;
this.type = payload.type;
this.policyDetails = payload.policy_details;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
id: this.id,
name: this.name,
description: this.description,
accountSid: this.accountSid,
userSid: this.userSid,
type: this.type,
policyDetails: this.policyDetails,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PolicyInstance = PolicyInstance;
class PolicyPage extends Page_1.default {
/**
* Initialize the PolicyPage
*
* @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 PolicyInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new PolicyInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.PolicyPage = PolicyPage;

300
node_modules/twilio/lib/rest/assistants/v1/session.d.ts generated vendored Normal file
View File

@@ -0,0 +1,300 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
import { MessageListInstance } from "./session/message";
/**
* Options to pass to each
*/
export interface SessionListInstanceEachOptions {
/** 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: SessionInstance, 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 SessionListInstanceOptions {
/** 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 SessionListInstancePageOptions {
/** 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 SessionContext {
messages: MessageListInstance;
/**
* Fetch a SessionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance
*/
fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
/**
* Fetch a SessionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SessionInstance>) => any): Promise<ApiResponse<SessionInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface SessionContextSolution {
id: string;
}
export declare class SessionContextImpl implements SessionContext {
protected _version: V1;
protected _solution: SessionContextSolution;
protected _uri: string;
protected _messages?: MessageListInstance;
constructor(_version: V1, id: string);
get messages(): MessageListInstance;
fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SessionInstance>) => any): Promise<ApiResponse<SessionInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): SessionContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface SessionPayload extends TwilioResponsePayload {
sessions: SessionResource[];
}
interface SessionResource {
id: string;
account_sid: string;
assistant_id: string;
verified: boolean;
identity: string;
date_created: Date;
date_updated: Date;
}
export declare class SessionInstance {
protected _version: V1;
protected _solution: SessionContextSolution;
protected _context?: SessionContext;
constructor(_version: V1, payload: SessionResource, id?: string);
/**
* The Session ID.
*/
id: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource.
*/
accountSid: string;
/**
* The Assistant ID.
*/
assistantId: string;
/**
* True if the session is verified.
*/
verified: boolean;
/**
* The unique identity of user for the session.
*/
identity: string;
/**
* The date and time in GMT when the Session was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Session was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
private get _proxy();
/**
* Fetch a SessionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance
*/
fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>;
/**
* Fetch a SessionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<SessionInstance>) => any): Promise<ApiResponse<SessionInstance>>;
/**
* Access the messages.
*/
messages(): MessageListInstance;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
id: string;
accountSid: string;
assistantId: string;
verified: boolean;
identity: string;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface SessionSolution {
}
export interface SessionListInstance {
_version: V1;
_solution: SessionSolution;
_uri: string;
(id: string): SessionContext;
get(id: string): SessionContext;
/**
* Streams SessionInstance 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 { SessionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
each(params: SessionListInstanceEachOptions, callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
/**
* Streams SessionInstance 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 { SessionListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: SessionListInstanceEachOptions, callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of SessionInstance 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: SessionPage) => any): Promise<SessionPage>;
/**
* Retrieve a single target page of SessionInstance 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<SessionPage>) => any): Promise<ApiResponse<SessionPage>>;
/**
* Lists SessionInstance 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 { SessionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>;
list(params: SessionListInstanceOptions, callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>;
/**
* Lists SessionInstance 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 { SessionListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SessionInstance[]>) => any): Promise<ApiResponse<SessionInstance[]>>;
listWithHttpInfo(params: SessionListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<SessionInstance[]>) => any): Promise<ApiResponse<SessionInstance[]>>;
/**
* Retrieve a single page of SessionInstance 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 { SessionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>;
page(params: SessionListInstancePageOptions, callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>;
/**
* Retrieve a single page of SessionInstance 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 { SessionListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<SessionPage>) => any): Promise<ApiResponse<SessionPage>>;
pageWithHttpInfo(params: SessionListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<SessionPage>) => any): Promise<ApiResponse<SessionPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function SessionListInstance(version: V1): SessionListInstance;
export declare class SessionPage extends Page<V1, SessionPayload, SessionResource, SessionInstance> {
/**
* Initialize the SessionPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: SessionSolution);
/**
* Build an instance of SessionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: SessionResource): SessionInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

275
node_modules/twilio/lib/rest/assistants/v1/session.js generated vendored Normal file
View File

@@ -0,0 +1,275 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.SessionPage = exports.SessionInstance = exports.SessionContextImpl = void 0;
exports.SessionListInstance = SessionListInstance;
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 message_1 = require("./session/message");
class SessionContextImpl {
constructor(_version, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { id };
this._uri = `/Sessions/${id}`;
}
get messages() {
this._messages =
this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.id);
return this._messages;
}
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 SessionInstance(operationVersion, payload, instance._solution.id));
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 SessionInstance(operationVersion, response.body, instance._solution.id),
}));
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.SessionContextImpl = SessionContextImpl;
class SessionInstance {
constructor(_version, payload, id) {
this._version = _version;
this.id = payload.id;
this.accountSid = payload.account_sid;
this.assistantId = payload.assistant_id;
this.verified = payload.verified;
this.identity = payload.identity;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this._solution = { id: id || this.id };
}
get _proxy() {
this._context =
this._context || new SessionContextImpl(this._version, this._solution.id);
return this._context;
}
/**
* Fetch a SessionInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a SessionInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed SessionInstance with HTTP metadata
*/
fetchWithHttpInfo(callback) {
return this._proxy.fetchWithHttpInfo(callback);
}
/**
* Access the messages.
*/
messages() {
return this._proxy.messages;
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
id: this.id,
accountSid: this.accountSid,
assistantId: this.assistantId,
verified: this.verified,
identity: this.identity,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SessionInstance = SessionInstance;
function SessionListInstance(version) {
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new SessionContextImpl(version, id);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Sessions`;
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 SessionPage(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 SessionPage(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 SessionPage(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 SessionPage(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 SessionPage extends Page_1.default {
/**
* Initialize the SessionPage
*
* @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 SessionInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new SessionInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.SessionPage = SessionPage;

View File

@@ -0,0 +1,249 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../../base/Page";
import Response from "../../../../http/response";
import V1 from "../../V1";
import { ApiResponse } from "../../../../base/ApiResponse";
/**
* Options to pass to each
*/
export interface MessageListInstanceEachOptions {
/** 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: MessageInstance, 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 MessageListInstanceOptions {
/** 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 MessageListInstancePageOptions {
/** 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 MessageSolution {
sessionId: string;
}
export interface MessageListInstance {
_version: V1;
_solution: MessageSolution;
_uri: string;
/**
* Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
/**
* Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>;
/**
* Retrieve a single target page of MessageInstance 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<MessagePage>) => any): Promise<ApiResponse<MessagePage>>;
/**
* Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>;
list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>;
/**
* Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<MessageInstance[]>) => any): Promise<ApiResponse<MessageInstance[]>>;
listWithHttpInfo(params: MessageListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<MessageInstance[]>) => any): Promise<ApiResponse<MessageInstance[]>>;
/**
* Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>;
page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>;
/**
* Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<MessagePage>) => any): Promise<ApiResponse<MessagePage>>;
pageWithHttpInfo(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<MessagePage>) => any): Promise<ApiResponse<MessagePage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function MessageListInstance(version: V1, sessionId: string): MessageListInstance;
interface MessagePayload extends TwilioResponsePayload {
messages: MessageResource[];
}
interface MessageResource {
id: string;
account_sid: string;
assistant_id: string;
session_id: string;
identity: string;
role: string;
content: Record<string, object>;
meta: Record<string, object>;
date_created: Date;
date_updated: Date;
}
export declare class MessageInstance {
protected _version: V1;
constructor(_version: V1, payload: MessageResource, sessionId: string);
/**
* The message ID.
*/
id: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource.
*/
accountSid: string;
/**
* The Assistant ID.
*/
assistantId: string;
/**
* The Session ID.
*/
sessionId: string;
/**
* The identity of the user.
*/
identity: string;
/**
* The role of the user associated with the message.
*/
role: string;
/**
* The content of the message.
*/
content: Record<string, object>;
/**
* The metadata of the message.
*/
meta: Record<string, object>;
/**
* The date and time in GMT when the Message was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Message was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
id: string;
accountSid: string;
assistantId: string;
sessionId: string;
identity: string;
role: string;
content: Record<string, object>;
meta: Record<string, object>;
dateCreated: Date;
dateUpdated: Date;
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> {
/**
* Initialize the MessagePage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: MessageSolution);
/**
* Build an instance of MessageInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: MessageResource): MessageInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

View File

@@ -0,0 +1,189 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.MessagePage = exports.MessageInstance = void 0;
exports.MessageListInstance = MessageListInstance;
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 MessageListInstance(version, sessionId) {
if (!(0, utility_1.isValidPathParam)(sessionId)) {
throw new Error("Parameter 'sessionId' is not valid.");
}
const instance = {};
instance._version = version;
instance._solution = { sessionId };
instance._uri = `/Sessions/${sessionId}/Messages`;
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 MessagePage(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 MessagePage(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 MessagePage(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 MessagePage(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 MessageInstance {
constructor(_version, payload, sessionId) {
this._version = _version;
this.id = payload.id;
this.accountSid = payload.account_sid;
this.assistantId = payload.assistant_id;
this.sessionId = payload.session_id;
this.identity = payload.identity;
this.role = payload.role;
this.content = payload.content;
this.meta = payload.meta;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
}
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON() {
return {
id: this.id,
accountSid: this.accountSid,
assistantId: this.assistantId,
sessionId: this.sessionId,
identity: this.identity,
role: this.role,
content: this.content,
meta: this.meta,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MessageInstance = MessageInstance;
class MessagePage extends Page_1.default {
/**
* Initialize the MessagePage
*
* @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 MessageInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new MessageInstance(this._version, payload, this._solution.sessionId);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.MessagePage = MessagePage;

585
node_modules/twilio/lib/rest/assistants/v1/tool.d.ts generated vendored Normal file
View File

@@ -0,0 +1,585 @@
import { inspect, InspectOptions } from "util";
import Page, { TwilioResponsePayload } from "../../../base/Page";
import Response from "../../../http/response";
import V1 from "../V1";
import { ApiResponse } from "../../../base/ApiResponse";
export declare class AssistantsV1ServiceCreatePolicyRequest {
/**
* The description of the policy.
*/
"description"?: string;
/**
* The Policy ID.
*/
"id"?: string;
/**
* The name of the policy.
*/
"name"?: string;
"policyDetails": any | null;
/**
* The description of the policy.
*/
"type"?: string;
constructor(payload: any);
}
export declare class AssistantsV1ServiceCreateToolRequest {
/**
* The Assistant ID.
*/
"assistantId"?: string;
/**
* The description of the tool.
*/
"description"?: string;
/**
* True if the tool is enabled.
*/
"enabled": boolean;
/**
* The metadata related to method, url, input_schema to used with the Tool.
*/
"meta"?: Record<string, object>;
/**
* The name of the tool.
*/
"name": string;
"policy"?: AssistantsV1ServiceCreatePolicyRequest;
/**
* The description of the tool.
*/
"type": string;
constructor(payload: any);
}
export declare class AssistantsV1ServicePolicy {
/**
* The Policy ID.
*/
"id"?: string;
/**
* The name of the policy.
*/
"name"?: string;
/**
* The description of the policy.
*/
"description"?: string;
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Policy resource.
*/
"accountSid"?: string;
/**
* The SID of the User that created the Policy resource.
*/
"userSid"?: string;
/**
* The type of the policy.
*/
"type": string;
/**
* The details of the policy based on the type.
*/
"policyDetails": Record<string, object>;
/**
* The date and time in GMT when the Policy was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateCreated"?: Date;
/**
* The date and time in GMT when the Policy was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
"dateUpdated"?: Date;
constructor(payload: any);
}
export declare class AssistantsV1ServiceUpdateToolRequest {
/**
* The Assistant ID.
*/
"assistantId"?: string;
/**
* The description of the tool.
*/
"description"?: string;
/**
* True if the tool is enabled.
*/
"enabled"?: boolean;
/**
* The metadata related to method, url, input_schema to used with the Tool.
*/
"meta"?: Record<string, object>;
/**
* The name of the tool.
*/
"name"?: string;
"policy"?: AssistantsV1ServiceCreatePolicyRequest;
/**
* The type of the tool.
*/
"type"?: string;
constructor(payload: any);
}
/**
* Options to pass to update a ToolInstance
*/
export interface ToolContextUpdateOptions {
/** */
assistantsV1ServiceUpdateToolRequest?: AssistantsV1ServiceUpdateToolRequest;
}
/**
* Options to pass to create a ToolInstance
*/
export interface ToolListInstanceCreateOptions {
/** */
assistantsV1ServiceCreateToolRequest: AssistantsV1ServiceCreateToolRequest;
}
/**
* Options to pass to each
*/
export interface ToolListInstanceEachOptions {
/** */
assistantId?: 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: ToolInstance, 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 ToolListInstanceOptions {
/** */
assistantId?: 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 ToolListInstancePageOptions {
/** */
assistantId?: 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 ToolContext {
/**
* Remove a ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ToolInstance 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 ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
fetch(callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Fetch a ToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Update a ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
update(callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Update a ToolInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
update(params: AssistantsV1ServiceUpdateToolRequest, headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Update a ToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Update a ToolInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateToolRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export interface ToolContextSolution {
id: string;
}
export declare class ToolContextImpl implements ToolContext {
protected _version: V1;
protected _solution: ToolContextSolution;
protected _uri: string;
constructor(_version: V1, id: 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?: ToolInstance) => any): Promise<ToolInstance>;
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
update(params?: AssistantsV1ServiceUpdateToolRequest | ((error: Error | null, item?: ToolInstance) => any), headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
updateWithHttpInfo(params?: AssistantsV1ServiceUpdateToolRequest | ((error: Error | null, item?: ApiResponse<ToolInstance>) => any), headers?: any, callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): ToolContextSolution;
[inspect.custom](_depth: any, options: InspectOptions): string;
}
interface ToolPayload extends TwilioResponsePayload {
tools: ToolResource[];
}
interface ToolResource {
account_sid: string;
description: string;
enabled: boolean;
id: string;
meta: Record<string, object>;
name: string;
requires_auth: boolean;
type: string;
url: string;
date_created: Date;
date_updated: Date;
policies: Array<AssistantsV1ServicePolicy>;
}
export declare class ToolInstance {
protected _version: V1;
protected _solution: ToolContextSolution;
protected _context?: ToolContext;
constructor(_version: V1, payload: ToolResource, id?: string);
/**
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
*/
accountSid: string;
/**
* The description of the tool.
*/
description: string;
/**
* True if the tool is enabled.
*/
enabled: boolean;
/**
* The tool ID.
*/
id: string;
/**
* The metadata related to method, url, input_schema to used with the Tool.
*/
meta: Record<string, object>;
/**
* The name of the tool.
*/
name: string;
/**
* The authentication requirement for the tool.
*/
requiresAuth: boolean;
/**
* The type of the tool. (\'WEBHOOK\')
*/
type: string;
/**
* The url of the tool resource.
*/
url: string;
/**
* The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateCreated: Date;
/**
* The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
*/
dateUpdated: Date;
/**
* The Policies associated with the tool.
*/
policies: Array<AssistantsV1ServicePolicy>;
private get _proxy();
/**
* Remove a ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
/**
* Remove a ToolInstance 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 ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
fetch(callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Fetch a ToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
fetchWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Update a ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
update(callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Update a ToolInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
update(params: AssistantsV1ServiceUpdateToolRequest, headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Update a ToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
updateWithHttpInfo(callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Update a ToolInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
updateWithHttpInfo(params: AssistantsV1ServiceUpdateToolRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Provide a user-friendly representation
*
* @returns Object
*/
toJSON(): {
accountSid: string;
description: string;
enabled: boolean;
id: string;
meta: Record<string, object>;
name: string;
requiresAuth: boolean;
type: string;
url: string;
dateCreated: Date;
dateUpdated: Date;
policies: AssistantsV1ServicePolicy[];
};
[inspect.custom](_depth: any, options: InspectOptions): string;
}
export interface ToolSolution {
}
export interface ToolListInstance {
_version: V1;
_solution: ToolSolution;
_uri: string;
(id: string): ToolContext;
get(id: string): ToolContext;
/**
* Create a ToolInstance
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
create(params: AssistantsV1ServiceCreateToolRequest, headers?: any, callback?: (error: Error | null, item?: ToolInstance) => any): Promise<ToolInstance>;
/**
* Create a ToolInstance and return HTTP info
*
* @param params - Body for request
* @param headers - header params for request
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance with HTTP metadata
*/
createWithHttpInfo(params: AssistantsV1ServiceCreateToolRequest, headers?: any, callback?: (error: Error | null, item?: ApiResponse<ToolInstance>) => any): Promise<ApiResponse<ToolInstance>>;
/**
* Streams ToolInstance 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 { ToolListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
each(callback?: (item: ToolInstance, done: (err?: Error) => void) => void): void;
each(params: ToolListInstanceEachOptions, callback?: (item: ToolInstance, done: (err?: Error) => void) => void): void;
/**
* Streams ToolInstance 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 { ToolListInstanceEachOptions } [params] - Options for request
* @param { function } [callback] - Function to process each record
*/
eachWithHttpInfo(callback?: (item: ToolInstance, done: (err?: Error) => void) => void): void;
eachWithHttpInfo(params: ToolListInstanceEachOptions, callback?: (item: ToolInstance, done: (err?: Error) => void) => void): void;
/**
* Retrieve a single target page of ToolInstance 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: ToolPage) => any): Promise<ToolPage>;
/**
* Retrieve a single target page of ToolInstance 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<ToolPage>) => any): Promise<ApiResponse<ToolPage>>;
/**
* Lists ToolInstance 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 { ToolListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
list(callback?: (error: Error | null, items: ToolInstance[]) => any): Promise<ToolInstance[]>;
list(params: ToolListInstanceOptions, callback?: (error: Error | null, items: ToolInstance[]) => any): Promise<ToolInstance[]>;
/**
* Lists ToolInstance 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 { ToolListInstanceOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ToolInstance[]>) => any): Promise<ApiResponse<ToolInstance[]>>;
listWithHttpInfo(params: ToolListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<ToolInstance[]>) => any): Promise<ApiResponse<ToolInstance[]>>;
/**
* Retrieve a single page of ToolInstance 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 { ToolListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records
*/
page(callback?: (error: Error | null, items: ToolPage) => any): Promise<ToolPage>;
page(params: ToolListInstancePageOptions, callback?: (error: Error | null, items: ToolPage) => any): Promise<ToolPage>;
/**
* Retrieve a single page of ToolInstance 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 { ToolListInstancePageOptions } [params] - Options for request
* @param { function } [callback] - Callback to handle list of records with metadata
*/
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<ToolPage>) => any): Promise<ApiResponse<ToolPage>>;
pageWithHttpInfo(params: ToolListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<ToolPage>) => any): Promise<ApiResponse<ToolPage>>;
/**
* Provide a user-friendly representation
*/
toJSON(): any;
[inspect.custom](_depth: any, options: InspectOptions): any;
}
export declare function ToolListInstance(version: V1): ToolListInstance;
export declare class ToolPage extends Page<V1, ToolPayload, ToolResource, ToolInstance> {
/**
* Initialize the ToolPage
*
* @param version - Version of the resource
* @param response - Response from the API
* @param solution - Path solution
*/
constructor(version: V1, response: Response<string>, solution: ToolSolution);
/**
* Build an instance of ToolInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload: ToolResource): ToolInstance;
[inspect.custom](depth: any, options: InspectOptions): string;
}
export {};

485
node_modules/twilio/lib/rest/assistants/v1/tool.js generated vendored Normal file
View File

@@ -0,0 +1,485 @@
"use strict";
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Assistants
* 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.ToolPage = exports.ToolInstance = exports.ToolContextImpl = exports.AssistantsV1ServiceUpdateToolRequest = exports.AssistantsV1ServicePolicy = exports.AssistantsV1ServiceCreateToolRequest = exports.AssistantsV1ServiceCreatePolicyRequest = void 0;
exports.ToolListInstance = ToolListInstance;
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 AssistantsV1ServiceCreatePolicyRequest {
constructor(payload) {
this.description = payload["description"];
this.id = payload["id"];
this.name = payload["name"];
this.policyDetails = payload["policy_details"];
this.type = payload["type"];
}
}
exports.AssistantsV1ServiceCreatePolicyRequest = AssistantsV1ServiceCreatePolicyRequest;
class AssistantsV1ServiceCreateToolRequest {
constructor(payload) {
this.assistantId = payload["assistant_id"];
this.description = payload["description"];
this.enabled = payload["enabled"];
this.meta = payload["meta"];
this.name = payload["name"];
this.policy = payload["policy"];
this.type = payload["type"];
}
}
exports.AssistantsV1ServiceCreateToolRequest = AssistantsV1ServiceCreateToolRequest;
class AssistantsV1ServicePolicy {
constructor(payload) {
this.id = payload["id"];
this.name = payload["name"];
this.description = payload["description"];
this.accountSid = payload["account_sid"];
this.userSid = payload["user_sid"];
this.type = payload["type"];
this.policyDetails = payload["policy_details"];
this.dateCreated = payload["date_created"];
this.dateUpdated = payload["date_updated"];
}
}
exports.AssistantsV1ServicePolicy = AssistantsV1ServicePolicy;
class AssistantsV1ServiceUpdateToolRequest {
constructor(payload) {
this.assistantId = payload["assistant_id"];
this.description = payload["description"];
this.enabled = payload["enabled"];
this.meta = payload["meta"];
this.name = payload["name"];
this.policy = payload["policy"];
this.type = payload["type"];
}
}
exports.AssistantsV1ServiceUpdateToolRequest = AssistantsV1ServiceUpdateToolRequest;
class ToolContextImpl {
constructor(_version, id) {
this._version = _version;
if (!(0, utility_1.isValidPathParam)(id)) {
throw new Error("Parameter 'id' is not valid.");
}
this._solution = { id };
this._uri = `/Tools/${id}`;
}
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 ToolInstance(operationVersion, payload, instance._solution.id));
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 ToolInstance(operationVersion, response.body, instance._solution.id),
}));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
update(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version, operationPromise = operationVersion.update({
uri: instance._uri,
method: "put",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ToolInstance(operationVersion, payload, instance._solution.id));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
}
updateWithHttpInfo(params, headers, callback) {
if (params instanceof Function) {
callback = params;
params = {};
}
else {
params = params || {};
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
const instance = this;
let operationVersion = instance._version;
// CREATE, FETCH, UPDATE operations
let operationPromise = operationVersion
.updateWithResponseInfo({
uri: instance._uri,
method: "put",
data,
headers,
})
.then((response) => ({
...response,
body: new ToolInstance(operationVersion, response.body, instance._solution.id),
}));
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.ToolContextImpl = ToolContextImpl;
class ToolInstance {
constructor(_version, payload, id) {
this._version = _version;
this.accountSid = payload.account_sid;
this.description = payload.description;
this.enabled = payload.enabled;
this.id = payload.id;
this.meta = payload.meta;
this.name = payload.name;
this.requiresAuth = payload.requires_auth;
this.type = payload.type;
this.url = payload.url;
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
this.policies =
payload.policies !== null && payload.policies !== undefined
? payload.policies.map((payload) => new AssistantsV1ServicePolicy(payload))
: null;
this._solution = { id: id || this.id };
}
get _proxy() {
this._context =
this._context || new ToolContextImpl(this._version, this._solution.id);
return this._context;
}
/**
* Remove a ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed boolean
*/
remove(callback) {
return this._proxy.remove(callback);
}
/**
* Remove a ToolInstance 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 ToolInstance
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance
*/
fetch(callback) {
return this._proxy.fetch(callback);
}
/**
* Fetch a ToolInstance and return HTTP info
*
* @param callback - Callback to handle processed record
*
* @returns Resolves to processed ToolInstance 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,
description: this.description,
enabled: this.enabled,
id: this.id,
meta: this.meta,
name: this.name,
requiresAuth: this.requiresAuth,
type: this.type,
url: this.url,
dateCreated: this.dateCreated,
dateUpdated: this.dateUpdated,
policies: this.policies,
};
}
[util_1.inspect.custom](_depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ToolInstance = ToolInstance;
function ToolListInstance(version) {
const instance = ((id) => instance.get(id));
instance.get = function get(id) {
return new ToolContextImpl(version, id);
};
instance._version = version;
instance._solution = {};
instance._uri = `/Tools`;
instance.create = function create(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
headers["Accept"] = "application/json";
let operationVersion = version, operationPromise = operationVersion.create({
uri: instance._uri,
method: "post",
data,
headers,
});
operationPromise = operationPromise.then((payload) => new ToolInstance(operationVersion, payload));
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
return operationPromise;
};
instance.createWithHttpInfo = function createWithHttpInfo(params, headers, callback) {
if (params === null || params === undefined) {
throw new Error('Required parameter "params" missing.');
}
let data = {};
data = params;
if (headers === null || headers === undefined) {
headers = {};
}
headers["Content-Type"] = "application/json";
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 ToolInstance(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["assistantId"] !== undefined)
data["AssistantId"] = params["assistantId"];
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 ToolPage(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 ToolPage(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["assistantId"] !== undefined)
data["AssistantId"] = params["assistantId"];
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 ToolPage(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 ToolPage(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 ToolPage extends Page_1.default {
/**
* Initialize the ToolPage
*
* @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 ToolInstance
*
* @param payload - Payload response from the API
*/
getInstance(payload) {
return new ToolInstance(this._version, payload);
}
[util_1.inspect.custom](depth, options) {
return (0, util_1.inspect)(this.toJSON(), options);
}
}
exports.ToolPage = ToolPage;