twilio 5.0.3 → 5.1.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.
Files changed (79) hide show
  1. package/README.md +1 -0
  2. package/lib/rest/ContentBase.d.ts +3 -0
  3. package/lib/rest/ContentBase.js +5 -0
  4. package/lib/rest/Twilio.d.ts +0 -5
  5. package/lib/rest/Twilio.js +0 -6
  6. package/lib/rest/api/v2010/account/call/stream.d.ts +5 -5
  7. package/lib/rest/api/v2010/account/message.d.ts +1 -1
  8. package/lib/rest/content/V2.d.ts +20 -0
  9. package/lib/rest/content/V2.js +43 -0
  10. package/lib/rest/content/v2/content.d.ts +196 -0
  11. package/lib/rest/content/v2/content.js +136 -0
  12. package/lib/rest/content/v2/contentAndApprovals.d.ts +190 -0
  13. package/lib/rest/content/v2/contentAndApprovals.js +134 -0
  14. package/lib/rest/flexApi/V2.d.ts +5 -0
  15. package/lib/rest/flexApi/V2.js +6 -0
  16. package/lib/rest/flexApi/v1/interaction.d.ts +1 -1
  17. package/lib/rest/flexApi/v1/interaction.js +2 -4
  18. package/lib/rest/flexApi/v1/plugin/pluginVersions.d.ts +4 -1
  19. package/lib/rest/flexApi/v1/plugin/pluginVersions.js +2 -0
  20. package/lib/rest/flexApi/v2/flexUser.d.ts +170 -0
  21. package/lib/rest/flexApi/v2/flexUser.js +142 -0
  22. package/lib/rest/flexApi/v2/webChannels.d.ts +2 -0
  23. package/lib/rest/flexApi/v2/webChannels.js +2 -0
  24. package/lib/rest/intelligence/V2.d.ts +30 -0
  25. package/lib/rest/intelligence/V2.js +40 -0
  26. package/lib/rest/intelligence/v2/customOperator.d.ts +330 -0
  27. package/lib/rest/intelligence/v2/customOperator.js +279 -0
  28. package/lib/rest/intelligence/v2/operator.d.ts +263 -0
  29. package/lib/rest/intelligence/v2/operator.js +197 -0
  30. package/lib/rest/intelligence/v2/operatorAttachment.d.ts +112 -0
  31. package/lib/rest/intelligence/v2/operatorAttachment.js +135 -0
  32. package/lib/rest/intelligence/v2/operatorAttachments.d.ts +94 -0
  33. package/lib/rest/intelligence/v2/operatorAttachments.js +110 -0
  34. package/lib/rest/intelligence/v2/operatorType.d.ts +259 -0
  35. package/lib/rest/intelligence/v2/operatorType.js +197 -0
  36. package/lib/rest/intelligence/v2/prebuiltOperator.d.ts +263 -0
  37. package/lib/rest/intelligence/v2/prebuiltOperator.js +197 -0
  38. package/lib/rest/intelligence/v2/service.d.ts +8 -4
  39. package/lib/rest/intelligence/v2/service.js +3 -2
  40. package/lib/rest/messaging/v1/service.d.ts +0 -6
  41. package/lib/rest/messaging/v1/service.js +0 -2
  42. package/lib/rest/numbers/V1.d.ts +20 -10
  43. package/lib/rest/numbers/V1.js +31 -14
  44. package/lib/rest/numbers/v1/portingPortIn.d.ts +133 -14
  45. package/lib/rest/numbers/v1/portingPortIn.js +116 -24
  46. package/lib/rest/numbers/v1/portingPortInPhoneNumber.d.ts +175 -0
  47. package/lib/rest/numbers/v1/portingPortInPhoneNumber.js +157 -0
  48. package/lib/rest/numbers/v1/portingWebhookConfiguration.d.ts +79 -0
  49. package/lib/rest/{previewMessaging/v1/broadcast.js → numbers/v1/portingWebhookConfiguration.js} +19 -32
  50. package/lib/rest/numbers/v1/portingWebhookConfigurationDelete.d.ts +51 -0
  51. package/lib/rest/numbers/v1/portingWebhookConfigurationDelete.js +68 -0
  52. package/lib/rest/numbers/v1/portingWebhookConfigurationFetch.d.ts +75 -0
  53. package/lib/rest/numbers/v1/portingWebhookConfigurationFetch.js +72 -0
  54. package/lib/rest/taskrouter/v1/workspace/task.d.ts +24 -0
  55. package/lib/rest/taskrouter/v1/workspace/task.js +12 -0
  56. package/lib/rest/trusthub/v1/complianceTollfreeInquiries.d.ts +2 -0
  57. package/lib/rest/trusthub/v1/complianceTollfreeInquiries.js +2 -0
  58. package/lib/rest/trusthub/v1/customerProfiles.d.ts +6 -0
  59. package/lib/rest/trusthub/v1/customerProfiles.js +2 -0
  60. package/lib/rest/trusthub/v1/trustProducts.d.ts +6 -0
  61. package/lib/rest/trusthub/v1/trustProducts.js +2 -0
  62. package/lib/rest/verify/v2/service/verification.d.ts +1 -1
  63. package/lib/rest/verify/v2/service/verificationCheck.d.ts +1 -1
  64. package/lib/rest/verify/v2/service.d.ts +1 -1
  65. package/lib/webhooks/webhooks.js +9 -11
  66. package/package.json +4 -6
  67. package/lib/rest/PreviewMessaging.d.ts +0 -9
  68. package/lib/rest/PreviewMessaging.js +0 -15
  69. package/lib/rest/PreviewMessagingBase.d.ts +0 -13
  70. package/lib/rest/PreviewMessagingBase.js +0 -31
  71. package/lib/rest/numbers/v1/portingBulkPortability.d.ts +0 -120
  72. package/lib/rest/numbers/v1/portingBulkPortability.js +0 -136
  73. package/lib/rest/numbers/v1/portingPortInFetch.d.ts +0 -142
  74. package/lib/rest/numbers/v1/portingPortInFetch.js +0 -128
  75. package/lib/rest/previewMessaging/V1.d.ts +0 -20
  76. package/lib/rest/previewMessaging/V1.js +0 -42
  77. package/lib/rest/previewMessaging/v1/broadcast.d.ts +0 -108
  78. package/lib/rest/previewMessaging/v1/message.d.ts +0 -178
  79. package/lib/rest/previewMessaging/v1/message.js +0 -91
