twilio 6.0.0 → 6.0.2
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/ConversationsBase.d.ts +3 -0
- package/lib/rest/ConversationsBase.js +5 -0
- package/lib/rest/InsightsBase.d.ts +3 -0
- package/lib/rest/InsightsBase.js +5 -0
- package/lib/rest/IntelligenceBase.d.ts +3 -0
- package/lib/rest/IntelligenceBase.js +5 -0
- package/lib/rest/KnowledgeBase.d.ts +3 -0
- package/lib/rest/KnowledgeBase.js +5 -0
- package/lib/rest/Memory.d.ts +4 -0
- package/lib/rest/Memory.js +8 -0
- package/lib/rest/MemoryBase.d.ts +13 -0
- package/lib/rest/MemoryBase.js +31 -0
- package/lib/rest/Twilio.d.ts +5 -0
- package/lib/rest/Twilio.js +5 -0
- package/lib/rest/VoiceBase.d.ts +3 -0
- package/lib/rest/VoiceBase.js +5 -0
- package/lib/rest/api/v2010/account/call/recording.d.ts +2 -0
- package/lib/rest/api/v2010/account/call/recording.js +4 -0
- package/lib/rest/api/v2010/account/call/transcription.d.ts +1 -1
- package/lib/rest/api/v2010/account/call/transcription.js +6 -4
- package/lib/rest/api/v2010/account/call.d.ts +2 -0
- package/lib/rest/api/v2010/account/call.js +4 -0
- package/lib/rest/api/v2010/account/conference/participant.d.ts +2 -0
- package/lib/rest/api/v2010/account/conference/participant.js +4 -0
- package/lib/rest/conversations/V2.d.ts +38 -0
- package/lib/rest/conversations/V2.js +72 -0
- package/lib/rest/conversations/v2/action.d.ts +241 -0
- package/lib/rest/conversations/v2/action.js +246 -0
- package/lib/rest/conversations/v2/communication.d.ts +479 -0
- package/lib/rest/conversations/v2/communication.js +436 -0
- package/lib/rest/conversations/v2/configuration.d.ts +906 -0
- package/lib/rest/conversations/v2/configuration.js +619 -0
- package/lib/rest/conversations/v2/conversation.d.ts +936 -0
- package/lib/rest/conversations/v2/conversation.js +664 -0
- package/lib/rest/conversations/v2/operation.d.ts +167 -0
- package/lib/rest/conversations/v2/operation.js +170 -0
- package/lib/rest/conversations/v2/participant.d.ts +469 -0
- package/lib/rest/conversations/v2/participant.js +442 -0
- package/lib/rest/flexApi/v1/plugin/pluginVersions.d.ts +1 -1
- package/lib/rest/flexApi/v1/plugin/pluginVersions.js +8 -6
- package/lib/rest/insights/V3.d.ts +20 -0
- package/lib/rest/insights/V3.js +42 -0
- package/lib/rest/insights/v1/call/callSummary.d.ts +10 -10
- package/lib/rest/insights/v1/call/event.d.ts +4 -4
- package/lib/rest/insights/v1/callSummaries.d.ts +12 -9
- package/lib/rest/insights/v3/metadata.d.ts +115 -0
- package/lib/rest/insights/v3/metadata.js +118 -0
- package/lib/rest/insights/v3/query.d.ts +180 -0
- package/lib/rest/insights/v3/query.js +214 -0
- package/lib/rest/intelligence/V3.d.ts +35 -0
- package/lib/rest/intelligence/V3.js +65 -0
- package/lib/rest/intelligence/v3/configuration.d.ts +693 -0
- package/lib/rest/intelligence/v3/configuration.js +528 -0
- package/lib/rest/intelligence/v3/conversation.d.ts +478 -0
- package/lib/rest/intelligence/v3/conversation.js +342 -0
- package/lib/rest/intelligence/v3/operator.d.ts +619 -0
- package/lib/rest/intelligence/v3/operator.js +493 -0
- package/lib/rest/intelligence/v3/operatorResult.d.ts +543 -0
- package/lib/rest/intelligence/v3/operatorResult.js +478 -0
- package/lib/rest/intelligence/v3/version.d.ts +469 -0
- package/lib/rest/intelligence/v3/version.js +341 -0
- package/lib/rest/knowledge/V2.d.ts +31 -0
- package/lib/rest/knowledge/V2.js +62 -0
- package/lib/rest/knowledge/v2/chunk.d.ts +209 -0
- package/lib/rest/knowledge/v2/chunk.js +178 -0
- package/lib/rest/knowledge/v2/knowledge.d.ts +507 -0
- package/lib/rest/knowledge/v2/knowledge.js +466 -0
- package/lib/rest/knowledge/v2/knowledgeBasis.d.ts +484 -0
- package/lib/rest/knowledge/v2/knowledgeBasis.js +441 -0
- package/lib/rest/knowledge/v2/operation.d.ts +162 -0
- package/lib/rest/knowledge/v2/operation.js +175 -0
- package/lib/rest/knowledge/v2/search.d.ts +180 -0
- package/lib/rest/knowledge/v2/search.js +174 -0
- package/lib/rest/memory/V1.d.ts +76 -0
- package/lib/rest/memory/V1.js +140 -0
- package/lib/rest/memory/v1/bulk.d.ts +129 -0
- package/lib/rest/memory/v1/bulk.js +158 -0
- package/lib/rest/memory/v1/conversationSummary.d.ts +531 -0
- package/lib/rest/memory/v1/conversationSummary.js +473 -0
- package/lib/rest/memory/v1/dataMapping.d.ts +630 -0
- package/lib/rest/memory/v1/dataMapping.js +512 -0
- package/lib/rest/memory/v1/event.d.ts +153 -0
- package/lib/rest/memory/v1/event.js +159 -0
- package/lib/rest/memory/v1/identifier.d.ts +362 -0
- package/lib/rest/memory/v1/identifier.js +369 -0
- package/lib/rest/memory/v1/identityResolutionSetting.d.ts +247 -0
- package/lib/rest/memory/v1/identityResolutionSetting.js +229 -0
- package/lib/rest/memory/v1/import.d.ts +292 -0
- package/lib/rest/memory/v1/import.js +280 -0
- package/lib/rest/memory/v1/lookup.d.ts +82 -0
- package/lib/rest/memory/v1/lookup.js +118 -0
- package/lib/rest/memory/v1/observation.d.ts +521 -0
- package/lib/rest/memory/v1/observation.js +477 -0
- package/lib/rest/memory/v1/operation.d.ts +162 -0
- package/lib/rest/memory/v1/operation.js +175 -0
- package/lib/rest/memory/v1/profile.d.ts +548 -0
- package/lib/rest/memory/v1/profile.js +531 -0
- package/lib/rest/memory/v1/recall.d.ts +306 -0
- package/lib/rest/memory/v1/recall.js +234 -0
- package/lib/rest/memory/v1/revision.d.ts +246 -0
- package/lib/rest/memory/v1/revision.js +195 -0
- package/lib/rest/memory/v1/store.d.ts +544 -0
- package/lib/rest/memory/v1/store.js +534 -0
- package/lib/rest/memory/v1/trait.d.ts +233 -0
- package/lib/rest/memory/v1/trait.js +190 -0
- package/lib/rest/memory/v1/traitGroup.d.ts +758 -0
- package/lib/rest/memory/v1/traitGroup.js +555 -0
- package/lib/rest/messaging/v2/channelsSender.d.ts +8 -0
- package/lib/rest/messaging/v2/channelsSender.js +2 -0
- package/lib/rest/previewIam/versionless/organization/roleAssignment.d.ts +32 -0
- package/lib/rest/previewIam/versionless/organization/roleAssignment.js +14 -0
- package/lib/rest/studio/v2/flow.d.ts +4 -0
- package/lib/rest/studio/v2/flow.js +8 -0
- package/lib/rest/verify/v2/service/webhook.d.ts +2 -2
- package/lib/rest/verify/v2/service/webhook.js +8 -8
- package/lib/rest/voice/V3.d.ts +15 -0
- package/lib/rest/voice/V3.js +37 -0
- package/lib/rest/voice/v3/transcription.d.ts +378 -0
- package/lib/rest/voice/v3/transcription.js +264 -0
- package/lib/twiml/VoiceResponse.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { inspect, InspectOptions } from "util";
|
|
2
|
+
import TokenPage, { TokenPaginationPayload } from "../../../base/TokenPage";
|
|
3
|
+
import Response from "../../../http/response";
|
|
4
|
+
import V1 from "../V1";
|
|
5
|
+
import { ApiResponse } from "../../../base/ApiResponse";
|
|
6
|
+
/**
|
|
7
|
+
* Options to pass to each
|
|
8
|
+
*/
|
|
9
|
+
export interface TraitListInstanceEachOptions {
|
|
10
|
+
/** The maximum number of items to return per page, maximum of 1000. */
|
|
11
|
+
pageSize?: number;
|
|
12
|
+
/** The token for the page of results to retrieve. */
|
|
13
|
+
pageToken?: string;
|
|
14
|
+
/** Either \'ASC\' or \'DESC\' to sort results ascending or descending respectively. */
|
|
15
|
+
orderBy?: "ASC" | "DESC";
|
|
16
|
+
/** Comma separated list of trait group names to include. */
|
|
17
|
+
traitGroups?: string;
|
|
18
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
19
|
+
callback?: (item: TraitInstance, done: (err?: Error) => void) => void;
|
|
20
|
+
/** Function to be called upon completion of streaming */
|
|
21
|
+
done?: Function;
|
|
22
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options to pass to list
|
|
27
|
+
*/
|
|
28
|
+
export interface TraitListInstanceOptions {
|
|
29
|
+
/** The maximum number of items to return per page, maximum of 1000. */
|
|
30
|
+
pageSize?: number;
|
|
31
|
+
/** The token for the page of results to retrieve. */
|
|
32
|
+
pageToken?: string;
|
|
33
|
+
/** Either \'ASC\' or \'DESC\' to sort results ascending or descending respectively. */
|
|
34
|
+
orderBy?: "ASC" | "DESC";
|
|
35
|
+
/** Comma separated list of trait group names to include. */
|
|
36
|
+
traitGroups?: string;
|
|
37
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
38
|
+
limit?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options to pass to page
|
|
42
|
+
*/
|
|
43
|
+
export interface TraitListInstancePageOptions {
|
|
44
|
+
/** The maximum number of items to return per page, maximum of 1000. */
|
|
45
|
+
pageSize?: number;
|
|
46
|
+
/** The token for the page of results to retrieve. */
|
|
47
|
+
pageToken?: string;
|
|
48
|
+
/** Either \'ASC\' or \'DESC\' to sort results ascending or descending respectively. */
|
|
49
|
+
orderBy?: "ASC" | "DESC";
|
|
50
|
+
/** Comma separated list of trait group names to include. */
|
|
51
|
+
traitGroups?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface TraitSolution {
|
|
54
|
+
storeId: string;
|
|
55
|
+
profileId: string;
|
|
56
|
+
}
|
|
57
|
+
export interface TraitListInstance {
|
|
58
|
+
_version: V1;
|
|
59
|
+
_solution: TraitSolution;
|
|
60
|
+
_uri: string;
|
|
61
|
+
/**
|
|
62
|
+
* Streams TraitInstance records from the API.
|
|
63
|
+
*
|
|
64
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
65
|
+
* is reached.
|
|
66
|
+
*
|
|
67
|
+
* The results are passed into the callback function, so this operation is memory
|
|
68
|
+
* efficient.
|
|
69
|
+
*
|
|
70
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
71
|
+
* function.
|
|
72
|
+
*
|
|
73
|
+
* @param { TraitListInstanceEachOptions } [params] - Options for request
|
|
74
|
+
* @param { function } [callback] - Function to process each record
|
|
75
|
+
*/
|
|
76
|
+
each(callback?: (item: TraitInstance, done: (err?: Error) => void) => void): void;
|
|
77
|
+
each(params: TraitListInstanceEachOptions, callback?: (item: TraitInstance, done: (err?: Error) => void) => void): void;
|
|
78
|
+
/**
|
|
79
|
+
* Streams TraitInstance records from the API with HTTP metadata captured per page.
|
|
80
|
+
*
|
|
81
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
82
|
+
* is reached. HTTP metadata (status code, headers) is captured for each page request.
|
|
83
|
+
*
|
|
84
|
+
* The results are passed into the callback function, so this operation is memory
|
|
85
|
+
* efficient.
|
|
86
|
+
*
|
|
87
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
88
|
+
* function.
|
|
89
|
+
*
|
|
90
|
+
* @param { TraitListInstanceEachOptions } [params] - Options for request
|
|
91
|
+
* @param { function } [callback] - Function to process each record
|
|
92
|
+
*/
|
|
93
|
+
eachWithHttpInfo(callback?: (item: TraitInstance, done: (err?: Error) => void) => void): void;
|
|
94
|
+
eachWithHttpInfo(params: TraitListInstanceEachOptions, callback?: (item: TraitInstance, done: (err?: Error) => void) => void): void;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieve a single target page of TraitInstance records from the API.
|
|
97
|
+
*
|
|
98
|
+
* The request is executed immediately.
|
|
99
|
+
*
|
|
100
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
101
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
102
|
+
*/
|
|
103
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: TraitPage) => any): Promise<TraitPage>;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieve a single target page of TraitInstance records from the API with HTTP metadata.
|
|
106
|
+
*
|
|
107
|
+
* The request is executed immediately.
|
|
108
|
+
*
|
|
109
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
110
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
111
|
+
*/
|
|
112
|
+
getPageWithHttpInfo(targetUrl: string, callback?: (error: Error | null, items: ApiResponse<TraitPage>) => any): Promise<ApiResponse<TraitPage>>;
|
|
113
|
+
/**
|
|
114
|
+
* Lists TraitInstance records from the API as a list.
|
|
115
|
+
*
|
|
116
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
117
|
+
* function.
|
|
118
|
+
*
|
|
119
|
+
* @param { TraitListInstanceOptions } [params] - Options for request
|
|
120
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
121
|
+
*/
|
|
122
|
+
list(callback?: (error: Error | null, items: TraitInstance[]) => any): Promise<TraitInstance[]>;
|
|
123
|
+
list(params: TraitListInstanceOptions, callback?: (error: Error | null, items: TraitInstance[]) => any): Promise<TraitInstance[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Lists TraitInstance records from the API as a list with HTTP metadata.
|
|
126
|
+
*
|
|
127
|
+
* Returns all records along with HTTP metadata from the first page fetched.
|
|
128
|
+
*
|
|
129
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
130
|
+
* function.
|
|
131
|
+
*
|
|
132
|
+
* @param { TraitListInstanceOptions } [params] - Options for request
|
|
133
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
134
|
+
*/
|
|
135
|
+
listWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TraitInstance[]>) => any): Promise<ApiResponse<TraitInstance[]>>;
|
|
136
|
+
listWithHttpInfo(params: TraitListInstanceOptions, callback?: (error: Error | null, items: ApiResponse<TraitInstance[]>) => any): Promise<ApiResponse<TraitInstance[]>>;
|
|
137
|
+
/**
|
|
138
|
+
* Retrieve a single page of TraitInstance records from the API.
|
|
139
|
+
*
|
|
140
|
+
* The request is executed immediately.
|
|
141
|
+
*
|
|
142
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
143
|
+
* function.
|
|
144
|
+
*
|
|
145
|
+
* @param { TraitListInstancePageOptions } [params] - Options for request
|
|
146
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
147
|
+
*/
|
|
148
|
+
page(callback?: (error: Error | null, items: TraitPage) => any): Promise<TraitPage>;
|
|
149
|
+
page(params: TraitListInstancePageOptions, callback?: (error: Error | null, items: TraitPage) => any): Promise<TraitPage>;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieve a single page of TraitInstance records from the API with HTTP metadata.
|
|
152
|
+
*
|
|
153
|
+
* The request is executed immediately.
|
|
154
|
+
*
|
|
155
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
156
|
+
* function.
|
|
157
|
+
*
|
|
158
|
+
* @param { TraitListInstancePageOptions } [params] - Options for request
|
|
159
|
+
* @param { function } [callback] - Callback to handle list of records with metadata
|
|
160
|
+
*/
|
|
161
|
+
pageWithHttpInfo(callback?: (error: Error | null, items: ApiResponse<TraitPage>) => any): Promise<ApiResponse<TraitPage>>;
|
|
162
|
+
pageWithHttpInfo(params: TraitListInstancePageOptions, callback?: (error: Error | null, items: ApiResponse<TraitPage>) => any): Promise<ApiResponse<TraitPage>>;
|
|
163
|
+
/**
|
|
164
|
+
* Provide a user-friendly representation
|
|
165
|
+
*/
|
|
166
|
+
toJSON(): any;
|
|
167
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
168
|
+
}
|
|
169
|
+
export declare function TraitListInstance(version: V1, storeId: string, profileId: string): TraitListInstance;
|
|
170
|
+
interface TraitPayload extends TokenPaginationPayload {
|
|
171
|
+
traits: TraitResource[];
|
|
172
|
+
}
|
|
173
|
+
interface TraitResource {
|
|
174
|
+
name: string;
|
|
175
|
+
value: any;
|
|
176
|
+
traitGroup: string;
|
|
177
|
+
timestamp: Date;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Full metadata about a trait, beyond the name value pair.
|
|
181
|
+
*/
|
|
182
|
+
export declare class TraitInstance {
|
|
183
|
+
protected _version: V1;
|
|
184
|
+
constructor(_version: V1, _payload: TraitResource, storeId: string, profileId: string);
|
|
185
|
+
/**
|
|
186
|
+
* The name of the trait.
|
|
187
|
+
*/
|
|
188
|
+
name: string;
|
|
189
|
+
/**
|
|
190
|
+
* The value of a trait. Can be a string, integer, boolean, or an array of these types (arrays cannot contain nested arrays).
|
|
191
|
+
*/
|
|
192
|
+
value: any;
|
|
193
|
+
/**
|
|
194
|
+
* The trait group name to which this trait belongs.
|
|
195
|
+
*/
|
|
196
|
+
traitGroup: string;
|
|
197
|
+
/**
|
|
198
|
+
* The time the trait was created or last updated.
|
|
199
|
+
*/
|
|
200
|
+
timestamp: Date;
|
|
201
|
+
/**
|
|
202
|
+
* Provide a user-friendly representation
|
|
203
|
+
*
|
|
204
|
+
* @returns Object
|
|
205
|
+
*/
|
|
206
|
+
toJSON(): {
|
|
207
|
+
name: string;
|
|
208
|
+
value: any;
|
|
209
|
+
traitGroup: string;
|
|
210
|
+
timestamp: Date;
|
|
211
|
+
};
|
|
212
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
213
|
+
}
|
|
214
|
+
export declare class TraitPage extends TokenPage<V1, TraitPayload, TraitResource, TraitInstance> {
|
|
215
|
+
/**
|
|
216
|
+
* Initialize the TraitPage
|
|
217
|
+
*
|
|
218
|
+
* @param version - Version of the resource
|
|
219
|
+
* @param response - Response from the API
|
|
220
|
+
* @param uri - URI of the resource
|
|
221
|
+
* @param params - Query parameters
|
|
222
|
+
* @param solution - Path solution
|
|
223
|
+
*/
|
|
224
|
+
constructor(version: V1, response: Response<string>, uri: string, params: any, solution: TraitSolution);
|
|
225
|
+
/**
|
|
226
|
+
* Build an instance of TraitInstance
|
|
227
|
+
*
|
|
228
|
+
* @param payload - Payload response from the API
|
|
229
|
+
*/
|
|
230
|
+
getInstance(payload: TraitResource): TraitInstance;
|
|
231
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
232
|
+
}
|
|
233
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio Memory API
|
|
9
|
+
* APIs for managing memory stores, profiles, events, and conversational intelligence capabilities.
|
|
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.TraitPage = exports.TraitInstance = void 0;
|
|
20
|
+
exports.TraitListInstance = TraitListInstance;
|
|
21
|
+
const util_1 = require("util");
|
|
22
|
+
const TokenPage_1 = __importDefault(require("../../../base/TokenPage"));
|
|
23
|
+
const deserialize = require("../../../base/deserialize");
|
|
24
|
+
const serialize = require("../../../base/serialize");
|
|
25
|
+
const utility_1 = require("../../../base/utility");
|
|
26
|
+
function TraitListInstance(version, storeId, profileId) {
|
|
27
|
+
if (!(0, utility_1.isValidPathParam)(storeId)) {
|
|
28
|
+
throw new Error("Parameter 'storeId' is not valid.");
|
|
29
|
+
}
|
|
30
|
+
if (!(0, utility_1.isValidPathParam)(profileId)) {
|
|
31
|
+
throw new Error("Parameter 'profileId' is not valid.");
|
|
32
|
+
}
|
|
33
|
+
const instance = {};
|
|
34
|
+
instance._version = version;
|
|
35
|
+
instance._solution = { storeId, profileId };
|
|
36
|
+
instance._uri = `/Stores/${storeId}/Profiles/${profileId}/Traits`;
|
|
37
|
+
instance.page = function page(params, callback) {
|
|
38
|
+
if (params instanceof Function) {
|
|
39
|
+
callback = params;
|
|
40
|
+
params = {};
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
params = params || {};
|
|
44
|
+
}
|
|
45
|
+
let data = {};
|
|
46
|
+
if (params["pageSize"] !== undefined)
|
|
47
|
+
data["pageSize"] = params["pageSize"];
|
|
48
|
+
if (params["pageToken"] !== undefined)
|
|
49
|
+
data["pageToken"] = params["pageToken"];
|
|
50
|
+
if (params["orderBy"] !== undefined)
|
|
51
|
+
data["orderBy"] = params["orderBy"];
|
|
52
|
+
if (params["traitGroups"] !== undefined)
|
|
53
|
+
data["traitGroups"] = params["traitGroups"];
|
|
54
|
+
const headers = {};
|
|
55
|
+
headers["Accept"] = "application/json";
|
|
56
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
57
|
+
uri: instance._uri,
|
|
58
|
+
method: "get",
|
|
59
|
+
params: data,
|
|
60
|
+
headers,
|
|
61
|
+
});
|
|
62
|
+
operationPromise = operationPromise.then((payload) => new TraitPage(operationVersion, payload, instance._uri, data, instance._solution));
|
|
63
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
64
|
+
return operationPromise;
|
|
65
|
+
};
|
|
66
|
+
instance.each = instance._version.each;
|
|
67
|
+
instance.list = instance._version.list;
|
|
68
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
69
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
70
|
+
method: "get",
|
|
71
|
+
uri: targetUrl,
|
|
72
|
+
});
|
|
73
|
+
let pagePromise = operationPromise.then((payload) => new TraitPage(instance._version, payload, instance._uri, {}, instance._solution));
|
|
74
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
75
|
+
return pagePromise;
|
|
76
|
+
};
|
|
77
|
+
instance.pageWithHttpInfo = function pageWithHttpInfo(params, callback) {
|
|
78
|
+
if (params instanceof Function) {
|
|
79
|
+
callback = params;
|
|
80
|
+
params = {};
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
params = params || {};
|
|
84
|
+
}
|
|
85
|
+
let data = {};
|
|
86
|
+
if (params["pageSize"] !== undefined)
|
|
87
|
+
data["pageSize"] = params["pageSize"];
|
|
88
|
+
if (params["pageToken"] !== undefined)
|
|
89
|
+
data["pageToken"] = params["pageToken"];
|
|
90
|
+
if (params["orderBy"] !== undefined)
|
|
91
|
+
data["orderBy"] = params["orderBy"];
|
|
92
|
+
if (params["traitGroups"] !== undefined)
|
|
93
|
+
data["traitGroups"] = params["traitGroups"];
|
|
94
|
+
const headers = {};
|
|
95
|
+
headers["Accept"] = "application/json";
|
|
96
|
+
let operationVersion = version;
|
|
97
|
+
// For page operations, use page() directly as it already returns { statusCode, body, headers }
|
|
98
|
+
// IMPORTANT: Pass full response to Page constructor, not response.body
|
|
99
|
+
let operationPromise = operationVersion
|
|
100
|
+
.page({ uri: instance._uri, method: "get", params: data, headers })
|
|
101
|
+
.then((response) => ({
|
|
102
|
+
statusCode: response.statusCode,
|
|
103
|
+
headers: response.headers,
|
|
104
|
+
body: new TraitPage(operationVersion, response, instance._uri, data, instance._solution),
|
|
105
|
+
}));
|
|
106
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
107
|
+
return operationPromise;
|
|
108
|
+
};
|
|
109
|
+
instance.each = instance._version.each;
|
|
110
|
+
instance.eachWithHttpInfo = instance._version.eachWithHttpInfo;
|
|
111
|
+
instance.list = instance._version.list;
|
|
112
|
+
instance.listWithHttpInfo = instance._version.listWithHttpInfo;
|
|
113
|
+
instance.getPageWithHttpInfo = function getPageWithHttpInfo(targetUrl, callback) {
|
|
114
|
+
// Use request() directly as it already returns { statusCode, body, headers }
|
|
115
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
116
|
+
method: "get",
|
|
117
|
+
uri: targetUrl,
|
|
118
|
+
});
|
|
119
|
+
let pagePromise = operationPromise.then((response) => ({
|
|
120
|
+
statusCode: response.statusCode,
|
|
121
|
+
headers: response.headers,
|
|
122
|
+
body: new TraitPage(instance._version, response, instance._uri, {}, instance._solution),
|
|
123
|
+
}));
|
|
124
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
125
|
+
return pagePromise;
|
|
126
|
+
};
|
|
127
|
+
instance.toJSON = function toJSON() {
|
|
128
|
+
return instance._solution;
|
|
129
|
+
};
|
|
130
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
131
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
132
|
+
};
|
|
133
|
+
return instance;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Full metadata about a trait, beyond the name value pair.
|
|
137
|
+
*/
|
|
138
|
+
class TraitInstance {
|
|
139
|
+
constructor(_version, _payload, storeId, profileId) {
|
|
140
|
+
this._version = _version;
|
|
141
|
+
const payload = _payload;
|
|
142
|
+
this.name = payload.name;
|
|
143
|
+
this.value = payload.value;
|
|
144
|
+
this.traitGroup = payload.traitGroup;
|
|
145
|
+
this.timestamp = deserialize.iso8601DateTime(payload.timestamp);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Provide a user-friendly representation
|
|
149
|
+
*
|
|
150
|
+
* @returns Object
|
|
151
|
+
*/
|
|
152
|
+
toJSON() {
|
|
153
|
+
return {
|
|
154
|
+
name: this.name,
|
|
155
|
+
value: this.value,
|
|
156
|
+
traitGroup: this.traitGroup,
|
|
157
|
+
timestamp: this.timestamp,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
[util_1.inspect.custom](_depth, options) {
|
|
161
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.TraitInstance = TraitInstance;
|
|
165
|
+
class TraitPage extends TokenPage_1.default {
|
|
166
|
+
/**
|
|
167
|
+
* Initialize the TraitPage
|
|
168
|
+
*
|
|
169
|
+
* @param version - Version of the resource
|
|
170
|
+
* @param response - Response from the API
|
|
171
|
+
* @param uri - URI of the resource
|
|
172
|
+
* @param params - Query parameters
|
|
173
|
+
* @param solution - Path solution
|
|
174
|
+
*/
|
|
175
|
+
constructor(version, response, uri, params, solution) {
|
|
176
|
+
super(version, response, uri, params, solution);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Build an instance of TraitInstance
|
|
180
|
+
*
|
|
181
|
+
* @param payload - Payload response from the API
|
|
182
|
+
*/
|
|
183
|
+
getInstance(payload) {
|
|
184
|
+
return new TraitInstance(this._version, payload, this._solution.storeId, this._solution.profileId);
|
|
185
|
+
}
|
|
186
|
+
[util_1.inspect.custom](depth, options) {
|
|
187
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.TraitPage = TraitPage;
|