twilio 5.2.3 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/rest/Assistants.d.ts +4 -0
- package/lib/rest/Assistants.js +8 -0
- package/lib/rest/AssistantsBase.d.ts +13 -0
- package/lib/rest/AssistantsBase.js +31 -0
- package/lib/rest/Iam.d.ts +4 -0
- package/lib/rest/Iam.js +8 -0
- package/lib/rest/IamBase.d.ts +13 -0
- package/lib/rest/IamBase.js +31 -0
- package/lib/rest/Twilio.d.ts +10 -0
- package/lib/rest/Twilio.js +11 -0
- package/lib/rest/assistants/V1.d.ts +35 -0
- package/lib/rest/assistants/V1.js +60 -0
- package/lib/rest/assistants/v1/assistant/feedback.d.ts +231 -0
- package/lib/rest/assistants/v1/assistant/feedback.js +161 -0
- package/lib/rest/assistants/v1/assistant.d.ts +466 -0
- package/lib/rest/assistants/v1/assistant.js +284 -0
- package/lib/rest/assistants/v1/knowledge/chunk.d.ts +167 -0
- package/lib/rest/assistants/v1/knowledge/chunk.js +130 -0
- package/lib/rest/assistants/v1/knowledge.d.ts +385 -0
- package/lib/rest/assistants/v1/knowledge.js +273 -0
- package/lib/rest/assistants/v1/policy.d.ts +202 -0
- package/lib/rest/assistants/v1/policy.js +138 -0
- package/lib/rest/assistants/v1/session/message.d.ts +197 -0
- package/lib/rest/assistants/v1/session/message.js +140 -0
- package/lib/rest/assistants/v1/session.d.ts +231 -0
- package/lib/rest/assistants/v1/session.js +194 -0
- package/lib/rest/assistants/v1/tool.d.ts +378 -0
- package/lib/rest/assistants/v1/tool.js +242 -0
- package/lib/rest/content/v1/content/approvalFetch.d.ts +5 -5
- package/lib/rest/content/v1/content/approvalFetch.js +14 -14
- package/lib/rest/content/v1/content.d.ts +33 -3
- package/lib/rest/content/v1/content.js +16 -1
- package/lib/rest/iam/V1.d.ts +25 -0
- package/lib/rest/iam/V1.js +48 -0
- package/lib/rest/iam/v1/apiKey.d.ts +167 -0
- package/lib/rest/iam/v1/apiKey.js +161 -0
- package/lib/rest/iam/v1/getApiKeys.d.ts +163 -0
- package/lib/rest/iam/v1/getApiKeys.js +124 -0
- package/lib/rest/iam/v1/newApiKey.d.ts +90 -0
- package/lib/rest/iam/v1/newApiKey.js +90 -0
- package/lib/rest/intelligence/v2/operatorType.d.ts +1 -1
- package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts +12 -18
- package/lib/rest/marketplace/v1/installedAddOn/installedAddOnUsage.js +3 -6
- package/lib/rest/marketplace/v1/moduleDataManagement.d.ts +14 -6
- package/lib/rest/marketplace/v1/moduleDataManagement.js +4 -0
- package/lib/rest/numbers/v1/portingPortIn.js +1 -1
- package/lib/rest/numbers/v2/bundleClone.d.ts +1 -1
- package/lib/rest/numbers/v2/regulatoryCompliance/bundle.d.ts +4 -4
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts +6 -0
- package/lib/rest/numbers/v2/regulatoryCompliance/supportingDocument.js +2 -0
- package/lib/rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect, InspectOptions } from "util";
|
|
3
|
+
import Page, { TwilioResponsePayload } from "../../../base/Page";
|
|
4
|
+
import Response from "../../../http/response";
|
|
5
|
+
import V1 from "../V1";
|
|
6
|
+
/**
|
|
7
|
+
* Options to pass to each
|
|
8
|
+
*/
|
|
9
|
+
export interface PolicyListInstanceEachOptions {
|
|
10
|
+
/** The tool ID. */
|
|
11
|
+
toolId?: string;
|
|
12
|
+
/** The knowledge ID. */
|
|
13
|
+
knowledgeId?: string;
|
|
14
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
15
|
+
pageSize?: number;
|
|
16
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
17
|
+
callback?: (item: PolicyInstance, done: (err?: Error) => void) => void;
|
|
18
|
+
/** Function to be called upon completion of streaming */
|
|
19
|
+
done?: Function;
|
|
20
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Options to pass to list
|
|
25
|
+
*/
|
|
26
|
+
export interface PolicyListInstanceOptions {
|
|
27
|
+
/** The tool ID. */
|
|
28
|
+
toolId?: string;
|
|
29
|
+
/** The knowledge ID. */
|
|
30
|
+
knowledgeId?: string;
|
|
31
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
32
|
+
pageSize?: number;
|
|
33
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
34
|
+
limit?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Options to pass to page
|
|
38
|
+
*/
|
|
39
|
+
export interface PolicyListInstancePageOptions {
|
|
40
|
+
/** The tool ID. */
|
|
41
|
+
toolId?: string;
|
|
42
|
+
/** The knowledge ID. */
|
|
43
|
+
knowledgeId?: string;
|
|
44
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
45
|
+
pageSize?: number;
|
|
46
|
+
/** Page Number, this value is simply for client state */
|
|
47
|
+
pageNumber?: number;
|
|
48
|
+
/** PageToken provided by the API */
|
|
49
|
+
pageToken?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface PolicySolution {
|
|
52
|
+
}
|
|
53
|
+
export interface PolicyListInstance {
|
|
54
|
+
_version: V1;
|
|
55
|
+
_solution: PolicySolution;
|
|
56
|
+
_uri: string;
|
|
57
|
+
/**
|
|
58
|
+
* Streams PolicyInstance records from the API.
|
|
59
|
+
*
|
|
60
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
61
|
+
* is reached.
|
|
62
|
+
*
|
|
63
|
+
* The results are passed into the callback function, so this operation is memory
|
|
64
|
+
* efficient.
|
|
65
|
+
*
|
|
66
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
67
|
+
* function.
|
|
68
|
+
*
|
|
69
|
+
* @param { PolicyListInstanceEachOptions } [params] - Options for request
|
|
70
|
+
* @param { function } [callback] - Function to process each record
|
|
71
|
+
*/
|
|
72
|
+
each(callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
|
|
73
|
+
each(params: PolicyListInstanceEachOptions, callback?: (item: PolicyInstance, done: (err?: Error) => void) => void): void;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieve a single target page of PolicyInstance records from the API.
|
|
76
|
+
*
|
|
77
|
+
* The request is executed immediately.
|
|
78
|
+
*
|
|
79
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
80
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
81
|
+
*/
|
|
82
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: PolicyPage) => any): Promise<PolicyPage>;
|
|
83
|
+
/**
|
|
84
|
+
* Lists PolicyInstance records from the API as a list.
|
|
85
|
+
*
|
|
86
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
87
|
+
* function.
|
|
88
|
+
*
|
|
89
|
+
* @param { PolicyListInstanceOptions } [params] - Options for request
|
|
90
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
91
|
+
*/
|
|
92
|
+
list(callback?: (error: Error | null, items: PolicyInstance[]) => any): Promise<PolicyInstance[]>;
|
|
93
|
+
list(params: PolicyListInstanceOptions, callback?: (error: Error | null, items: PolicyInstance[]) => any): Promise<PolicyInstance[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Retrieve a single page of PolicyInstance records from the API.
|
|
96
|
+
*
|
|
97
|
+
* The request is executed immediately.
|
|
98
|
+
*
|
|
99
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
100
|
+
* function.
|
|
101
|
+
*
|
|
102
|
+
* @param { PolicyListInstancePageOptions } [params] - Options for request
|
|
103
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
104
|
+
*/
|
|
105
|
+
page(callback?: (error: Error | null, items: PolicyPage) => any): Promise<PolicyPage>;
|
|
106
|
+
page(params: PolicyListInstancePageOptions, callback?: (error: Error | null, items: PolicyPage) => any): Promise<PolicyPage>;
|
|
107
|
+
/**
|
|
108
|
+
* Provide a user-friendly representation
|
|
109
|
+
*/
|
|
110
|
+
toJSON(): any;
|
|
111
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
112
|
+
}
|
|
113
|
+
export declare function PolicyListInstance(version: V1): PolicyListInstance;
|
|
114
|
+
interface PolicyPayload extends TwilioResponsePayload {
|
|
115
|
+
policies: PolicyResource[];
|
|
116
|
+
}
|
|
117
|
+
interface PolicyResource {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
description: string;
|
|
121
|
+
account_sid: string;
|
|
122
|
+
user_sid: string;
|
|
123
|
+
type: string;
|
|
124
|
+
policy_details: Record<string, object>;
|
|
125
|
+
date_created: Date;
|
|
126
|
+
date_updated: Date;
|
|
127
|
+
}
|
|
128
|
+
export declare class PolicyInstance {
|
|
129
|
+
protected _version: V1;
|
|
130
|
+
constructor(_version: V1, payload: PolicyResource);
|
|
131
|
+
/**
|
|
132
|
+
* The Policy ID.
|
|
133
|
+
*/
|
|
134
|
+
id: string;
|
|
135
|
+
/**
|
|
136
|
+
* The name of the policy.
|
|
137
|
+
*/
|
|
138
|
+
name: string;
|
|
139
|
+
/**
|
|
140
|
+
* The description of the policy.
|
|
141
|
+
*/
|
|
142
|
+
description: string;
|
|
143
|
+
/**
|
|
144
|
+
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Policy resource.
|
|
145
|
+
*/
|
|
146
|
+
accountSid: string;
|
|
147
|
+
/**
|
|
148
|
+
* The SID of the User that created the Policy resource.
|
|
149
|
+
*/
|
|
150
|
+
userSid: string;
|
|
151
|
+
/**
|
|
152
|
+
* The type of the policy.
|
|
153
|
+
*/
|
|
154
|
+
type: string;
|
|
155
|
+
/**
|
|
156
|
+
* The details of the policy based on the type.
|
|
157
|
+
*/
|
|
158
|
+
policyDetails: Record<string, object>;
|
|
159
|
+
/**
|
|
160
|
+
* The date and time in GMT when the Policy was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
161
|
+
*/
|
|
162
|
+
dateCreated: Date;
|
|
163
|
+
/**
|
|
164
|
+
* The date and time in GMT when the Policy was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
165
|
+
*/
|
|
166
|
+
dateUpdated: Date;
|
|
167
|
+
/**
|
|
168
|
+
* Provide a user-friendly representation
|
|
169
|
+
*
|
|
170
|
+
* @returns Object
|
|
171
|
+
*/
|
|
172
|
+
toJSON(): {
|
|
173
|
+
id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
description: string;
|
|
176
|
+
accountSid: string;
|
|
177
|
+
userSid: string;
|
|
178
|
+
type: string;
|
|
179
|
+
policyDetails: Record<string, object>;
|
|
180
|
+
dateCreated: Date;
|
|
181
|
+
dateUpdated: Date;
|
|
182
|
+
};
|
|
183
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
184
|
+
}
|
|
185
|
+
export declare class PolicyPage extends Page<V1, PolicyPayload, PolicyResource, PolicyInstance> {
|
|
186
|
+
/**
|
|
187
|
+
* Initialize the PolicyPage
|
|
188
|
+
*
|
|
189
|
+
* @param version - Version of the resource
|
|
190
|
+
* @param response - Response from the API
|
|
191
|
+
* @param solution - Path solution
|
|
192
|
+
*/
|
|
193
|
+
constructor(version: V1, response: Response<string>, solution: PolicySolution);
|
|
194
|
+
/**
|
|
195
|
+
* Build an instance of PolicyInstance
|
|
196
|
+
*
|
|
197
|
+
* @param payload - Payload response from the API
|
|
198
|
+
*/
|
|
199
|
+
getInstance(payload: PolicyResource): PolicyInstance;
|
|
200
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
201
|
+
}
|
|
202
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Assistants
|
|
9
|
+
* This is the public Twilio REST API.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator.
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.PolicyPage = exports.PolicyInstance = exports.PolicyListInstance = void 0;
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const Page_1 = __importDefault(require("../../../base/Page"));
|
|
22
|
+
const deserialize = require("../../../base/deserialize");
|
|
23
|
+
const serialize = require("../../../base/serialize");
|
|
24
|
+
function PolicyListInstance(version) {
|
|
25
|
+
const instance = {};
|
|
26
|
+
instance._version = version;
|
|
27
|
+
instance._solution = {};
|
|
28
|
+
instance._uri = `/Policies`;
|
|
29
|
+
instance.page = function page(params, callback) {
|
|
30
|
+
if (params instanceof Function) {
|
|
31
|
+
callback = params;
|
|
32
|
+
params = {};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
params = params || {};
|
|
36
|
+
}
|
|
37
|
+
let data = {};
|
|
38
|
+
if (params["toolId"] !== undefined)
|
|
39
|
+
data["ToolId"] = params["toolId"];
|
|
40
|
+
if (params["knowledgeId"] !== undefined)
|
|
41
|
+
data["KnowledgeId"] = params["knowledgeId"];
|
|
42
|
+
if (params["pageSize"] !== undefined)
|
|
43
|
+
data["PageSize"] = params["pageSize"];
|
|
44
|
+
if (params.pageNumber !== undefined)
|
|
45
|
+
data["Page"] = params.pageNumber;
|
|
46
|
+
if (params.pageToken !== undefined)
|
|
47
|
+
data["PageToken"] = params.pageToken;
|
|
48
|
+
const headers = {};
|
|
49
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
50
|
+
uri: instance._uri,
|
|
51
|
+
method: "get",
|
|
52
|
+
params: data,
|
|
53
|
+
headers,
|
|
54
|
+
});
|
|
55
|
+
operationPromise = operationPromise.then((payload) => new PolicyPage(operationVersion, payload, instance._solution));
|
|
56
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
57
|
+
return operationPromise;
|
|
58
|
+
};
|
|
59
|
+
instance.each = instance._version.each;
|
|
60
|
+
instance.list = instance._version.list;
|
|
61
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
62
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
63
|
+
method: "get",
|
|
64
|
+
uri: targetUrl,
|
|
65
|
+
});
|
|
66
|
+
let pagePromise = operationPromise.then((payload) => new PolicyPage(instance._version, payload, instance._solution));
|
|
67
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
68
|
+
return pagePromise;
|
|
69
|
+
};
|
|
70
|
+
instance.toJSON = function toJSON() {
|
|
71
|
+
return instance._solution;
|
|
72
|
+
};
|
|
73
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
74
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
75
|
+
};
|
|
76
|
+
return instance;
|
|
77
|
+
}
|
|
78
|
+
exports.PolicyListInstance = PolicyListInstance;
|
|
79
|
+
class PolicyInstance {
|
|
80
|
+
constructor(_version, payload) {
|
|
81
|
+
this._version = _version;
|
|
82
|
+
this.id = payload.id;
|
|
83
|
+
this.name = payload.name;
|
|
84
|
+
this.description = payload.description;
|
|
85
|
+
this.accountSid = payload.account_sid;
|
|
86
|
+
this.userSid = payload.user_sid;
|
|
87
|
+
this.type = payload.type;
|
|
88
|
+
this.policyDetails = payload.policy_details;
|
|
89
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
|
90
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Provide a user-friendly representation
|
|
94
|
+
*
|
|
95
|
+
* @returns Object
|
|
96
|
+
*/
|
|
97
|
+
toJSON() {
|
|
98
|
+
return {
|
|
99
|
+
id: this.id,
|
|
100
|
+
name: this.name,
|
|
101
|
+
description: this.description,
|
|
102
|
+
accountSid: this.accountSid,
|
|
103
|
+
userSid: this.userSid,
|
|
104
|
+
type: this.type,
|
|
105
|
+
policyDetails: this.policyDetails,
|
|
106
|
+
dateCreated: this.dateCreated,
|
|
107
|
+
dateUpdated: this.dateUpdated,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
[util_1.inspect.custom](_depth, options) {
|
|
111
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.PolicyInstance = PolicyInstance;
|
|
115
|
+
class PolicyPage extends Page_1.default {
|
|
116
|
+
/**
|
|
117
|
+
* Initialize the PolicyPage
|
|
118
|
+
*
|
|
119
|
+
* @param version - Version of the resource
|
|
120
|
+
* @param response - Response from the API
|
|
121
|
+
* @param solution - Path solution
|
|
122
|
+
*/
|
|
123
|
+
constructor(version, response, solution) {
|
|
124
|
+
super(version, response, solution);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Build an instance of PolicyInstance
|
|
128
|
+
*
|
|
129
|
+
* @param payload - Payload response from the API
|
|
130
|
+
*/
|
|
131
|
+
getInstance(payload) {
|
|
132
|
+
return new PolicyInstance(this._version, payload);
|
|
133
|
+
}
|
|
134
|
+
[util_1.inspect.custom](depth, options) {
|
|
135
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.PolicyPage = PolicyPage;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect, InspectOptions } from "util";
|
|
3
|
+
import Page, { TwilioResponsePayload } from "../../../../base/Page";
|
|
4
|
+
import Response from "../../../../http/response";
|
|
5
|
+
import V1 from "../../V1";
|
|
6
|
+
/**
|
|
7
|
+
* Options to pass to each
|
|
8
|
+
*/
|
|
9
|
+
export interface MessageListInstanceEachOptions {
|
|
10
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
13
|
+
callback?: (item: MessageInstance, done: (err?: Error) => void) => void;
|
|
14
|
+
/** Function to be called upon completion of streaming */
|
|
15
|
+
done?: Function;
|
|
16
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options to pass to list
|
|
21
|
+
*/
|
|
22
|
+
export interface MessageListInstanceOptions {
|
|
23
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options to pass to page
|
|
30
|
+
*/
|
|
31
|
+
export interface MessageListInstancePageOptions {
|
|
32
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
/** Page Number, this value is simply for client state */
|
|
35
|
+
pageNumber?: number;
|
|
36
|
+
/** PageToken provided by the API */
|
|
37
|
+
pageToken?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface MessageSolution {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MessageListInstance {
|
|
43
|
+
_version: V1;
|
|
44
|
+
_solution: MessageSolution;
|
|
45
|
+
_uri: string;
|
|
46
|
+
/**
|
|
47
|
+
* Streams MessageInstance records from the API.
|
|
48
|
+
*
|
|
49
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
50
|
+
* is reached.
|
|
51
|
+
*
|
|
52
|
+
* The results are passed into the callback function, so this operation is memory
|
|
53
|
+
* efficient.
|
|
54
|
+
*
|
|
55
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
56
|
+
* function.
|
|
57
|
+
*
|
|
58
|
+
* @param { MessageListInstanceEachOptions } [params] - Options for request
|
|
59
|
+
* @param { function } [callback] - Function to process each record
|
|
60
|
+
*/
|
|
61
|
+
each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
|
|
62
|
+
each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieve a single target page of MessageInstance records from the API.
|
|
65
|
+
*
|
|
66
|
+
* The request is executed immediately.
|
|
67
|
+
*
|
|
68
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
69
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
70
|
+
*/
|
|
71
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>;
|
|
72
|
+
/**
|
|
73
|
+
* Lists MessageInstance records from the API as a list.
|
|
74
|
+
*
|
|
75
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
76
|
+
* function.
|
|
77
|
+
*
|
|
78
|
+
* @param { MessageListInstanceOptions } [params] - Options for request
|
|
79
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
80
|
+
*/
|
|
81
|
+
list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>;
|
|
82
|
+
list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Retrieve a single page of MessageInstance records from the API.
|
|
85
|
+
*
|
|
86
|
+
* The request is executed immediately.
|
|
87
|
+
*
|
|
88
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
89
|
+
* function.
|
|
90
|
+
*
|
|
91
|
+
* @param { MessageListInstancePageOptions } [params] - Options for request
|
|
92
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
93
|
+
*/
|
|
94
|
+
page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>;
|
|
95
|
+
page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>;
|
|
96
|
+
/**
|
|
97
|
+
* Provide a user-friendly representation
|
|
98
|
+
*/
|
|
99
|
+
toJSON(): any;
|
|
100
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
101
|
+
}
|
|
102
|
+
export declare function MessageListInstance(version: V1, sessionId: string): MessageListInstance;
|
|
103
|
+
interface MessagePayload extends TwilioResponsePayload {
|
|
104
|
+
messages: MessageResource[];
|
|
105
|
+
}
|
|
106
|
+
interface MessageResource {
|
|
107
|
+
id: string;
|
|
108
|
+
account_sid: string;
|
|
109
|
+
assistant_id: string;
|
|
110
|
+
session_id: string;
|
|
111
|
+
identity: string;
|
|
112
|
+
role: string;
|
|
113
|
+
content: Record<string, object>;
|
|
114
|
+
meta: Record<string, object>;
|
|
115
|
+
date_created: Date;
|
|
116
|
+
date_updated: Date;
|
|
117
|
+
}
|
|
118
|
+
export declare class MessageInstance {
|
|
119
|
+
protected _version: V1;
|
|
120
|
+
constructor(_version: V1, payload: MessageResource, sessionId: string);
|
|
121
|
+
/**
|
|
122
|
+
* The message ID.
|
|
123
|
+
*/
|
|
124
|
+
id: string;
|
|
125
|
+
/**
|
|
126
|
+
* The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource.
|
|
127
|
+
*/
|
|
128
|
+
accountSid: string;
|
|
129
|
+
/**
|
|
130
|
+
* The Assistant ID.
|
|
131
|
+
*/
|
|
132
|
+
assistantId: string;
|
|
133
|
+
/**
|
|
134
|
+
* The Session ID.
|
|
135
|
+
*/
|
|
136
|
+
sessionId: string;
|
|
137
|
+
/**
|
|
138
|
+
* The identity of the user.
|
|
139
|
+
*/
|
|
140
|
+
identity: string;
|
|
141
|
+
/**
|
|
142
|
+
* The role of the user associated with the message.
|
|
143
|
+
*/
|
|
144
|
+
role: string;
|
|
145
|
+
/**
|
|
146
|
+
* The content of the message.
|
|
147
|
+
*/
|
|
148
|
+
content: Record<string, object>;
|
|
149
|
+
/**
|
|
150
|
+
* The metadata of the message.
|
|
151
|
+
*/
|
|
152
|
+
meta: Record<string, object>;
|
|
153
|
+
/**
|
|
154
|
+
* The date and time in GMT when the Message was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
155
|
+
*/
|
|
156
|
+
dateCreated: Date;
|
|
157
|
+
/**
|
|
158
|
+
* The date and time in GMT when the Message was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
159
|
+
*/
|
|
160
|
+
dateUpdated: Date;
|
|
161
|
+
/**
|
|
162
|
+
* Provide a user-friendly representation
|
|
163
|
+
*
|
|
164
|
+
* @returns Object
|
|
165
|
+
*/
|
|
166
|
+
toJSON(): {
|
|
167
|
+
id: string;
|
|
168
|
+
accountSid: string;
|
|
169
|
+
assistantId: string;
|
|
170
|
+
sessionId: string;
|
|
171
|
+
identity: string;
|
|
172
|
+
role: string;
|
|
173
|
+
content: Record<string, object>;
|
|
174
|
+
meta: Record<string, object>;
|
|
175
|
+
dateCreated: Date;
|
|
176
|
+
dateUpdated: Date;
|
|
177
|
+
};
|
|
178
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
179
|
+
}
|
|
180
|
+
export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> {
|
|
181
|
+
/**
|
|
182
|
+
* Initialize the MessagePage
|
|
183
|
+
*
|
|
184
|
+
* @param version - Version of the resource
|
|
185
|
+
* @param response - Response from the API
|
|
186
|
+
* @param solution - Path solution
|
|
187
|
+
*/
|
|
188
|
+
constructor(version: V1, response: Response<string>, solution: MessageSolution);
|
|
189
|
+
/**
|
|
190
|
+
* Build an instance of MessageInstance
|
|
191
|
+
*
|
|
192
|
+
* @param payload - Payload response from the API
|
|
193
|
+
*/
|
|
194
|
+
getInstance(payload: MessageResource): MessageInstance;
|
|
195
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
196
|
+
}
|
|
197
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Assistants
|
|
9
|
+
* This is the public Twilio REST API.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator.
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.MessagePage = exports.MessageInstance = exports.MessageListInstance = void 0;
|
|
20
|
+
const util_1 = require("util");
|
|
21
|
+
const Page_1 = __importDefault(require("../../../../base/Page"));
|
|
22
|
+
const deserialize = require("../../../../base/deserialize");
|
|
23
|
+
const serialize = require("../../../../base/serialize");
|
|
24
|
+
const utility_1 = require("../../../../base/utility");
|
|
25
|
+
function MessageListInstance(version, sessionId) {
|
|
26
|
+
if (!(0, utility_1.isValidPathParam)(sessionId)) {
|
|
27
|
+
throw new Error("Parameter 'sessionId' is not valid.");
|
|
28
|
+
}
|
|
29
|
+
const instance = {};
|
|
30
|
+
instance._version = version;
|
|
31
|
+
instance._solution = { sessionId };
|
|
32
|
+
instance._uri = `/Sessions/${sessionId}/Messages`;
|
|
33
|
+
instance.page = function page(params, callback) {
|
|
34
|
+
if (params instanceof Function) {
|
|
35
|
+
callback = params;
|
|
36
|
+
params = {};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
params = params || {};
|
|
40
|
+
}
|
|
41
|
+
let data = {};
|
|
42
|
+
if (params["pageSize"] !== undefined)
|
|
43
|
+
data["PageSize"] = params["pageSize"];
|
|
44
|
+
if (params.pageNumber !== undefined)
|
|
45
|
+
data["Page"] = params.pageNumber;
|
|
46
|
+
if (params.pageToken !== undefined)
|
|
47
|
+
data["PageToken"] = params.pageToken;
|
|
48
|
+
const headers = {};
|
|
49
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
50
|
+
uri: instance._uri,
|
|
51
|
+
method: "get",
|
|
52
|
+
params: data,
|
|
53
|
+
headers,
|
|
54
|
+
});
|
|
55
|
+
operationPromise = operationPromise.then((payload) => new MessagePage(operationVersion, payload, instance._solution));
|
|
56
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
57
|
+
return operationPromise;
|
|
58
|
+
};
|
|
59
|
+
instance.each = instance._version.each;
|
|
60
|
+
instance.list = instance._version.list;
|
|
61
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
62
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
63
|
+
method: "get",
|
|
64
|
+
uri: targetUrl,
|
|
65
|
+
});
|
|
66
|
+
let pagePromise = operationPromise.then((payload) => new MessagePage(instance._version, payload, instance._solution));
|
|
67
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
68
|
+
return pagePromise;
|
|
69
|
+
};
|
|
70
|
+
instance.toJSON = function toJSON() {
|
|
71
|
+
return instance._solution;
|
|
72
|
+
};
|
|
73
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
74
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
75
|
+
};
|
|
76
|
+
return instance;
|
|
77
|
+
}
|
|
78
|
+
exports.MessageListInstance = MessageListInstance;
|
|
79
|
+
class MessageInstance {
|
|
80
|
+
constructor(_version, payload, sessionId) {
|
|
81
|
+
this._version = _version;
|
|
82
|
+
this.id = payload.id;
|
|
83
|
+
this.accountSid = payload.account_sid;
|
|
84
|
+
this.assistantId = payload.assistant_id;
|
|
85
|
+
this.sessionId = payload.session_id;
|
|
86
|
+
this.identity = payload.identity;
|
|
87
|
+
this.role = payload.role;
|
|
88
|
+
this.content = payload.content;
|
|
89
|
+
this.meta = payload.meta;
|
|
90
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
|
91
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Provide a user-friendly representation
|
|
95
|
+
*
|
|
96
|
+
* @returns Object
|
|
97
|
+
*/
|
|
98
|
+
toJSON() {
|
|
99
|
+
return {
|
|
100
|
+
id: this.id,
|
|
101
|
+
accountSid: this.accountSid,
|
|
102
|
+
assistantId: this.assistantId,
|
|
103
|
+
sessionId: this.sessionId,
|
|
104
|
+
identity: this.identity,
|
|
105
|
+
role: this.role,
|
|
106
|
+
content: this.content,
|
|
107
|
+
meta: this.meta,
|
|
108
|
+
dateCreated: this.dateCreated,
|
|
109
|
+
dateUpdated: this.dateUpdated,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
[util_1.inspect.custom](_depth, options) {
|
|
113
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.MessageInstance = MessageInstance;
|
|
117
|
+
class MessagePage extends Page_1.default {
|
|
118
|
+
/**
|
|
119
|
+
* Initialize the MessagePage
|
|
120
|
+
*
|
|
121
|
+
* @param version - Version of the resource
|
|
122
|
+
* @param response - Response from the API
|
|
123
|
+
* @param solution - Path solution
|
|
124
|
+
*/
|
|
125
|
+
constructor(version, response, solution) {
|
|
126
|
+
super(version, response, solution);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Build an instance of MessageInstance
|
|
130
|
+
*
|
|
131
|
+
* @param payload - Payload response from the API
|
|
132
|
+
*/
|
|
133
|
+
getInstance(payload) {
|
|
134
|
+
return new MessageInstance(this._version, payload, this._solution.sessionId);
|
|
135
|
+
}
|
|
136
|
+
[util_1.inspect.custom](depth, options) {
|
|
137
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.MessagePage = MessagePage;
|