@@ -147,6 +147,8 @@ class TaskInstance {
147
147
  this.url = payload.url;
148
148
  this.links = payload.links;
149
149
  this.virtualStartTime = deserialize.iso8601DateTime(payload.virtual_start_time);
150
+ this.ignoreCapacity = payload.ignore_capacity;
151
+ this.routingTarget = payload.routing_target;
150
152
  this._solution = { workspaceSid, sid: sid || this.sid };
151
153
  }
152
154
  get _proxy() {
@@ -206,6 +208,8 @@ class TaskInstance {
206
208
  url: this.url,
207
209
  links: this.links,
208
210
  virtualStartTime: this.virtualStartTime,
211
+ ignoreCapacity: this.ignoreCapacity,
212
+ routingTarget: this.routingTarget,
209
213
  };
210
214
  }
211
215
  [util_1.inspect.custom](_depth, options) {
@@ -245,6 +249,12 @@ function TaskListInstance(version, workspaceSid) {
245
249
  data["Attributes"] = params["attributes"];
246
250
  if (params["virtualStartTime"] !== undefined)
247
251
  data["VirtualStartTime"] = serialize.iso8601DateTime(params["virtualStartTime"]);
252
+ if (params["routingTarget"] !== undefined)
253
+ data["RoutingTarget"] = params["routingTarget"];
254
+ if (params["ignoreCapacity"] !== undefined)
255
+ data["IgnoreCapacity"] = params["ignoreCapacity"];
256
+ if (params["taskQueueSid"] !== undefined)
257
+ data["TaskQueueSid"] = params["taskQueueSid"];
248
258
  const headers = {};
249
259
  headers["Content-Type"] = "application/x-www-form-urlencoded";
250
260
  let operationVersion = version, operationPromise = operationVersion.create({
@@ -280,6 +290,8 @@ function TaskListInstance(version, workspaceSid) {
280
290
  data["TaskQueueName"] = params["taskQueueName"];
281
291
  if (params["evaluateTaskAttributes"] !== undefined)
282
292
  data["EvaluateTaskAttributes"] = params["evaluateTaskAttributes"];
293
+ if (params["routingTarget"] !== undefined)
294
+ data["RoutingTarget"] = params["routingTarget"];
283
295
  if (params["ordering"] !== undefined)
284
296
  data["Ordering"] = params["ordering"];
285
297
  if (params["hasAddons"] !== undefined)
@@ -48,6 +48,8 @@ export interface ComplianceTollfreeInquiriesListInstanceCreateOptions {
48
48
  businessContactEmail?: string;
49
49
  /** The phone number of the contact for the business or organization using the Tollfree number. */
50
50
  businessContactPhone?: string;
51
+ /** Theme id for styling the inquiry form. */
52
+ themeSetId?: string;
51
53
  }
52
54
  export interface ComplianceTollfreeInquiriesSolution {
53
55
  }
@@ -76,6 +76,8 @@ function ComplianceTollfreeInquiriesListInstance(version) {
76
76
  data["BusinessContactEmail"] = params["businessContactEmail"];
77
77
  if (params["businessContactPhone"] !== undefined)
78
78
  data["BusinessContactPhone"] = params["businessContactPhone"];
79
+ if (params["themeSetId"] !== undefined)
80
+ data["ThemeSetId"] = params["themeSetId"];
79
81
  const headers = {};
80
82
  headers["Content-Type"] = "application/x-www-form-urlencoded";
81
83
  let operationVersion = version, operationPromise = operationVersion.create({
@@ -168,6 +168,7 @@ interface CustomerProfilesResource {
168
168
  date_updated: Date;
169
169
  url: string;
170
170
  links: Record<string, string>;
171
+ errors: Array<any>;
171
172
  }
172
173
  export declare class CustomerProfilesInstance {
173
174
  protected _version: V1;
@@ -219,6 +220,10 @@ export declare class CustomerProfilesInstance {
219
220
  * The URLs of the Assigned Items of the Customer-Profile resource.
220
221
  */
221
222
  links: Record<string, string>;
223
+ /**
224
+ * The error codes associated with the rejection of the Customer-Profile.
225
+ */
226
+ errors: Array<any>;
222
227
  private get _proxy();
223
228
  /**
224
229
  * Remove a CustomerProfilesInstance
@@ -283,6 +288,7 @@ export declare class CustomerProfilesInstance {
283
288
  dateUpdated: Date;
284
289
  url: string;
285
290
  links: Record<string, string>;
291
+ errors: any[];
286
292
  };
287
293
  [inspect.custom](_depth: any, options: InspectOptions): string;
288
294
  }
@@ -129,6 +129,7 @@ class CustomerProfilesInstance {
129
129
  this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
130
130
  this.url = payload.url;
131
131
  this.links = payload.links;
132
+ this.errors = payload.errors;
132
133
  this._solution = { sid: sid || this.sid };
133
134
  }
134
135
  get _proxy() {
@@ -197,6 +198,7 @@ class CustomerProfilesInstance {
197
198
  dateUpdated: this.dateUpdated,
198
199
  url: this.url,
199
200
  links: this.links,
201
+ errors: this.errors,
200
202
  };
201
203
  }
202
204
  [util_1.inspect.custom](_depth, options) {
@@ -168,6 +168,7 @@ interface TrustProductsResource {
168
168
  date_updated: Date;
169
169
  url: string;
170
170
  links: Record<string, string>;
171
+ errors: Array<any>;
171
172
  }
172
173
  export declare class TrustProductsInstance {
173
174
  protected _version: V1;
@@ -219,6 +220,10 @@ export declare class TrustProductsInstance {
219
220
  * The URLs of the Assigned Items of the Trust Product resource.
220
221
  */
221
222
  links: Record<string, string>;
223
+ /**
224
+ * The error codes associated with the rejection of the Trust Product.
225
+ */
226
+ errors: Array<any>;
222
227
  private get _proxy();
223
228
  /**
224
229
  * Remove a TrustProductsInstance
@@ -283,6 +288,7 @@ export declare class TrustProductsInstance {
283
288
  dateUpdated: Date;
284
289
  url: string;
285
290
  links: Record<string, string>;
291
+ errors: any[];
286
292
  };
287
293
  [inspect.custom](_depth: any, options: InspectOptions): string;
288
294
  }
@@ -129,6 +129,7 @@ class TrustProductsInstance {
129
129
  this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
130
130
  this.url = payload.url;
131
131
  this.links = payload.links;
132
+ this.errors = payload.errors;
132
133
  this._solution = { sid: sid || this.sid };
133
134
  }
134
135
  get _proxy() {
@@ -197,6 +198,7 @@ class TrustProductsInstance {
197
198
  dateUpdated: this.dateUpdated,
198
199
  url: this.url,
199
200
  links: this.links,
201
+ errors: this.errors,
200
202
  };
201
203
  }
202
204
  [util_1.inspect.custom](_depth, options) {
@@ -133,7 +133,7 @@ export declare class VerificationInstance {
133
133
  to: string;
134
134
  channel: VerificationChannel;
135
135
  /**
136
- * The status of the verification. One of: `pending`, `approved`, or `canceled`
136
+ * The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`.
137
137
  */
138
138
  status: string;
139
139
  /**
@@ -83,7 +83,7 @@ export declare class VerificationCheckInstance {
83
83
  to: string;
84
84
  channel: VerificationCheckChannel;
85
85
  /**
86
- * The status of the verification. Can be: `pending`, `approved`, or `canceled`.
86
+ * The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`.
87
87
  */
88
88
  status: string;
89
89
  /**
@@ -252,7 +252,7 @@ export declare class ServiceInstance {
252
252
  */
253
253
  accountSid: string;
254
254
  /**
255
- * The string that you assigned to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.**
255
+ * The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. **This value should not contain PII.**
256
256
  */
257
257
  friendlyName: string;
258
258
  /**
@@ -7,7 +7,6 @@ exports.webhook = exports.validateExpressRequest = exports.validateIncomingReque
7
7
  const scmp = require("scmp");
8
8
  const crypto_1 = __importDefault(require("crypto"));
9
9
  const url_1 = __importDefault(require("url"));
10
- const url_parse_1 = __importDefault(require("url-parse"));
11
10
  /**
12
11
  * Utility function to construct the URL string, since Node.js url library won't include standard port numbers
13
12
  *
@@ -22,7 +21,7 @@ function buildUrlWithStandardPort(parsedUrl) {
22
21
  url += parsedUrl.password ? ":" + parsedUrl.password : "";
23
22
  url += parsedUrl.username || parsedUrl.password ? "@" : "";
24
23
  url += parsedUrl.host ? parsedUrl.host + port : "";
25
- url += parsedUrl.pathname + parsedUrl.query + parsedUrl.hash;
24
+ url += parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
26
25
  return url;
27
26
  }
28
27
  /**
@@ -44,7 +43,7 @@ function addPort(parsedUrl) {
44
43
  @returns URL without port
45
44
  */
46
45
  function removePort(parsedUrl) {
47
- parsedUrl.set("port", "");
46
+ parsedUrl.port = "";
48
47
  return parsedUrl.toString();
49
48
  }
50
49
  /**
@@ -108,7 +107,7 @@ exports.getExpectedBodyHash = getExpectedBodyHash;
108
107
  */
109
108
  function validateRequest(authToken, twilioHeader, url, params) {
110
109
  twilioHeader = twilioHeader || "";
111
- const urlObject = new url_parse_1.default(url);
110
+ const urlObject = new URL(url);
112
111
  const urlWithPort = addPort(urlObject);
113
112
  const urlWithoutPort = removePort(urlObject);
114
113
  /*
@@ -138,9 +137,9 @@ exports.validateBody = validateBody;
138
137
  @returns valid
139
138
  */
140
139
  function validateRequestWithBody(authToken, twilioHeader, url, body) {
141
- const urlObject = new url_parse_1.default(url, true);
140
+ const urlObject = new URL(url);
142
141
  return (validateRequest(authToken, twilioHeader, url, {}) &&
143
- validateBody(body, urlObject.query.bodySHA256 || ""));
142
+ validateBody(body, urlObject.searchParams.get("bodySHA256") || ""));
144
143
  }
145
144
  exports.validateRequestWithBody = validateRequestWithBody;
146
145
  /**
@@ -235,11 +234,10 @@ function webhook(opts, authToken) {
235
234
  options = authToken;
236
235
  }
237
236
  }
238
- if (!options) {
239
- options = {
240
- validate: true,
241
- };
242
- }
237
+ if (!options)
238
+ options = {};
239
+ if (options.validate == undefined)
240
+ options.validate = true;
243
241
  // Process arguments
244
242
  var tokenString;
245
243
  for (var i = 0, l = arguments.length; i < l; i++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "twilio",
3
3
  "description": "A Twilio helper library",
4
- "version": "5.0.3",
4
+ "version": "5.1.0",
5
5
  "author": "API Team <api@twilio.com>",
6
6
  "contributors": [
7
7
  {
@@ -20,23 +20,21 @@
20
20
  "url": "https://github.com/twilio/twilio-node.git"
21
21
  },
22
22
  "dependencies": {
23
- "axios": "^1.6.0",
23
+ "axios": "^1.6.8",
24
24
  "dayjs": "^1.11.9",
25
25
  "https-proxy-agent": "^5.0.0",
26
- "jsonwebtoken": "^9.0.0",
26
+ "jsonwebtoken": "^9.0.2",
27
27
  "qs": "^6.9.4",
28
28
  "scmp": "^2.1.0",
29
- "url-parse": "^1.5.9",
30
29
  "xmlbuilder": "^13.0.2"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@babel/preset-env": "^7.23.0",
34
33
  "@babel/preset-typescript": "^7.18.6",
35
34
  "@types/jest": "^29.5.5",
36
- "@types/jsonwebtoken": "^9.0.0",
35
+ "@types/jsonwebtoken": "^9.0.2",
37
36
  "@types/node": "^18.11.18",
38
37
  "@types/qs": "^6.9.7",
39
- "@types/url-parse": "^1.4.8",
40
38
  "babel-plugin-replace-ts-export-assignment": "^0.0.2",
41
39
  "eslint": "^8.31.0",
42
40
  "express": "^4.17.1",
@@ -1,9 +0,0 @@
1
- import PreviewMessagingBase from "./PreviewMessagingBase";
2
- import { MessageListInstance } from "./previewMessaging/v1/message";
3
- declare class PreviewMessaging extends PreviewMessagingBase {
4
- /**
5
- * @deprecated - Use v1.messages; instead
6
- */
7
- get messages(): MessageListInstance;
8
- }
9
- export = PreviewMessaging;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- const PreviewMessagingBase_1 = __importDefault(require("./PreviewMessagingBase"));
6
- class PreviewMessaging extends PreviewMessagingBase_1.default {
7
- /**
8
- * @deprecated - Use v1.messages; instead
9
- */
10
- get messages() {
11
- console.warn("messages is deprecated. Use v1.messages; instead.");
12
- return this.v1.messages;
13
- }
14
- }
15
- module.exports = PreviewMessaging;
@@ -1,13 +0,0 @@
1
- import Domain from "../base/Domain";
2
- import V1 from "./previewMessaging/V1";
3
- declare class PreviewMessagingBase extends Domain {
4
- _v1?: V1;
5
- /**
6
- * Initialize previewMessaging domain
7
- *
8
- * @param twilio - The twilio client
9
- */
10
- constructor(twilio: any);
11
- get v1(): V1;
12
- }
13
- export = PreviewMessagingBase;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /*
3
- * This code was generated by
4
- * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
- * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
- * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator.
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- var __importDefault = (this && this.__importDefault) || function (mod) {
13
- return (mod && mod.__esModule) ? mod : { "default": mod };
14
- };
15
- const Domain_1 = __importDefault(require("../base/Domain"));
16
- const V1_1 = __importDefault(require("./previewMessaging/V1"));
17
- class PreviewMessagingBase extends Domain_1.default {
18
- /**
19
- * Initialize previewMessaging domain
20
- *
21
- * @param twilio - The twilio client
22
- */
23
- constructor(twilio) {
24
- super(twilio, "https://preview.messaging.twilio.com");
25
- }
26
- get v1() {
27
- this._v1 = this._v1 || new V1_1.default(this);
28
- return this._v1;
29
- }
30
- }
31
- module.exports = PreviewMessagingBase;
@@ -1,120 +0,0 @@
1
- /// <reference types="node" />
2
- import { inspect, InspectOptions } from "util";
3
- import V1 from "../V1";
4
- export type PortingBulkPortabilityStatus = "in-progress" | "completed" | "expired";
5
- /**
6
- * Options to pass to create a PortingBulkPortabilityInstance
7
- */
8
- export interface PortingBulkPortabilityListInstanceCreateOptions {
9
- /** The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . */
10
- phoneNumbers: Array<string>;
11
- }
12
- export interface PortingBulkPortabilityContext {
13
- /**
14
- * Fetch a PortingBulkPortabilityInstance
15
- *
16
- * @param callback - Callback to handle processed record
17
- *
18
- * @returns Resolves to processed PortingBulkPortabilityInstance
19
- */
20
- fetch(callback?: (error: Error | null, item?: PortingBulkPortabilityInstance) => any): Promise<PortingBulkPortabilityInstance>;
21
- /**
22
- * Provide a user-friendly representation
23
- */
24
- toJSON(): any;
25
- [inspect.custom](_depth: any, options: InspectOptions): any;
26
- }
27
- export interface PortingBulkPortabilityContextSolution {
28
- sid: string;
29
- }
30
- export declare class PortingBulkPortabilityContextImpl implements PortingBulkPortabilityContext {
31
- protected _version: V1;
32
- protected _solution: PortingBulkPortabilityContextSolution;
33
- protected _uri: string;
34
- constructor(_version: V1, sid: string);
35
- fetch(callback?: (error: Error | null, item?: PortingBulkPortabilityInstance) => any): Promise<PortingBulkPortabilityInstance>;
36
- /**
37
- * Provide a user-friendly representation
38
- *
39
- * @returns Object
40
- */
41
- toJSON(): PortingBulkPortabilityContextSolution;
42
- [inspect.custom](_depth: any, options: InspectOptions): string;
43
- }
44
- interface PortingBulkPortabilityResource {
45
- sid: string;
46
- status: PortingBulkPortabilityStatus;
47
- datetime_created: Date;
48
- phone_numbers: Array<any>;
49
- url: string;
50
- }
51
- export declare class PortingBulkPortabilityInstance {
52
- protected _version: V1;
53
- protected _solution: PortingBulkPortabilityContextSolution;
54
- protected _context?: PortingBulkPortabilityContext;
55
- constructor(_version: V1, payload: PortingBulkPortabilityResource, sid?: string);
56
- /**
57
- * A 34 character string that uniquely identifies this Portability check.
58
- */
59
- sid: string;
60
- status: PortingBulkPortabilityStatus;
61
- /**
62
- * The date that the Portability check was created, given in ISO 8601 format.
63
- */
64
- datetimeCreated: Date;
65
- /**
66
- * Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number.
67
- */
68
- phoneNumbers: Array<any>;
69
- /**
70
- * This is the url of the request that you\'re trying to reach out to locate the resource.
71
- */
72
- url: string;
73
- private get _proxy();
74
- /**
75
- * Fetch a PortingBulkPortabilityInstance
76
- *
77
- * @param callback - Callback to handle processed record
78
- *
79
- * @returns Resolves to processed PortingBulkPortabilityInstance
80
- */
81
- fetch(callback?: (error: Error | null, item?: PortingBulkPortabilityInstance) => any): Promise<PortingBulkPortabilityInstance>;
82
- /**
83
- * Provide a user-friendly representation
84
- *
85
- * @returns Object
86
- */
87
- toJSON(): {
88
- sid: string;
89
- status: PortingBulkPortabilityStatus;
90
- datetimeCreated: Date;
91
- phoneNumbers: any[];
92
- url: string;
93
- };
94
- [inspect.custom](_depth: any, options: InspectOptions): string;
95
- }
96
- export interface PortingBulkPortabilitySolution {
97
- }
98
- export interface PortingBulkPortabilityListInstance {
99
- _version: V1;
100
- _solution: PortingBulkPortabilitySolution;
101
- _uri: string;
102
- (sid: string): PortingBulkPortabilityContext;
103
- get(sid: string): PortingBulkPortabilityContext;
104
- /**
105
- * Create a PortingBulkPortabilityInstance
106
- *
107
- * @param params - Parameter for request
108
- * @param callback - Callback to handle processed record
109
- *
110
- * @returns Resolves to processed PortingBulkPortabilityInstance
111
- */
112
- create(params: PortingBulkPortabilityListInstanceCreateOptions, callback?: (error: Error | null, item?: PortingBulkPortabilityInstance) => any): Promise<PortingBulkPortabilityInstance>;
113
- /**
114
- * Provide a user-friendly representation
115
- */
116
- toJSON(): any;
117
- [inspect.custom](_depth: any, options: InspectOptions): any;
118
- }
119
- export declare function PortingBulkPortabilityListInstance(version: V1): PortingBulkPortabilityListInstance;
120
- export {};
@@ -1,136 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.PortingBulkPortabilityListInstance = exports.PortingBulkPortabilityInstance = exports.PortingBulkPortabilityContextImpl = void 0;
17
- const util_1 = require("util");
18
- const deserialize = require("../../../base/deserialize");
19
- const serialize = require("../../../base/serialize");
20
- const utility_1 = require("../../../base/utility");
21
- class PortingBulkPortabilityContextImpl {
22
- constructor(_version, sid) {
23
- this._version = _version;
24
- if (!(0, utility_1.isValidPathParam)(sid)) {
25
- throw new Error("Parameter 'sid' is not valid.");
26
- }
27
- this._solution = { sid };
28
- this._uri = `/Porting/Portability/${sid}`;
29
- }
30
- fetch(callback) {
31
- const instance = this;
32
- let operationVersion = instance._version, operationPromise = operationVersion.fetch({
33
- uri: instance._uri,
34
- method: "get",
35
- });
36
- operationPromise = operationPromise.then((payload) => new PortingBulkPortabilityInstance(operationVersion, payload, instance._solution.sid));
37
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
38
- return operationPromise;
39
- }
40
- /**
41
- * Provide a user-friendly representation
42
- *
43
- * @returns Object
44
- */
45
- toJSON() {
46
- return this._solution;
47
- }
48
- [util_1.inspect.custom](_depth, options) {
49
- return (0, util_1.inspect)(this.toJSON(), options);
50
- }
51
- }
52
- exports.PortingBulkPortabilityContextImpl = PortingBulkPortabilityContextImpl;
53
- class PortingBulkPortabilityInstance {
54
- constructor(_version, payload, sid) {
55
- this._version = _version;
56
- this.sid = payload.sid;
57
- this.status = payload.status;
58
- this.datetimeCreated = deserialize.iso8601DateTime(payload.datetime_created);
59
- this.phoneNumbers = payload.phone_numbers;
60
- this.url = payload.url;
61
- this._solution = { sid: sid || this.sid };
62
- }
63
- get _proxy() {
64
- this._context =
65
- this._context ||
66
- new PortingBulkPortabilityContextImpl(this._version, this._solution.sid);
67
- return this._context;
68
- }
69
- /**
70
- * Fetch a PortingBulkPortabilityInstance
71
- *
72
- * @param callback - Callback to handle processed record
73
- *
74
- * @returns Resolves to processed PortingBulkPortabilityInstance
75
- */
76
- fetch(callback) {
77
- return this._proxy.fetch(callback);
78
- }
79
- /**
80
- * Provide a user-friendly representation
81
- *
82
- * @returns Object
83
- */
84
- toJSON() {
85
- return {
86
- sid: this.sid,
87
- status: this.status,
88
- datetimeCreated: this.datetimeCreated,
89
- phoneNumbers: this.phoneNumbers,
90
- url: this.url,
91
- };
92
- }
93
- [util_1.inspect.custom](_depth, options) {
94
- return (0, util_1.inspect)(this.toJSON(), options);
95
- }
96
- }
97
- exports.PortingBulkPortabilityInstance = PortingBulkPortabilityInstance;
98
- function PortingBulkPortabilityListInstance(version) {
99
- const instance = ((sid) => instance.get(sid));
100
- instance.get = function get(sid) {
101
- return new PortingBulkPortabilityContextImpl(version, sid);
102
- };
103
- instance._version = version;
104
- instance._solution = {};
105
- instance._uri = `/Porting/Portability`;
106
- instance.create = function create(params, callback) {
107
- if (params === null || params === undefined) {
108
- throw new Error('Required parameter "params" missing.');
109
- }
110
- if (params["phoneNumbers"] === null ||
111
- params["phoneNumbers"] === undefined) {
112
- throw new Error("Required parameter \"params['phoneNumbers']\" missing.");
113
- }
114
- let data = {};
115
- data["PhoneNumbers"] = serialize.map(params["phoneNumbers"], (e) => e);
116
- const headers = {};
117
- headers["Content-Type"] = "application/x-www-form-urlencoded";
118
- let operationVersion = version, operationPromise = operationVersion.create({
119
- uri: instance._uri,
120
- method: "post",
121
- data,
122
- headers,
123
- });
124
- operationPromise = operationPromise.then((payload) => new PortingBulkPortabilityInstance(operationVersion, payload));
125
- operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
126
- return operationPromise;
127
- };
128
- instance.toJSON = function toJSON() {
129
- return instance._solution;
130
- };
131
- instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
132
- return (0, util_1.inspect)(instance.toJSON(), options);
133
- };
134
- return instance;
135
- }
136
- exports.PortingBulkPortabilityListInstance = PortingBulkPortabilityListInstance;