@signalhousellc/sdk 1.5.0 → 1.6.0

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.
Files changed (54) hide show
  1. package/README.md +5 -56
  2. package/index.d.ts +1 -0
  3. package/index.js +2 -0
  4. package/package.json +32 -34
  5. package/voice-browser.d.ts +1 -0
  6. package/voice-browser.js +2 -0
  7. package/warn.js +7 -0
  8. package/webhooks.d.ts +1 -0
  9. package/webhooks.js +2 -0
  10. package/scripts/install-skills.mjs +0 -329
  11. package/skills/VENDORED.json +0 -22
  12. package/skills/signalhouse-10dlc/SKILL.md +0 -172
  13. package/skills/signalhouse-10dlc/examples/brightsmile-onboarding.md +0 -62
  14. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +0 -104
  15. package/skills/signalhouse-advisor/SKILL.md +0 -84
  16. package/skills/signalhouse-numbers/SKILL.md +0 -82
  17. package/skills/signalhouse-setup/SKILL.md +0 -121
  18. package/skills/signalhouse-sms/SKILL.md +0 -81
  19. package/skills/signalhouse-webhooks/SKILL.md +0 -148
  20. package/src/SignalHouseSDK.js +0 -201
  21. package/src/domains/Agents.js +0 -987
  22. package/src/domains/Auth.js +0 -225
  23. package/src/domains/Billing.js +0 -264
  24. package/src/domains/Brands.js +0 -508
  25. package/src/domains/Campaigns.js +0 -691
  26. package/src/domains/Dnc.js +0 -168
  27. package/src/domains/Groups.js +0 -187
  28. package/src/domains/Landings.js +0 -237
  29. package/src/domains/Messages.js +0 -609
  30. package/src/domains/Notifications.js +0 -62
  31. package/src/domains/Numbers.js +0 -572
  32. package/src/domains/Onboarding.js +0 -128
  33. package/src/domains/Registrations.js +0 -246
  34. package/src/domains/Shortlinks.js +0 -80
  35. package/src/domains/Subgroups.js +0 -136
  36. package/src/domains/Subscriptions.js +0 -146
  37. package/src/domains/Templates.js +0 -403
  38. package/src/domains/Tickets.js +0 -100
  39. package/src/domains/Users.js +0 -228
  40. package/src/domains/Voice.js +0 -41
  41. package/src/domains/Webhooks.js +0 -125
  42. package/src/domains/voice/Analytics.js +0 -82
  43. package/src/domains/voice/CallLogs.js +0 -111
  44. package/src/domains/voice/Calls.js +0 -118
  45. package/src/domains/voice/GlobalVoiceSettings.js +0 -54
  46. package/src/domains/voice/NumberRoutes.js +0 -82
  47. package/src/domains/voice/ProgrammableVoiceProfiles.js +0 -191
  48. package/src/domains/voice/SipProfiles.js +0 -203
  49. package/src/domains/voice/SipTrunks.js +0 -203
  50. package/src/domains/voice/Tokens.js +0 -96
  51. package/src/domains/voice/browser/Call.js +0 -366
  52. package/src/domains/voice/browser/Device.js +0 -484
  53. package/src/domains/voice/browser/index.js +0 -17
  54. package/src/webhooks/verifySignature.js +0 -66
