twilio 5.0.3 → 5.0.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 +1 -0
- package/lib/rest/api/v2010/account/call/stream.d.ts +5 -5
- package/lib/rest/flexApi/V2.d.ts +5 -0
- package/lib/rest/flexApi/V2.js +6 -0
- package/lib/rest/flexApi/v2/flexUser.d.ts +170 -0
- package/lib/rest/flexApi/v2/flexUser.js +142 -0
- package/lib/rest/flexApi/v2/webChannels.d.ts +2 -0
- package/lib/rest/flexApi/v2/webChannels.js +2 -0
- package/lib/rest/numbers/V1.d.ts +5 -0
- package/lib/rest/numbers/V1.js +8 -0
- package/lib/rest/numbers/v1/portingPortIn.d.ts +65 -20
- package/lib/rest/numbers/v1/portingPortIn.js +78 -24
- package/lib/rest/numbers/v1/portingPortInPhoneNumber.d.ts +51 -0
- package/lib/rest/numbers/v1/portingPortInPhoneNumber.js +71 -0
- package/lib/webhooks/webhooks.js +5 -6
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -15,15 +15,15 @@ export interface StreamContextUpdateOptions {
|
|
|
15
15
|
* Options to pass to create a StreamInstance
|
|
16
16
|
*/
|
|
17
17
|
export interface StreamListInstanceCreateOptions {
|
|
18
|
-
/** Relative or absolute
|
|
18
|
+
/** Relative or absolute URL where WebSocket connection will be established. */
|
|
19
19
|
url: string;
|
|
20
|
-
/** The user-specified name of this Stream, if one was given when the Stream was created. This
|
|
20
|
+
/** The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. */
|
|
21
21
|
name?: string;
|
|
22
22
|
/** */
|
|
23
23
|
track?: StreamTrack;
|
|
24
|
-
/** Absolute URL
|
|
24
|
+
/** Absolute URL to which Twilio sends status callback HTTP requests. */
|
|
25
25
|
statusCallback?: string;
|
|
26
|
-
/** The
|
|
26
|
+
/** The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`. */
|
|
27
27
|
statusCallbackMethod?: string;
|
|
28
28
|
/** Parameter name */
|
|
29
29
|
"parameter1.name"?: string;
|
|
@@ -484,7 +484,7 @@ export declare class StreamInstance {
|
|
|
484
484
|
*/
|
|
485
485
|
callSid: string;
|
|
486
486
|
/**
|
|
487
|
-
* The user-specified name of this Stream, if one was given when the Stream was created. This
|
|
487
|
+
* The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream.
|
|
488
488
|
*/
|
|
489
489
|
name: string;
|
|
490
490
|
status: StreamStatus;
|
package/lib/rest/flexApi/V2.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import FlexApiBase from "../FlexApiBase";
|
|
2
2
|
import Version from "../../base/Version";
|
|
3
|
+
import { FlexUserListInstance } from "./v2/flexUser";
|
|
3
4
|
import { WebChannelsListInstance } from "./v2/webChannels";
|
|
4
5
|
export default class V2 extends Version {
|
|
5
6
|
/**
|
|
@@ -8,8 +9,12 @@ export default class V2 extends Version {
|
|
|
8
9
|
* @param domain - The Twilio (Twilio.FlexApi) domain
|
|
9
10
|
*/
|
|
10
11
|
constructor(domain: FlexApiBase);
|
|
12
|
+
/** flexUser - { Twilio.FlexApi.V2.FlexUserListInstance } resource */
|
|
13
|
+
protected _flexUser?: FlexUserListInstance;
|
|
11
14
|
/** webChannels - { Twilio.FlexApi.V2.WebChannelsListInstance } resource */
|
|
12
15
|
protected _webChannels?: WebChannelsListInstance;
|
|
16
|
+
/** Getter for flexUser resource */
|
|
17
|
+
get flexUser(): FlexUserListInstance;
|
|
13
18
|
/** Getter for webChannels resource */
|
|
14
19
|
get webChannels(): WebChannelsListInstance;
|
|
15
20
|
}
|
package/lib/rest/flexApi/V2.js
CHANGED
|
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
const Version_1 = __importDefault(require("../../base/Version"));
|
|
20
|
+
const flexUser_1 = require("./v2/flexUser");
|
|
20
21
|
const webChannels_1 = require("./v2/webChannels");
|
|
21
22
|
class V2 extends Version_1.default {
|
|
22
23
|
/**
|
|
@@ -27,6 +28,11 @@ class V2 extends Version_1.default {
|
|
|
27
28
|
constructor(domain) {
|
|
28
29
|
super(domain, "v2");
|
|
29
30
|
}
|
|
31
|
+
/** Getter for flexUser resource */
|
|
32
|
+
get flexUser() {
|
|
33
|
+
this._flexUser = this._flexUser || (0, flexUser_1.FlexUserListInstance)(this);
|
|
34
|
+
return this._flexUser;
|
|
35
|
+
}
|
|
30
36
|
/** Getter for webChannels resource */
|
|
31
37
|
get webChannels() {
|
|
32
38
|
this._webChannels = this._webChannels || (0, webChannels_1.WebChannelsListInstance)(this);
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect, InspectOptions } from "util";
|
|
3
|
+
import V2 from "../V2";
|
|
4
|
+
export interface FlexUserContext {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch a FlexUserInstance
|
|
7
|
+
*
|
|
8
|
+
* @param callback - Callback to handle processed record
|
|
9
|
+
*
|
|
10
|
+
* @returns Resolves to processed FlexUserInstance
|
|
11
|
+
*/
|
|
12
|
+
fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>;
|
|
13
|
+
/**
|
|
14
|
+
* Provide a user-friendly representation
|
|
15
|
+
*/
|
|
16
|
+
toJSON(): any;
|
|
17
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
18
|
+
}
|
|
19
|
+
export interface FlexUserContextSolution {
|
|
20
|
+
instanceSid: string;
|
|
21
|
+
flexUserSid: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class FlexUserContextImpl implements FlexUserContext {
|
|
24
|
+
protected _version: V2;
|
|
25
|
+
protected _solution: FlexUserContextSolution;
|
|
26
|
+
protected _uri: string;
|
|
27
|
+
constructor(_version: V2, instanceSid: string, flexUserSid: string);
|
|
28
|
+
fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>;
|
|
29
|
+
/**
|
|
30
|
+
* Provide a user-friendly representation
|
|
31
|
+
*
|
|
32
|
+
* @returns Object
|
|
33
|
+
*/
|
|
34
|
+
toJSON(): FlexUserContextSolution;
|
|
35
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
36
|
+
}
|
|
37
|
+
interface FlexUserResource {
|
|
38
|
+
account_sid: string;
|
|
39
|
+
instance_sid: string;
|
|
40
|
+
user_sid: string;
|
|
41
|
+
flex_user_sid: string;
|
|
42
|
+
worker_sid: string;
|
|
43
|
+
workspace_sid: string;
|
|
44
|
+
flex_team_sid: string;
|
|
45
|
+
first_name: string;
|
|
46
|
+
last_name: string;
|
|
47
|
+
username: string;
|
|
48
|
+
email: string;
|
|
49
|
+
friendly_name: string;
|
|
50
|
+
created_date: Date;
|
|
51
|
+
updated_date: Date;
|
|
52
|
+
version: number;
|
|
53
|
+
url: string;
|
|
54
|
+
}
|
|
55
|
+
export declare class FlexUserInstance {
|
|
56
|
+
protected _version: V2;
|
|
57
|
+
protected _solution: FlexUserContextSolution;
|
|
58
|
+
protected _context?: FlexUserContext;
|
|
59
|
+
constructor(_version: V2, payload: FlexUserResource, instanceSid?: string, flexUserSid?: string);
|
|
60
|
+
/**
|
|
61
|
+
* The unique SID of the account that created the resource.
|
|
62
|
+
*/
|
|
63
|
+
accountSid: string;
|
|
64
|
+
/**
|
|
65
|
+
* The unique ID created by Twilio to identify a Flex instance.
|
|
66
|
+
*/
|
|
67
|
+
instanceSid: string;
|
|
68
|
+
/**
|
|
69
|
+
* The unique SID identifier of the Twilio Unified User.
|
|
70
|
+
*/
|
|
71
|
+
userSid: string;
|
|
72
|
+
/**
|
|
73
|
+
* The unique SID identifier of the Flex User.
|
|
74
|
+
*/
|
|
75
|
+
flexUserSid: string;
|
|
76
|
+
/**
|
|
77
|
+
* The unique SID identifier of the worker.
|
|
78
|
+
*/
|
|
79
|
+
workerSid: string;
|
|
80
|
+
/**
|
|
81
|
+
* The unique SID identifier of the workspace.
|
|
82
|
+
*/
|
|
83
|
+
workspaceSid: string;
|
|
84
|
+
/**
|
|
85
|
+
* The unique SID identifier of the Flex Team.
|
|
86
|
+
*/
|
|
87
|
+
flexTeamSid: string;
|
|
88
|
+
/**
|
|
89
|
+
* First name of the User.
|
|
90
|
+
*/
|
|
91
|
+
firstName: string;
|
|
92
|
+
/**
|
|
93
|
+
* Last name of the User.
|
|
94
|
+
*/
|
|
95
|
+
lastName: string;
|
|
96
|
+
/**
|
|
97
|
+
* Username of the User.
|
|
98
|
+
*/
|
|
99
|
+
username: string;
|
|
100
|
+
/**
|
|
101
|
+
* Email of the User.
|
|
102
|
+
*/
|
|
103
|
+
email: string;
|
|
104
|
+
/**
|
|
105
|
+
* Friendly name of the User.
|
|
106
|
+
*/
|
|
107
|
+
friendlyName: string;
|
|
108
|
+
/**
|
|
109
|
+
* The date that this user was created, given in ISO 8601 format.
|
|
110
|
+
*/
|
|
111
|
+
createdDate: Date;
|
|
112
|
+
/**
|
|
113
|
+
* The date that this user was updated, given in ISO 8601 format.
|
|
114
|
+
*/
|
|
115
|
+
updatedDate: Date;
|
|
116
|
+
/**
|
|
117
|
+
* The current version of the user.
|
|
118
|
+
*/
|
|
119
|
+
version: number;
|
|
120
|
+
url: string;
|
|
121
|
+
private get _proxy();
|
|
122
|
+
/**
|
|
123
|
+
* Fetch a FlexUserInstance
|
|
124
|
+
*
|
|
125
|
+
* @param callback - Callback to handle processed record
|
|
126
|
+
*
|
|
127
|
+
* @returns Resolves to processed FlexUserInstance
|
|
128
|
+
*/
|
|
129
|
+
fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>;
|
|
130
|
+
/**
|
|
131
|
+
* Provide a user-friendly representation
|
|
132
|
+
*
|
|
133
|
+
* @returns Object
|
|
134
|
+
*/
|
|
135
|
+
toJSON(): {
|
|
136
|
+
accountSid: string;
|
|
137
|
+
instanceSid: string;
|
|
138
|
+
userSid: string;
|
|
139
|
+
flexUserSid: string;
|
|
140
|
+
workerSid: string;
|
|
141
|
+
workspaceSid: string;
|
|
142
|
+
flexTeamSid: string;
|
|
143
|
+
firstName: string;
|
|
144
|
+
lastName: string;
|
|
145
|
+
username: string;
|
|
146
|
+
email: string;
|
|
147
|
+
friendlyName: string;
|
|
148
|
+
createdDate: Date;
|
|
149
|
+
updatedDate: Date;
|
|
150
|
+
version: number;
|
|
151
|
+
url: string;
|
|
152
|
+
};
|
|
153
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
154
|
+
}
|
|
155
|
+
export interface FlexUserSolution {
|
|
156
|
+
}
|
|
157
|
+
export interface FlexUserListInstance {
|
|
158
|
+
_version: V2;
|
|
159
|
+
_solution: FlexUserSolution;
|
|
160
|
+
_uri: string;
|
|
161
|
+
(instanceSid: string, flexUserSid: string): FlexUserContext;
|
|
162
|
+
get(instanceSid: string, flexUserSid: string): FlexUserContext;
|
|
163
|
+
/**
|
|
164
|
+
* Provide a user-friendly representation
|
|
165
|
+
*/
|
|
166
|
+
toJSON(): any;
|
|
167
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
168
|
+
}
|
|
169
|
+
export declare function FlexUserListInstance(version: V2): FlexUserListInstance;
|
|
170
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Flex
|
|
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.FlexUserListInstance = exports.FlexUserInstance = exports.FlexUserContextImpl = void 0;
|
|
17
|
+
const util_1 = require("util");
|
|
18
|
+
const deserialize = require("../../../base/deserialize");
|
|
19
|
+
const serialize = require("../../../base/serialize");
|
|
20
|
+
const utility_1 = require("../../../base/utility");
|
|
21
|
+
class FlexUserContextImpl {
|
|
22
|
+
constructor(_version, instanceSid, flexUserSid) {
|
|
23
|
+
this._version = _version;
|
|
24
|
+
if (!(0, utility_1.isValidPathParam)(instanceSid)) {
|
|
25
|
+
throw new Error("Parameter 'instanceSid' is not valid.");
|
|
26
|
+
}
|
|
27
|
+
if (!(0, utility_1.isValidPathParam)(flexUserSid)) {
|
|
28
|
+
throw new Error("Parameter 'flexUserSid' is not valid.");
|
|
29
|
+
}
|
|
30
|
+
this._solution = { instanceSid, flexUserSid };
|
|
31
|
+
this._uri = `/Instances/${instanceSid}/Users/${flexUserSid}`;
|
|
32
|
+
}
|
|
33
|
+
fetch(callback) {
|
|
34
|
+
const instance = this;
|
|
35
|
+
let operationVersion = instance._version, operationPromise = operationVersion.fetch({
|
|
36
|
+
uri: instance._uri,
|
|
37
|
+
method: "get",
|
|
38
|
+
});
|
|
39
|
+
operationPromise = operationPromise.then((payload) => new FlexUserInstance(operationVersion, payload, instance._solution.instanceSid, instance._solution.flexUserSid));
|
|
40
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
41
|
+
return operationPromise;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Provide a user-friendly representation
|
|
45
|
+
*
|
|
46
|
+
* @returns Object
|
|
47
|
+
*/
|
|
48
|
+
toJSON() {
|
|
49
|
+
return this._solution;
|
|
50
|
+
}
|
|
51
|
+
[util_1.inspect.custom](_depth, options) {
|
|
52
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.FlexUserContextImpl = FlexUserContextImpl;
|
|
56
|
+
class FlexUserInstance {
|
|
57
|
+
constructor(_version, payload, instanceSid, flexUserSid) {
|
|
58
|
+
this._version = _version;
|
|
59
|
+
this.accountSid = payload.account_sid;
|
|
60
|
+
this.instanceSid = payload.instance_sid;
|
|
61
|
+
this.userSid = payload.user_sid;
|
|
62
|
+
this.flexUserSid = payload.flex_user_sid;
|
|
63
|
+
this.workerSid = payload.worker_sid;
|
|
64
|
+
this.workspaceSid = payload.workspace_sid;
|
|
65
|
+
this.flexTeamSid = payload.flex_team_sid;
|
|
66
|
+
this.firstName = payload.first_name;
|
|
67
|
+
this.lastName = payload.last_name;
|
|
68
|
+
this.username = payload.username;
|
|
69
|
+
this.email = payload.email;
|
|
70
|
+
this.friendlyName = payload.friendly_name;
|
|
71
|
+
this.createdDate = deserialize.iso8601DateTime(payload.created_date);
|
|
72
|
+
this.updatedDate = deserialize.iso8601DateTime(payload.updated_date);
|
|
73
|
+
this.version = deserialize.integer(payload.version);
|
|
74
|
+
this.url = payload.url;
|
|
75
|
+
this._solution = {
|
|
76
|
+
instanceSid: instanceSid || this.instanceSid,
|
|
77
|
+
flexUserSid: flexUserSid || this.flexUserSid,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
get _proxy() {
|
|
81
|
+
this._context =
|
|
82
|
+
this._context ||
|
|
83
|
+
new FlexUserContextImpl(this._version, this._solution.instanceSid, this._solution.flexUserSid);
|
|
84
|
+
return this._context;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Fetch a FlexUserInstance
|
|
88
|
+
*
|
|
89
|
+
* @param callback - Callback to handle processed record
|
|
90
|
+
*
|
|
91
|
+
* @returns Resolves to processed FlexUserInstance
|
|
92
|
+
*/
|
|
93
|
+
fetch(callback) {
|
|
94
|
+
return this._proxy.fetch(callback);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Provide a user-friendly representation
|
|
98
|
+
*
|
|
99
|
+
* @returns Object
|
|
100
|
+
*/
|
|
101
|
+
toJSON() {
|
|
102
|
+
return {
|
|
103
|
+
accountSid: this.accountSid,
|
|
104
|
+
instanceSid: this.instanceSid,
|
|
105
|
+
userSid: this.userSid,
|
|
106
|
+
flexUserSid: this.flexUserSid,
|
|
107
|
+
workerSid: this.workerSid,
|
|
108
|
+
workspaceSid: this.workspaceSid,
|
|
109
|
+
flexTeamSid: this.flexTeamSid,
|
|
110
|
+
firstName: this.firstName,
|
|
111
|
+
lastName: this.lastName,
|
|
112
|
+
username: this.username,
|
|
113
|
+
email: this.email,
|
|
114
|
+
friendlyName: this.friendlyName,
|
|
115
|
+
createdDate: this.createdDate,
|
|
116
|
+
updatedDate: this.updatedDate,
|
|
117
|
+
version: this.version,
|
|
118
|
+
url: this.url,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
[util_1.inspect.custom](_depth, options) {
|
|
122
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.FlexUserInstance = FlexUserInstance;
|
|
126
|
+
function FlexUserListInstance(version) {
|
|
127
|
+
const instance = ((instanceSid, flexUserSid) => instance.get(instanceSid, flexUserSid));
|
|
128
|
+
instance.get = function get(instanceSid, flexUserSid) {
|
|
129
|
+
return new FlexUserContextImpl(version, instanceSid, flexUserSid);
|
|
130
|
+
};
|
|
131
|
+
instance._version = version;
|
|
132
|
+
instance._solution = {};
|
|
133
|
+
instance._uri = ``;
|
|
134
|
+
instance.toJSON = function toJSON() {
|
|
135
|
+
return instance._solution;
|
|
136
|
+
};
|
|
137
|
+
instance[util_1.inspect.custom] = function inspectImpl(_depth, options) {
|
|
138
|
+
return (0, util_1.inspect)(instance.toJSON(), options);
|
|
139
|
+
};
|
|
140
|
+
return instance;
|
|
141
|
+
}
|
|
142
|
+
exports.FlexUserListInstance = FlexUserListInstance;
|
|
@@ -7,6 +7,8 @@ import V2 from "../V2";
|
|
|
7
7
|
export interface WebChannelsListInstanceCreateOptions {
|
|
8
8
|
/** The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. */
|
|
9
9
|
addressSid: string;
|
|
10
|
+
/** The Ui-Version HTTP request header */
|
|
11
|
+
uiVersion?: string;
|
|
10
12
|
/** The Conversation\\\'s friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. */
|
|
11
13
|
chatFriendlyName?: string;
|
|
12
14
|
/** The Conversation participant\\\'s friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. */
|
|
@@ -39,6 +39,8 @@ function WebChannelsListInstance(version) {
|
|
|
39
39
|
data["PreEngagementData"] = params["preEngagementData"];
|
|
40
40
|
const headers = {};
|
|
41
41
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
42
|
+
if (params["uiVersion"] !== undefined)
|
|
43
|
+
headers["Ui-Version"] = params["uiVersion"];
|
|
42
44
|
let operationVersion = version, operationPromise = operationVersion.create({
|
|
43
45
|
uri: instance._uri,
|
|
44
46
|
method: "post",
|
package/lib/rest/numbers/V1.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { EligibilityListInstance } from "./v1/eligibility";
|
|
|
5
5
|
import { PortingBulkPortabilityListInstance } from "./v1/portingBulkPortability";
|
|
6
6
|
import { PortingPortInListInstance } from "./v1/portingPortIn";
|
|
7
7
|
import { PortingPortInFetchListInstance } from "./v1/portingPortInFetch";
|
|
8
|
+
import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNumber";
|
|
8
9
|
import { PortingPortabilityListInstance } from "./v1/portingPortability";
|
|
9
10
|
export default class V1 extends Version {
|
|
10
11
|
/**
|
|
@@ -23,6 +24,8 @@ export default class V1 extends Version {
|
|
|
23
24
|
protected _portingPortIns?: PortingPortInListInstance;
|
|
24
25
|
/** portingPortInsFetch - { Twilio.Numbers.V1.PortingPortInFetchListInstance } resource */
|
|
25
26
|
protected _portingPortInsFetch?: PortingPortInFetchListInstance;
|
|
27
|
+
/** portingPortInPhoneNumber - { Twilio.Numbers.V1.PortingPortInPhoneNumberListInstance } resource */
|
|
28
|
+
protected _portingPortInPhoneNumber?: PortingPortInPhoneNumberListInstance;
|
|
26
29
|
/** portingPortabilities - { Twilio.Numbers.V1.PortingPortabilityListInstance } resource */
|
|
27
30
|
protected _portingPortabilities?: PortingPortabilityListInstance;
|
|
28
31
|
/** Getter for bulkEligibilities resource */
|
|
@@ -35,6 +38,8 @@ export default class V1 extends Version {
|
|
|
35
38
|
get portingPortIns(): PortingPortInListInstance;
|
|
36
39
|
/** Getter for portingPortInsFetch resource */
|
|
37
40
|
get portingPortInsFetch(): PortingPortInFetchListInstance;
|
|
41
|
+
/** Getter for portingPortInPhoneNumber resource */
|
|
42
|
+
get portingPortInPhoneNumber(): PortingPortInPhoneNumberListInstance;
|
|
38
43
|
/** Getter for portingPortabilities resource */
|
|
39
44
|
get portingPortabilities(): PortingPortabilityListInstance;
|
|
40
45
|
}
|
package/lib/rest/numbers/V1.js
CHANGED
|
@@ -22,6 +22,7 @@ const eligibility_1 = require("./v1/eligibility");
|
|
|
22
22
|
const portingBulkPortability_1 = require("./v1/portingBulkPortability");
|
|
23
23
|
const portingPortIn_1 = require("./v1/portingPortIn");
|
|
24
24
|
const portingPortInFetch_1 = require("./v1/portingPortInFetch");
|
|
25
|
+
const portingPortInPhoneNumber_1 = require("./v1/portingPortInPhoneNumber");
|
|
25
26
|
const portingPortability_1 = require("./v1/portingPortability");
|
|
26
27
|
class V1 extends Version_1.default {
|
|
27
28
|
/**
|
|
@@ -62,6 +63,13 @@ class V1 extends Version_1.default {
|
|
|
62
63
|
this._portingPortInsFetch || (0, portingPortInFetch_1.PortingPortInFetchListInstance)(this);
|
|
63
64
|
return this._portingPortInsFetch;
|
|
64
65
|
}
|
|
66
|
+
/** Getter for portingPortInPhoneNumber resource */
|
|
67
|
+
get portingPortInPhoneNumber() {
|
|
68
|
+
this._portingPortInPhoneNumber =
|
|
69
|
+
this._portingPortInPhoneNumber ||
|
|
70
|
+
(0, portingPortInPhoneNumber_1.PortingPortInPhoneNumberListInstance)(this);
|
|
71
|
+
return this._portingPortInPhoneNumber;
|
|
72
|
+
}
|
|
65
73
|
/** Getter for portingPortabilities resource */
|
|
66
74
|
get portingPortabilities() {
|
|
67
75
|
this._portingPortabilities =
|
|
@@ -8,48 +8,61 @@ export interface PortingPortInListInstanceCreateOptions {
|
|
|
8
8
|
/** */
|
|
9
9
|
body?: object;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
}
|
|
13
|
-
export interface PortingPortInListInstance {
|
|
14
|
-
_version: V1;
|
|
15
|
-
_solution: PortingPortInSolution;
|
|
16
|
-
_uri: string;
|
|
17
|
-
/**
|
|
18
|
-
* Create a PortingPortInInstance
|
|
19
|
-
*
|
|
20
|
-
* @param callback - Callback to handle processed record
|
|
21
|
-
*
|
|
22
|
-
* @returns Resolves to processed PortingPortInInstance
|
|
23
|
-
*/
|
|
24
|
-
create(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>;
|
|
11
|
+
export interface PortingPortInContext {
|
|
25
12
|
/**
|
|
26
|
-
*
|
|
13
|
+
* Remove a PortingPortInInstance
|
|
27
14
|
*
|
|
28
|
-
* @param params - Body for request
|
|
29
15
|
* @param callback - Callback to handle processed record
|
|
30
16
|
*
|
|
31
|
-
* @returns Resolves to processed
|
|
17
|
+
* @returns Resolves to processed boolean
|
|
32
18
|
*/
|
|
33
|
-
|
|
19
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
34
20
|
/**
|
|
35
21
|
* Provide a user-friendly representation
|
|
36
22
|
*/
|
|
37
23
|
toJSON(): any;
|
|
38
24
|
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
39
25
|
}
|
|
40
|
-
export
|
|
26
|
+
export interface PortingPortInContextSolution {
|
|
27
|
+
portInRequestSid: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class PortingPortInContextImpl implements PortingPortInContext {
|
|
30
|
+
protected _version: V1;
|
|
31
|
+
protected _solution: PortingPortInContextSolution;
|
|
32
|
+
protected _uri: string;
|
|
33
|
+
constructor(_version: V1, portInRequestSid: string);
|
|
34
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Provide a user-friendly representation
|
|
37
|
+
*
|
|
38
|
+
* @returns Object
|
|
39
|
+
*/
|
|
40
|
+
toJSON(): PortingPortInContextSolution;
|
|
41
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
42
|
+
}
|
|
41
43
|
interface PortingPortInResource {
|
|
42
44
|
port_in_request_sid: string;
|
|
43
45
|
url: string;
|
|
44
46
|
}
|
|
45
47
|
export declare class PortingPortInInstance {
|
|
46
48
|
protected _version: V1;
|
|
47
|
-
|
|
49
|
+
protected _solution: PortingPortInContextSolution;
|
|
50
|
+
protected _context?: PortingPortInContext;
|
|
51
|
+
constructor(_version: V1, payload: PortingPortInResource, portInRequestSid?: string);
|
|
48
52
|
/**
|
|
49
53
|
* The SID of the Port In request. This is a unique identifier of the port in request.
|
|
50
54
|
*/
|
|
51
55
|
portInRequestSid: string;
|
|
52
56
|
url: string;
|
|
57
|
+
private get _proxy();
|
|
58
|
+
/**
|
|
59
|
+
* Remove a PortingPortInInstance
|
|
60
|
+
*
|
|
61
|
+
* @param callback - Callback to handle processed record
|
|
62
|
+
*
|
|
63
|
+
* @returns Resolves to processed boolean
|
|
64
|
+
*/
|
|
65
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
53
66
|
/**
|
|
54
67
|
* Provide a user-friendly representation
|
|
55
68
|
*
|
|
@@ -61,4 +74,36 @@ export declare class PortingPortInInstance {
|
|
|
61
74
|
};
|
|
62
75
|
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
63
76
|
}
|
|
77
|
+
export interface PortingPortInSolution {
|
|
78
|
+
}
|
|
79
|
+
export interface PortingPortInListInstance {
|
|
80
|
+
_version: V1;
|
|
81
|
+
_solution: PortingPortInSolution;
|
|
82
|
+
_uri: string;
|
|
83
|
+
(portInRequestSid: string): PortingPortInContext;
|
|
84
|
+
get(portInRequestSid: string): PortingPortInContext;
|
|
85
|
+
/**
|
|
86
|
+
* Create a PortingPortInInstance
|
|
87
|
+
*
|
|
88
|
+
* @param callback - Callback to handle processed record
|
|
89
|
+
*
|
|
90
|
+
* @returns Resolves to processed PortingPortInInstance
|
|
91
|
+
*/
|
|
92
|
+
create(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>;
|
|
93
|
+
/**
|
|
94
|
+
* Create a PortingPortInInstance
|
|
95
|
+
*
|
|
96
|
+
* @param params - Body for request
|
|
97
|
+
* @param callback - Callback to handle processed record
|
|
98
|
+
*
|
|
99
|
+
* @returns Resolves to processed PortingPortInInstance
|
|
100
|
+
*/
|
|
101
|
+
create(params: object, callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>;
|
|
102
|
+
/**
|
|
103
|
+
* Provide a user-friendly representation
|
|
104
|
+
*/
|
|
105
|
+
toJSON(): any;
|
|
106
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
107
|
+
}
|
|
108
|
+
export declare function PortingPortInListInstance(version: V1): PortingPortInListInstance;
|
|
64
109
|
export {};
|
|
@@ -13,12 +13,88 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.PortingPortInInstance = exports.
|
|
16
|
+
exports.PortingPortInListInstance = exports.PortingPortInInstance = exports.PortingPortInContextImpl = void 0;
|
|
17
17
|
const util_1 = require("util");
|
|
18
18
|
const deserialize = require("../../../base/deserialize");
|
|
19
19
|
const serialize = require("../../../base/serialize");
|
|
20
|
+
const utility_1 = require("../../../base/utility");
|
|
21
|
+
class PortingPortInContextImpl {
|
|
22
|
+
constructor(_version, portInRequestSid) {
|
|
23
|
+
this._version = _version;
|
|
24
|
+
if (!(0, utility_1.isValidPathParam)(portInRequestSid)) {
|
|
25
|
+
throw new Error("Parameter 'portInRequestSid' is not valid.");
|
|
26
|
+
}
|
|
27
|
+
this._solution = { portInRequestSid };
|
|
28
|
+
this._uri = `/Porting/PortIn/${portInRequestSid}`;
|
|
29
|
+
}
|
|
30
|
+
remove(callback) {
|
|
31
|
+
const instance = this;
|
|
32
|
+
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
|
33
|
+
uri: instance._uri,
|
|
34
|
+
method: "delete",
|
|
35
|
+
});
|
|
36
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
37
|
+
return operationPromise;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provide a user-friendly representation
|
|
41
|
+
*
|
|
42
|
+
* @returns Object
|
|
43
|
+
*/
|
|
44
|
+
toJSON() {
|
|
45
|
+
return this._solution;
|
|
46
|
+
}
|
|
47
|
+
[util_1.inspect.custom](_depth, options) {
|
|
48
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.PortingPortInContextImpl = PortingPortInContextImpl;
|
|
52
|
+
class PortingPortInInstance {
|
|
53
|
+
constructor(_version, payload, portInRequestSid) {
|
|
54
|
+
this._version = _version;
|
|
55
|
+
this.portInRequestSid = payload.port_in_request_sid;
|
|
56
|
+
this.url = payload.url;
|
|
57
|
+
this._solution = {
|
|
58
|
+
portInRequestSid: portInRequestSid || this.portInRequestSid,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
get _proxy() {
|
|
62
|
+
this._context =
|
|
63
|
+
this._context ||
|
|
64
|
+
new PortingPortInContextImpl(this._version, this._solution.portInRequestSid);
|
|
65
|
+
return this._context;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Remove a PortingPortInInstance
|
|
69
|
+
*
|
|
70
|
+
* @param callback - Callback to handle processed record
|
|
71
|
+
*
|
|
72
|
+
* @returns Resolves to processed boolean
|
|
73
|
+
*/
|
|
74
|
+
remove(callback) {
|
|
75
|
+
return this._proxy.remove(callback);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Provide a user-friendly representation
|
|
79
|
+
*
|
|
80
|
+
* @returns Object
|
|
81
|
+
*/
|
|
82
|
+
toJSON() {
|
|
83
|
+
return {
|
|
84
|
+
portInRequestSid: this.portInRequestSid,
|
|
85
|
+
url: this.url,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
[util_1.inspect.custom](_depth, options) {
|
|
89
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.PortingPortInInstance = PortingPortInInstance;
|
|
20
93
|
function PortingPortInListInstance(version) {
|
|
21
|
-
const instance =
|
|
94
|
+
const instance = ((portInRequestSid) => instance.get(portInRequestSid));
|
|
95
|
+
instance.get = function get(portInRequestSid) {
|
|
96
|
+
return new PortingPortInContextImpl(version, portInRequestSid);
|
|
97
|
+
};
|
|
22
98
|
instance._version = version;
|
|
23
99
|
instance._solution = {};
|
|
24
100
|
instance._uri = `/Porting/PortIn`;
|
|
@@ -53,25 +129,3 @@ function PortingPortInListInstance(version) {
|
|
|
53
129
|
return instance;
|
|
54
130
|
}
|
|
55
131
|
exports.PortingPortInListInstance = PortingPortInListInstance;
|
|
56
|
-
class PortingPortInInstance {
|
|
57
|
-
constructor(_version, payload) {
|
|
58
|
-
this._version = _version;
|
|
59
|
-
this.portInRequestSid = payload.port_in_request_sid;
|
|
60
|
-
this.url = payload.url;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Provide a user-friendly representation
|
|
64
|
-
*
|
|
65
|
-
* @returns Object
|
|
66
|
-
*/
|
|
67
|
-
toJSON() {
|
|
68
|
-
return {
|
|
69
|
-
portInRequestSid: this.portInRequestSid,
|
|
70
|
-
url: this.url,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
[util_1.inspect.custom](_depth, options) {
|
|
74
|
-
return (0, util_1.inspect)(this.toJSON(), options);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.PortingPortInInstance = PortingPortInInstance;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { inspect, InspectOptions } from "util";
|
|
3
|
+
import V1 from "../V1";
|
|
4
|
+
export interface PortingPortInPhoneNumberContext {
|
|
5
|
+
/**
|
|
6
|
+
* Remove a PortingPortInPhoneNumberInstance
|
|
7
|
+
*
|
|
8
|
+
* @param callback - Callback to handle processed record
|
|
9
|
+
*
|
|
10
|
+
* @returns Resolves to processed boolean
|
|
11
|
+
*/
|
|
12
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Provide a user-friendly representation
|
|
15
|
+
*/
|
|
16
|
+
toJSON(): any;
|
|
17
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
18
|
+
}
|
|
19
|
+
export interface PortingPortInPhoneNumberContextSolution {
|
|
20
|
+
portInRequestSid: string;
|
|
21
|
+
phoneNumberSid: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class PortingPortInPhoneNumberContextImpl implements PortingPortInPhoneNumberContext {
|
|
24
|
+
protected _version: V1;
|
|
25
|
+
protected _solution: PortingPortInPhoneNumberContextSolution;
|
|
26
|
+
protected _uri: string;
|
|
27
|
+
constructor(_version: V1, portInRequestSid: string, phoneNumberSid: string);
|
|
28
|
+
remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Provide a user-friendly representation
|
|
31
|
+
*
|
|
32
|
+
* @returns Object
|
|
33
|
+
*/
|
|
34
|
+
toJSON(): PortingPortInPhoneNumberContextSolution;
|
|
35
|
+
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
36
|
+
}
|
|
37
|
+
export interface PortingPortInPhoneNumberSolution {
|
|
38
|
+
}
|
|
39
|
+
export interface PortingPortInPhoneNumberListInstance {
|
|
40
|
+
_version: V1;
|
|
41
|
+
_solution: PortingPortInPhoneNumberSolution;
|
|
42
|
+
_uri: string;
|
|
43
|
+
(portInRequestSid: string, phoneNumberSid: string): PortingPortInPhoneNumberContext;
|
|
44
|
+
get(portInRequestSid: string, phoneNumberSid: string): PortingPortInPhoneNumberContext;
|
|
45
|
+
/**
|
|
46
|
+
* Provide a user-friendly representation
|
|
47
|
+
*/
|
|
48
|
+
toJSON(): any;
|
|
49
|
+
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
50
|
+
}
|
|
51
|
+
export declare function PortingPortInPhoneNumberListInstance(version: V1): PortingPortInPhoneNumberListInstance;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This code was generated by
|
|
4
|
+
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
5
|
+
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
6
|
+
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
7
|
+
*
|
|
8
|
+
* Twilio - Numbers
|
|
9
|
+
* This is the public Twilio REST API.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator.
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PortingPortInPhoneNumberListInstance = exports.PortingPortInPhoneNumberContextImpl = void 0;
|
|
17
|
+
const util_1 = require("util");
|
|
18
|
+
const deserialize = require("../../../base/deserialize");
|
|
19
|
+
const serialize = require("../../../base/serialize");
|
|
20
|
+
const utility_1 = require("../../../base/utility");
|
|
21
|
+
class PortingPortInPhoneNumberContextImpl {
|
|
22
|
+
constructor(_version, portInRequestSid, phoneNumberSid) {
|
|
23
|
+
this._version = _version;
|
|
24
|
+
if (!(0, utility_1.isValidPathParam)(portInRequestSid)) {
|
|
25
|
+
throw new Error("Parameter 'portInRequestSid' is not valid.");
|
|
26
|
+
}
|
|
27
|
+
if (!(0, utility_1.isValidPathParam)(phoneNumberSid)) {
|
|
28
|
+
throw new Error("Parameter 'phoneNumberSid' is not valid.");
|
|
29
|
+
}
|
|
30
|
+
this._solution = { portInRequestSid, phoneNumberSid };
|
|
31
|
+
this._uri = `/Porting/PortIn/${portInRequestSid}/PhoneNumber/${phoneNumberSid}`;
|
|
32
|
+
}
|
|
33
|
+
remove(callback) {
|
|
34
|
+
const instance = this;
|
|
35
|
+
let operationVersion = instance._version, operationPromise = operationVersion.remove({
|
|
36
|
+
uri: instance._uri,
|
|
37
|
+
method: "delete",
|
|
38
|
+
});
|
|
39
|
+
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
40
|
+
return operationPromise;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Provide a user-friendly representation
|
|
44
|
+
*
|
|
45
|
+
* @returns Object
|
|
46
|
+
*/
|
|
47
|
+
toJSON() {
|
|
48
|
+
return this._solution;
|
|
49
|
+
}
|
|
50
|
+
[util_1.inspect.custom](_depth, options) {
|
|
51
|
+
return (0, util_1.inspect)(this.toJSON(), options);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.PortingPortInPhoneNumberContextImpl = PortingPortInPhoneNumberContextImpl;
|
|
55
|
+
function PortingPortInPhoneNumberListInstance(version) {
|
|
56
|
+
const instance = ((portInRequestSid, phoneNumberSid) => instance.get(portInRequestSid, phoneNumberSid));
|
|
57
|
+
instance.get = function get(portInRequestSid, phoneNumberSid) {
|
|
58
|
+
return new PortingPortInPhoneNumberContextImpl(version, portInRequestSid, phoneNumberSid);
|
|
59
|
+
};
|
|
60
|
+
instance._version = version;
|
|
61
|
+
instance._solution = {};
|
|
62
|
+
instance._uri = ``;
|
|
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.PortingPortInPhoneNumberListInstance = PortingPortInPhoneNumberListInstance;
|
package/lib/webhooks/webhooks.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.webhook = exports.validateExpressRequest = exports.validateIncomingReque
|
|
|
7
7
|
const scmp = require("scmp");
|
|
8
8
|
const crypto_1 = __importDefault(require("crypto"));
|
|
9
9
|
const url_1 = __importDefault(require("url"));
|
|
10
|
-
const url_parse_1 = __importDefault(require("url-parse"));
|
|
11
10
|
/**
|
|
12
11
|
* Utility function to construct the URL string, since Node.js url library won't include standard port numbers
|
|
13
12
|
*
|
|
@@ -22,7 +21,7 @@ function buildUrlWithStandardPort(parsedUrl) {
|
|
|
22
21
|
url += parsedUrl.password ? ":" + parsedUrl.password : "";
|
|
23
22
|
url += parsedUrl.username || parsedUrl.password ? "@" : "";
|
|
24
23
|
url += parsedUrl.host ? parsedUrl.host + port : "";
|
|
25
|
-
url += parsedUrl.pathname + parsedUrl.
|
|
24
|
+
url += parsedUrl.pathname + parsedUrl.search + parsedUrl.hash;
|
|
26
25
|
return url;
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
@@ -44,7 +43,7 @@ function addPort(parsedUrl) {
|
|
|
44
43
|
@returns URL without port
|
|
45
44
|
*/
|
|
46
45
|
function removePort(parsedUrl) {
|
|
47
|
-
parsedUrl.
|
|
46
|
+
parsedUrl.port = "";
|
|
48
47
|
return parsedUrl.toString();
|
|
49
48
|
}
|
|
50
49
|
/**
|
|
@@ -108,7 +107,7 @@ exports.getExpectedBodyHash = getExpectedBodyHash;
|
|
|
108
107
|
*/
|
|
109
108
|
function validateRequest(authToken, twilioHeader, url, params) {
|
|
110
109
|
twilioHeader = twilioHeader || "";
|
|
111
|
-
const urlObject = new
|
|
110
|
+
const urlObject = new URL(url);
|
|
112
111
|
const urlWithPort = addPort(urlObject);
|
|
113
112
|
const urlWithoutPort = removePort(urlObject);
|
|
114
113
|
/*
|
|
@@ -138,9 +137,9 @@ exports.validateBody = validateBody;
|
|
|
138
137
|
@returns valid
|
|
139
138
|
*/
|
|
140
139
|
function validateRequestWithBody(authToken, twilioHeader, url, body) {
|
|
141
|
-
const urlObject = new
|
|
140
|
+
const urlObject = new URL(url);
|
|
142
141
|
return (validateRequest(authToken, twilioHeader, url, {}) &&
|
|
143
|
-
validateBody(body, urlObject.
|
|
142
|
+
validateBody(body, urlObject.searchParams.get("bodySHA256") || ""));
|
|
144
143
|
}
|
|
145
144
|
exports.validateRequestWithBody = validateRequestWithBody;
|
|
146
145
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twilio",
|
|
3
3
|
"description": "A Twilio helper library",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.4",
|
|
5
5
|
"author": "API Team <api@twilio.com>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
{
|
|
@@ -20,23 +20,21 @@
|
|
|
20
20
|
"url": "https://github.com/twilio/twilio-node.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"axios": "^1.6.
|
|
23
|
+
"axios": "^1.6.8",
|
|
24
24
|
"dayjs": "^1.11.9",
|
|
25
25
|
"https-proxy-agent": "^5.0.0",
|
|
26
|
-
"jsonwebtoken": "^9.0.
|
|
26
|
+
"jsonwebtoken": "^9.0.2",
|
|
27
27
|
"qs": "^6.9.4",
|
|
28
28
|
"scmp": "^2.1.0",
|
|
29
|
-
"url-parse": "^1.5.9",
|
|
30
29
|
"xmlbuilder": "^13.0.2"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
33
32
|
"@babel/preset-env": "^7.23.0",
|
|
34
33
|
"@babel/preset-typescript": "^7.18.6",
|
|
35
34
|
"@types/jest": "^29.5.5",
|
|
36
|
-
"@types/jsonwebtoken": "^9.0.
|
|
35
|
+
"@types/jsonwebtoken": "^9.0.2",
|
|
37
36
|
"@types/node": "^18.11.18",
|
|
38
37
|
"@types/qs": "^6.9.7",
|
|
39
|
-
"@types/url-parse": "^1.4.8",
|
|
40
38
|
"babel-plugin-replace-ts-export-assignment": "^0.0.2",
|
|
41
39
|
"eslint": "^8.31.0",
|
|
42
40
|
"express": "^4.17.1",
|