twilio 5.4.2 → 5.4.4

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/README.md CHANGED
@@ -22,7 +22,8 @@ This library supports the following Node.js implementations:
22
22
  - Node.js 14
23
23
  - Node.js 16
24
24
  - Node.js 18
25
- - Node.js LTS (20)
25
+ - Node.js 20
26
+ - Node.js lts(22)
26
27
 
27
28
  TypeScript is supported for TypeScript version 2.9 and above.
28
29
 
@@ -8,7 +8,7 @@ import { DependentPhoneNumberListInstance } from "./address/dependentPhoneNumber
8
8
  * Options to pass to update a AddressInstance
9
9
  */
10
10
  export interface AddressContextUpdateOptions {
11
- /** A descriptive string that you create to describe the address. It can be up to 64 characters long. */
11
+ /** A descriptive string that you create to describe the new address. It can be up to 64 characters long for Regulatory Compliance addresses and 32 characters long for Emergency addresses. */
12
12
  friendlyName?: string;
13
13
  /** The name to associate with the address. */
14
14
  customerName?: string;
@@ -166,6 +166,14 @@ export declare class TwilioQuickReply {
166
166
  "body": string;
167
167
  "actions": Array<QuickReplyAction>;
168
168
  }
169
+ /**
170
+ * twilio/schedule templates allow us to send a message with a schedule with different time slots
171
+ */
172
+ export declare class TwilioSchedule {
173
+ "id": string;
174
+ "title": string;
175
+ "timeSlots": string;
176
+ }
169
177
  /**
170
178
  * Type containing only plain text-based content
171
179
  */
@@ -186,6 +194,7 @@ export declare class Types {
186
194
  "twilio/catalog"?: TwilioCatalog | null;
187
195
  "twilio/carousel"?: TwilioCarousel | null;
188
196
  "twilio/flows"?: TwilioFlows | null;
197
+ "twilio/schedule"?: TwilioSchedule | null;
189
198
  "whatsapp/card"?: WhatsappCard | null;
190
199
  "whatsapp/authentication"?: WhatsappAuthentication | null;
191
200
  }
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
19
+ exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioSchedule = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
20
20
  const util_1 = require("util");
21
21
  const Page_1 = __importDefault(require("../../../base/Page"));
22
22
  const deserialize = require("../../../base/deserialize");
@@ -114,6 +114,12 @@ exports.TwilioMedia = TwilioMedia;
114
114
  class TwilioQuickReply {
115
115
  }
116
116
  exports.TwilioQuickReply = TwilioQuickReply;
117
+ /**
118
+ * twilio/schedule templates allow us to send a message with a schedule with different time slots
119
+ */
120
+ class TwilioSchedule {
121
+ }
122
+ exports.TwilioSchedule = TwilioSchedule;
117
123
  /**
118
124
  * Type containing only plain text-based content
119
125
  */
@@ -5,7 +5,7 @@ import Response from "../../../http/response";
5
5
  import V1 from "../V1";
6
6
  export type AddressConfigurationAutoCreationType = "webhook" | "studio" | "default";
7
7
  export type AddressConfigurationMethod = "GET" | "POST";
8
- export type AddressConfigurationType = "sms" | "whatsapp" | "messenger" | "gbm" | "email" | "rcs";
8
+ export type AddressConfigurationType = "sms" | "whatsapp" | "messenger" | "gbm" | "email" | "rcs" | "apple";
9
9
  /**
10
10
  * Options to pass to update a AddressConfigurationInstance
11
11
  */
@@ -12,6 +12,8 @@ export interface SubscriptionContextUpdateOptions {
12
12
  description?: string;
13
13
  /** The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */
14
14
  sinkSid?: string;
15
+ /** Receive events from all children accounts in the parent account subscription. */
16
+ receiveEventsFromSubaccounts?: boolean;
15
17
  }
16
18
  /**
17
19
  * Options to pass to create a SubscriptionInstance
@@ -23,6 +25,8 @@ export interface SubscriptionListInstanceCreateOptions {
23
25
  sinkSid: string;
24
26
  /** An array of objects containing the subscribed Event Types */
25
27
  types: Array<any>;
28
+ /** Receive events from all children accounts in the parent account subscription. */
29
+ receiveEventsFromSubaccounts?: boolean;
26
30
  }
27
31
  /**
28
32
  * Options to pass to each
@@ -137,6 +141,7 @@ interface SubscriptionResource {
137
141
  sink_sid: string;
138
142
  url: string;
139
143
  links: Record<string, string>;
144
+ receive_events_from_subaccounts: boolean;
140
145
  }
141
146
  export declare class SubscriptionInstance {
142
147
  protected _version: V1;
@@ -175,6 +180,10 @@ export declare class SubscriptionInstance {
175
180
  * Contains a dictionary of URL links to nested resources of this Subscription.
176
181
  */
177
182
  links: Record<string, string>;
183
+ /**
184
+ * Receive events from all children accounts in the parent account subscription.
185
+ */
186
+ receiveEventsFromSubaccounts: boolean;
178
187
  private get _proxy();
179
188
  /**
180
189
  * Remove a SubscriptionInstance
@@ -227,6 +236,7 @@ export declare class SubscriptionInstance {
227
236
  sinkSid: string;
228
237
  url: string;
229
238
  links: Record<string, string>;
239
+ receiveEventsFromSubaccounts: boolean;
230
240
  };
231
241
  [inspect.custom](_depth: any, options: InspectOptions): string;
232
242
  }
@@ -75,6 +75,8 @@ class SubscriptionContextImpl {
75
75
  data["Description"] = params["description"];
76
76
  if (params["sinkSid"] !== undefined)
77
77
  data["SinkSid"] = params["sinkSid"];
78
+ if (params["receiveEventsFromSubaccounts"] !== undefined)
79
+ data["ReceiveEventsFromSubaccounts"] = serialize.bool(params["receiveEventsFromSubaccounts"]);
78
80
  const headers = {};
79
81
  headers["Content-Type"] = "application/x-www-form-urlencoded";
80
82
  headers["Accept"] = "application/json";
@@ -113,6 +115,7 @@ class SubscriptionInstance {
113
115
  this.sinkSid = payload.sink_sid;
114
116
  this.url = payload.url;
115
117
  this.links = payload.links;
118
+ this.receiveEventsFromSubaccounts = payload.receive_events_from_subaccounts;
116
119
  this._solution = { sid: sid || this.sid };
117
120
  }
118
121
  get _proxy() {
@@ -165,6 +168,7 @@ class SubscriptionInstance {
165
168
  sinkSid: this.sinkSid,
166
169
  url: this.url,
167
170
  links: this.links,
171
+ receiveEventsFromSubaccounts: this.receiveEventsFromSubaccounts,
168
172
  };
169
173
  }
170
174
  [util_1.inspect.custom](_depth, options) {
@@ -197,6 +201,8 @@ function SubscriptionListInstance(version) {
197
201
  data["Description"] = params["description"];
198
202
  data["SinkSid"] = params["sinkSid"];
199
203
  data["Types"] = serialize.map(params["types"], (e) => serialize.object(e));
204
+ if (params["receiveEventsFromSubaccounts"] !== undefined)
205
+ data["ReceiveEventsFromSubaccounts"] = serialize.bool(params["receiveEventsFromSubaccounts"]);
200
206
  const headers = {};
201
207
  headers["Content-Type"] = "application/x-www-form-urlencoded";
202
208
  headers["Accept"] = "application/json";
@@ -2,7 +2,7 @@ import IamBase from "../IamBase";
2
2
  import Version from "../../base/Version";
3
3
  import { ApiKeyListInstance } from "./v1/apiKey";
4
4
  import { GetApiKeysListInstance } from "./v1/getApiKeys";
5
- import { KeyListInstance } from "./v1/key";
5
+ import { NewApiKeyListInstance } from "./v1/newApiKey";
6
6
  export default class V1 extends Version {
7
7
  /**
8
8
  * Initialize the V1 version of Iam
@@ -14,12 +14,12 @@ export default class V1 extends Version {
14
14
  protected _apiKey?: ApiKeyListInstance;
15
15
  /** getApiKeys - { Twilio.Iam.V1.GetApiKeysListInstance } resource */
