@signalhousellc/sdk 1.0.25 → 1.0.27
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/package.json +19 -19
- package/src/domains/Numbers.js +231 -201
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@signalhousellc/sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Signal House SDK for use with the Signal House platform",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "src/SignalHouseSDK.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./src/SignalHouseSDK.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"author": "Signal House LLC",
|
|
15
|
-
"license": "ISC",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"axios": "^1.13.5"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@signalhousellc/sdk",
|
|
3
|
+
"version": "1.0.27",
|
|
4
|
+
"description": "Signal House SDK for use with the Signal House platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/SignalHouseSDK.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/SignalHouseSDK.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"author": "Signal House LLC",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"axios": "^1.13.5"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/domains/Numbers.js
CHANGED
|
@@ -1,202 +1,232 @@
|
|
|
1
|
-
export class Numbers {
|
|
2
|
-
constructor(client, enableAdmin) {
|
|
3
|
-
this.client = client;
|
|
4
|
-
this.enableAdmin = enableAdmin;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get a list of phone numbers with optional filters such as campaignId, brandId, subgroupId, groupId, and pagination parameters
|
|
9
|
-
* @async
|
|
10
|
-
* @roles api, admin, developer, billing, user
|
|
11
|
-
* @param {Object} params - The parameters for filtering the phone numbers
|
|
12
|
-
* @param {string} [params.phoneNumber] - Filter by phone number (partial match)
|
|
13
|
-
* @param {string} [params.campaignId] - Filter by campaign ID
|
|
14
|
-
* @param {string} [params.brandId] - Filter by brand ID
|
|
15
|
-
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
16
|
-
* @param {string} [params.groupId] - Filter by group ID
|
|
17
|
-
* @param {number} [params.page] - The page number for pagination (default: 1)
|
|
18
|
-
* @param {number} [params.limit] - The number of items per page for pagination (default: 20)
|
|
19
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
20
|
-
* @returns {Promise<Object>} A promise that resolves to the list of phone numbers
|
|
21
|
-
*/
|
|
22
|
-
async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
|
|
23
|
-
const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
|
|
24
|
-
const queryString = this.client._getQueryString(filters);
|
|
25
|
-
return this.client(`/number${queryString}`, { method: "GET", ...options });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get a list of available phone numbers for purchase with optional filters
|
|
30
|
-
* @async
|
|
31
|
-
* @roles api, admin, developer, billing, user
|
|
32
|
-
* @param {Object} params - The parameters for filtering the available phone numbers
|
|
33
|
-
* @param {boolean} [params.smsEnabled] - Filter for phone numbers that are SMS enabled
|
|
34
|
-
* @param {boolean} [params.mmsEnabled] - Filter for phone numbers that are MMS enabled
|
|
35
|
-
* @param {boolean} [params.voiceEnabled] - Filter for phone numbers that are voice enabled
|
|
36
|
-
* @param {string} [params.country] - Filter by country code (e.g., "US")
|
|
37
|
-
* @param {string} [params.state] - Filter by state code (e.g., "CA")
|
|
38
|
-
* @param {string} [params.npa] - Filter by NPA (area code)
|
|
39
|
-
* @param {string} [params.nxx] - Filter by NXX (central office code) - the first three digits of the local phone number after the area code
|
|
40
|
-
* @param {string} [params.phoneNumber] - Filter by phone number
|
|
41
|
-
* @param {number} [params.limit] - The number of items per page for pagination
|
|
42
|
-
* @param {number} [params.page] - The page number for pagination
|
|
43
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
44
|
-
* @returns {Promise<Object>} A promise that resolves to the list of available phone numbers
|
|
45
|
-
*/
|
|
46
|
-
async getAvailablePhoneNumbers({ smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page, options = {} }) {
|
|
47
|
-
const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page };
|
|
48
|
-
const queryString = this.client._getQueryString(filters);
|
|
49
|
-
return this.client(`/number/available${queryString}`, { method: "GET", ...options });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to
|
|
54
|
-
* @async
|
|
55
|
-
* @roles api, admin, developer, billing, user
|
|
56
|
-
* @param {Object} params - The parameters for purchasing phone numbers
|
|
57
|
-
* @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
|
|
58
|
-
* @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
|
|
59
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
60
|
-
* @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
|
|
61
|
-
* @returns {Promise<Object>} A promise that resolves to the result of the purchase operation
|
|
62
|
-
*/
|
|
63
|
-
async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
|
|
64
|
-
this.client._require({ phoneNumbers, subgroupId });
|
|
65
|
-
return this.client(`/number`, { method: "POST", body: { phoneNumbers, subgroupId }, ...options });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Update an existing phone number's details (e.g., setting a friendly name)
|
|
70
|
-
* @async
|
|
71
|
-
* @roles api, admin, developer, user
|
|
72
|
-
* @param {Object} params - The parameters for updating the phone number
|
|
73
|
-
* @param {string} params.phoneNumber - The phone number to update
|
|
74
|
-
* @param {Object} params.updateData - The data to update for the phone number
|
|
75
|
-
* @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
|
|
76
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
77
|
-
* @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
|
|
78
|
-
* @returns {Promise<Object>} A promise that resolves to the updated phone number object
|
|
79
|
-
*/
|
|
80
|
-
async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
|
|
81
|
-
this.client._require({ phoneNumber, updateData });
|
|
82
|
-
|
|
83
|
-
// Safely encode the phone number for the URL path
|
|
84
|
-
const safePhoneNumber = encodeURIComponent(phoneNumber);
|
|
85
|
-
|
|
86
|
-
return this.client(`/number/${safePhoneNumber}`, {
|
|
87
|
-
method: "PUT",
|
|
88
|
-
body: updateData,
|
|
89
|
-
...options
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Port in a phone number by providing the necessary information for porting. Note: This operation is not currently supported and will throw an error if called.
|
|
95
|
-
* @async
|
|
96
|
-
* @roles api, admin, developer, billing, user
|
|
97
|
-
* @param {Object} params - The parameters for porting in a phone number
|
|
98
|
-
* @param {Object} params.numberData - The data for the phone number to be ported
|
|
99
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
100
|
-
* @throws {Error} Throws an error indicating that porting is not supported
|
|
101
|
-
* @returns {Promise<Object>} A promise that would resolve to the result of the porting operation if it were supported
|
|
102
|
-
*/
|
|
103
|
-
async portInPhoneNumber({ numberData, options = {} }) {
|
|
104
|
-
throw new Error("Porting phone numbers is not currently supported. Please contact support for assistance.");
|
|
105
|
-
// this.client._require({ numberData });
|
|
106
|
-
// return this.client(`/number/portin`, { method: "POST", body: numberData, ...options });
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign
|
|
111
|
-
* @async
|
|
112
|
-
* @roles api, admin, developer, billing, user
|
|
113
|
-
* @param {Object} params - The parameters for assigning phone numbers to a campaign
|
|
114
|
-
* @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
|
|
115
|
-
* @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
|
|
116
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
117
|
-
* @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing
|
|
118
|
-
* @returns {Promise<Object>} A promise that resolves to the result of the assignment operation
|
|
119
|
-
*/
|
|
120
|
-
async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
|
|
121
|
-
this.client._require({ campaignId, phoneNumbers });
|
|
122
|
-
const safeCampaignId = encodeURIComponent(campaignId);
|
|
123
|
-
return this.client(`/number/assign/${safeCampaignId}`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Unassign phone numbers from a campaign by providing a list of phone numbers to unassign. Note: This operation will unassign the specified phone numbers from any campaign they are currently assigned to.
|
|
128
|
-
* @async
|
|
129
|
-
* @roles api, admin, developer, billing, user
|
|
130
|
-
* @param {Object} params - The parameters for unassigning phone numbers from campaigns
|
|
131
|
-
* @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
|
|
132
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
133
|
-
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
134
|
-
* @returns {Promise<Object>} A promise that resolves to the result of the unassignment operation
|
|
135
|
-
*/
|
|
136
|
-
async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
|
|
137
|
-
this.client._require({ phoneNumbers });
|
|
138
|
-
return this.client(`/number/unassign`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". Note: This operation is irreversible and should be used with caution.
|
|
143
|
-
* @async
|
|
144
|
-
* @roles api, admin, developer, billing, user
|
|
145
|
-
* @param {Object} params - The parameters for deleting phone numbers
|
|
146
|
-
* @param {string[]} params.phoneNumbers - The list of phone numbers to delete
|
|
147
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
148
|
-
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
149
|
-
* @returns {Promise<Object>} A promise that resolves to the result of the deletion operation
|
|
150
|
-
*/
|
|
151
|
-
async deletePhoneNumbers({ phoneNumbers, options = {} }) {
|
|
152
|
-
this.client._require({ phoneNumbers });
|
|
153
|
-
return this.client(`/number`, { method: "DELETE", body: { phoneNumbers }, ...options });
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
*
|
|
158
|
-
* @async
|
|
159
|
-
* @
|
|
160
|
-
* @param {
|
|
161
|
-
* @param {string} params.
|
|
162
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
163
|
-
* @
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* @
|
|
175
|
-
* @
|
|
176
|
-
* @param {
|
|
177
|
-
* @param {
|
|
178
|
-
* @
|
|
179
|
-
* @
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
*
|
|
192
|
-
* @
|
|
193
|
-
* @
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
1
|
+
export class Numbers {
|
|
2
|
+
constructor(client, enableAdmin) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
this.enableAdmin = enableAdmin;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get a list of phone numbers with optional filters such as campaignId, brandId, subgroupId, groupId, and pagination parameters
|
|
9
|
+
* @async
|
|
10
|
+
* @roles api, admin, developer, billing, user
|
|
11
|
+
* @param {Object} params - The parameters for filtering the phone numbers
|
|
12
|
+
* @param {string} [params.phoneNumber] - Filter by phone number (partial match)
|
|
13
|
+
* @param {string} [params.campaignId] - Filter by campaign ID
|
|
14
|
+
* @param {string} [params.brandId] - Filter by brand ID
|
|
15
|
+
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
16
|
+
* @param {string} [params.groupId] - Filter by group ID
|
|
17
|
+
* @param {number} [params.page] - The page number for pagination (default: 1)
|
|
18
|
+
* @param {number} [params.limit] - The number of items per page for pagination (default: 20)
|
|
19
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
20
|
+
* @returns {Promise<Object>} A promise that resolves to the list of phone numbers
|
|
21
|
+
*/
|
|
22
|
+
async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
|
|
23
|
+
const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
|
|
24
|
+
const queryString = this.client._getQueryString(filters);
|
|
25
|
+
return this.client(`/number${queryString}`, { method: "GET", ...options });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get a list of available phone numbers for purchase with optional filters
|
|
30
|
+
* @async
|
|
31
|
+
* @roles api, admin, developer, billing, user
|
|
32
|
+
* @param {Object} params - The parameters for filtering the available phone numbers
|
|
33
|
+
* @param {boolean} [params.smsEnabled] - Filter for phone numbers that are SMS enabled
|
|
34
|
+
* @param {boolean} [params.mmsEnabled] - Filter for phone numbers that are MMS enabled
|
|
35
|
+
* @param {boolean} [params.voiceEnabled] - Filter for phone numbers that are voice enabled
|
|
36
|
+
* @param {string} [params.country] - Filter by country code (e.g., "US")
|
|
37
|
+
* @param {string} [params.state] - Filter by state code (e.g., "CA")
|
|
38
|
+
* @param {string} [params.npa] - Filter by NPA (area code)
|
|
39
|
+
* @param {string} [params.nxx] - Filter by NXX (central office code) - the first three digits of the local phone number after the area code
|
|
40
|
+
* @param {string} [params.phoneNumber] - Filter by phone number
|
|
41
|
+
* @param {number} [params.limit] - The number of items per page for pagination
|
|
42
|
+
* @param {number} [params.page] - The page number for pagination
|
|
43
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
44
|
+
* @returns {Promise<Object>} A promise that resolves to the list of available phone numbers
|
|
45
|
+
*/
|
|
46
|
+
async getAvailablePhoneNumbers({ smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page, options = {} }) {
|
|
47
|
+
const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page };
|
|
48
|
+
const queryString = this.client._getQueryString(filters);
|
|
49
|
+
return this.client(`/number/available${queryString}`, { method: "GET", ...options });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to
|
|
54
|
+
* @async
|
|
55
|
+
* @roles api, admin, developer, billing, user
|
|
56
|
+
* @param {Object} params - The parameters for purchasing phone numbers
|
|
57
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
|
|
58
|
+
* @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
|
|
59
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
60
|
+
* @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
|
|
61
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the purchase operation
|
|
62
|
+
*/
|
|
63
|
+
async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
|
|
64
|
+
this.client._require({ phoneNumbers, subgroupId });
|
|
65
|
+
return this.client(`/number`, { method: "POST", body: { phoneNumbers, subgroupId }, ...options });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Update an existing phone number's details (e.g., setting a friendly name)
|
|
70
|
+
* @async
|
|
71
|
+
* @roles api, admin, developer, user
|
|
72
|
+
* @param {Object} params - The parameters for updating the phone number
|
|
73
|
+
* @param {string} params.phoneNumber - The phone number to update
|
|
74
|
+
* @param {Object} params.updateData - The data to update for the phone number
|
|
75
|
+
* @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
|
|
76
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
77
|
+
* @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
|
|
78
|
+
* @returns {Promise<Object>} A promise that resolves to the updated phone number object
|
|
79
|
+
*/
|
|
80
|
+
async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
|
|
81
|
+
this.client._require({ phoneNumber, updateData });
|
|
82
|
+
|
|
83
|
+
// Safely encode the phone number for the URL path
|
|
84
|
+
const safePhoneNumber = encodeURIComponent(phoneNumber);
|
|
85
|
+
|
|
86
|
+
return this.client(`/number/${safePhoneNumber}`, {
|
|
87
|
+
method: "PUT",
|
|
88
|
+
body: updateData,
|
|
89
|
+
...options
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Port in a phone number by providing the necessary information for porting. Note: This operation is not currently supported and will throw an error if called.
|
|
95
|
+
* @async
|
|
96
|
+
* @roles api, admin, developer, billing, user
|
|
97
|
+
* @param {Object} params - The parameters for porting in a phone number
|
|
98
|
+
* @param {Object} params.numberData - The data for the phone number to be ported
|
|
99
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
100
|
+
* @throws {Error} Throws an error indicating that porting is not supported
|
|
101
|
+
* @returns {Promise<Object>} A promise that would resolve to the result of the porting operation if it were supported
|
|
102
|
+
*/
|
|
103
|
+
async portInPhoneNumber({ numberData, options = {} }) {
|
|
104
|
+
throw new Error("Porting phone numbers is not currently supported. Please contact support for assistance.");
|
|
105
|
+
// this.client._require({ numberData });
|
|
106
|
+
// return this.client(`/number/portin`, { method: "POST", body: numberData, ...options });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign
|
|
111
|
+
* @async
|
|
112
|
+
* @roles api, admin, developer, billing, user
|
|
113
|
+
* @param {Object} params - The parameters for assigning phone numbers to a campaign
|
|
114
|
+
* @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
|
|
115
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
|
|
116
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
117
|
+
* @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing
|
|
118
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the assignment operation
|
|
119
|
+
*/
|
|
120
|
+
async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
|
|
121
|
+
this.client._require({ campaignId, phoneNumbers });
|
|
122
|
+
const safeCampaignId = encodeURIComponent(campaignId);
|
|
123
|
+
return this.client(`/number/assign/${safeCampaignId}`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Unassign phone numbers from a campaign by providing a list of phone numbers to unassign. Note: This operation will unassign the specified phone numbers from any campaign they are currently assigned to.
|
|
128
|
+
* @async
|
|
129
|
+
* @roles api, admin, developer, billing, user
|
|
130
|
+
* @param {Object} params - The parameters for unassigning phone numbers from campaigns
|
|
131
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
|
|
132
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
133
|
+
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
134
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the unassignment operation
|
|
135
|
+
*/
|
|
136
|
+
async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
|
|
137
|
+
this.client._require({ phoneNumbers });
|
|
138
|
+
return this.client(`/number/unassign`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". Note: This operation is irreversible and should be used with caution.
|
|
143
|
+
* @async
|
|
144
|
+
* @roles api, admin, developer, billing, user
|
|
145
|
+
* @param {Object} params - The parameters for deleting phone numbers
|
|
146
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to delete
|
|
147
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
148
|
+
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
149
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the deletion operation
|
|
150
|
+
*/
|
|
151
|
+
async deletePhoneNumbers({ phoneNumbers, options = {} }) {
|
|
152
|
+
this.client._require({ phoneNumbers });
|
|
153
|
+
return this.client(`/number`, { method: "DELETE", body: { phoneNumbers }, ...options });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Deactivate one or more phone numbers. Numbers must be in READY status to be deactivated. Deactivated numbers will not be able to send or receive messages but will remain assigned to their subgroup and campaign.
|
|
158
|
+
* @async
|
|
159
|
+
* @roles api, admin, developer, billing, user
|
|
160
|
+
* @param {Object} params - The parameters for deactivating phone numbers
|
|
161
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to deactivate
|
|
162
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
163
|
+
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
164
|
+
* @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
|
|
165
|
+
*/
|
|
166
|
+
async deactivatePhoneNumbers({ phoneNumbers, options = {} }) {
|
|
167
|
+
this.client._require({ phoneNumbers });
|
|
168
|
+
return this.client(`/number/deactivate`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Reactivate one or more previously deactivated phone numbers. Numbers must be in DEACTIVATED status to be reactivated. Reactivated numbers will return to PENDING or IN_PROGRESS status depending on their campaign assignment.
|
|
173
|
+
* @async
|
|
174
|
+
* @roles api, admin, developer, billing, user
|
|
175
|
+
* @param {Object} params - The parameters for reactivating phone numbers
|
|
176
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to reactivate
|
|
177
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
178
|
+
* @throws {Error} Throws an error if the phoneNumbers parameter is missing
|
|
179
|
+
* @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
|
|
180
|
+
*/
|
|
181
|
+
async reactivatePhoneNumbers({ phoneNumbers, options = {} }) {
|
|
182
|
+
this.client._require({ phoneNumbers });
|
|
183
|
+
return this.client(`/number/reactivate`, { method: "POST", body: { phoneNumbers }, ...options });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Transfer unassigned phone numbers from one subgroup to another.
|
|
188
|
+
* @async
|
|
189
|
+
* @param {Object} params - The parameters for transferring phone numbers
|
|
190
|
+
* @param {string[]} params.phoneNumbers - The list of phone numbers to transfer
|
|
191
|
+
* @param {string} params.newSubgroupId - The ID of the new subgroup to transfer the phone numbers to
|
|
192
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
193
|
+
* @returns {Promise<Object>} A promise that resolves to the result of the transfer operation
|
|
194
|
+
*/
|
|
195
|
+
async transferPhoneNumbers({ phoneNumbers, newSubgroupId, options = {} }) {
|
|
196
|
+
this.client._require({ phoneNumbers, newSubgroupId });
|
|
197
|
+
return this.client(`/number/transfer`, { method: "POST", body: { phoneNumbers, newSubgroupId }, ...options });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Search NPA/NXX lookup data with optional filters.
|
|
202
|
+
* At least one search parameter is required.
|
|
203
|
+
* Location filters (country, state, city) cannot be combined with NPA/NXX filters.
|
|
204
|
+
* @async
|
|
205
|
+
* @roles api, admin, developer, billing, user
|
|
206
|
+
* @param {Object} params - The parameters for searching NPA/NXX data
|
|
207
|
+
* @param {string} [params.country] - Filter by country code
|
|
208
|
+
* @param {string} [params.state] - Filter by state code (2 characters)
|
|
209
|
+
* @param {string} [params.city] - Filter by city name (prefix match, case-insensitive; requires country and state)
|
|
210
|
+
* @param {string} [params.npa] - Area code filter (1-3 digits; cannot combine with location filters)
|
|
211
|
+
* @param {string} [params.nxx] - Central office code filter (1-3 digits; cannot combine with location filters)
|
|
212
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
213
|
+
* @returns {Promise<Object>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
|
|
214
|
+
*/
|
|
215
|
+
async searchNpaNxx({ country, state, city, npa, nxx, options = {} }) {
|
|
216
|
+
const queryString = this.client._getQueryString({ country, state, city, npa, nxx });
|
|
217
|
+
return this.client(`/number/lookup${queryString}`, { method: "GET", ...options });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Batch lookup city/state for NPA/NXX pairs
|
|
222
|
+
* @async
|
|
223
|
+
* @roles api, admin, developer, billing, user
|
|
224
|
+
* @param {Object} params - The parameters for the lookup
|
|
225
|
+
* @param {Array<{npa: string, nxx: string}>} params.entries - NPA/NXX pairs to look up (max 50)
|
|
226
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
227
|
+
* @returns {Promise<Object>} A promise that resolves to an array of {npa, nxx, city, state} objects
|
|
228
|
+
*/
|
|
229
|
+
async lookupLocations({ entries, options = {} }) {
|
|
230
|
+
return this.client("/number/lookup/location", { method: "POST", body: { entries }, ...options });
|
|
231
|
+
}
|
|
202
232
|
}
|