@@ -1,508 +0,0 @@
1
- /** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {string} BrandLookupId - Carrier Brand ID (B…, TFNB…, or SCB…), Mongo `_id`, or internal reference UUID.
9
- * Use on update, delete, revet, vetting, appeal, and transfer routes. Pending brands return `brandId: null`
10
- * in read/create responses — poll `GET /brand?id=<Mongo _id>` until a carrier Brand ID is assigned.
11
- */
12
-
13
- /**
14
- * @typedef {Object} CreateBrandData
15
- * @property {string} subgroupId - The ID of the subgroup to create the brand under
16
- * @property {string} entityType - The type of entity for the brand (PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, GOVERNMENT)
17
- * @property {string} displayName - The display name for the brand
18
- * @property {string} companyName - The company name for the brand
19
- * @property {string} ein - The EIN (Employer Identification Number) for the brand
20
- * @property {string} [einIssuingCountry] - The country that issued the EIN for the brand
21
- * @property {string} [altBusinessId] - An alternative business identifier for the brand (e.g., DUNS number)
22
- * @property {string} [altBusinessIdType] - The type of the alternative business identifier ("NONE", "DUNS", "LEI", "GIIN")
23
- * @property {string} [firstName] - The first name of the primary contact for the brand
24
- * @property {string} [lastName] - The last name of the primary contact for the brand
25
- * @property {string} phone - The phone number of the primary contact for the brand
26
- * @property {string} street - The street address of the primary contact for the brand
27
- * @property {string} city - The city of the primary contact for the brand
28
- * @property {string} state - The state of the primary contact for the brand
29
- * @property {string} postalCode - The postal code of the primary contact for the brand
30
- * @property {string} country - The country code of the primary contact for the brand (e.g., "US")
31
- * @property {string} email - The email address of the primary contact for the brand
32
- * @property {string} [mobilePhone] - The mobile phone number of the primary contact for the brand
33
- * @property {string} [stockSymbol] - The stock symbol for the brand if it is a publicly traded company
34
- * @property {string} [stockExchange] - The stock exchange where the brand is listed if it is a publicly traded company
35
- * @property {string} [website] - The website URL for the brand
36
- * @property {string} vertical - The vertical for the brand (PROFESSIONAL, REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION)
37
- * @property {string} [referenceId] - A unique reference for the brand
38
- * @property {Array<string>} [tag] - An array of tags to associate with the brand
39
- * @property {boolean} [mock] - Whether to register the brand in TCR's mock environment instead of the live registry. TCR is still called and the mock brand auto-approves, so it does not exercise the rejection states a live registration can hit. Brand creation is not billed; campaign registration and number purchase are still billed as normal
40
- * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
41
- */
42
-
43
- /**
44
- * @typedef {Object} UpdateBrandData
45
- * @property {string} [companyName] - The company name for the brand
46
- * @property {string} [ein] - The EIN (Employer Identification Number) for the brand
47
- * @property {string} [einIssuingCountry] - The country that issued the EIN for the brand
48
- * @property {string} [entityType] - The type of entity for the brand (PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT, GOVERNMENT)
49
- * @property {string} [firstName] - The first name of the primary contact for the brand
50
- * @property {string} [lastName] - The last name of the primary contact for the brand
51
- * @property {string} [displayName] - The display name for the brand
52
- * @property {string} [website] - The website URL for the brand
53
- * @property {string} [street] - The street address of the primary contact for the brand
54
- * @property {string} [city] - The city of the primary contact for the brand
55
- * @property {string} [state] - The state of the primary contact for the brand
56
- * @property {string} [postalCode] - The postal code of the primary contact for the brand
57
- * @property {string} [country] - The country code of the primary contact for the brand (e.g., "US")
58
- * @property {string} [email] - The email address of the primary contact for the brand
59
- * @property {string} [referenceId] - A unique reference for the brand
60
- * @property {string} [phone] - The phone number of the primary contact for the brand
61
- * @property {string} [vertical] - The vertical for the brand (PROFESSIONAL, REAL_ESTATE, HEALTHCARE, HUMAN_RESOURCES, ENERGY, ENTERTAINMENT, RETAIL, TRANSPORTATION, AGRICULTURE, INSURANCE, POSTAL, EDUCATION, HOSPITALITY, FINANCIAL, POLITICAL, GAMBLING, LEGAL, CONSTRUCTION, NGO, MANUFACTURING, GOVERNMENT, TECHNOLOGY, COMMUNICATION)
62
- * @property {string} [stockSymbol] - The stock symbol for the brand if it is a publicly traded company
63
- * @property {string} [stockExchange] - The stock exchange where the brand is listed if it is a publicly traded company
64
- * @property {string} [altBusinessId] - An alternative business identifier for the brand (e.g., DUNS number)
65
- * @property {string} [altBusinessIdType] - The type of the alternative business identifier ("NONE", "DUNS", "LEI", "GIIN")
66
- * @property {string} [brandRelationship] - Not in use - reserved for future use
67
- * @property {string} [businessContactEmail] - The email address of the business contact for the brand (required if entityType is PUBLIC_PROFIT or NON_PROFIT)
68
- * @property {Object} [tollFree] - Toll-Free editable fields, used when updating a Toll-Free brand. Optional sub-fields: legalEntityType, businessRegistrationType, taxId, countryCode, supportPhone, taxIdIssuingCountry, businessDBA, businessWebsite. supportPhone must be E.164 with an optional leading "+" and no spaces, parentheses or hyphens (e.g. "17025550100"). (Toll-Free brands sync to Infobip; only DCA_PENDING/DCA_ACTIVE brands are editable and subgroupId is immutable.)
69
- */
70
-
71
- /**
72
- * @typedef {Object} TollFreeBrandDetails
73
- * @property {string} businessRegistrationType - The business registration type (required, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
74
- * @property {string} legalEntityType - The legal entity type (required, one of PRIVATE_COMPANY, PUBLIC_COMPANY, NON_PROFIT, GOVERNMENT, SOLE_PROPRIETOR)
75
- * @property {string} taxId - The business tax identifier (required, at most 50 characters)
76
- * @property {string} countryCode - The business country code (required, 2-letter ISO code)
77
- * @property {string} supportPhone - The customer-support phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "17025550100")
78
- * @property {string} [taxIdIssuingCountry] - The country that issued the tax ID (optional, 2-letter ISO code)
79
- * @property {string} [businessDBA] - The business "doing business as" name (optional, at most 255 characters)
80
- * @property {string} [businessWebsite] - The customer's real website, sent to Infobip for brand verification (optional, valid URL, at most 255 characters; distinct from the top-level website / landing URL)
81
- */
82
-
83
- /**
84
- * @typedef {Object} BusinessVerificationDetails
85
- * @property {string} businessName - The legal business name (required, at most 255 characters)
86
- * @property {string} businessType - The business type (required, one of CO_OPERATIVE, CORPORATION, LIMITED_LIABILITY_CORPORATION, NON_PROFIT_CORPORATION, PARTNERSHIP)
87
- * @property {string} industry - The business industry (required, one of AGRICULTURE, AUTOMOTIVE, BANKING, CONSTRUCTION, CONSUMER, EDUCATION, ELECTRONICS, ENGINEERING, ENERGY, FAST_MOVING_CONSUMER_GOODS, FINANCIAL, FINTECH, FOOD_AND_BEVERAGE, GOVERNMENT, HEALTHCARE, HOSPITALITY, INSURANCE, JEWELRY, LEGAL, MANUFACTURING, MEDIA, NOT_FOR_PROFIT, OIL_AND_GAS, ONLINE, PROFESSIONAL_SERVICES, RAW_MATERIALS, REAL_ESTATE, RELIGION, RETAIL, TECHNOLOGY, TELECOMMUNICATIONS, TRANSPORTATION, TRAVEL)
88
- * @property {string} registrationType - The business registration type (required, one of EIN, CBN, NEQ, PROVINCIAL_NUMBER, CRN, VAT, ACN, ABN, BRN, SIREN, SIRET, NZBN, UST_IDNR, CIF, NIF, CNPJ, UID, OTHER)
89
- * @property {string} registrationNumber - The business registration number, e.g. the EIN (required, at most 50 characters)
90
- * @property {string} website - The business website (required, valid URL, at most 255 characters)
91
- * @property {string} street - The business street address (required, at most 255 characters)
92
- * @property {string} [street2] - The second line of the street address (optional, at most 255 characters)
93
- * @property {string} city - The business city (required, at most 100 characters)
94
- * @property {string} state - The business state or province (required, 2-letter code)
95
- * @property {string} postalCode - The business postal code (required, at most 10 characters)
96
- * @property {string} country - The business country (required, "US" or "CA")
97
- * @property {Object} representative - The business's authorized representative (required)
98
- * @property {string} representative.firstName - The representative's first name (required, at most 100 characters)
99
- * @property {string} representative.lastName - The representative's last name (required, at most 100 characters)
100
- * @property {string} representative.email - The representative's email address (required, valid email, at most 100 characters)
101
- * @property {string} representative.phone - The representative's phone number (required, E.164 with an optional leading "+" and no spaces, parentheses or hyphens, e.g. "+17025550100")
102
- * @property {string} representative.jobTitle - The representative's job title (required, at most 100 characters)
103
- * @property {string} representative.jobLevel - The representative's job level (required, one of DIRECTOR, GM, VP, CEO, CFO, GENERAL_COUNSEL, OTHER)
104
- */
105
-
106
- /**
107
- * @typedef {Object} CreateTollFreeBrandData
108
- * @property {string} subgroupId - The ID of the subgroup to create the brand under (required, exactly 8 characters)
109
- * @property {string} displayName - The display name for the brand (required, at most 255 characters)
110
- * @property {string} companyName - The company name for the brand (required, at most 255 characters)
111
- * @property {string} street - The street address of the primary contact for the brand (required, at most 255 characters)
112
- * @property {string} city - The city of the primary contact for the brand (required, at most 100 characters)
113
- * @property {string} state - The state of the primary contact for the brand (required, at most 20 characters; must be a valid 2-letter US state code when country is "US")
114
- * @property {string} postalCode - The postal code of the primary contact for the brand (required, at most 10 characters)
115
- * @property {string} email - The email address of the primary contact for the brand (required, valid email, at most 100 characters)
116
- * @property {string} firstName - The first name of the primary contact for the brand (required, at most 100 characters)
117
- * @property {string} lastName - The last name of the primary contact for the brand (required, at most 100 characters)
118
- * @property {string} website - The website URL for the brand (required, valid URL, at most 255 characters)
119
- * @property {TollFreeBrandDetails} tollFree - The Toll-Free brand details (required)
120
- * @property {string} [referenceId] - A unique reference for the brand (optional, at most 50 characters)
121
- * @property {Array<string>} [tag] - An array of tags to associate with the brand (optional)
122
- * @property {boolean} [mock] - Accepted and stored, but has no effect on Toll-Free registration: Toll-Free does not use TCR and is already free
123
- * @property {string} [optInLink] - A URL linking to the opt-in flow for the brand (optional, valid URL, at most 255 characters)
124
- * @property {string} [privacyPolicyLink] - A URL linking to the privacy policy for the brand (optional, valid URL, at most 255 characters)
125
- * @property {string} [termsAndConditionsLink] - A URL linking to the terms and conditions for the brand (optional, valid URL, at most 255 characters)
126
- * @property {string} [landingId] - The ID of the landing page associated with the brand (optional)
127
- * @property {string} [country] - The country code of the primary contact for the brand (optional, 2-letter code; when "US", state must be a valid 2-letter US state code)
128
- */
129
-
130
- /**
131
- * @typedef {Object} CreateShortCodeBrandData
132
- * @property {string} subgroupId - The ID of the subgroup to create the brand under.
133
- * @property {string} displayName - The Short Code brand display name.
134
- * @property {string} companyName - The official company name.
135
- * @property {string} street - The street address.
136
- * @property {string} city - The city.
137
- * @property {string} state - The state or province.
138
- * @property {string} postalCode - The postal code.
139
- * @property {string} country - The 2-letter country code.
140
- * @property {string} email - The support email address.
141
- * @property {string} firstName - The contact's first name.
142
- * @property {string} lastName - The contact's last name.
143
- * @property {string} website - The company website URL.
144
- * @property {{ businessRegistrationType: string, legalEntityType: string, taxId: string, countryCode: string, supportPhone: string }} shortCode - Short Code registration details.
145
- */
146
-
147
- export class Brands {
148
- constructor(client, multipartClient, enableAdmin) {
149
- this.client = client;
150
- this.multipartClient = multipartClient;
151
- this.enableAdmin = enableAdmin;
152
- }
153
-
154
- /**
155
- * Get a list of brands with optional filters
156
- * @async
157
- * @roles api, admin, developer, user
158
- * @param {Object} params - The parameters for filtering the brands
159
- * @param {string} [params.id] - Brand lookup id (carrier Brand ID, Mongo _id, or internal reference)
160
- * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
161
- * @param {string} [params.groupId] - The ID of the group to filter by
162
- * @param {number} [params.page] - The page number for pagination
163
- * @param {number} [params.limit] - The number of items per page
164
- * @param {string} [params.status] - The status of the brand to filter by (PENDING_CREATION, PENDING_APPROVAL, UNVERIFIED, VERIFIED, VETTED_VERIFIED, PENDING_DELETE, DELETED)
165
- * @param {string} [params.registrationType] - Filter by registration type ("TEN_DLC", "TOLL_FREE", or "SHORT_CODE")
166
- * @param {boolean} [params.currentTollFreeCarrier] - With subgroupId or groupId: when true, return only toll-free brands that a new toll-free campaign in that group can use (those on the group's current toll-free carrier)
167
- * @param {string} [params.search] - Staff-only (no id/subgroupId/groupId): case-insensitive substring over brandId, names, EIN, email, group, subgroup and reference ID
168
- * @param {string} [params.sortBy] - Staff-only: createdAt, brandId, displayName, groupId, subgroupId, status, entityType or country
169
- * @param {"asc"|"desc"} [params.sortOrder] - Staff-only: sort direction (default asc)
170
- * @param {string} [params.entityType] - Staff-only: exact entity type filter
171
- * @param {string} [params.ein] - Staff-only: EIN substring filter
172
- * @param {string} [params.email] - Staff-only: support email substring filter
173
- * @param {string} [params.referenceId] - Staff-only: reference ID substring filter
174
- * @param {string|Array<string>} [params.groupIds] - Staff-only: restrict to these group IDs (sent comma-separated)
175
- * @param {string} [params.createdFrom] - Staff-only: inclusive createdAt lower bound (ISO date)
176
- * @param {string} [params.createdTo] - Staff-only: inclusive createdAt upper bound (ISO date)
177
- * @param {boolean} [params.excludeDeleted] - Staff-only: hide DELETED brands when no status is given
178
- * @param {boolean} [params.includeTotal] - Staff-only: with page and limit, return `{ data, total, page, limit, totalPages }` instead of the array
179
- * @param {RequestOptions} [params.options] - Additional options for the request
180
- * @returns {Promise<SdkResponse<Array<{ _id: string, brandId: string|null, status: string, registrationType: string, tollFree?: { isBrandReady?: boolean, maxNumbersPerCampaign?: number, maxOptInMethods?: number, requiresPrivacyPolicy?: boolean, requiresTermsAndConditions?: boolean, maxAppealReasonLength?: number, labelsSamples?: boolean, supportsMms?: boolean, usesBusinessVerification?: boolean, [key: string]: any }, [key: string]: any }>|{ data: Array<Object>, total: number, page: number, limit: number, totalPages: number }>>} 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. Toll-free brands carry `tollFree.isBrandReady` (whether the brand can host campaigns), `tollFree.maxNumbersPerCampaign` (the most numbers one of its campaigns can hold), `tollFree.maxOptInMethods` (the most opt-in methods one of its campaigns can declare), `tollFree.requiresPrivacyPolicy` (whether its campaigns need a privacy policy URL), `tollFree.requiresTermsAndConditions` (whether its campaigns need a terms and conditions URL), `tollFree.maxAppealReasonLength` (the longest appeal reason its campaigns may give), `tollFree.labelsSamples` (whether its campaigns' sample messages each start with their use case's name), `tollFree.supportsMms` (whether its numbers can send MMS and group messages) and `tollFree.usesBusinessVerification` (whether it waits on the group's business verification). The staff-only list (no id/subgroupId/groupId) returns the `{ data, total, page, limit, totalPages }` envelope only when includeTotal is sent with page and limit.
181
- */
182
- async getBrands({
183
- id,
184
- subgroupId,
185
- groupId,
186
- page,
187
- limit,
188
- status,
189
- registrationType,
190
- currentTollFreeCarrier,
191
- search,
192
- sortBy,
193
- sortOrder,
194
- entityType,
195
- ein,
196
- email,
197
- referenceId,
198
- groupIds,
199
- createdFrom,
200
- createdTo,
201
- excludeDeleted,
202
- includeTotal,
203
- options = {},
204
- }) {
205
- const filters = {
206
- id,
207
- subgroupId,
208
- groupId,
209
- page,
210
- limit,
211
- status,
212
- registrationType,
213
- currentTollFreeCarrier,
214
- search,
215
- sortBy,
216
- sortOrder,
217
- entityType,
218
- ein,
219
- email,
220
- referenceId,
221
- groupIds: Array.isArray(groupIds) ? (groupIds.length ? groupIds.join(',') : undefined) : groupIds,
222
- createdFrom,
223
- createdTo,
224
- excludeDeleted,
225
- includeTotal,
226
- };
227
- const queryString = this.client._getQueryString(filters);
228
- return this.client(`/brand${queryString}`, { method: 'GET', ...options });
229
- }
230
-
231
- /**
232
- * Get external vetting information for a brand
233
- * @async
234
- * @roles api, admin, developer, user
235
- * @param {Object} params - The parameters for getting the external vetting information
236
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
237
- * @param {RequestOptions} [params.options] - Additional options for the request
238
- * @throws {Error} Throws an error if the brandId parameter is missing
239
- * @returns {Promise<SdkResponse<any>>} The response from the server
240
- */
241
- async getExternalVetting({ brandId, options = {} }) {
242
- this.client._require({ brandId });
243
- const safeBrandId = encodeURIComponent(brandId);
244
- return this.client(`/brand/externalvetting/${safeBrandId}`, { method: 'GET', ...options });
245
- }
246
-
247
- /**
248
- * Create a new brand
249
- * @async
250
- * @roles api, admin, developer, billing, user
251
- * @param {Object} params - The parameters for creating the brand (see CreateBrandData typedef for details)
252
- * @param {CreateBrandData} params.brandData - The data for the brand to be created
253
- * @param {RequestOptions} [params.options] - Additional options for the request
254
- * @throws {Error} Throws an error if the brandData parameter is missing or if required fields in brandData are missing
255
- * @returns {Promise<SdkResponse<any>>} Brand entity. `brandId` is `null` until the carrier assigns a Brand ID — use `_id` to poll status.
256
- */
257
- async createBrand({ brandData, options = {} }) {
258
- this.client._require({ brandData: brandData });
259
- return this.client(`/brand`, { method: 'POST', body: brandData, ...options });
260
- }
261
-
262
- /**
263
- * Create a new Toll-Free (TFN) brand
264
- * @async
265
- * @roles api, admin, developer, billing, user
266
- * @param {Object} params - The parameters for creating the toll-free brand
267
- * @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)
268
- * @param {RequestOptions} [params.options] - Additional options for the request
269
- * @throws {Error} Throws an error if the brandData parameter is missing
270
- * @returns {Promise<SdkResponse<any>>} Brand entity. For Toll-Free, `brandId` is a TFNB-prefixed id when assigned; otherwise `null` — use `_id` to poll.
271
- */
272
- async createTollFreeBrand({ brandData, options = {} }) {
273
- this.client._require({ brandData });
274
- return this.client(`/brand/toll-free`, { method: 'POST', body: brandData, ...options });
275
- }
276
-
277
- /**
278
- * Get a group's business verification: whether its toll-free brands need one, its status and the submitted details.
279
- * @async
280
- * @roles api, admin, developer, billing, user
281
- * @param {Object} params - The parameters for getting the business verification
282
- * @param {string} params.groupId - The ID of the group whose business verification to get
283
- * @param {RequestOptions} [params.options] - Additional options for the request
284
- * @throws {Error} Throws an error if the groupId parameter is missing
285
- * @returns {Promise<SdkResponse<{ groupId: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} The group's business verification. `required` says whether the group's new toll-free brands need one; `status` is NOT_STARTED, SUBMITTING, IN_REVIEW, VERIFIED or NEEDS_CHANGES; `rejectionReason` says why it needs changes, or is null. When `required` is true and `status` is NOT_STARTED, submit it before creating the group's first toll-free brand.
286
- */
287
- async getBusinessVerification({ groupId, options = {} }) {
288
- this.client._require({ groupId });
289
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}`, { method: 'GET', ...options });
290
- }
291
-
292
- /**
293
- * Submit or update a group's business verification. Allowed when it is not started or needs changes. Review usually
294
- * takes 1–2 business days; the group's toll-free brands stay pending until it is verified.
295
- * @async
296
- * @roles api, admin, developer, billing, user
297
- * @param {Object} params - The parameters for submitting the business verification
298
- * @param {string} params.groupId - The ID of the group whose business verification to submit (must be the caller's active group)
299
- * @param {BusinessVerificationDetails} params.details - The business verification details (see BusinessVerificationDetails typedef for details)
300
- * @param {RequestOptions} [params.options] - Additional options for the request
301
- * @throws {Error} Throws an error if the groupId or details parameter is missing
302
- * @returns {Promise<SdkResponse<{ groupId: string, required: boolean, status: string, details: BusinessVerificationDetails|null, submittedAt: string|null, reviewedAt: string|null, rejectionReason: string|null }>>} A 202 with the group's business verification, now SUBMITTING (the same shape as getBusinessVerification).
303
- */
304
- async submitBusinessVerification({ groupId, details, options = {} }) {
305
- this.client._require({ groupId, details });
306
- return this.client(`/brand/business-verification/${encodeURIComponent(groupId)}`, { method: 'PUT', body: details, ...options });
307
- }
308
-
309
- /**
310
- * Create a local Short Code brand for manual Signal House review.
311
- * @async
312
- * @roles api, admin, developer, billing, user
313
- * @param {Object} params - The creation parameters.
314
- * @param {CreateShortCodeBrandData} params.brandData - The Short Code brand data. The route forces registrationType server-side.
315
- * @param {RequestOptions} [params.options] - Additional options for the request.
316
- * @returns {Promise<SdkResponse<any>>} A 201-created Short Code brand with a stable SCB-prefixed ID and PENDING_APPROVAL status.
317
- */
318
- async createShortCodeBrand({ brandData, options = {} }) {
319
- this.client._require({ brandData });
320
- return this.client(`/brand/short-code`, { method: 'POST', body: brandData, ...options });
321
- }
322
-
323
- /**
324
- * Approve a pending Short Code brand.
325
- * @async
326
- * @roles signalhouse_admin
327
- * @param {Object} params - The approval parameters.
328
- * @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
329
- * @param {RequestOptions} [params.options] - Additional options for the request.
330
- * @returns {Promise<SdkResponse<any>>} The verified Short Code brand.
331
- */
332
- async approveShortCodeBrand({ brandId, options = {} }) {
333
- this.client._require({ brandId });
334
- return this.client(`/brand/approve/${encodeURIComponent(brandId)}`, { method: 'POST', ...options });
335
- }
336
-
337
- /**
338
- * Reject a pending Short Code brand with a customer-visible reason.
339
- * @async
340
- * @roles signalhouse_admin
341
- * @param {Object} params - The rejection parameters.
342
- * @param {BrandLookupId} params.brandId - The pending Short Code brand lookup ID.
343
- * @param {string} params.internalRejectionReason - Required customer-visible rejection reason.
344
- * @param {RequestOptions} [params.options] - Additional options for the request.
345
- * @returns {Promise<SdkResponse<any>>} The rejected Short Code brand.
346
- */
347
- async rejectShortCodeBrand({ brandId, internalRejectionReason, options = {} }) {
348
- this.client._require({ brandId, internalRejectionReason });
349
- return this.client(`/brand/reject/${encodeURIComponent(brandId)}`, {
350
- method: 'POST',
351
- body: { internalRejectionReason },
352
- ...options,
353
- });
354
- }
355
-
356
- /**
357
- * Transfer one or more brands to a different subgroup
358
- * @async
359
- * @roles api, admin, developer, billing, user
360
- * @param {Object} params - The parameters for transferring the brands
361
- * @param {string} params.subgroupId - The ID of the subgroup to transfer the brands to
362
- * @param {BrandLookupId[]} params.brandIds - Brand lookup ids to transfer (carrier id, Mongo `_id`, or internal reference).
363
- * @param {RequestOptions} [params.options] - Additional options for the request
364
- * @throws {Error} Throws an error if the subgroupId or brandIds parameters are missing
365
- * @returns {Promise<SdkResponse<any>>} The response from the server
366
- */
367
- async transferBrand({ subgroupId, brandIds, options = {} }) {
368
- this.client._require({ subgroupId, brandIds });
369
- const safeSubgroupId = encodeURIComponent(subgroupId);
370
- return this.client(`/brand/transfer/${safeSubgroupId}`, { method: 'POST', body: { brandIds }, ...options });
371
- }
372
-
373
- /**
374
- * Create external vetting for a brand
375
- * @async
376
- * @roles api, admin, developer, billing, user
377
- * @param {Object} params - The parameters for creating external vetting
378
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
379
- * @param {string} params.vettingProviderId - The external vetting provider: AEGIS or WMC
380
- * @param {string} params.vettingClass - The vetting class: STANDARD, ENHANCED, AUTHPLUS, or RCS (AEGIS accepts all four; WMC accepts STANDARD only)
381
- * @param {Object} [params.additionalData] - Provider-specific additional data forwarded to TCR
382
- * @param {RequestOptions} [params.options] - Additional options for the request
383
- * @throws {Error} Throws an error if the brandId, vettingProviderId, or vettingClass parameter is missing
384
- * @returns {Promise<SdkResponse<any>>} The response from the server
385
- */
386
- async createExternalVetting({ brandId, vettingProviderId, vettingClass, additionalData, options = {} }) {
387
- this.client._require({ brandId, vettingProviderId, vettingClass });
388
- const safeBrandId = encodeURIComponent(brandId);
389
- const body = { vettingProviderId, vettingClass };
390
- if (additionalData !== undefined) body.additionalData = additionalData;
391
- return this.client(`/brand/externalvetting/${safeBrandId}`, { method: 'POST', body, ...options });
392
- }
393
-
394
- /**
395
- * Import an existing external vetting record for a brand
396
- *
397
- * Unlike createExternalVetting (which orders a new, billable vetting), this attaches a vetting the
398
- * brand already completed directly with the provider, using the provider-issued vettingId and
399
- * vettingToken. It is synchronous and not billable.
400
- * @async
401
- * @roles api, admin, developer, billing, user
402
- * @param {Object} params - The parameters for importing external vetting
403
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
404
- * @param {string} params.vettingProviderId - The external vetting provider (AEGIS, WMC, CV)
405
- * @param {string} params.vettingId - The provider-issued vetting / transaction ID to import
406
- * @param {string} [params.vettingToken] - The provider-issued vetting token (required by some providers, e.g. AEGIS)
407
- * @param {RequestOptions} [params.options] - Additional options for the request
408
- * @throws {Error} Throws an error if brandId, vettingProviderId, or vettingId is missing
409
- * @returns {Promise<SdkResponse<any>>} The response from the server
410
- */
411
- async importExternalVetting({ brandId, vettingProviderId, vettingId, vettingToken, options = {} }) {
412
- this.client._require({ brandId, vettingProviderId, vettingId });
413
- const safeBrandId = encodeURIComponent(brandId);
414
- return this.client(`/brand/externalvetting/import/${safeBrandId}`, {
415
- method: 'POST',
416
- body: { vettingProviderId, vettingId, vettingToken },
417
- ...options,
418
- });
419
- }
420
-
421
- /**
422
- * Update a brand's information
423
- * @async
424
- * @roles api, admin, developer, billing, user
425
- * @param {Object} params - The parameters for updating the brand (see UpdateBrandData typedef for details)
426
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
427
- * @param {UpdateBrandData} params.brandData - The data for the brand to be updated
428
- * @param {RequestOptions} [params.options] - Additional options for the request
429
- * @throws {Error} Throws an error if the brandId parameter is missing
430
- * @returns {Promise<SdkResponse<any>>} The response from the server
431
- */
432
- async updateBrand({ brandId, brandData, options = {} }) {
433
- this.client._require({ brandId });
434
- const safeBrandId = encodeURIComponent(brandId);
435
- return this.client(`/brand/${safeBrandId}`, { method: 'PUT', body: brandData, ...options });
436
- }
437
-
438
- /**
439
- * Revet a brand that is in UNVERIFIED status due to an update afer it was previously VERIFIED or VETTED_VERIFIED
440
- * @async
441
- * @roles api, admin, developer, billing, user
442
- * @param {Object} params - The parameters for reverting the brand
443
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
444
- * @param {RequestOptions} [params.options] - Additional options for the request
445
- * @throws {Error} Throws an error if the brandId parameter is missing
446
- * @returns {Promise<SdkResponse<any>>} The response from the server
447
- */
448
- async revetBrand({ brandId, options = {} }) {
449
- this.client._require({ brandId });
450
- const safeBrandId = encodeURIComponent(brandId);
451
- return this.client(`/brand/revet/${safeBrandId}`, { method: 'PUT', ...options });
452
- }
453
-
454
- /**
455
- * Delete a brand (mark it as DELETED). The brand will still be retrievable
456
- * @async
457
- * @roles api, admin, developer, billing, user
458
- * @param {Object} params - The parameters for deleting the brand
459
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
460
- * @param {RequestOptions} [params.options] - Additional options for the request
461
- * @throws {Error} Throws an error if the brandId parameter is missing
462
- * @returns {Promise<SdkResponse<any>>} The response from the server
463
- */
464
- async deleteBrand({ brandId, options = {} }) {
465
- this.client._require({ brandId });
466
- const safeBrandId = encodeURIComponent(brandId);
467
- return this.client(`/brand/${safeBrandId}`, { method: 'DELETE', ...options });
468
- }
469
-
470
- /**
471
- * Get appeal history for a brand
472
- * @async
473
- * @roles api, admin, developer, billing, user
474
- * @param {Object} params - The parameters for getting the appeal history
475
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
476
- * @param {RequestOptions} [params.options] - Additional options for the request
477
- * @throws {Error} Throws an error if the brandId parameter is missing
478
- * @returns {Promise<SdkResponse<Array>>} Array of BrandAppeal objects
479
- */
480
- async getAppealHistory({ brandId, options = {} }) {
481
- this.client._require({ brandId });
482
- const safeBrandId = encodeURIComponent(brandId);
483
- return this.client(`/brand/appeal/${safeBrandId}`, { method: 'GET', ...options });
484
- }
485
-
486
- /**
487
- * Submit a brand identity status appeal with supporting documentation
488
- * @async
489
- * @roles api, admin, developer, billing, user
490
- * @param {Object} params - The parameters for submitting the appeal
491
- * @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, Mongo `_id`, or internal reference).
492
- * @param {Array<string>} params.appealCategories - Array of appeal categories (VERIFY_TAX_ID, VERIFY_NON_PROFIT, VERIFY_GOVERNMENT)
493
- * @param {string} params.explanation - Required explanation justifying the appeal
494
- * @param {File|Blob} params.file - The supporting document file
495
- * @param {RequestOptions} [params.options] - Additional options for the request
496
- * @throws {Error} Throws an error if required parameters are missing
497
- * @returns {Promise<SdkResponse<any>>} The response from the server
498
- */
499
- async submitAppeal({ brandId, appealCategories, explanation, file, options = {} }) {
500
- this.client._require({ brandId, appealCategories, explanation, file });
501
- const safeBrandId = encodeURIComponent(brandId);
502
- const formData = new FormData();
503
- formData.append('appealCategories', JSON.stringify(appealCategories));
504
- formData.append('explanation', explanation);
505
- formData.append('file', file);
506
- return this.multipartClient(`/brand/appeal/${safeBrandId}`, { method: 'POST', body: formData, ...options });
507
- }
508
- }