twilio 5.4.1 → 5.4.3

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.
@@ -41,7 +41,7 @@ export interface TranscriptionListInstanceCreateOptions {
41
41
  hints?: string;
42
42
  /** The provider will add punctuation to recognition result */
43
43
  enableAutomaticPunctuation?: boolean;
44
- /** The SID or the unique name of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. */
44
+ /** The SID of the [Voice Intelligence Service](https://www.twilio.com/docs/voice/intelligence/api/service-resource) for persisting transcripts and running post-call Language Operators . */
45
45
  intelligenceService?: string;
46
46
  }
47
47
  export interface TranscriptionContext {
@@ -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
  */
@@ -9,7 +9,7 @@ export type WebhookTarget = "webhook" | "flex";
9
9
  export interface WebhookContextUpdateOptions {
10
10
  /** The HTTP method to be used when sending a webhook request. */
11
11
  method?: string;
12
- /** The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` */
12
+ /** The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated` */
13
13
  filters?: Array<string>;
14
14
  /** The absolute url the pre-event webhook request should be sent to. */
15
15
  preWebhookUrl?: string;
@@ -87,7 +87,7 @@ export declare class WebhookInstance {
87
87
  accountSid: string;
88
88
  method: WebhookMethod;
89
89
  /**
90
- * The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`
90
+ * The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onMessageAdd`, `onMessageUpdate`, `onMessageRemove`, `onConversationUpdated`, `onConversationRemoved`, `onConversationAdd`, `onConversationAdded`, `onConversationRemove`, `onConversationUpdate`, `onConversationStateUpdated`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onParticipantAdd`, `onParticipantRemove`, `onParticipantUpdate`, `onDeliveryUpdated`, `onUserAdded`, `onUserUpdate`, `onUserUpdated`
91
91
  */
92
92
  filters: Array<string>;
93
93
  /**
@@ -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";
@@ -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
@@ -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;
@@ -2,6 +2,7 @@ import MarketplaceBase from "../MarketplaceBase";
2
2
  import Version from "../../base/Version";
3
3
  import { AvailableAddOnListInstance } from "./v1/availableAddOn";
4
4
  import { InstalledAddOnListInstance } from "./v1/installedAddOn";
5
+ import { ModuleDataListInstance } from "./v1/moduleData";
5
6
  import { ModuleDataManagementListInstance } from "./v1/moduleDataManagement";
6
7
  import { ReferralConversionListInstance } from "./v1/referralConversion";
7
8
  export default class V1 extends Version {
@@ -15,6 +16,8 @@ export default class V1 extends Version {
15
16
  protected _availableAddOns?: AvailableAddOnListInstance;
16
17
  /** installedAddOns - { Twilio.Marketplace.V1.InstalledAddOnListInstance } resource */
17
18
  protected _installedAddOns?: InstalledAddOnListInstance;
19
+ /** moduleData - { Twilio.Marketplace.V1.ModuleDataListInstance } resource */
20
+ protected _moduleData?: ModuleDataListInstance;
18
21
  /** moduleDataManagement - { Twilio.Marketplace.V1.ModuleDataManagementListInstance } resource */
19
22
  protected _moduleDataManagement?: ModuleDataManagementListInstance;
20
23
  /** referralConversion - { Twilio.Marketplace.V1.ReferralConversionListInstance } resource */
@@ -23,6 +26,8 @@ export default class V1 extends Version {
23
26
  get availableAddOns(): AvailableAddOnListInstance;
24
27
  /** Getter for installedAddOns resource */
25
28
  get installedAddOns(): InstalledAddOnListInstance;
29
+ /** Getter for moduleData resource */
30
+ get moduleData(): ModuleDataListInstance;
26
31
  /** Getter for moduleDataManagement resource */
27
32
  get moduleDataManagement(): ModuleDataManagementListInstance;
28
33
  /** Getter for referralConversion resource */
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const Version_1 = __importDefault(require("../../base/Version"));
20
20
  const availableAddOn_1 = require("./v1/availableAddOn");
21
21
  const installedAddOn_1 = require("./v1/installedAddOn");
22
+ const moduleData_1 = require("./v1/moduleData");
22
23
  const moduleDataManagement_1 = require("./v1/moduleDataManagement");
23
24
  const referralConversion_1 = require("./v1/referralConversion");
24
25
  class V1 extends Version_1.default {
@@ -42,6 +43,11 @@ class V1 extends Version_1.default {
42
43
  this._installedAddOns || (0, installedAddOn_1.InstalledAddOnListInstance)(this);
43
44
  return this._installedAddOns;
44
45
  }
46
+ /** Getter for moduleData resource */
47
+ get moduleData() {
48
+ this._moduleData = this._moduleData || (0, moduleData_1.ModuleDataListInstance)(this);
49
+ return this._moduleData;
50
+ }
45
51
  /** Getter for moduleDataManagement resource */
46
52
  get moduleDataManagement() {
47
53
  this._moduleDataManagement =
@@ -80,7 +80,7 @@ interface AvailableAddOnResource {
80
80
  friendly_name: string;
81
81
  description: string;
82
82
  pricing_type: string;
83
- configuration_schema: any;
83
+ configuration_schema: Record<string, object>;
84
84
  url: string;
85
85
  links: Record<string, string>;
86
86
  }
@@ -108,7 +108,7 @@ export declare class AvailableAddOnInstance {
108
108
  /**
109
109
  * The JSON object with the configuration that must be provided when installing a given Add-on.
110
110
  */
111
- configurationSchema: any;
111
+ configurationSchema: Record<string, object>;
112
112
  /**
113
113
  * The absolute URL of the resource.
114
114
  */
@@ -140,7 +140,7 @@ export declare class AvailableAddOnInstance {
140
140
  friendlyName: string;
141
141
  description: string;
142
142
  pricingType: string;
143
- configurationSchema: any;
143
+ configurationSchema: Record<string, object>;
144
144
  url: string;
145
145
  links: Record<string, string>;
146
146
  };
@@ -133,7 +133,7 @@ interface InstalledAddOnResource {
133
133
  account_sid: string;
134
134
  friendly_name: string;
135
135
  description: string;
136
- configuration: any;
136
+ configuration: Record<string, object>;
137
137
  unique_name: string;
138
138
  date_created: Date;
139
139
  date_updated: Date;
@@ -164,7 +164,7 @@ export declare class InstalledAddOnInstance {
164
164
  /**
165
165
  * The JSON object that represents the current configuration of installed Add-on.
166
166
  */
167
- configuration: any;
167
+ configuration: Record<string, object>;
168
168
  /**
169
169
  * An application-defined string that uniquely identifies the resource.
170
170
  */
@@ -237,7 +237,7 @@ export declare class InstalledAddOnInstance {
237
237
  accountSid: string;
238
238
  friendlyName: string;
239
239
  description: string;
240
- configuration: any;
240
+ configuration: Record<string, object>;
241
241
  uniqueName: string;
242
242
  dateCreated: Date;
243
243
  dateUpdated: Date;
@@ -0,0 +1,125 @@
1
+ /// <reference types="node" />
2
+ import { inspect, InspectOptions } from "util";
3
+ import V1 from "../V1";
4
+ /**
5
+ * Options to pass to create a ModuleDataInstance
6
+ */
7
+ export interface ModuleDataListInstanceCreateOptions {
8
+ /** A JSON object containing essential attributes that define a Listing. */
9
+ moduleInfo?: string;
10
+ /** A JSON object for providing Listing-specific configuration. Contains button setup, notification URL, and more. */
11
+ configuration?: string;
12
+ }
13
+ export interface ModuleDataSolution {
14
+ }
15
+ export interface ModuleDataListInstance {
16
+ _version: V1;
17
+ _solution: ModuleDataSolution;
18
+ _uri: string;
19
+ /**
20
+ * Create a ModuleDataInstance
21
+ *
22
+ * @param callback - Callback to handle processed record
23
+ *
24
+ * @returns Resolves to processed ModuleDataInstance
25
+ */
26
+ create(callback?: (error: Error | null, item?: ModuleDataInstance) => any): Promise<ModuleDataInstance>;
27
+ /**
28
+ * Create a ModuleDataInstance
29
+ *
30
+ * @param params - Parameter for request
31
+ * @param callback - Callback to handle processed record
32
+ *
33
+ * @returns Resolves to processed ModuleDataInstance
34
+ */
35
+ create(params: ModuleDataListInstanceCreateOptions, callback?: (error: Error | null, item?: ModuleDataInstance) => any): Promise<ModuleDataInstance>;
36
+ /**
37
+ * Fetch a ModuleDataInstance
38
+ *
39
+ * @param callback - Callback to handle processed record
40
+ *
41
+ * @returns Resolves to processed ModuleDataInstance
42
+ */
43
+ fetch(callback?: (error: Error | null, item?: ModuleDataInstance) => any): Promise<ModuleDataInstance>;
44
+ /**
45
+ * Provide a user-friendly representation
46
+ */
47
+ toJSON(): any;
48
+ [inspect.custom](_depth: any, options: InspectOptions): any;
49
+ }
50
+ export declare function ModuleDataListInstance(version: V1): ModuleDataListInstance;
51
+ interface ModuleDataResource {
52
+ url: string;
53
+ sid: string;
54
+ description: Record<string, object>;
55
+ support: Record<string, object>;
56
+ policies: Record<string, object>;
57
+ module_info: Record<string, object>;
58
+ documentation: Record<string, object>;
59
+ configuration: Record<string, object>;
60
+ pricing: Record<string, object>;
61
+ listings: Array<Record<string, object>>;
62
+ }
63
+ export declare class ModuleDataInstance {
64
+ protected _version: V1;
65
+ constructor(_version: V1, payload: ModuleDataResource);
66
+ /**
67
+ * URL to query the subresource.
68
+ */
69
+ url: string;
70
+ /**
71
+ * ModuleSid that identifies this Listing.
72
+ */
73
+ sid: string;
74
+ /**
75
+ * A JSON object describing the module and is displayed under the Description tab of the Module detail page. You can define the main body of the description, highlight key features or aspects of the module and if applicable, provide code samples for developers
76
+ */
77
+ description: Record<string, object>;
78
+ /**
79
+ * A JSON object containing information on how customers can obtain support for the module. Use this parameter to provide details such as contact information and support description.
80
+ */
81
+ support: Record<string, object>;
82
+ /**
83
+ * A JSON object describing the module\'s privacy and legal policies and is displayed under the Policies tab of the Module detail page. The maximum file size for Policies is 5MB
84
+ */
85
+ policies: Record<string, object>;
86
+ /**
87
+ * A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object
88
+ */
89
+ moduleInfo: Record<string, object>;
90
+ /**
91
+ * A JSON object for providing comprehensive information, instructions, and resources related to the module
92
+ */
93
+ documentation: Record<string, object>;
94
+ /**
95
+ * A JSON object for providing listing specific configuration. Contains button setup, notification url, among others.
96
+ */
97
+ configuration: Record<string, object>;
98
+ /**
99
+ * A JSON object for providing Listing specific pricing information.
100
+ */
101
+ pricing: Record<string, object>;
102
+ /**
103
+ *
104
+ */
105
+ listings: Array<Record<string, object>>;
106
+ /**
107
+ * Provide a user-friendly representation
108
+ *
109
+ * @returns Object
110
+ */
111
+ toJSON(): {
112
+ url: string;
113
+ sid: string;
114
+ description: Record<string, object>;
115
+ support: Record<string, object>;
116
+ policies: Record<string, object>;
117
+ moduleInfo: Record<string, object>;
118
+ documentation: Record<string, object>;
119
+ configuration: Record<string, object>;
120
+ pricing: Record<string, object>;
121
+ listings: Record<string, object>[];
122
+ };
123
+ [inspect.custom](_depth: any, options: InspectOptions): string;
124
+ }
125
+ export {};
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /*
3
+ * This code was generated by
4
+ * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
5
+ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
6
+ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
7
+ *
8
+ * Twilio - Marketplace
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.ModuleDataInstance = exports.ModuleDataListInstance = void 0;
17
+ const util_1 = require("util");
18
+ const deserialize = require("../../../base/deserialize");
19
+ const serialize = require("../../../base/serialize");
20
+ function ModuleDataListInstance(version) {
21
+ const instance = {};
22
+ instance._version = version;
23
+ instance._solution = {};
24
+ instance._uri = `/Listings`;
25
+ instance.create = function create(params, callback) {
26
+ if (params instanceof Function) {
27
+ callback = params;
28
+ params = {};
29
+ }
30
+ else {
31
+ params = params || {};
32
+ }
33
+ let data = {};
34
+ if (params["moduleInfo"] !== undefined)
35
+ data["ModuleInfo"] = params["moduleInfo"];
36
+ if (params["configuration"] !== undefined)
37
+ data["Configuration"] = params["configuration"];
38
+ const headers = {};
39
+ headers["Content-Type"] = "application/x-www-form-urlencoded";
40
+ headers["Accept"] = "application/json";
41
+ let operationVersion = version, operationPromise = operationVersion.create({
42
+ uri: instance._uri,
43
+ method: "post",
44
+ data,
45
+ headers,
46
+ });
47
+ operationPromise = operationPromise.then((payload) => new ModuleDataInstance(operationVersion, payload));
48
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
49
+ return operationPromise;
50
+ };
51
+ instance.fetch = function fetch(callback) {
52
+ const headers = {};
53
+ headers["Accept"] = "application/json";
54
+ let operationVersion = version, operationPromise = operationVersion.fetch({
55
+ uri: instance._uri,
56
+ method: "get",
57
+ headers,
58
+ });
59
+ operationPromise = operationPromise.then((payload) => new ModuleDataInstance(operationVersion, payload));
60
+ operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
61
+ return operationPromise;
62
+ };
63
+ instance.toJSON = function toJSON() {
64
+ return instance._solution;
65
+ };
66
+ instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
67
+ return (0, util_1.inspect)(instance.toJSON(), options);
68
+ };
69
+ return instance;
70
+ }
71
+ exports.ModuleDataListInstance = ModuleDataListInstance;
72
+ class ModuleDataInstance {
73
+ constructor(_version, payload) {
74
+ this._version = _version;
75
+ this.url = payload.url;
76
+ this.sid = payload.sid;
77
+ this.description = payload.description;
78
+ this.support = payload.support;
79
+ this.policies = payload.policies;
80
+ this.moduleInfo = payload.module_info;
81
+ this.documentation = payload.documentation;
82
+ this.configuration = payload.configuration;
83
+ this.pricing = payload.pricing;
84
+ this.listings = payload.listings;
85
+ }
86
+ /**
87
+ * Provide a user-friendly representation
88
+ *
89
+ * @returns Object
90
+ */
91
+ toJSON() {
92
+ return {
93
+ url: this.url,
94
+ sid: this.sid,
95
+ description: this.description,
96
+ support: this.support,
97
+ policies: this.policies,
98
+ moduleInfo: this.moduleInfo,
99
+ documentation: this.documentation,
100
+ configuration: this.configuration,
101
+ pricing: this.pricing,
102
+ listings: this.listings,
103
+ };
104
+ }
105
+ [util_1.inspect.custom](_depth, options) {
106
+ return (0, util_1.inspect)(this.toJSON(), options);
107
+ }
108
+ }
109
+ exports.ModuleDataInstance = ModuleDataInstance;
@@ -73,13 +73,14 @@ export declare class ModuleDataManagementContextImpl implements ModuleDataManage
73
73
  interface ModuleDataManagementResource {
74
74
  url: string;
75
75
  sid: string;
76
- description: any;
77
- support: any;
78
- policies: any;
79
- module_info: any;
80
- documentation: any;
81
- configuration: any;
82
- pricing: any;
76
+ description: Record<string, object>;
77
+ support: Record<string, object>;
78
+ policies: Record<string, object>;
79
+ module_info: Record<string, object>;
80
+ documentation: Record<string, object>;
81
+ configuration: Record<string, object>;
82
+ pricing: Record<string, object>;
83
+ listings: Array<Record<string, object>>;
83
84
  }
84
85
  export declare class ModuleDataManagementInstance {
85
86
  protected _version: V1;
@@ -97,31 +98,35 @@ export declare class ModuleDataManagementInstance {
97
98
  /**
98
99
  * A JSON object describing the module and is displayed under the Description tab of the Module detail page. You can define the main body of the description, highlight key features or aspects of the module and if applicable, provide code samples for developers
99
100
  */
100
- description: any;
101
+ description: Record<string, object>;
101
102
  /**
102
103
  * A JSON object containing information on how customers can obtain support for the module. Use this parameter to provide details such as contact information and support description.
103
104
  */
104
- support: any;
105
+ support: Record<string, object>;
105
106
  /**
106
107
  * A JSON object describing the module\'s privacy and legal policies and is displayed under the Policies tab of the Module detail page. The maximum file size for Policies is 5MB
107
108
  */
108
- policies: any;
109
+ policies: Record<string, object>;
109
110
  /**
110
111
  * A JSON object containing essential attributes that define a module. This information is presented on the Module detail page in the Twilio Marketplace Catalog. You can pass the following attributes in the JSON object
111
112
  */
112
- moduleInfo: any;
113
+ moduleInfo: Record<string, object>;
113
114
  /**
114
115
  * A JSON object for providing comprehensive information, instructions, and resources related to the module
115
116
  */
116
- documentation: any;
117
+ documentation: Record<string, object>;
117
118
  /**
118
119
  * A JSON object for providing listing specific configuration. Contains button setup, notification url, among others.
119
120
  */
120
- configuration: any;
121
+ configuration: Record<string, object>;
121
122
  /**
122
123
  * A JSON object for providing Listing specific pricing information.
123
124
  */
124
- pricing: any;
125
+ pricing: Record<string, object>;
126
+ /**
127
+ *
128
+ */
129
+ listings: Array<Record<string, object>>;
125
130
  private get _proxy();
126
131
  /**
127
132
  * Fetch a ModuleDataManagementInstance
@@ -156,13 +161,14 @@ export declare class ModuleDataManagementInstance {
156
161
  toJSON(): {
157
162
  url: string;
158
163
  sid: string;
159
- description: any;
160
- support: any;
161
- policies: any;
162
- moduleInfo: any;
163
- documentation: any;
164
- configuration: any;
165
- pricing: any;
164
+ description: Record<string, object>;
165
+ support: Record<string, object>;
166
+ policies: Record<string, object>;
167
+ moduleInfo: Record<string, object>;
168
+ documentation: Record<string, object>;
169
+ configuration: Record<string, object>;
170
+ pricing: Record<string, object>;
171
+ listings: Record<string, object>[];
166
172
  };
167
173
  [inspect.custom](_depth: any, options: InspectOptions): string;
168
174
  }
@@ -102,6 +102,7 @@ class ModuleDataManagementInstance {
102
102
  this.documentation = payload.documentation;
103
103
  this.configuration = payload.configuration;
104
104
  this.pricing = payload.pricing;
105
+ this.listings = payload.listings;
105
106
  this._solution = { sid: sid || this.sid };
106
107
  }
107
108
  get _proxy() {
@@ -139,6 +140,7 @@ class ModuleDataManagementInstance {
139
140
  documentation: this.documentation,
140
141
  configuration: this.configuration,
141
142
  pricing: this.pricing,
143
+ listings: this.listings,
142
144
  };
143
145
  }
144
146
  [util_1.inspect.custom](_depth, options) {
@@ -38,7 +38,7 @@ export interface ServiceContextUpdateOptions {
38
38
  fallbackToLongCode?: boolean;
39
39
  /** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */
40
40
  areaCodeGeomatch?: boolean;
41
- /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. */
41
+ /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. */
42
42
  validityPeriod?: number;
43
43
  /** Reserved. */
44
44
  synchronousValidation?: boolean;
@@ -75,7 +75,7 @@ export interface ServiceListInstanceCreateOptions {
75
75
  fallbackToLongCode?: boolean;
76
76
  /** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */
77
77
  areaCodeGeomatch?: boolean;
78
- /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. */
78
+ /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`. */
79
79
  validityPeriod?: number;
80
80
  /** Reserved. */
81
81
  synchronousValidation?: boolean;
@@ -293,7 +293,7 @@ export declare class ServiceInstance {
293
293
  */
294
294
  synchronousValidation: boolean;
295
295
  /**
296
- * How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`.
296
+ * How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. Default value is `14,400`.
297
297
  */
298
298
  validityPeriod: number;
299
299
  /**
@@ -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.1",
4
+ "version": "5.4.3",
5
5
  "author": "API Team <api@twilio.com>",
6
6
  "contributors": [
7
7
  {