twilio 4.11.2 → 4.13.0
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/base/BaseTwilio.js +15 -8
- package/lib/rest/api/v2010/account/message.d.ts +2 -2
- package/lib/rest/api/v2010/account/message.js +2 -2
- package/lib/rest/insights/v1/call/annotation.d.ts +9 -9
- package/lib/rest/insights/v1/call/callSummary.d.ts +58 -1
- package/lib/rest/insights/v1/call/event.d.ts +30 -3
- package/lib/rest/insights/v1/call/metric.d.ts +27 -6
- package/lib/rest/insights/v1/callSummaries.d.ts +135 -78
- package/lib/rest/insights/v1/callSummaries.js +8 -6
- package/lib/rest/insights/v1/setting.d.ts +16 -4
- package/lib/rest/lookups/v2/phoneNumber.d.ts +9 -1
- package/lib/rest/lookups/v2/phoneNumber.js +4 -0
- package/lib/rest/numbers/V1.d.ts +10 -0
- package/lib/rest/numbers/V1.js +15 -0
- package/lib/rest/numbers/V2.d.ts +10 -0
- package/lib/rest/numbers/V2.js +14 -0
- package/lib/rest/numbers/v1/portingBulkPortability.d.ts +120 -0
- package/lib/rest/numbers/v1/portingBulkPortability.js +136 -0
- package/lib/rest/numbers/v1/portingPortability.d.ts +134 -0
- package/lib/rest/numbers/v1/portingPortability.js +124 -0
- package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.d.ts +265 -0
- package/lib/rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.js +164 -0
- package/lib/rest/numbers/v2/authorizationDocument.d.ts +288 -0
- package/lib/rest/numbers/v2/authorizationDocument.js +257 -0
- package/lib/rest/numbers/v2/hostedNumberOrder.d.ts +390 -0
- package/lib/rest/numbers/v2/hostedNumberOrder.js +296 -0
- package/lib/rest/taskrouter/v1/workspace/worker.d.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,390 @@
|
|
|
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 V2 from "../V2";
|
|
6
|
+
import { PhoneNumberCapabilities } from "../../../interfaces";
|
|
7
|
+
export type HostedNumberOrderStatus = "received" | "verified" | "pending-loa" | "carrier-processing" | "completed" | "failed" | "action-required";
|
|
8
|
+
/**
|
|
9
|
+
* Options to pass to create a HostedNumberOrderInstance
|
|
10
|
+
*/
|
|
11
|
+
export interface HostedNumberOrderListInstanceCreateOptions {
|
|
12
|
+
/** The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format */
|
|
13
|
+
phoneNumber: string;
|
|
14
|
+
/** The contact phone number of the person authorized to sign the Authorization Document. */
|
|
15
|
+
contactPhoneNumber: string;
|
|
16
|
+
/** Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */
|
|
17
|
+
addressSid: string;
|
|
18
|
+
/** Optional. Email of the owner of this phone number that is being hosted. */
|
|
19
|
+
email: string;
|
|
20
|
+
/** This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. */
|
|
21
|
+
accountSid?: string;
|
|
22
|
+
/** A 64 character string that is a human readable text that describes this resource. */
|
|
23
|
+
friendlyName?: string;
|
|
24
|
+
/** Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. */
|
|
25
|
+
ccEmails?: Array<string>;
|
|
26
|
+
/** The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. */
|
|
27
|
+
smsUrl?: string;
|
|
28
|
+
/** The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */
|
|
29
|
+
smsMethod?: string;
|
|
30
|
+
/** A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. */
|
|
31
|
+
smsFallbackUrl?: string;
|
|
32
|
+
/** Used to specify that the SMS capability will be hosted on Twilio\\\'s platform. */
|
|
33
|
+
smsCapability?: boolean;
|
|
34
|
+
/** The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */
|
|
35
|
+
smsFallbackMethod?: string;
|
|
36
|
+
/** Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. */
|
|
37
|
+
statusCallbackUrl?: string;
|
|
38
|
+
/** Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. */
|
|
39
|
+
statusCallbackMethod?: string;
|
|
40
|
+
/** Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. */
|
|
41
|
+
smsApplicationSid?: string;
|
|
42
|
+
/** The title of the person authorized to sign the Authorization Document for this phone number. */
|
|
43
|
+
contactTitle?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options to pass to each
|
|
47
|
+
*/
|
|
48
|
+
export interface HostedNumberOrderListInstanceEachOptions {
|
|
49
|
+
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
|
|
50
|
+
status?: HostedNumberOrderStatus;
|
|
51
|
+
/** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */
|
|
52
|
+
smsCapability?: boolean;
|
|
53
|
+
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
|
|
54
|
+
phoneNumber?: string;
|
|
55
|
+
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
|
|
56
|
+
incomingPhoneNumberSid?: string;
|
|
57
|
+
/** A human readable description of this resource, up to 64 characters. */
|
|
58
|
+
friendlyName?: string;
|
|
59
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
60
|
+
pageSize?: number;
|
|
61
|
+
/** Function to process each record. If this and a positional callback are passed, this one will be used */
|
|
62
|
+
callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void;
|
|
63
|
+
/** Function to be called upon completion of streaming */
|
|
64
|
+
done?: Function;
|
|
65
|
+
/** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
|
|
66
|
+
limit?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Options to pass to list
|
|
70
|
+
*/
|
|
71
|
+
export interface HostedNumberOrderListInstanceOptions {
|
|
72
|
+
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
|
|
73
|
+
status?: HostedNumberOrderStatus;
|
|
74
|
+
/** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */
|
|
75
|
+
smsCapability?: boolean;
|
|
76
|
+
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
|
|
77
|
+
phoneNumber?: string;
|
|
78
|
+
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
|
|
79
|
+
incomingPhoneNumberSid?: string;
|
|
80
|
+
/** A human readable description of this resource, up to 64 characters. */
|
|
81
|
+
friendlyName?: string;
|
|
82
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
83
|
+
pageSize?: number;
|
|
84
|
+
/** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
|
|
85
|
+
limit?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options to pass to page
|
|
89
|
+
*/
|
|
90
|
+
export interface HostedNumberOrderListInstancePageOptions {
|
|
91
|
+
/** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */
|
|
92
|
+
status?: HostedNumberOrderStatus;
|
|
93
|
+
/** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */
|
|
94
|
+
smsCapability?: boolean;
|
|
95
|
+
/** An E164 formatted phone number hosted by this HostedNumberOrder. */
|
|
96
|
+
phoneNumber?: string;
|
|
97
|
+
/** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */
|
|
98
|
+
incomingPhoneNumberSid?: string;
|
|
99
|
+
/** A human readable description of this resource, up to 64 characters. */
|
|
100
|
+
friendlyName?: string;
|
|
101
|
+
/** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
|
|
102
|
+
pageSize?: number;
|
|
103
|
+
/** Page Number, this value is simply for client state */
|
|
104
|
+
pageNumber?: number;
|
|
105
|
+
/** PageToken provided by the API */
|
|
106
|
+
pageToken?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface HostedNumberOrderContext {
|
|
109
|
+
/**
|
|
110
|
+
* Remove a HostedNumberOrderInstance
|
|
111
|
+
*
|
|
112
|
+
* @param callback - Callback to handle processed record
|
|
113
|
+
*
|
|
114
|
+
* @returns Resolves to processed boolean
|
|
115
|
+
*/
|
|
116
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
117
|
+
/**
|
|
118
|
+
* Fetch a HostedNumberOrderInstance
|
|
119
|
+
*
|
|
120
|
+
* @param callback - Callback to handle processed record
|
|
121
|
+
*
|
|
122
|
+
* @returns Resolves to processed HostedNumberOrderInstance
|
|
123
|
+
*/
|
|
124
|
+
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
|
|
125
|
+
/**
|
|
126
|
+
* Provide a user-friendly representation
|
|
127
|
+
*/
|
|
128
|
+
toJSON(): any;
|
|
129
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
130
|
+
}
|
|
131
|
+
export interface HostedNumberOrderContextSolution {
|
|
132
|
+
sid: string;
|
|
133
|
+
}
|
|
134
|
+
export declare class HostedNumberOrderContextImpl implements HostedNumberOrderContext {
|
|
135
|
+
protected _version: V2;
|
|
136
|
+
protected _solution: HostedNumberOrderContextSolution;
|
|
137
|
+
protected _uri: string;
|
|
138
|
+
constructor(_version: V2, sid: string);
|
|
139
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
140
|
+
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
|
|
141
|
+
/**
|
|
142
|
+
* Provide a user-friendly representation
|
|
143
|
+
*
|
|
144
|
+
* @returns Object
|
|
145
|
+
*/
|
|
146
|
+
toJSON(): HostedNumberOrderContextSolution;
|
|
147
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
148
|
+
}
|
|
149
|
+
interface HostedNumberOrderPayload extends TwilioResponsePayload {
|
|
150
|
+
items: HostedNumberOrderResource[];
|
|
151
|
+
}
|
|
152
|
+
interface HostedNumberOrderResource {
|
|
153
|
+
sid: string;
|
|
154
|
+
account_sid: string;
|
|
155
|
+
incoming_phone_number_sid: string;
|
|
156
|
+
address_sid: string;
|
|
157
|
+
signing_document_sid: string;
|
|
158
|
+
phone_number: string;
|
|
159
|
+
capabilities: PhoneNumberCapabilities;
|
|
160
|
+
friendly_name: string;
|
|
161
|
+
status: HostedNumberOrderStatus;
|
|
162
|
+
failure_reason: string;
|
|
163
|
+
date_created: Date;
|
|
164
|
+
sms_capability: boolean;
|
|
165
|
+
date_updated: Date;
|
|
166
|
+
email: string;
|
|
167
|
+
cc_emails: Array<string>;
|
|
168
|
+
url: string;
|
|
169
|
+
contact_title: string;
|
|
170
|
+
contact_phone_number: string;
|
|
171
|
+
bulk_hosting_request_sid: string;
|
|
172
|
+
next_step: string;
|
|
173
|
+
}
|
|
174
|
+
export declare class HostedNumberOrderInstance {
|
|
175
|
+
protected _version: V2;
|
|
176
|
+
protected _solution: HostedNumberOrderContextSolution;
|
|
177
|
+
protected _context?: HostedNumberOrderContext;
|
|
178
|
+
constructor(_version: V2, payload: HostedNumberOrderResource, sid?: string);
|
|
179
|
+
/**
|
|
180
|
+
* A 34 character string that uniquely identifies this HostedNumberOrder.
|
|
181
|
+
*/
|
|
182
|
+
sid: string;
|
|
183
|
+
/**
|
|
184
|
+
* A 34 character string that uniquely identifies the account.
|
|
185
|
+
*/
|
|
186
|
+
accountSid: string;
|
|
187
|
+
/**
|
|
188
|
+
* A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/api/rest/incoming-phone-numbers) resource that represents the phone number being hosted.
|
|
189
|
+
*/
|
|
190
|
+
incomingPhoneNumberSid: string;
|
|
191
|
+
/**
|
|
192
|
+
* A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
|
193
|
+
*/
|
|
194
|
+
addressSid: string;
|
|
195
|
+
/**
|
|
196
|
+
* A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents) the user needs to sign.
|
|
197
|
+
*/
|
|
198
|
+
signingDocumentSid: string;
|
|
199
|
+
/**
|
|
200
|
+
* Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212
|
|
201
|
+
*/
|
|
202
|
+
phoneNumber: string;
|
|
203
|
+
capabilities: PhoneNumberCapabilities;
|
|
204
|
+
/**
|
|
205
|
+
* A 64 character string that is a human-readable text that describes this resource.
|
|
206
|
+
*/
|
|
207
|
+
friendlyName: string;
|
|
208
|
+
status: HostedNumberOrderStatus;
|
|
209
|
+
/**
|
|
210
|
+
* A message that explains why a hosted_number_order went to status \"action-required\"
|
|
211
|
+
*/
|
|
212
|
+
failureReason: string;
|
|
213
|
+
/**
|
|
214
|
+
* The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
|
215
|
+
*/
|
|
216
|
+
dateCreated: Date;
|
|
217
|
+
/**
|
|
218
|
+
* Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
|
219
|
+
*/
|
|
220
|
+
smsCapability: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
|
223
|
+
*/
|
|
224
|
+
dateUpdated: Date;
|
|
225
|
+
/**
|
|
226
|
+
* Email of the owner of this phone number that is being hosted.
|
|
227
|
+
*/
|
|
228
|
+
email: string;
|
|
229
|
+
/**
|
|
230
|
+
* A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.
|
|
231
|
+
*/
|
|
232
|
+
ccEmails: Array<string>;
|
|
233
|
+
/**
|
|
234
|
+
* The URL of this HostedNumberOrder.
|
|
235
|
+
*/
|
|
236
|
+
url: string;
|
|
237
|
+
/**
|
|
238
|
+
* The title of the person authorized to sign the Authorization Document for this phone number.
|
|
239
|
+
*/
|
|
240
|
+
contactTitle: string;
|
|
241
|
+
/**
|
|
242
|
+
* The contact phone number of the person authorized to sign the Authorization Document.
|
|
243
|
+
*/
|
|
244
|
+
contactPhoneNumber: string;
|
|
245
|
+
/**
|
|
246
|
+
* A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder.
|
|
247
|
+
*/
|
|
248
|
+
bulkHostingRequestSid: string;
|
|
249
|
+
/**
|
|
250
|
+
* The next step you need to take to complete the hosted number order and request it successfully.
|
|
251
|
+
*/
|
|
252
|
+
nextStep: string;
|
|
253
|
+
private get _proxy();
|
|
254
|
+
/**
|
|
255
|
+
* Remove a HostedNumberOrderInstance
|
|
256
|
+
*
|
|
257
|
+
* @param callback - Callback to handle processed record
|
|
258
|
+
*
|
|
259
|
+
* @returns Resolves to processed boolean
|
|
260
|
+
*/
|
|
261
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
262
|
+
/**
|
|
263
|
+
* Fetch a HostedNumberOrderInstance
|
|
264
|
+
*
|
|
265
|
+
* @param callback - Callback to handle processed record
|
|
266
|
+
*
|
|
267
|
+
* @returns Resolves to processed HostedNumberOrderInstance
|
|
268
|
+
*/
|
|
269
|
+
fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
|
|
270
|
+
/**
|
|
271
|
+
* Provide a user-friendly representation
|
|
272
|
+
*
|
|
273
|
+
* @returns Object
|
|
274
|
+
*/
|
|
275
|
+
toJSON(): {
|
|
276
|
+
sid: string;
|
|
277
|
+
accountSid: string;
|
|
278
|
+
incomingPhoneNumberSid: string;
|
|
279
|
+
addressSid: string;
|
|
280
|
+
signingDocumentSid: string;
|
|
281
|
+
phoneNumber: string;
|
|
282
|
+
capabilities: PhoneNumberCapabilities;
|
|
283
|
+
friendlyName: string;
|
|
284
|
+
status: HostedNumberOrderStatus;
|
|
285
|
+
failureReason: string;
|
|
286
|
+
dateCreated: Date;
|
|
287
|
+
smsCapability: boolean;
|
|
288
|
+
dateUpdated: Date;
|
|
289
|
+
email: string;
|
|
290
|
+
ccEmails: string[];
|
|
291
|
+
url: string;
|
|
292
|
+
contactTitle: string;
|
|
293
|
+
contactPhoneNumber: string;
|
|
294
|
+
bulkHostingRequestSid: string;
|
|
295
|
+
nextStep: string;
|
|
296
|
+
};
|
|
297
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
298
|
+
}
|
|
299
|
+
export interface HostedNumberOrderSolution {
|
|
300
|
+
}
|
|
301
|
+
export interface HostedNumberOrderListInstance {
|
|
302
|
+
_version: V2;
|
|
303
|
+
_solution: HostedNumberOrderSolution;
|
|
304
|
+
_uri: string;
|
|
305
|
+
(sid: string): HostedNumberOrderContext;
|
|
306
|
+
get(sid: string): HostedNumberOrderContext;
|
|
307
|
+
/**
|
|
308
|
+
* Create a HostedNumberOrderInstance
|
|
309
|
+
*
|
|
310
|
+
* @param params - Parameter for request
|
|
311
|
+
* @param callback - Callback to handle processed record
|
|
312
|
+
*
|
|
313
|
+
* @returns Resolves to processed HostedNumberOrderInstance
|
|
314
|
+
*/
|
|
315
|
+
create(params: HostedNumberOrderListInstanceCreateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>;
|
|
316
|
+
/**
|
|
317
|
+
* Streams HostedNumberOrderInstance records from the API.
|
|
318
|
+
*
|
|
319
|
+
* This operation lazily loads records as efficiently as possible until the limit
|
|
320
|
+
* is reached.
|
|
321
|
+
*
|
|
322
|
+
* The results are passed into the callback function, so this operation is memory
|
|
323
|
+
* efficient.
|
|
324
|
+
*
|
|
325
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
326
|
+
* function.
|
|
327
|
+
*
|
|
328
|
+
* @param { HostedNumberOrderListInstanceEachOptions } [params] - Options for request
|
|
329
|
+
* @param { function } [callback] - Function to process each record
|
|
330
|
+
*/
|
|
331
|
+
each(callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
|
|
332
|
+
each(params: HostedNumberOrderListInstanceEachOptions, callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void;
|
|
333
|
+
/**
|
|
334
|
+
* Retrieve a single target page of HostedNumberOrderInstance records from the API.
|
|
335
|
+
*
|
|
336
|
+
* The request is executed immediately.
|
|
337
|
+
*
|
|
338
|
+
* @param { string } [targetUrl] - API-generated URL for the requested results page
|
|
339
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
340
|
+
*/
|
|
341
|
+
getPage(targetUrl: string, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
|
|
342
|
+
/**
|
|
343
|
+
* Lists HostedNumberOrderInstance records from the API as a list.
|
|
344
|
+
*
|
|
345
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
346
|
+
* function.
|
|
347
|
+
*
|
|
348
|
+
* @param { HostedNumberOrderListInstanceOptions } [params] - Options for request
|
|
349
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
350
|
+
*/
|
|
351
|
+
list(callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>;
|
|
352
|
+
list(params: HostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>;
|
|
353
|
+
/**
|
|
354
|
+
* Retrieve a single page of HostedNumberOrderInstance records from the API.
|
|
355
|
+
*
|
|
356
|
+
* The request is executed immediately.
|
|
357
|
+
*
|
|
358
|
+
* If a function is passed as the first argument, it will be used as the callback
|
|
359
|
+
* function.
|
|
360
|
+
*
|
|
361
|
+
* @param { HostedNumberOrderListInstancePageOptions } [params] - Options for request
|
|
362
|
+
* @param { function } [callback] - Callback to handle list of records
|
|
363
|
+
*/
|
|
364
|
+
page(callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
|
|
365
|
+
page(params: HostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>;
|
|
366
|
+
/**
|
|
367
|
+
* Provide a user-friendly representation
|
|
368
|
+
*/
|
|
369
|
+
toJSON(): any;
|
|
370
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
371
|
+
}
|
|
372
|
+
export declare function HostedNumberOrderListInstance(version: V2): HostedNumberOrderListInstance;
|
|
373
|
+
export declare class HostedNumberOrderPage extends Page<V2, HostedNumberOrderPayload, HostedNumberOrderResource, HostedNumberOrderInstance> {
|
|
374
|
+
/**
|
|
375
|
+
* Initialize the HostedNumberOrderPage
|
|
376
|
+
*
|
|
377
|
+
* @param version - Version of the resource
|
|
378
|
+
* @param response - Response from the API
|
|
379
|
+
* @param solution - Path solution
|
|
380
|
+
*/
|
|
381
|
+
constructor(version: V2, response: Response<string>, solution: HostedNumberOrderSolution);
|
|
382
|
+
/**
|
|
383
|
+
* Build an instance of HostedNumberOrderInstance
|
|
384
|
+
*
|
|
385
|
+
* @param payload - Payload response from the API
|
|
386
|
+
*/
|
|
387
|
+
getInstance(payload: HostedNumberOrderResource): HostedNumberOrderInstance;
|
|
388
|
+
[inspect.custom](depth: any, options: InspectOptions): string;
|
|
389
|
+
}
|
|
390
|
+
export {};
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Numbers
|
|
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.HostedNumberOrderPage = exports.HostedNumberOrderListInstance = exports.HostedNumberOrderInstance = exports.HostedNumberOrderContextImpl = 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
|
+
class HostedNumberOrderContextImpl {
|
|
26
|
+
constructor(_version, sid) {
|
|
27
|
+
this._version = _version;
|
|
28
|
+
if (!(0, utility_1.isValidPathParam)(sid)) {
|
|
29
|
+
throw new Error("Parameter 'sid' is not valid.");
|
|
30
|
+
}
|
|
31
|
+
this._solution = { sid };
|
|
32
|
+
this._uri = `/HostedNumber/Orders/${sid}`;
|
|
33
|
+
}
|
|
34
|
+
remove(callback) {
|
|
35
|
+
const instance = this;
|
|
36
|
+
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
|
37
|
+
uri: instance._uri,
|
|
38
|
+
method: "delete",
|
|
39
|
+
});
|
|
40
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
41
|
+
return operationPromise;
|
|
42
|
+
}
|
|
43
|
+
fetch(callback) {
|
|
44
|
+
const instance = this;
|
|
45
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
46
|
+
uri: instance._uri,
|
|
47
|
+
method: "get",
|
|
48
|
+
});
|
|
49
|
+
operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid));
|
|
50
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
51
|
+
return operationPromise;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Provide a user-friendly representation
|
|
55
|
+
*
|
|
56
|
+
* @returns Object
|
|
57
|
+
*/
|
|
58
|
+
toJSON() {
|
|
59
|
+
return this._solution;
|
|
60
|
+
}
|
|
61
|
+
[util_1.inspect.custom](_depth, options) {
|
|
62
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.HostedNumberOrderContextImpl = HostedNumberOrderContextImpl;
|
|
66
|
+
class HostedNumberOrderInstance {
|
|
67
|
+
constructor(_version, payload, sid) {
|
|
68
|
+
this._version = _version;
|
|
69
|
+
this.sid = payload.sid;
|
|
70
|
+
this.accountSid = payload.account_sid;
|
|
71
|
+
this.incomingPhoneNumberSid = payload.incoming_phone_number_sid;
|
|
72
|
+
this.addressSid = payload.address_sid;
|
|
73
|
+
this.signingDocumentSid = payload.signing_document_sid;
|
|
74
|
+
this.phoneNumber = payload.phone_number;
|
|
75
|
+
this.capabilities = payload.capabilities;
|
|
76
|
+
this.friendlyName = payload.friendly_name;
|
|
77
|
+
this.status = payload.status;
|
|
78
|
+
this.failureReason = payload.failure_reason;
|
|
79
|
+
this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
|
|
80
|
+
this.smsCapability = payload.sms_capability;
|
|
81
|
+
this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
|
|
82
|
+
this.email = payload.email;
|
|
83
|
+
this.ccEmails = payload.cc_emails;
|
|
84
|
+
this.url = payload.url;
|
|
85
|
+
this.contactTitle = payload.contact_title;
|
|
86
|
+
this.contactPhoneNumber = payload.contact_phone_number;
|
|
87
|
+
this.bulkHostingRequestSid = payload.bulk_hosting_request_sid;
|
|
88
|
+
this.nextStep = payload.next_step;
|
|
89
|
+
this._solution = { sid: sid || this.sid };
|
|
90
|
+
}
|
|
91
|
+
get _proxy() {
|
|
92
|
+
this._context =
|
|
93
|
+
this._context ||
|
|
94
|
+
new HostedNumberOrderContextImpl(this._version, this._solution.sid);
|
|
95
|
+
return this._context;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Remove a HostedNumberOrderInstance
|
|
99
|
+
*
|
|
100
|
+
* @param callback - Callback to handle processed record
|
|
101
|
+
*
|
|
102
|
+
* @returns Resolves to processed boolean
|
|
103
|
+
*/
|
|
104
|
+
remove(callback) {
|
|
105
|
+
return this._proxy.remove(callback);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fetch a HostedNumberOrderInstance
|
|
109
|
+
*
|
|
110
|
+
* @param callback - Callback to handle processed record
|
|
111
|
+
*
|
|
112
|
+
* @returns Resolves to processed HostedNumberOrderInstance
|
|
113
|
+
*/
|
|
114
|
+
fetch(callback) {
|
|
115
|
+
return this._proxy.fetch(callback);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Provide a user-friendly representation
|
|
119
|
+
*
|
|
120
|
+
* @returns Object
|
|
121
|
+
*/
|
|
122
|
+
toJSON() {
|
|
123
|
+
return {
|
|
124
|
+
sid: this.sid,
|
|
125
|
+
accountSid: this.accountSid,
|
|
126
|
+
incomingPhoneNumberSid: this.incomingPhoneNumberSid,
|
|
127
|
+
addressSid: this.addressSid,
|
|
128
|
+
signingDocumentSid: this.signingDocumentSid,
|
|
129
|
+
phoneNumber: this.phoneNumber,
|
|
130
|
+
capabilities: this.capabilities,
|
|
131
|
+
friendlyName: this.friendlyName,
|
|
132
|
+
status: this.status,
|
|
133
|
+
failureReason: this.failureReason,
|
|
134
|
+
dateCreated: this.dateCreated,
|
|
135
|
+
smsCapability: this.smsCapability,
|
|
136
|
+
dateUpdated: this.dateUpdated,
|
|
137
|
+
email: this.email,
|
|
138
|
+
ccEmails: this.ccEmails,
|
|
139
|
+
url: this.url,
|
|
140
|
+
contactTitle: this.contactTitle,
|
|
141
|
+
contactPhoneNumber: this.contactPhoneNumber,
|
|
142
|
+
bulkHostingRequestSid: this.bulkHostingRequestSid,
|
|
143
|
+
nextStep: this.nextStep,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
[util_1.inspect.custom](_depth, options) {
|
|
147
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.HostedNumberOrderInstance = HostedNumberOrderInstance;
|
|
151
|
+
function HostedNumberOrderListInstance(version) {
|
|
152
|
+
const instance = ((sid) => instance.get(sid));
|
|
153
|
+
instance.get = function get(sid) {
|
|
154
|
+
return new HostedNumberOrderContextImpl(version, sid);
|
|
155
|
+
};
|
|
156
|
+
instance._version = version;
|
|
157
|
+
instance._solution = {};
|
|
158
|
+
instance._uri = `/HostedNumber/Orders`;
|
|
159
|
+
instance.create = function create(params, callback) {
|
|
160
|
+
if (params === null || params === undefined) {
|
|
161
|
+
throw new Error('Required parameter "params" missing.');
|
|
162
|
+
}
|
|
163
|
+
if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) {
|
|
164
|
+
throw new Error("Required parameter \"params['phoneNumber']\" missing.");
|
|
165
|
+
}
|
|
166
|
+
if (params["contactPhoneNumber"] === null ||
|
|
167
|
+
params["contactPhoneNumber"] === undefined) {
|
|
168
|
+
throw new Error("Required parameter \"params['contactPhoneNumber']\" missing.");
|
|
169
|
+
}
|
|
170
|
+
if (params["addressSid"] === null || params["addressSid"] === undefined) {
|
|
171
|
+
throw new Error("Required parameter \"params['addressSid']\" missing.");
|
|
172
|
+
}
|
|
173
|
+
if (params["email"] === null || params["email"] === undefined) {
|
|
174
|
+
throw new Error("Required parameter \"params['email']\" missing.");
|
|
175
|
+
}
|
|
176
|
+
let data = {};
|
|
177
|
+
data["PhoneNumber"] = params["phoneNumber"];
|
|
178
|
+
data["ContactPhoneNumber"] = params["contactPhoneNumber"];
|
|
179
|
+
data["AddressSid"] = params["addressSid"];
|
|
180
|
+
data["Email"] = params["email"];
|
|
181
|
+
if (params["accountSid"] !== undefined)
|
|
182
|
+
data["AccountSid"] = params["accountSid"];
|
|
183
|
+
if (params["friendlyName"] !== undefined)
|
|
184
|
+
data["FriendlyName"] = params["friendlyName"];
|
|
185
|
+
if (params["ccEmails"] !== undefined)
|
|
186
|
+
data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e);
|
|
187
|
+
if (params["smsUrl"] !== undefined)
|
|
188
|
+
data["SmsUrl"] = params["smsUrl"];
|
|
189
|
+
if (params["smsMethod"] !== undefined)
|
|
190
|
+
data["SmsMethod"] = params["smsMethod"];
|
|
191
|
+
if (params["smsFallbackUrl"] !== undefined)
|
|
192
|
+
data["SmsFallbackUrl"] = params["smsFallbackUrl"];
|
|
193
|
+
if (params["smsCapability"] !== undefined)
|
|
194
|
+
data["SmsCapability"] = serialize.bool(params["smsCapability"]);
|
|
195
|
+
if (params["smsFallbackMethod"] !== undefined)
|
|
196
|
+
data["SmsFallbackMethod"] = params["smsFallbackMethod"];
|
|
197
|
+
if (params["statusCallbackUrl"] !== undefined)
|
|
198
|
+
data["StatusCallbackUrl"] = params["statusCallbackUrl"];
|
|
199
|
+
if (params["statusCallbackMethod"] !== undefined)
|
|
200
|
+
data["StatusCallbackMethod"] = params["statusCallbackMethod"];
|
|
201
|
+
if (params["smsApplicationSid"] !== undefined)
|
|
202
|
+
data["SmsApplicationSid"] = params["smsApplicationSid"];
|
|
203
|
+
if (params["contactTitle"] !== undefined)
|
|
204
|
+
data["ContactTitle"] = params["contactTitle"];
|
|
205
|
+
const headers = {};
|
|
206
|
+
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
207
|
+
let operationVersion = version, operationPromise = operationVersion.create({
|
|
208
|
+
uri: instance._uri,
|
|
209
|
+
method: "post",
|
|
210
|
+
data,
|
|
211
|
+
headers,
|
|
212
|
+
});
|
|
213
|
+
operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload));
|
|
214
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
215
|
+
return operationPromise;
|
|
216
|
+
};
|
|
217
|
+
instance.page = function page(params, callback) {
|
|
218
|
+
if (params instanceof Function) {
|
|
219
|
+
callback = params;
|
|
220
|
+
params = {};
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
params = params || {};
|
|
224
|
+
}
|
|
225
|
+
let data = {};
|
|
226
|
+
if (params["status"] !== undefined)
|
|
227
|
+
data["Status"] = params["status"];
|
|
228
|
+
if (params["smsCapability"] !== undefined)
|
|
229
|
+
data["SmsCapability"] = serialize.bool(params["smsCapability"]);
|
|
230
|
+
if (params["phoneNumber"] !== undefined)
|
|
231
|
+
data["PhoneNumber"] = params["phoneNumber"];
|
|
232
|
+
if (params["incomingPhoneNumberSid"] !== undefined)
|
|
233
|
+
data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"];
|
|
234
|
+
if (params["friendlyName"] !== undefined)
|
|
235
|
+
data["FriendlyName"] = params["friendlyName"];
|
|
236
|
+
if (params["pageSize"] !== undefined)
|
|
237
|
+
data["PageSize"] = params["pageSize"];
|
|
238
|
+
if (params.pageNumber !== undefined)
|
|
239
|
+
data["Page"] = params.pageNumber;
|
|
240
|
+
if (params.pageToken !== undefined)
|
|
241
|
+
data["PageToken"] = params.pageToken;
|
|
242
|
+
const headers = {};
|
|
243
|
+
let operationVersion = version, operationPromise = operationVersion.page({
|
|
244
|
+
uri: instance._uri,
|
|
245
|
+
method: "get",
|
|
246
|
+
params: data,
|
|
247
|
+
headers,
|
|
248
|
+
});
|
|
249
|
+
operationPromise = operationPromise.then((payload) => new HostedNumberOrderPage(operationVersion, payload, instance._solution));
|
|
250
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
251
|
+
return operationPromise;
|
|
252
|
+
};
|
|
253
|
+
instance.each = instance._version.each;
|
|
254
|
+
instance.list = instance._version.list;
|
|
255
|
+
instance.getPage = function getPage(targetUrl, callback) {
|
|
256
|
+
const operationPromise = instance._version._domain.twilio.request({
|
|
257
|
+
method: "get",
|
|
258
|
+
uri: targetUrl,
|
|
259
|
+
});
|
|
260
|
+
let pagePromise = operationPromise.then((payload) => new HostedNumberOrderPage(instance._version, payload, instance._solution));
|
|
261
|
+
pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
|
|
262
|
+
return pagePromise;
|
|
263
|
+
};
|
|
264
|
+
instance.toJSON = function toJSON() {
|
|
265
|
+
return instance._solution;
|
|
266
|
+
};
|
|
267
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
268
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
269
|
+
};
|
|
270
|
+
return instance;
|
|
271
|
+
}
|
|
272
|
+
exports.HostedNumberOrderListInstance = HostedNumberOrderListInstance;
|
|
273
|
+
class HostedNumberOrderPage extends Page_1.default {
|
|
274
|
+
/**
|
|
275
|
+
* Initialize the HostedNumberOrderPage
|
|
276
|
+
*
|
|
277
|
+
* @param version - Version of the resource
|
|
278
|
+
* @param response - Response from the API
|
|
279
|
+
* @param solution - Path solution
|
|
280
|
+
*/
|
|
281
|
+
constructor(version, response, solution) {
|
|
282
|
+
super(version, response, solution);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Build an instance of HostedNumberOrderInstance
|
|
286
|
+
*
|
|
287
|
+
* @param payload - Payload response from the API
|
|
288
|
+
*/
|
|
289
|
+
getInstance(payload) {
|
|
290
|
+
return new HostedNumberOrderInstance(this._version, payload);
|
|
291
|
+
}
|
|
292
|
+
[util_1.inspect.custom](depth, options) {
|
|
293
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
exports.HostedNumberOrderPage = HostedNumberOrderPage;
|