@signalhousellc/sdk 1.0.67 → 1.0.68
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 +9 -2
- package/src/SignalHouseSDK.js +24 -13
- package/src/domains/Agents.js +204 -55
- package/src/domains/Auth.js +30 -24
- package/src/domains/Billing.js +32 -26
- package/src/domains/Brands.js +45 -34
- package/src/domains/Campaigns.js +106 -47
- package/src/domains/Groups.js +53 -16
- package/src/domains/Landings.js +36 -30
- package/src/domains/Messages.js +102 -60
- package/src/domains/Notifications.js +12 -6
- package/src/domains/Numbers.js +55 -49
- package/src/domains/Onboarding.js +14 -8
- package/src/domains/Shortlinks.js +10 -4
- package/src/domains/Subgroups.js +16 -10
- package/src/domains/Subscriptions.js +22 -16
- package/src/domains/Tickets.js +18 -12
- package/src/domains/Users.js +26 -20
- package/src/domains/Webhooks.js +14 -8
- package/src/domains/voice/Analytics.js +8 -2
- package/src/domains/voice/CallLogs.js +14 -8
- package/src/domains/voice/Calls.js +14 -8
- package/src/domains/voice/GlobalVoiceSettings.js +10 -4
- package/src/domains/voice/ProgrammableVoiceProfiles.js +22 -16
- package/src/domains/voice/SipProfiles.js +24 -18
- package/src/domains/voice/SipTrunks.js +26 -20
- package/src/domains/voice/Tokens.js +10 -4
- package/src/domains/voice/browser/Call.js +2 -0
- package/src/domains/voice/browser/Device.js +23 -11
package/src/domains/Auth.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
export class Auth {
|
|
2
8
|
constructor(client, enableAdmin) {
|
|
3
9
|
this.client = client;
|
|
@@ -13,9 +19,9 @@ export class Auth {
|
|
|
13
19
|
* @roles signalhouse
|
|
14
20
|
* @param {Object} params - The parameters for forcing a group logout
|
|
15
21
|
* @param {string} params.groupId - The ID of the group whose users should be force-logged-out
|
|
16
|
-
* @param {
|
|
22
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
17
23
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
18
|
-
* @returns {Promise<
|
|
24
|
+
* @returns {Promise<SdkResponse<any>>} - The response containing loggedOutCount
|
|
19
25
|
*/
|
|
20
26
|
forceLogoutGroupUsers: async ({ groupId, options = {} }) => {
|
|
21
27
|
this.client._require({ groupId });
|
|
@@ -33,8 +39,8 @@ export class Auth {
|
|
|
33
39
|
* @param {Object} params
|
|
34
40
|
* @param {string} params.email - The user's email address
|
|
35
41
|
* @param {string} params.password - The user's password
|
|
36
|
-
* @param {
|
|
37
|
-
* @returns {Promise<
|
|
42
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
43
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
38
44
|
*/
|
|
39
45
|
async login({ email, password, options = {} }) {
|
|
40
46
|
return this.client(`/auth`, { method: "POST", body: { email, password }, ...options });
|
|
@@ -57,8 +63,8 @@ export class Auth {
|
|
|
57
63
|
* @param {boolean} [params.acceptedTermsOfService] - Whether the user accepted the Terms of Service
|
|
58
64
|
* @param {string} [params.psXid] - PartnerStack click id (ps_xid) captured from a referral link
|
|
59
65
|
* @param {string} [params.psPartnerKey] - PartnerStack partner key (ps_partner_key) captured from a referral link
|
|
60
|
-
* @param {
|
|
61
|
-
* @returns {Promise<
|
|
66
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
67
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server (contains the JWT token)
|
|
62
68
|
*/
|
|
63
69
|
async register({ businessName, fullName, email, password, phone, dialCode, country, volume, products, acceptedTermsOfService, psXid, psPartnerKey, options = {} }) {
|
|
64
70
|
return this.client(`/auth/register`, {
|
|
@@ -83,8 +89,8 @@ export class Auth {
|
|
|
83
89
|
* @roles public
|
|
84
90
|
* @param {Object} params
|
|
85
91
|
* @param {string} params.token - The verification token from the email link
|
|
86
|
-
* @param {
|
|
87
|
-
* @returns {Promise<
|
|
92
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
93
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server ({ verified: true, token?: string })
|
|
88
94
|
*/
|
|
89
95
|
async verifyEmail({ token, options = {} }) {
|
|
90
96
|
this.client._require({ token });
|
|
@@ -99,8 +105,8 @@ export class Auth {
|
|
|
99
105
|
* @roles public
|
|
100
106
|
* @param {Object} params
|
|
101
107
|
* @param {string} params.email - The email address to send a reset link to
|
|
102
|
-
* @param {
|
|
103
|
-
* @returns {Promise<
|
|
108
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
109
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server ({ success: true })
|
|
104
110
|
*/
|
|
105
111
|
async forgotPassword({ email, options = {} }) {
|
|
106
112
|
this.client._require({ email });
|
|
@@ -114,8 +120,8 @@ export class Auth {
|
|
|
114
120
|
* @param {Object} params
|
|
115
121
|
* @param {string} params.token - The single-use reset token from the email link
|
|
116
122
|
* @param {string} params.password - The new password to set (min 8 characters)
|
|
117
|
-
* @param {
|
|
118
|
-
* @returns {Promise<
|
|
123
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
124
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server ({ success: true })
|
|
119
125
|
*/
|
|
120
126
|
async resetPasswordWithToken({ token, password, options = {} }) {
|
|
121
127
|
this.client._require({ token, password });
|
|
@@ -129,8 +135,8 @@ export class Auth {
|
|
|
129
135
|
* @async
|
|
130
136
|
* @roles admin, developer, billing, user
|
|
131
137
|
* @param {Object} [params]
|
|
132
|
-
* @param {
|
|
133
|
-
* @returns {Promise<
|
|
138
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
139
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server ({ sent: true })
|
|
134
140
|
*/
|
|
135
141
|
async sendVerificationEmail({ options = {} } = {}) {
|
|
136
142
|
return this.client(`/auth/send-verification-email`, { method: "POST", ...options });
|
|
@@ -143,8 +149,8 @@ export class Auth {
|
|
|
143
149
|
* @param {Object} params
|
|
144
150
|
* @param {string} params.userId - The id of the user
|
|
145
151
|
* @param {string} params.newPassword - The new password to set for the user
|
|
146
|
-
* @param {
|
|
147
|
-
* @returns {Promise<
|
|
152
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
153
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
148
154
|
*/
|
|
149
155
|
async resetPassword({ userId, newPassword, options = {} }) {
|
|
150
156
|
this.client._require({ userId, newPassword });
|
|
@@ -161,8 +167,8 @@ export class Auth {
|
|
|
161
167
|
* @param {string} [params.userId] - Returns history for a specific user (one of groupId/userId required)
|
|
162
168
|
* @param {number} [params.page] - Page number (min 1, default 1)
|
|
163
169
|
* @param {number} [params.limit] - Results per page (min 1, max 100, default 20)
|
|
164
|
-
* @param {
|
|
165
|
-
* @returns {Promise<
|
|
170
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
171
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
166
172
|
*/
|
|
167
173
|
async getAuthHistory({ groupId, userId, page, limit, options = {} }) {
|
|
168
174
|
this.client._require({ "groupId or userId": groupId ?? userId });
|
|
@@ -175,8 +181,8 @@ export class Auth {
|
|
|
175
181
|
* @async
|
|
176
182
|
* @roles admin
|
|
177
183
|
* @param {Object} [params]
|
|
178
|
-
* @param {
|
|
179
|
-
* @returns {Promise<
|
|
184
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
185
|
+
* @returns {Promise<SdkResponse<any>>} The response containing loggedOutCount
|
|
180
186
|
*/
|
|
181
187
|
async logoutAll({ options = {} } = {}) {
|
|
182
188
|
return this.client(`/auth/logout-all`, { method: "POST", ...options });
|
|
@@ -188,8 +194,8 @@ export class Auth {
|
|
|
188
194
|
* @async
|
|
189
195
|
* @roles admin, developer, billing, user, api
|
|
190
196
|
* @param {Object} [params]
|
|
191
|
-
* @param {
|
|
192
|
-
* @returns {Promise<
|
|
197
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
198
|
+
* @returns {Promise<SdkResponse<any>>} The response containing { groupId }
|
|
193
199
|
*/
|
|
194
200
|
async getGroupId({ options = {} } = {}) {
|
|
195
201
|
return this.client(`/auth/group-id`, { method: "GET", ...options });
|
|
@@ -202,8 +208,8 @@ export class Auth {
|
|
|
202
208
|
* @roles admin, developer, billing, user
|
|
203
209
|
* @param {Object} params
|
|
204
210
|
* @param {string} params.product - The external system to link to ("ghl" or "shopify")
|
|
205
|
-
* @param {
|
|
206
|
-
* @returns {Promise<
|
|
211
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
212
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server ({ token })
|
|
207
213
|
*/
|
|
208
214
|
async requestExternalLinkToken({ product, options = {} }) {
|
|
209
215
|
this.client._require({ product });
|
package/src/domains/Billing.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
export class Billing {
|
|
2
8
|
constructor(client, enableAdmin) {
|
|
3
9
|
this.client = client;
|
|
@@ -14,8 +20,8 @@ export class Billing {
|
|
|
14
20
|
* @param {number} params.amount - Amount in microdollars
|
|
15
21
|
* @param {string} params.transactionType - Type of credit (e.g. "Goodwill Credit", "Billing Correction")
|
|
16
22
|
* @param {string} params.description - Reason for the credit (1-500 characters)
|
|
17
|
-
* @param {
|
|
18
|
-
* @returns {Promise<
|
|
23
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
24
|
+
* @returns {Promise<SdkResponse<any>>} The created transaction object
|
|
19
25
|
*/
|
|
20
26
|
issueCredit: async ({ groupId, amount, transactionType, description, options = {} }) => {
|
|
21
27
|
this.client._require({ groupId, amount, transactionType, description });
|
|
@@ -35,8 +41,8 @@ export class Billing {
|
|
|
35
41
|
* @param {string} params.groupId - The group ID to update fees for
|
|
36
42
|
* @param {Object} params.fees - Object of fee field names to microdollar values
|
|
37
43
|
* @param {boolean} [params.overrideActiveSubscription=false] - If true, also update the active subscription fees
|
|
38
|
-
* @param {
|
|
39
|
-
* @returns {Promise<
|
|
44
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
45
|
+
* @returns {Promise<SdkResponse<any>>} The updated fee schedule
|
|
40
46
|
*/
|
|
41
47
|
updateFees: async ({ groupId, fees, overrideActiveSubscription, options = {} }) => {
|
|
42
48
|
this.client._require({ groupId, fees });
|
|
@@ -64,8 +70,8 @@ export class Billing {
|
|
|
64
70
|
* @param {string} [params.transactionType] - The type of transaction to filter by
|
|
65
71
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
66
72
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
67
|
-
* @param {
|
|
68
|
-
* @returns {Promise<Array
|
|
73
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
74
|
+
* @returns {Promise<SdkResponse<Array>>} The response from the server
|
|
69
75
|
*/
|
|
70
76
|
async getTransactionHistory({ groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate, options = {} }) {
|
|
71
77
|
const filters = { groupId, subgroupId, brandId, campaignId, entryType, transactionType, startDate, endDate };
|
|
@@ -84,8 +90,8 @@ export class Billing {
|
|
|
84
90
|
* @param {number} [params.page=1] - Page number (positive integer)
|
|
85
91
|
* @param {number} [params.limit=10] - Results per page (positive integer, max 10000)
|
|
86
92
|
* @param {string} [params.timezone] - IANA timezone (default: "UTC")
|
|
87
|
-
* @param {
|
|
88
|
-
* @returns {Promise<{data: Array<Object>, pagination: {page: number, limit: number, totalRecords: number, totalPages: number, totalAmount: number}}
|
|
93
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
94
|
+
* @returns {Promise<SdkResponse<{data: Array<Object>, pagination: {page: number, limit: number, totalRecords: number, totalPages: number, totalAmount: number}}>>}
|
|
89
95
|
*/
|
|
90
96
|
async getPaymentHistory({ groupId, startDate, endDate, page, limit, timezone, options = {} }) {
|
|
91
97
|
const filters = { groupId, startDate, endDate, page, limit, timezone };
|
|
@@ -99,9 +105,9 @@ export class Billing {
|
|
|
99
105
|
* @roles api, admin, developer, billing, user
|
|
100
106
|
* @param {Object} params - The parameters for getting the wallet information
|
|
101
107
|
* @param {string} params.groupId - The ID of the group to get the wallet information for
|
|
102
|
-
* @param {
|
|
108
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
103
109
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
104
|
-
* @returns {Promise<
|
|
110
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
105
111
|
*/
|
|
106
112
|
async getWallet({ groupId, options = {} }) {
|
|
107
113
|
this.client._require({ groupId });
|
|
@@ -120,9 +126,9 @@ export class Billing {
|
|
|
120
126
|
* @param {number} [params.autoRechargeToAmount] - The amount to recharge to when auto-recharge is triggered
|
|
121
127
|
* @param {string} [params.primaryPaymentMethodId] - The ID of the primary payment method to use for auto-recharge
|
|
122
128
|
* @param {string} [params.secondaryPaymentMethodId] - The ID of the secondary payment method to use for auto-recharge if the primary method fails
|
|
123
|
-
* @param {
|
|
129
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
124
130
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
125
|
-
* @returns {Promise<
|
|
131
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
126
132
|
*/
|
|
127
133
|
async updateWallet({ groupId, autoRechargeEnabled, autoRechargeThreshold, autoRechargeToAmount, primaryPaymentMethodId, secondaryPaymentMethodId, options = {} }) {
|
|
128
134
|
this.client._require({ groupId });
|
|
@@ -140,9 +146,9 @@ export class Billing {
|
|
|
140
146
|
* @roles api, admin, developer, billing, user
|
|
141
147
|
* @param {Object} params - The parameters for getting the payment methods
|
|
142
148
|
* @param {string} params.groupId - The ID of the group to get the payment methods for
|
|
143
|
-
* @param {
|
|
149
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
144
150
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
145
|
-
* @returns {Promise<Array
|
|
151
|
+
* @returns {Promise<SdkResponse<Array>>} The response from the server
|
|
146
152
|
*/
|
|
147
153
|
async getPaymentMethods({ groupId, options = {} }) {
|
|
148
154
|
this.client._require({ groupId });
|
|
@@ -158,9 +164,9 @@ export class Billing {
|
|
|
158
164
|
* @param {string} params.groupId - The ID of the group to add funds to
|
|
159
165
|
* @param {number} params.amount - The amount to add to the group's wallet in microdollars (e.g., $10 would be 10000000)
|
|
160
166
|
* @param {string} [params.paymentMethodId] - The ID of the payment method to use for adding funds
|
|
161
|
-
* @param {
|
|
167
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
162
168
|
* @throws {Error} Throws an error if the groupId or amount parameters are missing
|
|
163
|
-
* @returns {Promise<
|
|
169
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
164
170
|
*/
|
|
165
171
|
async addFunds({ groupId, amount, paymentMethodId = undefined, options = {} }) {
|
|
166
172
|
this.client._require({ groupId, amount });
|
|
@@ -175,9 +181,9 @@ export class Billing {
|
|
|
175
181
|
* @param {Object} params - The parameters for adding a payment method
|
|
176
182
|
* @param {string} params.groupId - The ID of the group to add the payment method to
|
|
177
183
|
* @param {string} params.paymentMethodId - The ID of the payment method to add
|
|
178
|
-
* @param {
|
|
184
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
179
185
|
* @throws {Error} Throws an error if the groupId or paymentMethodId parameters are missing
|
|
180
|
-
* @returns {Promise<
|
|
186
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
181
187
|
*/
|
|
182
188
|
async addPaymentMethod({ groupId, paymentMethodId, options = {} }) {
|
|
183
189
|
this.client._require({ groupId, paymentMethodId });
|
|
@@ -192,9 +198,9 @@ export class Billing {
|
|
|
192
198
|
* @param {Object} params - The parameters for removing a payment method
|
|
193
199
|
* @param {string} params.groupId - The ID of the group to remove the payment method from
|
|
194
200
|
* @param {string} params.paymentMethodId - The ID of the payment method to remove
|
|
195
|
-
* @param {
|
|
201
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
196
202
|
* @throws {Error} Throws an error if the groupId or paymentMethodId parameters are missing
|
|
197
|
-
* @returns {Promise<
|
|
203
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
198
204
|
*/
|
|
199
205
|
async removePaymentMethod({ groupId, paymentMethodId, options = {} }) {
|
|
200
206
|
this.client._require({ groupId, paymentMethodId });
|
|
@@ -212,8 +218,8 @@ export class Billing {
|
|
|
212
218
|
* @param {string} [params.subgroupId] - The ID of the subgroup to filter by
|
|
213
219
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
214
220
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
215
|
-
* @param {
|
|
216
|
-
* @returns {Promise<
|
|
221
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
222
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
217
223
|
*/
|
|
218
224
|
async getInvoiceDetails({ groupId, subgroupId, startDate, endDate, options = {} }) {
|
|
219
225
|
const filters = { groupId, subgroupId, startDate, endDate };
|
|
@@ -231,8 +237,8 @@ export class Billing {
|
|
|
231
237
|
* @param {string} params.startDate - Start date in YYYY-MM-DD format (inclusive)
|
|
232
238
|
* @param {string} params.endDate - End date in YYYY-MM-DD format (inclusive)
|
|
233
239
|
* @param {string} [params.timezone] - IANA timezone (default: "UTC")
|
|
234
|
-
* @param {
|
|
235
|
-
* @returns {Promise<Array<{entryType: string, transactionType: string, unitPrice: number, quantity: number, amount: number}
|
|
240
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
241
|
+
* @returns {Promise<SdkResponse<Array<{entryType: string, transactionType: string, unitPrice: number, quantity: number, amount: number}>>>}
|
|
236
242
|
*/
|
|
237
243
|
async getInvoiceLedger({ groupId, subgroupId, startDate, endDate, timezone, options = {} }) {
|
|
238
244
|
const filters = { groupId, subgroupId, startDate, endDate, timezone };
|
|
@@ -246,9 +252,9 @@ export class Billing {
|
|
|
246
252
|
* @roles api, admin, developer, billing, user
|
|
247
253
|
* @param {Object} params - The parameters for getting the fees
|
|
248
254
|
* @param {string} params.groupId - The ID of the group to get fees for
|
|
249
|
-
* @param {
|
|
255
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
250
256
|
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
251
|
-
* @returns {Promise<
|
|
257
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
252
258
|
*/
|
|
253
259
|
async getFees({ groupId, options = {} }) {
|
|
254
260
|
this.client._require({ groupId });
|
package/src/domains/Brands.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* @typedef {string} BrandLookupId - Carrier Brand ID (B…, TFNB…, or SCB…), Mongo `_id`, or internal reference UUID.
|
|
3
9
|
* Use on update, delete, revet, vetting, appeal, and transfer routes. Pending brands return `brandId: null`
|
|
@@ -134,8 +140,8 @@ export class Brands {
|
|
|
134
140
|
* @param {number} [params.limit] - The number of items per page
|
|
135
141
|
* @param {string} [params.status] - The status of the brand to filter by (PENDING_CREATION, PENDING_APPROVAL, UNVERIFIED, VERIFIED, VETTED_VERIFIED, PENDING_DELETE, DELETED)
|
|
136
142
|
* @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
|
|
137
|
-
* @param {
|
|
138
|
-
* @returns {Promise<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, [key: string]: any }
|
|
143
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
144
|
+
* @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, [key: string]: any }>>>} Brand records. For 10DLC brands in PENDING_CREATION (or rejected before carrier assignment), brandId is null — poll by _id until status advances and brandId is assigned.
|
|
139
145
|
*/
|
|
140
146
|
async getBrands({ id, subgroupId, groupId, page, limit, status, registrationType, options = {} }) {
|
|
141
147
|
const filters = { id, subgroupId, groupId, page, limit, status, registrationType };
|
|
@@ -149,9 +155,9 @@ export class Brands {
|
|
|
149
155
|
* @roles api, admin, developer, user
|
|
150
156
|
* @param {Object} params - The parameters for getting the external vetting information
|
|
151
157
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
152
|
-
* @param {
|
|
158
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
153
159
|
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
154
|
-
* @returns {Promise<
|
|
160
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
155
161
|
*/
|
|
156
162
|
async getExternalVetting({ brandId, options = {} }) {
|
|
157
163
|
this.client._require({ brandId });
|
|
@@ -165,9 +171,9 @@ export class Brands {
|
|
|
165
171
|
* @roles api, admin, developer, billing, user
|
|
166
172
|
* @param {Object} params - The parameters for creating the brand (see CreateBrandData typedef for details)
|
|
167
173
|
* @param {CreateBrandData} params.brandData - The data for the brand to be created
|
|
168
|
-
* @param {
|
|
174
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
169
175
|
* @throws {Error} Throws an error if the brandData parameter is missing or if required fields in brandData are missing
|
|
170
|
-
* @returns {Promise<
|
|
176
|
+
* @returns {Promise<SdkResponse<any>>} Brand entity. `brandId` is `null` until the carrier assigns a Brand ID — use `_id` to poll status.
|
|
171
177
|
*/
|
|
172
178
|
async createBrand({ brandData, options = {} }) {
|
|
173
179
|
this.client._require({ brandData: brandData });
|
|
@@ -180,9 +186,9 @@ export class Brands {
|
|
|
180
186
|
* @roles api, admin, developer, billing, user
|
|
181
187
|
* @param {Object} params - The parameters for creating the toll-free brand
|
|
182
188
|
* @param {CreateTollFreeBrandData} params.brandData - The data for the toll-free brand to be created (see CreateTollFreeBrandData typedef for details; TFN-specific fields live under brandData.tollFree, and registrationType is forced server-side by the route)
|
|
183
|
-
* @param {
|
|
189
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
184
190
|
* @throws {Error} Throws an error if the brandData parameter is missing
|
|
185
|
-
* @returns {Promise<
|
|
191
|
+
* @returns {Promise<SdkResponse<any>>} Brand entity. For Toll-Free, `brandId` is a TFNB-prefixed id when assigned; otherwise `null` — use `_id` to poll.
|
|
186
192
|
*/
|
|
187
193
|
async createTollFreeBrand({ brandData, options = {} }) {
|
|
188
194
|
this.client._require({ brandData });
|
|
@@ -195,8 +201,8 @@ export class Brands {
|
|
|
195
201
|
* @roles api, admin, developer, billing, user
|
|
196
202
|
* @param {Object} params - The creation parameters.
|
|
197
203
|
* @param {CreateShortCodeBrandData} params.brandData - The Short Code brand data. The route forces registrationType server-side.
|
|
198
|
-
* @param {
|
|
199
|
-
* @returns {Promise<
|
|
204
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
205
|
+
* @returns {Promise<SdkResponse<any>>} A 201-created Short Code brand with a stable SCB-prefixed ID and PENDING_APPROVAL status.
|
|
200
206
|
*/
|
|
201
207
|
async createShortCodeBrand({ brandData, options = {} }) {
|
|
202
208
|
this.client._require({ brandData });
|
|
@@ -209,8 +215,8 @@ export class Brands {
|
|
|
209
215
|
* @roles signalhouse_admin
|
|
210
216
|
* @param {Object} params - The approval parameters.
|
|
211
217
|
* @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
|
|
212
|
-
* @param {
|
|
213
|
-
* @returns {Promise<
|
|
218
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
219
|
+
* @returns {Promise<SdkResponse<any>>} The verified Short Code brand.
|
|
214
220
|
*/
|
|
215
221
|
async approveShortCodeBrand({ brandId, options = {} }) {
|
|
216
222
|
this.client._require({ brandId });
|
|
@@ -224,8 +230,8 @@ export class Brands {
|
|
|
224
230
|
* @param {Object} params - The rejection parameters.
|
|
225
231
|
* @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
|
|
226
232
|
* @param {string} params.internalRejectionReason - Required customer-visible rejection reason.
|
|
227
|
-
* @param {
|
|
228
|
-
* @returns {Promise<
|
|
233
|
+
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
234
|
+
* @returns {Promise<SdkResponse<any>>} The rejected Short Code brand.
|
|
229
235
|
*/
|
|
230
236
|
async rejectShortCodeBrand({ brandId, internalRejectionReason, options = {} }) {
|
|
231
237
|
this.client._require({ brandId, internalRejectionReason });
|
|
@@ -243,9 +249,9 @@ export class Brands {
|
|
|
243
249
|
* @param {Object} params - The parameters for transferring the brands
|
|
244
250
|
* @param {string} params.subgroupId - The ID of the subgroup to transfer the brands to
|
|
245
251
|
* @param {BrandLookupId[]} params.brandIds - Brand lookup ids to transfer (carrier id, Mongo `_id`, or internal reference).
|
|
246
|
-
* @param {
|
|
252
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
247
253
|
* @throws {Error} Throws an error if the subgroupId or brandIds parameters are missing
|
|
248
|
-
* @returns {Promise<
|
|
254
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
249
255
|
*/
|
|
250
256
|
async transferBrand({ subgroupId, brandIds, options = {} }) {
|
|
251
257
|
this.client._require({ subgroupId, brandIds });
|
|
@@ -259,14 +265,19 @@ export class Brands {
|
|
|
259
265
|
* @roles api, admin, developer, billing, user
|
|
260
266
|
* @param {Object} params - The parameters for creating external vetting
|
|
261
267
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
262
|
-
* @param {
|
|
263
|
-
* @
|
|
264
|
-
* @
|
|
268
|
+
* @param {string} params.vettingProviderId - The external vetting provider: AEGIS or WMC
|
|
269
|
+
* @param {string} params.vettingClass - The vetting class: STANDARD, ENHANCED, AUTHPLUS, or RCS (AEGIS accepts all four; WMC accepts STANDARD only)
|
|
270
|
+
* @param {Object} [params.additionalData] - Provider-specific additional data forwarded to TCR
|
|
271
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
272
|
+
* @throws {Error} Throws an error if the brandId, vettingProviderId, or vettingClass parameter is missing
|
|
273
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
265
274
|
*/
|
|
266
|
-
async createExternalVetting({ brandId, options = {} }) {
|
|
267
|
-
this.client._require({ brandId });
|
|
275
|
+
async createExternalVetting({ brandId, vettingProviderId, vettingClass, additionalData, options = {} }) {
|
|
276
|
+
this.client._require({ brandId, vettingProviderId, vettingClass });
|
|
268
277
|
const safeBrandId = encodeURIComponent(brandId);
|
|
269
|
-
|
|
278
|
+
const body = { vettingProviderId, vettingClass };
|
|
279
|
+
if (additionalData !== undefined) body.additionalData = additionalData;
|
|
280
|
+
return this.client(`/brand/externalvetting/${safeBrandId}`, { method: 'POST', body, ...options });
|
|
270
281
|
}
|
|
271
282
|
|
|
272
283
|
/**
|
|
@@ -282,9 +293,9 @@ export class Brands {
|
|
|
282
293
|
* @param {string} params.vettingProviderId - The external vetting provider (AEGIS, WMC, CV)
|
|
283
294
|
* @param {string} params.vettingId - The provider-issued vetting / transaction ID to import
|
|
284
295
|
* @param {string} [params.vettingToken] - The provider-issued vetting token (required by some providers, e.g. AEGIS)
|
|
285
|
-
* @param {
|
|
296
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
286
297
|
* @throws {Error} Throws an error if brandId, vettingProviderId, or vettingId is missing
|
|
287
|
-
* @returns {Promise<
|
|
298
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
288
299
|
*/
|
|
289
300
|
async importExternalVetting({ brandId, vettingProviderId, vettingId, vettingToken, options = {} }) {
|
|
290
301
|
this.client._require({ brandId, vettingProviderId, vettingId });
|
|
@@ -303,9 +314,9 @@ export class Brands {
|
|
|
303
314
|
* @param {Object} params - The parameters for updating the brand (see UpdateBrandData typedef for details)
|
|
304
315
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
305
316
|
* @param {UpdateBrandData} params.brandData - The data for the brand to be updated
|
|
306
|
-
* @param {
|
|
317
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
307
318
|
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
308
|
-
* @returns {Promise<
|
|
319
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
309
320
|
*/
|
|
310
321
|
async updateBrand({ brandId, brandData, options = {} }) {
|
|
311
322
|
this.client._require({ brandId });
|
|
@@ -319,9 +330,9 @@ export class Brands {
|
|
|
319
330
|
* @roles api, admin, developer, billing, user
|
|
320
331
|
* @param {Object} params - The parameters for reverting the brand
|
|
321
332
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
322
|
-
* @param {
|
|
333
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
323
334
|
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
324
|
-
* @returns {Promise<
|
|
335
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
325
336
|
*/
|
|
326
337
|
async revetBrand({ brandId, options = {} }) {
|
|
327
338
|
this.client._require({ brandId });
|
|
@@ -335,9 +346,9 @@ export class Brands {
|
|
|
335
346
|
* @roles api, admin, developer, billing, user
|
|
336
347
|
* @param {Object} params - The parameters for deleting the brand
|
|
337
348
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
338
|
-
* @param {
|
|
349
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
339
350
|
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
340
|
-
* @returns {Promise<
|
|
351
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
341
352
|
*/
|
|
342
353
|
async deleteBrand({ brandId, options = {} }) {
|
|
343
354
|
this.client._require({ brandId });
|
|
@@ -351,9 +362,9 @@ export class Brands {
|
|
|
351
362
|
* @roles api, admin, developer, billing, user
|
|
352
363
|
* @param {Object} params - The parameters for getting the appeal history
|
|
353
364
|
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
|
|
354
|
-
* @param {
|
|
365
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
355
366
|
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
356
|
-
* @returns {Promise<Array
|
|
367
|
+
* @returns {Promise<SdkResponse<Array>>} Array of BrandAppeal objects
|
|
357
368
|
*/
|
|
358
369
|
async getAppealHistory({ brandId, options = {} }) {
|
|
359
370
|
this.client._require({ brandId });
|
|
@@ -370,9 +381,9 @@ export class Brands {
|
|
|
370
381
|
* @param {Array<string>} params.appealCategories - Array of appeal categories (VERIFY_TAX_ID, VERIFY_NON_PROFIT, VERIFY_GOVERNMENT)
|
|
371
382
|
* @param {string} params.explanation - Required explanation justifying the appeal
|
|
372
383
|
* @param {File|Blob} params.file - The supporting document file
|
|
373
|
-
* @param {
|
|
384
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
374
385
|
* @throws {Error} Throws an error if required parameters are missing
|
|
375
|
-
* @returns {Promise<
|
|
386
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
376
387
|
*/
|
|
377
388
|
async submitAppeal({ brandId, appealCategories, explanation, file, options = {} }) {
|
|
378
389
|
this.client._require({ brandId, appealCategories, explanation, file });
|