16
16
  protected _getApiKeys?: GetApiKeysListInstance;
17
- /** keys - { Twilio.Iam.V1.KeyListInstance } resource */
18
- protected _keys?: KeyListInstance;
17
+ /** newApiKey - { Twilio.Iam.V1.NewApiKeyListInstance } resource */
18
+ protected _newApiKey?: NewApiKeyListInstance;
19
19
  /** Getter for apiKey resource */
20
20
  get apiKey(): ApiKeyListInstance;
21
21
  /** Getter for getApiKeys resource */
22
22
  get getApiKeys(): GetApiKeysListInstance;
23
- /** Getter for keys resource */
24
- get keys(): KeyListInstance;
23
+ /** Getter for newApiKey resource */
24
+ get newApiKey(): NewApiKeyListInstance;
25
25
  }
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const Version_1 = __importDefault(require("../../base/Version"));
20
20
  const apiKey_1 = require("./v1/apiKey");
21
21
  const getApiKeys_1 = require("./v1/getApiKeys");
22
- const key_1 = require("./v1/key");
22
+ const newApiKey_1 = require("./v1/newApiKey");
23
23
  class V1 extends Version_1.default {
24
24
  /**
25
25
  * Initialize the V1 version of Iam
@@ -39,10 +39,10 @@ class V1 extends Version_1.default {
39
39
  this._getApiKeys = this._getApiKeys || (0, getApiKeys_1.GetApiKeysListInstance)(this);
40
40
  return this._getApiKeys;
41
41
  }
42
- /** Getter for keys resource */
43
- get keys() {
44
- this._keys = this._keys || (0, key_1.KeyListInstance)(this);
45
- return this._keys;
42
+ /** Getter for newApiKey resource */
43
+ get newApiKey() {
44
+ this._newApiKey = this._newApiKey || (0, newApiKey_1.NewApiKeyListInstance)(this);
45
+ return this._newApiKey;
46
46
  }
47
47
  }
48
48
  exports.default = V1;
@@ -1,43 +1,43 @@
1
1
  /// <reference types="node" />
2
2
  import { inspect, InspectOptions } from "util";
3
3
  import V1 from "../V1";
4
- export type KeyKeytype = "restricted";
4
+ export type NewApiKeyKeytype = "restricted";
5
5
  /**
6
- * Options to pass to create a KeyInstance
6
+ * Options to pass to create a NewApiKeyInstance
7
7
  */
8
- export interface KeyListInstanceCreateOptions {
8
+ export interface NewApiKeyListInstanceCreateOptions {
9
9
  /** The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. */
10
10
  accountSid: string;
11
11
  /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
12
12
  friendlyName?: string;
13
13
  /** */
14
- keyType?: KeyKeytype;
14
+ keyType?: NewApiKeyKeytype;
15
15
  /** The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). */
16
16
  policy?: any;
17
17
  }
18
- export interface KeySolution {
18
+ export interface NewApiKeySolution {
19
19
  }
20
- export interface KeyListInstance {
20
+ export interface NewApiKeyListInstance {
21
21
  _version: V1;
22
- _solution: KeySolution;
22
+ _solution: NewApiKeySolution;
23
23
  _uri: string;
24
24
  /**
25
- * Create a KeyInstance
25
+ * Create a NewApiKeyInstance
26
26
  *
27
27
  * @param params - Parameter for request
28
28
  * @param callback - Callback to handle processed record
29
29
  *
30
- * @returns Resolves to processed KeyInstance
30
+ * @returns Resolves to processed NewApiKeyInstance
31
31
  */
32
- create(params: KeyListInstanceCreateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>;
32
+ create(params: NewApiKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: NewApiKeyInstance) => any): Promise<NewApiKeyInstance>;
33
33
  /**
34
34
  * Provide a user-friendly representation
35
35
  */
36
36
  toJSON(): any;
37
37
  [inspect.custom](_depth: any, options: InspectOptions): any;
38
38
  }
39
- export declare function KeyListInstance(version: V1): KeyListInstance;
40
- interface KeyResource {
39
+ export declare function NewApiKeyListInstance(version: V1): NewApiKeyListInstance;
40
+ interface NewApiKeyResource {
41
41
  sid: string;
42
42
  friendly_name: string;
43
43
  date_created: Date;
@@ -45,9 +45,9 @@ interface KeyResource {
45
45
  secret: string;
46
46
  policy: any;
47
47
  }
48
- export declare class KeyInstance {
48
+ export declare class NewApiKeyInstance {
49
49
  protected _version: V1;
50
- constructor(_version: V1, payload: KeyResource);
50
+ constructor(_version: V1, payload: NewApiKeyResource);
51
51
  /**
52
52
  * The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API.
53
53
  */
@@ -13,11 +13,11 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.KeyInstance = exports.KeyListInstance = void 0;
16
+ exports.NewApiKeyInstance = exports.NewApiKeyListInstance = void 0;
17
17
  const util_1 = require("util");
18
18
  const deserialize = require("../../../base/deserialize");
19
19
  const serialize = require("../../../base/serialize");
20
- function KeyListInstance(version) {
20
+ function NewApiKeyListInstance(version) {
21
21
  const instance = {};
22
22
  instance._version = version;
23
23
  instance._solution = {};
@@ -46,7 +46,7 @@ function KeyListInstance(version) {
46
46
  data,
47
47
  headers,
48
48
  });
49
- operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload));
49
+ operationPromise = operationPromise.then((payload) => new NewApiKeyInstance(operationVersion, payload));
50
50
  operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
51
51
  return operationPromise;
52
52
  };
@@ -58,8 +58,8 @@ function KeyListInstance(version) {
58
58
  };
59
59
  return instance;
60
60
  }
61
- exports.KeyListInstance = KeyListInstance;
62
- class KeyInstance {
61
+ exports.NewApiKeyListInstance = NewApiKeyListInstance;
62
+ class NewApiKeyInstance {
63
63
  constructor(_version, payload) {
64
64
  this._version = _version;
65
65
  this.sid = payload.sid;
@@ -88,4 +88,4 @@ class KeyInstance {
88
88
  return (0, util_1.inspect)(this.toJSON(), options);
89
89
  }
90
90
  }
91
- exports.KeyInstance = KeyInstance;
91
+ exports.NewApiKeyInstance = NewApiKeyInstance;
@@ -7,7 +7,7 @@ import { ConferenceParticipantListInstance } from "./conference/conferencePartic
7
7
  export type ConferenceConferenceEndReason = "last_participant_left" | "conference_ended_via_api" | "participant_with_end_conference_on_exit_left" | "last_participant_kicked" | "participant_with_end_conference_on_exit_kicked";
8
8
  export type ConferenceConferenceStatus = "in_progress" | "not_started" | "completed" | "summary_timeout";
9
9
  export type ConferenceProcessingState = "complete" | "in_progress" | "timeout";
10
- export type ConferenceRegion = "us1" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1";
10
+ export type ConferenceRegion = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1";
11
11
  export type ConferenceTag = "invalid_requested_region" | "duplicate_identity" | "start_failure" | "region_configuration_issues" | "quality_warnings" | "participant_behavior_issues" | "high_packet_loss" | "high_jitter" | "high_latency" | "low_mos" | "detected_silence" | "no_concurrent_participants";
12
12
  /**
13
13
  * Options to pass to each
@@ -3,7 +3,7 @@ import { inspect, InspectOptions } from "util";
3
3
  import Page, { TwilioResponsePayload } from "../../../../base/Page";
4
4
  import Response from "../../../../http/response";
5
5
  import V2 from "../../V2";
6
- export type OperatorResultOperatorType = "conversation_classify" | "utterance_classify" | "extract" | "extract_normalize" | "pii_extract";
6
+ export type OperatorResultOperatorType = "conversation_classify" | "utterance_classify" | "extract" | "extract_normalize" | "pii_extract" | "text_generation" | "json";
7
7
  /**
8
8
  * Options to pass to fetch a OperatorResultInstance
9
9
  */
@@ -109,6 +109,7 @@ interface OperatorResultResource {
109
109
  label_probabilities: any;
110
110
  extract_results: any;
111
111
  text_generation_results: any;
112
+ json_results: any;
112
113
  transcript_sid: string;
113
114
  url: string;
114
115
  }
@@ -166,6 +167,7 @@ export declare class OperatorResultInstance {
166
167
  * Output of a text generation operator for example Conversation Sumamary.
167
168
  */
168
169
  textGenerationResults: any;
170
+ jsonResults: any;
169
171
  /**
170
172
  * A 34 character string that uniquely identifies this Transcript.
171
173
  */
@@ -211,6 +213,7 @@ export declare class OperatorResultInstance {
211
213
  labelProbabilities: any;
212
214
  extractResults: any;
213
215
  textGenerationResults: any;
216
+ jsonResults: any;
214
217
  transcriptSid: string;
215
218
  url: string;
216
219
  };
@@ -87,6 +87,7 @@ class OperatorResultInstance {
87
87
  this.labelProbabilities = payload.label_probabilities;
88
88
  this.extractResults = payload.extract_results;
89
89
  this.textGenerationResults = payload.text_generation_results;
90
+ this.jsonResults = payload.json_results;
90
91
  this.transcriptSid = payload.transcript_sid;
91
92
  this.url = payload.url;
92
93
  this._solution = {
@@ -123,6 +124,7 @@ class OperatorResultInstance {
123
124
  labelProbabilities: this.labelProbabilities,
124
125
  extractResults: this.extractResults,
125
126
  textGenerationResults: this.textGenerationResults,
127
+ jsonResults: this.jsonResults,
126
128
  transcriptSid: this.transcriptSid,
127
129
  url: this.url,
128
130
  };
@@ -34,6 +34,8 @@ export interface PhoneNumberContextFetchOptions {
34
34
  lastVerifiedDate?: string;
35
35
  /** The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. */
36
36
  verificationSid?: string;
37
+ /** The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. */
38
+ partnerSubId?: string;
37
39
  }
38
40
  export interface PhoneNumberContext {
39
41
  /**
@@ -64,6 +64,8 @@ class PhoneNumberContextImpl {
64
64
  data["LastVerifiedDate"] = params["lastVerifiedDate"];
65
65
  if (params["verificationSid"] !== undefined)
66
66
  data["VerificationSid"] = params["verificationSid"];
67
+ if (params["partnerSubId"] !== undefined)
68
+ data["PartnerSubId"] = params["partnerSubId"];
67
69
  const headers = {};
68
70
  headers["Accept"] = "application/json";
69
71
  const instance = this;
@@ -0,0 +1,272 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import Page, { TwilioResponsePayload } from "../../../../base/Page";
4
+ import Response from "../../../../http/response";
5
+ import V1 from "../../V1";
6
+ /**
7
+ * Options to pass to create a DestinationAlphaSenderInstance
8
+ */
9
+ export interface DestinationAlphaSenderListInstanceCreateOptions {
10
+ /** The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. */
11
+ alphaSender: string;
12
+ /** The Optional Two Character ISO Country Code the Alphanumeric Sender ID will be used for. If the IsoCountryCode is not provided, a default Alpha Sender will be created that can be used across all countries. */
13
+ isoCountryCode?: string;
14
+ }
15
+ /**
16
+ * Options to pass to each
17
+ */
18
+ export interface DestinationAlphaSenderListInstanceEachOptions {
19
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
20
+ pageSize?: number;
21
+ /** Function to process each record. If this and a positional callback are passed, this one will be used */
22
+ callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void;
23
+ /** Function to be called upon completion of streaming */
24
+ done?: Function;
25
+ /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */
26
+ limit?: number;
27
+ }
28
+ /**
29
+ * Options to pass to list
30
+ */
31
+ export interface DestinationAlphaSenderListInstanceOptions {
32
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
33
+ pageSize?: number;
34
+ /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */
35
+ limit?: number;
36
+ }
37
+ /**
38
+ * Options to pass to page
39
+ */
40
+ export interface DestinationAlphaSenderListInstancePageOptions {
41
+ /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */
42
+ pageSize?: number;
43
+ /** Page Number, this value is simply for client state */
44
+ pageNumber?: number;
45
+ /** PageToken provided by the API */
46
+ pageToken?: string;
47
+ }
48
+ export interface DestinationAlphaSenderContext {
49
+ /**
50
+ * Remove a DestinationAlphaSenderInstance
51
+ *
52
+ * @param callback - Callback to handle processed record
53
+ *
54
+ * @returns Resolves to processed boolean
55
+ */
56
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
57
+ /**
58
+ * Fetch a DestinationAlphaSenderInstance
59
+ *
60
+ * @param callback - Callback to handle processed record
61
+ *
62
+ * @returns Resolves to processed DestinationAlphaSenderInstance
63
+ */
64
+ fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
65
+ /**
66
+ * Provide a user-friendly representation
67
+ */
68
+ toJSON(): any;
69
+ [inspect.custom](_depth: any, options: InspectOptions): any;
70
+ }
71
+ export interface DestinationAlphaSenderContextSolution {
72
+ serviceSid: string;
73
+ sid: string;
74
+ }
75
+ export declare class DestinationAlphaSenderContextImpl implements DestinationAlphaSenderContext {
76
+ protected _version: V1;
77
+ protected _solution: DestinationAlphaSenderContextSolution;
78
+ protected _uri: string;
79
+ constructor(_version: V1, serviceSid: string, sid: string);
80
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
81
+ fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
82
+ /**
83
+ * Provide a user-friendly representation
84
+ *
85
+ * @returns Object
86
+ */
87
+ toJSON(): DestinationAlphaSenderContextSolution;
88
+ [inspect.custom](_depth: any, options: InspectOptions): string;
89
+ }
90
+ interface DestinationAlphaSenderPayload extends TwilioResponsePayload {
91
+ alpha_senders: DestinationAlphaSenderResource[];
92
+ }
93
+ interface DestinationAlphaSenderResource {
94
+ sid: string;
95
+ account_sid: string;
96
+ service_sid: string;
97
+ date_created: Date;
98
+ date_updated: Date;
99
+ alpha_sender: string;
100
+ capabilities: Array<string>;
101
+ url: string;
102
+ iso_country_code: string;
103
+ }
104
+ export declare class DestinationAlphaSenderInstance {
105
+ protected _version: V1;
106
+ protected _solution: DestinationAlphaSenderContextSolution;
107
+ protected _context?: DestinationAlphaSenderContext;
108
+ constructor(_version: V1, payload: DestinationAlphaSenderResource, serviceSid: string, sid?: string);
109
+ /**
110
+ * The unique string that we created to identify the AlphaSender resource.
111
+ */
112
+ sid: string;
113
+ /**
114
+ * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource.
115
+ */
116
+ accountSid: string;
117
+ /**
118
+ * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
119
+ */
120
+ serviceSid: string;
121
+ /**
122
+ * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
123
+ */
124
+ dateCreated: Date;
125
+ /**
126
+ * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
127
+ */
128
+ dateUpdated: Date;
129
+ /**
130
+ * The Alphanumeric Sender ID string.
131
+ */
132
+ alphaSender: string;
133
+ /**
134
+ * An array of values that describe whether the number can receive calls or messages. Can be: `SMS`.
135
+ */
136
+ capabilities: Array<string>;
137
+ /**
138
+ * The absolute URL of the AlphaSender resource.
139
+ */
140
+ url: string;
141
+ /**
142
+ * The Two Character ISO Country Code the Alphanumeric Sender ID will be used for. For Default Alpha Senders that work across countries, this value will be an empty string
143
+ */
144
+ isoCountryCode: string;
145
+ private get _proxy();
146
+ /**
147
+ * Remove a DestinationAlphaSenderInstance
148
+ *
149
+ * @param callback - Callback to handle processed record
150
+ *
151
+ * @returns Resolves to processed boolean
152
+ */
153
+ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
154
+ /**
155
+ * Fetch a DestinationAlphaSenderInstance
156
+ *
157
+ * @param callback - Callback to handle processed record
158
+ *
159
+ * @returns Resolves to processed DestinationAlphaSenderInstance
160
+ */
161
+ fetch(callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
162
+ /**
163
+ * Provide a user-friendly representation
164
+ *
165
+ * @returns Object
166
+ */
167
+ toJSON(): {
168
+ sid: string;
169
+ accountSid: string;
170
+ serviceSid: string;
171
+ dateCreated: Date;
172
+ dateUpdated: Date;
173
+ alphaSender: string;
174
+ capabilities: string[];
175
+ url: string;
176
+ isoCountryCode: string;
177
+ };
178
+ [inspect.custom](_depth: any, options: InspectOptions): string;
179
+ }
180
+ export interface DestinationAlphaSenderSolution {
181
+ serviceSid: string;
182
+ }
183
+ export interface DestinationAlphaSenderListInstance {
184
+ _version: V1;
185
+ _solution: DestinationAlphaSenderSolution;
186
+ _uri: string;
187
+ (sid: string): DestinationAlphaSenderContext;
188
+ get(sid: string): DestinationAlphaSenderContext;
189
+ /**
190
+ * Create a DestinationAlphaSenderInstance
191
+ *
192
+ * @param params - Parameter for request
193
+ * @param callback - Callback to handle processed record
194
+ *
195
+ * @returns Resolves to processed DestinationAlphaSenderInstance
196
+ */
197
+ create(params: DestinationAlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: DestinationAlphaSenderInstance) => any): Promise<DestinationAlphaSenderInstance>;
198
+ /**
199
+ * Streams DestinationAlphaSenderInstance records from the API.
200
+ *
201
+ * This operation lazily loads records as efficiently as possible until the limit
202
+ * is reached.
203
+ *
204
+ * The results are passed into the callback function, so this operation is memory
205
+ * efficient.
206
+ *
207
+ * If a function is passed as the first argument, it will be used as the callback
208
+ * function.
209
+ *
210
+ * @param { DestinationAlphaSenderListInstanceEachOptions } [params] - Options for request
211
+ * @param { function } [callback] - Function to process each record
212
+ */
213
+ each(callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
214
+ each(params: DestinationAlphaSenderListInstanceEachOptions, callback?: (item: DestinationAlphaSenderInstance, done: (err?: Error) => void) => void): void;
215
+ /**
216
+ * Retrieve a single target page of DestinationAlphaSenderInstance records from the API.
217
+ *
218
+ * The request is executed immediately.
219
+ *
220
+ * @param { string } [targetUrl] - API-generated URL for the requested results page
221
+ * @param { function } [callback] - Callback to handle list of records
222
+ */
223
+ getPage(targetUrl: string, callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
224
+ /**
225
+ * Lists DestinationAlphaSenderInstance records from the API as a list.
226
+ *
227
+ * If a function is passed as the first argument, it will be used as the callback
228
+ * function.
229
+ *
230
+ * @param { DestinationAlphaSenderListInstanceOptions } [params] - Options for request
231
+ * @param { function } [callback] - Callback to handle list of records
232
+ */
233
+ list(callback?: (error: Error | null, items: DestinationAlphaSenderInstance[]) => any): Promise<DestinationAlphaSenderInstance[]>;
234
+ list(params: DestinationAlphaSenderListInstanceOptions, callback?: (error: Error | null, items: DestinationAlphaSenderInstance[]) => any): Promise<DestinationAlphaSenderInstance[]>;
235
+ /**
236
+ * Retrieve a single page of DestinationAlphaSenderInstance records from the API.
237
+ *
238
+ * The request is executed immediately.
239
+ *
240
+ * If a function is passed as the first argument, it will be used as the callback
241
+ * function.
242
+ *
243
+ * @param { DestinationAlphaSenderListInstancePageOptions } [params] - Options for request
244
+ * @param { function } [callback] - Callback to handle list of records
245
+ */
246
+ page(callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
247
+ page(params: DestinationAlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: DestinationAlphaSenderPage) => any): Promise<DestinationAlphaSenderPage>;
248
+ /**
249
+ * Provide a user-friendly representation
250
+ */
251
+ toJSON(): any;
252
+ [inspect.custom](_depth: any, options: InspectOptions): any;
253
+ }
254
+ export declare function DestinationAlphaSenderListInstance(version: V1, serviceSid: string): DestinationAlphaSenderListInstance;
255
+ export declare class DestinationAlphaSenderPage extends Page<V1, DestinationAlphaSenderPayload, DestinationAlphaSenderResource, DestinationAlphaSenderInstance> {
256
+ /**
257
+ * Initialize the DestinationAlphaSenderPage
258
+ *
259
+ * @param version - Version of the resource
260
+ * @param response - Response from the API
261
+ * @param solution - Path solution
262
+ */
263
+ constructor(version: V1, response: Response<string>, solution: DestinationAlphaSenderSolution);
264
+ /**
265
+ * Build an instance of DestinationAlphaSenderInstance
266
+ *
267
+ * @param payload - Payload response from the API
268
+ */
269
+ getInstance(payload: DestinationAlphaSenderResource): DestinationAlphaSenderInstance;
270
+ [inspect.custom](depth: any, options: InspectOptions): string;
271
+ }
272
+ export {};
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Messaging
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.DestinationAlphaSenderPage = exports.DestinationAlphaSenderListInstance = exports.DestinationAlphaSenderInstance = exports.DestinationAlphaSenderContextImpl = 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 DestinationAlphaSenderContextImpl {
26
+ constructor(_version, serviceSid, sid) {
27
+ this._version = _version;
28
+ if (!(0, utility_1.isValidPathParam)(serviceSid)) {
29
+ throw new Error("Parameter 'serviceSid' is not valid.");
30
+ }
31
+ if (!(0, utility_1.isValidPathParam)(sid)) {
32
+ throw new Error("Parameter 'sid' is not valid.");
33
+ }
34
+ this._solution = { serviceSid, sid };
35
+ this._uri = `/Services/${serviceSid}/DestinationAlphaSenders/${sid}`;
36
+ }
37
+ remove(callback) {
38
+ const headers = {};
39
+ const instance = this;
40
+ let operationVersion = instance._version, operationPromise = operationVersion.remove({
41
+ uri: instance._uri,
42
+ method: "delete",
43
+ headers,
44
+ });
45
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
46
+ return operationPromise;
47
+ }
48
+ fetch(callback) {
49
+ const headers = {};
50
+ headers["Accept"] = "application/json";
51
+ const instance = this;
52
+ let operationVersion = instance._version, operationPromise = operationVersion.fetch({
53
+ uri: instance._uri,
54
+ method: "get",
55
+ headers,
56
+ });
57
+ operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid));
58
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
59
+ return operationPromise;
60
+ }
61
+ /**
62
+ * Provide a user-friendly representation
63
+ *
64
+ * @returns Object
65
+ */
66
+ toJSON() {
67
+ return this._solution;
68
+ }
69
+ [util_1.inspect.custom](_depth, options) {
70
+ return (0, util_1.inspect)(this.toJSON(), options);
71
+ }
72
+ }
73
+ exports.DestinationAlphaSenderContextImpl = DestinationAlphaSenderContextImpl;
74
+ class DestinationAlphaSenderInstance {
75
+ constructor(_version, payload, serviceSid, sid) {
76
+ this._version = _version;
77
+ this.sid = payload.sid;
78
+ this.accountSid = payload.account_sid;
79
+ this.serviceSid = payload.service_sid;
80
+ this.dateCreated = deserialize.iso8601DateTime(payload.date_created);
81
+ this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated);
82
+ this.alphaSender = payload.alpha_sender;
83
+ this.capabilities = payload.capabilities;
84
+ this.url = payload.url;
85
+ this.isoCountryCode = payload.iso_country_code;
86
+ this._solution = { serviceSid, sid: sid || this.sid };
87
+ }
88
+ get _proxy() {
89
+ this._context =
90
+ this._context ||
91
+ new DestinationAlphaSenderContextImpl(this._version, this._solution.serviceSid, this._solution.sid);
92
+ return this._context;
93
+ }
94
+ /**
95
+ * Remove a DestinationAlphaSenderInstance
96
+ *
97
+ * @param callback - Callback to handle processed record
98
+ *
99
+ * @returns Resolves to processed boolean
100
+ */
101
+ remove(callback) {
102
+ return this._proxy.remove(callback);
103
+ }
104
+ /**
105
+ * Fetch a DestinationAlphaSenderInstance
106
+ *
107
+ * @param callback - Callback to handle processed record
108
+ *
109
+ * @returns Resolves to processed DestinationAlphaSenderInstance
110
+ */
111
+ fetch(callback) {
112
+ return this._proxy.fetch(callback);
113
+ }
114
+ /**
115
+ * Provide a user-friendly representation
116
+ *
117
+ * @returns Object
118
+ */
119
+ toJSON() {
120
+ return {
121
+ sid: this.sid,
122
+ accountSid: this.accountSid,
123
+ serviceSid: this.serviceSid,
124
+ dateCreated: this.dateCreated,
125
+ dateUpdated: this.dateUpdated,
126
+ alphaSender: this.alphaSender,
127
+ capabilities: this.capabilities,
128
+ url: this.url,
129
+ isoCountryCode: this.isoCountryCode,
130
+ };
131
+ }
132
+ [util_1.inspect.custom](_depth, options) {
133
+ return (0, util_1.inspect)(this.toJSON(), options);
134
+ }
135
+ }
136
+ exports.DestinationAlphaSenderInstance = DestinationAlphaSenderInstance;
137
+ function DestinationAlphaSenderListInstance(version, serviceSid) {
138
+ if (!(0, utility_1.isValidPathParam)(serviceSid)) {
139
+ throw new Error("Parameter 'serviceSid' is not valid.");
140
+ }
141
+ const instance = ((sid) => instance.get(sid));
142
+ instance.get = function get(sid) {
143
+ return new DestinationAlphaSenderContextImpl(version, serviceSid, sid);
144
+ };
145
+ instance._version = version;
146
+ instance._solution = { serviceSid };
147
+ instance._uri = `/Services/${serviceSid}/DestinationAlphaSenders`;
148
+ instance.create = function create(params, callback) {
149
+ if (params === null || params === undefined) {
150
+ throw new Error('Required parameter "params" missing.');
151
+ }
152
+ if (params["alphaSender"] === null || params["alphaSender"] === undefined) {
153
+ throw new Error("Required parameter \"params['alphaSender']\" missing.");
154
+ }
155
+ let data = {};
156
+ data["AlphaSender"] = params["alphaSender"];
157
+ if (params["isoCountryCode"] !== undefined)
158
+ data["IsoCountryCode"] = params["isoCountryCode"];
159
+ const headers = {};
160
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
161
+ headers["Accept"] = "application/json";
162
+ let operationVersion = version, operationPromise = operationVersion.create({
163
+ uri: instance._uri,
164
+ method: "post",
165
+ data,
166
+ headers,
167
+ });
168
+ operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid));
169
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
170
+ return operationPromise;
171
+ };
172
+ instance.page = function page(params, callback) {
173
+ if (params instanceof Function) {
174
+ callback = params;
175
+ params = {};
176
+ }
177
+ else {
178
+ params = params || {};
179
+ }
180
+ let data = {};
181
+ if (params["pageSize"] !== undefined)
182
+ data["PageSize"] = params["pageSize"];
183
+ if (params.pageNumber !== undefined)
184
+ data["Page"] = params.pageNumber;
185
+ if (params.pageToken !== undefined)
186
+ data["PageToken"] = params.pageToken;
187
+ const headers = {};
188
+ headers["Accept"] = "application/json";
189
+ let operationVersion = version, operationPromise = operationVersion.page({
190
+ uri: instance._uri,
191
+ method: "get",
192
+ params: data,
193
+ headers,
194
+ });
195
+ operationPromise = operationPromise.then((payload) => new DestinationAlphaSenderPage(operationVersion, payload, instance._solution));
196
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
197
+ return operationPromise;
198
+ };
199
+ instance.each = instance._version.each;
200
+ instance.list = instance._version.list;
201
+ instance.getPage = function getPage(targetUrl, callback) {
202
+ const operationPromise = instance._version._domain.twilio.request({
203
+ method: "get",
204
+ uri: targetUrl,
205
+ });
206
+ let pagePromise = operationPromise.then((payload) => new DestinationAlphaSenderPage(instance._version, payload, instance._solution));
207
+ pagePromise = instance._version.setPromiseCallback(pagePromise, callback);
208
+ return pagePromise;
209
+ };
210
+ instance.toJSON = function toJSON() {
211
+ return instance._solution;
212
+ };
213
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
214
+ return (0, util_1.inspect)(instance.toJSON(), options);
215
+ };
216
+ return instance;
217
+ }
218
+ exports.DestinationAlphaSenderListInstance = DestinationAlphaSenderListInstance;
219
+ class DestinationAlphaSenderPage extends Page_1.default {
220
+ /**
221
+ * Initialize the DestinationAlphaSenderPage
222
+ *
223
+ * @param version - Version of the resource
224
+ * @param response - Response from the API
225
+ * @param solution - Path solution
226
+ */
227
+ constructor(version, response, solution) {
228
+ super(version, response, solution);
229
+ }
230
+ /**
231
+ * Build an instance of DestinationAlphaSenderInstance
232
+ *
233
+ * @param payload - Payload response from the API
234
+ */
235
+ getInstance(payload) {
236
+ return new DestinationAlphaSenderInstance(this._version, payload, this._solution.serviceSid);
237
+ }
238
+ [util_1.inspect.custom](depth, options) {
239
+ return (0, util_1.inspect)(this.toJSON(), options);
240
+ }
241
+ }
242
+ exports.DestinationAlphaSenderPage = DestinationAlphaSenderPage;
@@ -5,6 +5,7 @@ import Response from "../../../http/response";
5
5
  import V1 from "../V1";
6
6
  import { AlphaSenderListInstance } from "./service/alphaSender";
7
7
  import { ChannelSenderListInstance } from "./service/channelSender";
8
+ import { DestinationAlphaSenderListInstance } from "./service/destinationAlphaSender";
8
9
  import { PhoneNumberListInstance } from "./service/phoneNumber";
9
10
  import { ShortCodeListInstance } from "./service/shortCode";
10
11
  import { UsAppToPersonListInstance } from "./service/usAppToPerson";
@@ -120,6 +121,7 @@ export interface ServiceListInstancePageOptions {
120
121
  export interface ServiceContext {
121
122
  alphaSenders: AlphaSenderListInstance;
122
123
  channelSenders: ChannelSenderListInstance;
124
+ destinationAlphaSenders: DestinationAlphaSenderListInstance;
123
125
  phoneNumbers: PhoneNumberListInstance;
124
126
  shortCodes: ShortCodeListInstance;
125
127
  usAppToPerson: UsAppToPersonListInstance;
@@ -172,6 +174,7 @@ export declare class ServiceContextImpl implements ServiceContext {
172
174
  protected _uri: string;
173
175
  protected _alphaSenders?: AlphaSenderListInstance;
174
176
  protected _channelSenders?: ChannelSenderListInstance;
177
+ protected _destinationAlphaSenders?: DestinationAlphaSenderListInstance;
175
178
  protected _phoneNumbers?: PhoneNumberListInstance;
176
179
  protected _shortCodes?: ShortCodeListInstance;
177
180
  protected _usAppToPerson?: UsAppToPersonListInstance;
@@ -179,6 +182,7 @@ export declare class ServiceContextImpl implements ServiceContext {
179
182
  constructor(_version: V1, sid: string);
180
183
  get alphaSenders(): AlphaSenderListInstance;
181
184
  get channelSenders(): ChannelSenderListInstance;
185
+ get destinationAlphaSenders(): DestinationAlphaSenderListInstance;
182
186
  get phoneNumbers(): PhoneNumberListInstance;
183
187
  get shortCodes(): ShortCodeListInstance;
184
188
  get usAppToPerson(): UsAppToPersonListInstance;
@@ -358,6 +362,10 @@ export declare class ServiceInstance {
358
362
  * Access the channelSenders.
359
363
  */
360
364
  channelSenders(): ChannelSenderListInstance;
365
+ /**
366
+ * Access the destinationAlphaSenders.
367
+ */
368
+ destinationAlphaSenders(): DestinationAlphaSenderListInstance;
361
369
  /**
362
370
  * Access the phoneNumbers.
363
371
  */
@@ -24,6 +24,7 @@ const serialize = require("../../../base/serialize");
24
24
  const utility_1 = require("../../../base/utility");
25
25
  const alphaSender_1 = require("./service/alphaSender");
26
26
  const channelSender_1 = require("./service/channelSender");
27
+ const destinationAlphaSender_1 = require("./service/destinationAlphaSender");
27
28
  const phoneNumber_1 = require("./service/phoneNumber");
28
29
  const shortCode_1 = require("./service/shortCode");
29
30
  const usAppToPerson_1 = require("./service/usAppToPerson");
@@ -49,6 +50,12 @@ class ServiceContextImpl {
49
50
  (0, channelSender_1.ChannelSenderListInstance)(this._version, this._solution.sid);
50
51
  return this._channelSenders;
51
52
  }
53
+ get destinationAlphaSenders() {
54
+ this._destinationAlphaSenders =
55
+ this._destinationAlphaSenders ||
56
+ (0, destinationAlphaSender_1.DestinationAlphaSenderListInstance)(this._version, this._solution.sid);
57
+ return this._destinationAlphaSenders;
58
+ }
52
59
  get phoneNumbers() {
53
60
  this._phoneNumbers =
54
61
  this._phoneNumbers ||
@@ -234,6 +241,12 @@ class ServiceInstance {
234
241
  channelSenders() {
235
242
  return this._proxy.channelSenders;
236
243
  }
244
+ /**
245
+ * Access the destinationAlphaSenders.
246
+ */
247
+ destinationAlphaSenders() {
248
+ return this._proxy.destinationAlphaSenders;
249
+ }
237
250
  /**
238
251
  * Access the phoneNumbers.
239
252
  */
@@ -7,8 +7,8 @@ import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNum
7
7
  import { PortingPortabilityListInstance } from "./v1/portingPortability";
8
8
  import { PortingWebhookConfigurationListInstance } from "./v1/portingWebhookConfiguration";
9
9
  import { PortingWebhookConfigurationDeleteListInstance } from "./v1/portingWebhookConfigurationDelete";
10
+ import { PortingWebhookConfigurationFetchListInstance } from "./v1/portingWebhookConfigurationFetch";
10
11
  import { SigningRequestConfigurationListInstance } from "./v1/signingRequestConfiguration";
11
- import { WebhookListInstance } from "./v1/webhook";
12
12
  export default class V1 extends Version {
13
13
  /**
14
14
  * Initialize the V1 version of Numbers
@@ -30,10 +30,10 @@ export default class V1 extends Version {
30
30
  protected _portingWebhookConfigurations?: PortingWebhookConfigurationListInstance;
31
31
  /** portingWebhookConfigurationsDelete - { Twilio.Numbers.V1.PortingWebhookConfigurationDeleteListInstance } resource */
32
32
  protected _portingWebhookConfigurationsDelete?: PortingWebhookConfigurationDeleteListInstance;
33
+ /** portingWebhookConfigurationFetch - { Twilio.Numbers.V1.PortingWebhookConfigurationFetchListInstance } resource */
34
+ protected _portingWebhookConfigurationFetch?: PortingWebhookConfigurationFetchListInstance;
33
35
  /** signingRequestConfigurations - { Twilio.Numbers.V1.SigningRequestConfigurationListInstance } resource */
34
36
  protected _signingRequestConfigurations?: SigningRequestConfigurationListInstance;
35
- /** webhook - { Twilio.Numbers.V1.WebhookListInstance } resource */
36
- protected _webhook?: WebhookListInstance;
37
37
  /** Getter for bulkEligibilities resource */
38
38
  get bulkEligibilities(): BulkEligibilityListInstance;
39
39
  /** Getter for eligibilities resource */
@@ -48,8 +48,8 @@ export default class V1 extends Version {
48
48
  get portingWebhookConfigurations(): PortingWebhookConfigurationListInstance;
49
49
  /** Getter for portingWebhookConfigurationsDelete resource */
50
50
  get portingWebhookConfigurationsDelete(): PortingWebhookConfigurationDeleteListInstance;
51
+ /** Getter for portingWebhookConfigurationFetch resource */
52
+ get portingWebhookConfigurationFetch(): PortingWebhookConfigurationFetchListInstance;
51
53
  /** Getter for signingRequestConfigurations resource */
52
54
  get signingRequestConfigurations(): SigningRequestConfigurationListInstance;
53
- /** Getter for webhook resource */
54
- get webhook(): WebhookListInstance;
55
55
  }
@@ -24,8 +24,8 @@ const portingPortInPhoneNumber_1 = require("./v1/portingPortInPhoneNumber");
24
24
  const portingPortability_1 = require("./v1/portingPortability");
25
25
  const portingWebhookConfiguration_1 = require("./v1/portingWebhookConfiguration");
26
26
  const portingWebhookConfigurationDelete_1 = require("./v1/portingWebhookConfigurationDelete");
27
+ const portingWebhookConfigurationFetch_1 = require("./v1/portingWebhookConfigurationFetch");
27
28
  const signingRequestConfiguration_1 = require("./v1/signingRequestConfiguration");
28
- const webhook_1 = require("./v1/webhook");
29
29
  class V1 extends Version_1.default {
30
30
  /**
31
31
  * Initialize the V1 version of Numbers
@@ -79,6 +79,13 @@ class V1 extends Version_1.default {
79
79
  (0, portingWebhookConfigurationDelete_1.PortingWebhookConfigurationDeleteListInstance)(this);
80
80
  return this._portingWebhookConfigurationsDelete;
81
81
  }
82
+ /** Getter for portingWebhookConfigurationFetch resource */
83
+ get portingWebhookConfigurationFetch() {
84
+ this._portingWebhookConfigurationFetch =
85
+ this._portingWebhookConfigurationFetch ||
86
+ (0, portingWebhookConfigurationFetch_1.PortingWebhookConfigurationFetchListInstance)(this);
87
+ return this._portingWebhookConfigurationFetch;
88
+ }
82
89
  /** Getter for signingRequestConfigurations resource */
83
90
  get signingRequestConfigurations() {
84
91
  this._signingRequestConfigurations =
@@ -86,10 +93,5 @@ class V1 extends Version_1.default {
86
93
  (0, signingRequestConfiguration_1.SigningRequestConfigurationListInstance)(this);
87
94
  return this._signingRequestConfigurations;
88
95
  }
89
- /** Getter for webhook resource */
90
- get webhook() {
91
- this._webhook = this._webhook || (0, webhook_1.WebhookListInstance)(this);
92
- return this._webhook;
93
- }
94
96
  }
95
97
  exports.default = V1;
@@ -1,28 +1,28 @@
1
1
  /// <reference types="node" />
2
2
  import { inspect, InspectOptions } from "util";
3
3
  import V1 from "../V1";
4
- export interface WebhookSolution {
4
+ export interface PortingWebhookConfigurationFetchSolution {
5
5
  }
6
- export interface WebhookListInstance {
6
+ export interface PortingWebhookConfigurationFetchListInstance {
7
7
  _version: V1;
8
- _solution: WebhookSolution;
8
+ _solution: PortingWebhookConfigurationFetchSolution;
9
9
  _uri: string;
10
10
  /**
11
- * Fetch a WebhookInstance
11
+ * Fetch a PortingWebhookConfigurationFetchInstance
12
12
  *
13
13
  * @param callback - Callback to handle processed record
14
14
  *
15
- * @returns Resolves to processed WebhookInstance
15
+ * @returns Resolves to processed PortingWebhookConfigurationFetchInstance
16
16
  */
17
- fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>;
17
+ fetch(callback?: (error: Error | null, item?: PortingWebhookConfigurationFetchInstance) => any): Promise<PortingWebhookConfigurationFetchInstance>;
18
18
  /**
19
19
  * Provide a user-friendly representation
20
20
  */
21
21
  toJSON(): any;
22
22
  [inspect.custom](_depth: any, options: InspectOptions): any;
23
23
  }
24
- export declare function WebhookListInstance(version: V1): WebhookListInstance;
25
- interface WebhookResource {
24
+ export declare function PortingWebhookConfigurationFetchListInstance(version: V1): PortingWebhookConfigurationFetchListInstance;
25
+ interface PortingWebhookConfigurationFetchResource {
26
26
  url: string;
27
27
  port_in_target_url: string;
28
28
  port_out_target_url: string;
@@ -30,9 +30,9 @@ interface WebhookResource {
30
30
  port_in_target_date_created: Date;
31
31
  port_out_target_date_created: Date;
32
32
  }
33
- export declare class WebhookInstance {
33
+ export declare class PortingWebhookConfigurationFetchInstance {
34
34
  protected _version: V1;
35
- constructor(_version: V1, payload: WebhookResource);
35
+ constructor(_version: V1, payload: PortingWebhookConfigurationFetchResource);
36
36
  /**
37
37
  * The URL of the webhook configuration request
38
38
  */
@@ -13,11 +13,11 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.WebhookInstance = exports.WebhookListInstance = void 0;
16
+ exports.PortingWebhookConfigurationFetchInstance = exports.PortingWebhookConfigurationFetchListInstance = void 0;
17
17
  const util_1 = require("util");
18
18
  const deserialize = require("../../../base/deserialize");
19
19
  const serialize = require("../../../base/serialize");
20
- function WebhookListInstance(version) {
20
+ function PortingWebhookConfigurationFetchListInstance(version) {
21
21
  const instance = {};
22
22
  instance._version = version;
23
23
  instance._solution = {};
@@ -30,7 +30,7 @@ function WebhookListInstance(version) {
30
30
  method: "get",
31
31
  headers,
32
32
  });
33
- operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload));
33
+ operationPromise = operationPromise.then((payload) => new PortingWebhookConfigurationFetchInstance(operationVersion, payload));
34
34
  operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
35
35
  return operationPromise;
36
36
  };
@@ -42,8 +42,8 @@ function WebhookListInstance(version) {
42
42
  };
43
43
  return instance;
44
44
  }
45
- exports.WebhookListInstance = WebhookListInstance;
46
- class WebhookInstance {
45
+ exports.PortingWebhookConfigurationFetchListInstance = PortingWebhookConfigurationFetchListInstance;
46
+ class PortingWebhookConfigurationFetchInstance {
47
47
  constructor(_version, payload) {
48
48
  this._version = _version;
49
49
  this.url = payload.url;
@@ -72,4 +72,4 @@ class WebhookInstance {
72
72
  return (0, util_1.inspect)(this.toJSON(), options);
73
73
  }
74
74
  }
75
- exports.WebhookInstance = WebhookInstance;
75
+ exports.PortingWebhookConfigurationFetchInstance = PortingWebhookConfigurationFetchInstance;
@@ -7,6 +7,7 @@ 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 querystring_1 = require("querystring");
10
11
  /**
11
12
  * Utility function to construct the URL string, since Node.js url library won't include standard port numbers
12
13
  *
@@ -43,9 +44,19 @@ function addPort(parsedUrl) {
43
44
  @returns URL without port
44
45
  */
45
46
  function removePort(parsedUrl) {
47
+ parsedUrl = new URL(parsedUrl); // prevent mutation of original URL object
46
48
  parsedUrl.port = "";
47
49
  return parsedUrl.toString();
48
50
  }
51
+ function withLegacyQuerystring(url) {
52
+ const parsedUrl = new URL(url);
53
+ if (parsedUrl.search) {
54
+ const qs = (0, querystring_1.parse)(parsedUrl.search.slice(1));
55
+ parsedUrl.search = "";
56
+ return parsedUrl.toString() + "?" + (0, querystring_1.stringify)(qs);
57
+ }
58
+ return url;
59
+ }
49
60
  /**
50
61
  Utility function to convert request parameter to a string format
51
62
 
@@ -108,19 +119,31 @@ exports.getExpectedBodyHash = getExpectedBodyHash;
108
119
  function validateRequest(authToken, twilioHeader, url, params) {
109
120
  twilioHeader = twilioHeader || "";
110
121
  const urlObject = new URL(url);
111
- const urlWithPort = addPort(urlObject);
112
- const urlWithoutPort = removePort(urlObject);
113
122
  /*
114
123
  * Check signature of the url with and without the port number
124
+ * and with and without the legacy querystring (special chars are encoded when using `new URL()`)
115
125
  * since signature generation on the back end is inconsistent
116
126
  */
117
- const signatureWithPort = getExpectedTwilioSignature(authToken, urlWithPort, params);
118
- const signatureWithoutPort = getExpectedTwilioSignature(authToken, urlWithoutPort, params);
119
- const validSignatureWithPort = scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithPort));
120
- const validSignatureWithoutPort = scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithoutPort));
121
- return validSignatureWithoutPort || validSignatureWithPort;
127
+ const isValidSignatureWithoutPort = validateSignatureWithUrl(authToken, twilioHeader, removePort(urlObject), params);
128
+ if (isValidSignatureWithoutPort) {
129
+ return true;
130
+ }
131
+ const isValidSignatureWithPort = validateSignatureWithUrl(authToken, twilioHeader, addPort(urlObject), params);
132
+ if (isValidSignatureWithPort) {
133
+ return true;
134
+ }
135
+ const isValidSignatureWithLegacyQuerystringWithoutPort = validateSignatureWithUrl(authToken, twilioHeader, withLegacyQuerystring(removePort(urlObject)), params);
136
+ if (isValidSignatureWithLegacyQuerystringWithoutPort) {
137
+ return true;
138
+ }
139
+ const isValidSignatureWithLegacyQuerystringWithPort = validateSignatureWithUrl(authToken, twilioHeader, withLegacyQuerystring(addPort(urlObject)), params);
140
+ return isValidSignatureWithLegacyQuerystringWithPort;
122
141
  }
123
142
  exports.validateRequest = validateRequest;
143
+ function validateSignatureWithUrl(authToken, twilioHeader, url, params) {
144
+ const signatureWithoutPort = getExpectedTwilioSignature(authToken, url, params);
145
+ return scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithoutPort));
146
+ }
124
147
  function validateBody(body, bodyHash) {
125
148
  var expectedHash = getExpectedBodyHash(body);
126
149
  return scmp(Buffer.from(bodyHash), Buffer.from(expectedHash));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "twilio",
3
3
  "description": "A Twilio helper library",
4
- "version": "5.4.2",
4
+ "version": "5.4.4",
5
5
  "author": "API Team <api@twilio.com>",
6
6
  "contributors": [
7
7
  {
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/twilio/twilio-node.git"
21
21
  },
22
22
  "dependencies": {
23
- "axios": "^1.7.4",
23
+ "axios": "^1.7.8",
24
24
  "dayjs": "^1.11.9",
25
25
  "https-proxy-agent": "^5.0.0",
26
26
  "jsonwebtoken": "^9.0.2",