@signalhousellc/sdk 1.5.1 → 1.7.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.
- package/README.md +5 -56
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +32 -34
- package/voice-browser.d.ts +1 -0
- package/voice-browser.js +2 -0
- package/warn.js +7 -0
- package/webhooks.d.ts +1 -0
- package/webhooks.js +2 -0
- package/scripts/install-skills.mjs +0 -329
- package/skills/VENDORED.json +0 -22
- package/skills/signalhouse-10dlc/SKILL.md +0 -172
- package/skills/signalhouse-10dlc/examples/brightsmile-onboarding.md +0 -62
- package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +0 -104
- package/skills/signalhouse-advisor/SKILL.md +0 -84
- package/skills/signalhouse-numbers/SKILL.md +0 -82
- package/skills/signalhouse-setup/SKILL.md +0 -121
- package/skills/signalhouse-sms/SKILL.md +0 -81
- package/skills/signalhouse-webhooks/SKILL.md +0 -148
- package/src/SignalHouseSDK.js +0 -201
- package/src/domains/Agents.js +0 -987
- package/src/domains/Auth.js +0 -225
- package/src/domains/Billing.js +0 -265
- package/src/domains/Brands.js +0 -566
- package/src/domains/Campaigns.js +0 -691
- package/src/domains/Dnc.js +0 -168
- package/src/domains/Groups.js +0 -187
- package/src/domains/Landings.js +0 -237
- package/src/domains/Messages.js +0 -609
- package/src/domains/Notifications.js +0 -62
- package/src/domains/Numbers.js +0 -574
- package/src/domains/Onboarding.js +0 -128
- package/src/domains/Registrations.js +0 -246
- package/src/domains/Shortlinks.js +0 -80
- package/src/domains/Subgroups.js +0 -136
- package/src/domains/Subscriptions.js +0 -164
- package/src/domains/Templates.js +0 -403
- package/src/domains/Tickets.js +0 -100
- package/src/domains/Users.js +0 -228
- package/src/domains/Voice.js +0 -41
- package/src/domains/Webhooks.js +0 -125
- package/src/domains/voice/Analytics.js +0 -82
- package/src/domains/voice/CallLogs.js +0 -111
- package/src/domains/voice/Calls.js +0 -118
- package/src/domains/voice/GlobalVoiceSettings.js +0 -54
- package/src/domains/voice/NumberRoutes.js +0 -82
- package/src/domains/voice/ProgrammableVoiceProfiles.js +0 -191
- package/src/domains/voice/SipProfiles.js +0 -203
- package/src/domains/voice/SipTrunks.js +0 -203
- package/src/domains/voice/Tokens.js +0 -96
- package/src/domains/voice/browser/Call.js +0 -366
- package/src/domains/voice/browser/Device.js +0 -484
- package/src/domains/voice/browser/index.js +0 -17
- package/src/webhooks/verifySignature.js +0 -66
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
-
/**
|
|
3
|
-
* @template T
|
|
4
|
-
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export class Onboarding {
|
|
8
|
-
constructor(client, enableAdmin) {
|
|
9
|
-
this.client = client;
|
|
10
|
-
this.enableAdmin = enableAdmin;
|
|
11
|
-
|
|
12
|
-
// Hidden Admin namespace INSIDE the domain
|
|
13
|
-
if (enableAdmin) {
|
|
14
|
-
this.admin = {
|
|
15
|
-
/**
|
|
16
|
-
* Get all onboarding records (one per group). Staff-only.
|
|
17
|
-
* @async
|
|
18
|
-
* @roles signalhouse
|
|
19
|
-
* @param {Object} [params] - Optional parameters
|
|
20
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
21
|
-
* @returns {Promise<SdkResponse<any>>} - Array of onboarding records
|
|
22
|
-
*/
|
|
23
|
-
getOnboardings: async ({ options = {} } = {}) => {
|
|
24
|
-
return this.client(`/group/onboarding`, { method: "GET", ...options });
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Get a single onboarding record by group ID. Staff-only.
|
|
29
|
-
* @async
|
|
30
|
-
* @roles signalhouse
|
|
31
|
-
* @param {Object} params
|
|
32
|
-
* @param {string} params.groupId - The group ID whose onboarding record to retrieve
|
|
33
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
34
|
-
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
35
|
-
* @returns {Promise<SdkResponse<any>>} - The onboarding record
|
|
36
|
-
*/
|
|
37
|
-
getOnboarding: async ({ groupId, options = {} }) => {
|
|
38
|
-
this.client._require({ groupId });
|
|
39
|
-
const safeGroupId = encodeURIComponent(groupId);
|
|
40
|
-
return this.client(`/group/onboarding/${safeGroupId}`, { method: "GET", ...options });
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Set where a group's new toll-free brands and numbers go (`infobip` or `twilio`). Staff-only. Existing brands,
|
|
45
|
-
* numbers and campaigns stay where they are.
|
|
46
|
-
* @async
|
|
47
|
-
* @roles signalhouse
|
|
48
|
-
* @param {Object} params
|
|
49
|
-
* @param {string} params.groupId - The group ID whose toll-free provider to set
|
|
50
|
-
* @param {string} params.tollFreeProvider - The toll-free provider for the group's new toll-free brands and numbers ("infobip" or "twilio")
|
|
51
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
52
|
-
* @throws {Error} Throws an error if the groupId or tollFreeProvider parameter is missing
|
|
53
|
-
* @returns {Promise<SdkResponse<any>>} - The updated onboarding record
|
|
54
|
-
*/
|
|
55
|
-
setTollFreeProvider: async ({ groupId, tollFreeProvider, options = {} }) => {
|
|
56
|
-
this.client._require({ groupId, tollFreeProvider });
|
|
57
|
-
const safeGroupId = encodeURIComponent(groupId);
|
|
58
|
-
return this.client(`/group/onboarding/${safeGroupId}/toll-free-provider`, { method: "PUT", body: { tollFreeProvider }, ...options });
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Add an internal comment/note to a group's admin Pricing editor. Staff-only.
|
|
63
|
-
* @async
|
|
64
|
-
* @roles signalhouse_admin, signalhouse_user
|
|
65
|
-
* @param {Object} params
|
|
66
|
-
* @param {string} params.groupId - The group ID to comment on
|
|
67
|
-
* @param {string} params.comment - The comment/note text
|
|
68
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
69
|
-
* @throws {Error} Throws an error if the groupId or comment parameter is missing
|
|
70
|
-
* @returns {Promise<SdkResponse<any>>} - The updated onboarding record
|
|
71
|
-
*/
|
|
72
|
-
addPricingComment: async ({ groupId, comment, options = {} }) => {
|
|
73
|
-
this.client._require({ groupId, comment });
|
|
74
|
-
const safeGroupId = encodeURIComponent(groupId);
|
|
75
|
-
return this.client(`/group/onboarding/${safeGroupId}/pricing-comments`, { method: "POST", body: { comment }, ...options });
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Add an internal comment/note to a group's admin Credits page. Staff-only.
|
|
80
|
-
* @async
|
|
81
|
-
* @roles signalhouse_admin, signalhouse_user
|
|
82
|
-
* @param {Object} params
|
|
83
|
-
* @param {string} params.groupId - The group ID to comment on
|
|
84
|
-
* @param {string} params.comment - The comment/note text
|
|
85
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
86
|
-
* @throws {Error} Throws an error if the groupId or comment parameter is missing
|
|
87
|
-
* @returns {Promise<SdkResponse<any>>} - The updated onboarding record
|
|
88
|
-
*/
|
|
89
|
-
addCreditComment: async ({ groupId, comment, options = {} }) => {
|
|
90
|
-
this.client._require({ groupId, comment });
|
|
91
|
-
const safeGroupId = encodeURIComponent(groupId);
|
|
92
|
-
return this.client(`/group/onboarding/${safeGroupId}/credit-comments`, { method: "POST", body: { comment }, ...options });
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Get the caller's own onboarding record (customer-safe projection) — the selections captured at
|
|
100
|
-
* signup plus the gate flags derived from them. Never returns internal KYC, staff assignment,
|
|
101
|
-
* referral, or external-reference data.
|
|
102
|
-
*
|
|
103
|
-
* Staff roles and sessions with no active group receive a synthetic verified, selection-free
|
|
104
|
-
* record rather than an error, so callers never have to special-case them.
|
|
105
|
-
* @async
|
|
106
|
-
* @param {Object} [params] - Optional parameters
|
|
107
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
108
|
-
* @returns {Promise<SdkResponse<any>>} - `{ acceptedTermsOfService: boolean, emailVerified: boolean, products: string[], estimatedVolume: string|null, pendingExternalLink: "ghl"|"shopify"|null }`
|
|
109
|
-
*/
|
|
110
|
-
async getMyOnboarding({ options = {} } = {}) {
|
|
111
|
-
return this.client(`/group/onboarding/my`, { method: "GET", ...options });
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Accept the Terms of Service for the caller's active group.
|
|
116
|
-
* @async
|
|
117
|
-
* @param {Object} [params] - Optional parameters
|
|
118
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
119
|
-
* @returns {Promise<SdkResponse<any>>} - `{ acceptedTermsOfService: true }`
|
|
120
|
-
*/
|
|
121
|
-
async acceptTermsOfService({ options = {} } = {}) {
|
|
122
|
-
return this.client(`/group/onboarding/my/accept-terms`, {
|
|
123
|
-
method: "PUT",
|
|
124
|
-
body: { acceptedTermsOfService: true },
|
|
125
|
-
...options,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,246 +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
|
-
* Sender registrations for every jurisdiction and type: the catalog of what a region offers, retail quotes,
|
|
9
|
-
* customer submissions and staff review operations. `type` selects the shape of `data`
|
|
10
|
-
* (for VIRTUAL_LONG_CODE: quantity, useCases and the optional voice dossier; for GB ALPHANUMERIC_SENDER_ID: requestedSenderId,
|
|
11
|
-
* trafficOrigin, trafficType and the company details).
|
|
12
|
-
*/
|
|
13
|
-
export class Registrations {
|
|
14
|
-
constructor(client, enableAdmin) {
|
|
15
|
-
this.client = client;
|
|
16
|
-
this.enableAdmin = enableAdmin;
|
|
17
|
-
|
|
18
|
-
if (enableAdmin) {
|
|
19
|
-
this.admin = {
|
|
20
|
-
/**
|
|
21
|
-
* Approve or reject a registration awaiting Signal House review (signalhouse only)
|
|
22
|
-
* @async
|
|
23
|
-
* @roles signalhouse
|
|
24
|
-
* @param {Object} params - The parameters for the review decision
|
|
25
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
26
|
-
* @param {("APPROVE"|"REJECT")} params.action - The review decision
|
|
27
|
-
* @param {string} [params.reason] - Why the registration was rejected; required when action is REJECT
|
|
28
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
29
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
|
|
30
|
-
*/
|
|
31
|
-
reviewRegistration: async ({ registrationId, action, reason, options = {} }) => {
|
|
32
|
-
this.client._require({ registrationId, action });
|
|
33
|
-
const safeId = encodeURIComponent(registrationId);
|
|
34
|
-
return this.client(`/registration/${safeId}/review`, {
|
|
35
|
-
method: "POST",
|
|
36
|
-
body: { action, reason },
|
|
37
|
-
...options,
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Save corrections to the type's correctable fields for a registration the provider sent back for
|
|
43
|
-
* more information; owner, quantity, bundle and provider order never change (signalhouse only)
|
|
44
|
-
* @async
|
|
45
|
-
* @roles signalhouse
|
|
46
|
-
* @param {Object} params - The parameters for the correction
|
|
47
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
48
|
-
* @param {string} params.reason - Why the registration was corrected
|
|
49
|
-
* @param {Object} params.data - The type's correctable fields (for VIRTUAL_LONG_CODE: useCases and, for SMS + Voice, voice)
|
|
50
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
51
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
|
|
52
|
-
*/
|
|
53
|
-
correctRegistration: async ({ registrationId, reason, data, options = {} }) => {
|
|
54
|
-
this.client._require({ registrationId, reason, data });
|
|
55
|
-
const safeId = encodeURIComponent(registrationId);
|
|
56
|
-
return this.client(`/registration/${safeId}/corrections`, {
|
|
57
|
-
method: "POST",
|
|
58
|
-
body: { reason, data },
|
|
59
|
-
...options,
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Allocate a provider-owned number to a registration through the staff recovery path (signalhouse only)
|
|
65
|
-
* @async
|
|
66
|
-
* @roles signalhouse
|
|
67
|
-
* @param {Object} params - The parameters for the allocation
|
|
68
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
69
|
-
* @param {string} params.phoneNumber - The E.164 number (10-15 digits, optional leading +) to allocate
|
|
70
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
71
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
|
|
72
|
-
*/
|
|
73
|
-
addNumber: async ({ registrationId, phoneNumber, options = {} }) => {
|
|
74
|
-
this.client._require({ registrationId, phoneNumber });
|
|
75
|
-
const safeId = encodeURIComponent(registrationId);
|
|
76
|
-
return this.client(`/registration/${safeId}/numbers`, {
|
|
77
|
-
method: "POST",
|
|
78
|
-
body: { phoneNumber },
|
|
79
|
-
...options,
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Link an existing provider order to a registration parked in RECONCILIATION_REQUIRED (signalhouse only)
|
|
85
|
-
* @async
|
|
86
|
-
* @roles signalhouse
|
|
87
|
-
* @param {Object} params - The parameters for the reconciliation
|
|
88
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
89
|
-
* @param {string} params.externalId - The provider's identifier for the existing order
|
|
90
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
91
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
|
|
92
|
-
*/
|
|
93
|
-
reconcile: async ({ registrationId, externalId, options = {} }) => {
|
|
94
|
-
this.client._require({ registrationId, externalId });
|
|
95
|
-
const safeId = encodeURIComponent(registrationId);
|
|
96
|
-
return this.client(`/registration/${safeId}/reconcile`, {
|
|
97
|
-
method: "POST",
|
|
98
|
-
body: { externalId },
|
|
99
|
-
...options,
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Download the completed carrier application as DOCX bytes (signalhouse only)
|
|
105
|
-
* @async
|
|
106
|
-
* @roles signalhouse
|
|
107
|
-
* @param {Object} params - The parameters for the download
|
|
108
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
109
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
110
|
-
* @returns {Promise<SdkResponse<ArrayBuffer>>} A promise that resolves to the DOCX document as an ArrayBuffer
|
|
111
|
-
*/
|
|
112
|
-
getApplication: async ({ registrationId, options = {} }) => {
|
|
113
|
-
this.client._require({ registrationId });
|
|
114
|
-
const safeId = encodeURIComponent(registrationId);
|
|
115
|
-
return this.client(`/registration/${safeId}/application`, {
|
|
116
|
-
method: "GET",
|
|
117
|
-
responseType: "arraybuffer",
|
|
118
|
-
...options,
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Get the registration types a region offers and whether each can be acquired right now
|
|
127
|
-
* @async
|
|
128
|
-
* @roles api, admin, developer, billing, user
|
|
129
|
-
* @param {Object} params - The parameters for the catalog
|
|
130
|
-
* @param {string} params.region - ISO-2 jurisdiction (US, GB or CA; any case of UK/GB/GBR/United Kingdom is accepted for GB)
|
|
131
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
132
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { region, jurisdiction, sendingRequiresRegistration, registeredThrough, provisioning, types }
|
|
133
|
-
*/
|
|
134
|
-
async getCatalog({ region, options = {} }) {
|
|
135
|
-
this.client._require({ region });
|
|
136
|
-
const queryString = this.client._getQueryString({ region });
|
|
137
|
-
return this.client(`/registration/catalog${queryString}`, { method: "GET", ...options });
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get retail quotes for a registration type: one quote per capability bundle with per-number setupAmount
|
|
142
|
-
* and monthlyAmount, the totals for the quantity (integer microdollars) and etaDays. GB ALPHANUMERIC_SENDER_ID
|
|
143
|
-
* quotes one ["SMS"] bundle (6000000 setup and 6000000 monthly by default).
|
|
144
|
-
* Unavailable (400) while the type cannot be acquired in the region.
|
|
145
|
-
* @async
|
|
146
|
-
* @roles api, admin, developer, billing, user
|
|
147
|
-
* @param {Object} params - The parameters for the quote
|
|
148
|
-
* @param {string} params.region - ISO-2 jurisdiction (any case of UK/GB/GBR/United Kingdom is accepted for GB)
|
|
149
|
-
* @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE, or ALPHANUMERIC_SENDER_ID for GB)
|
|
150
|
-
* @param {number} [params.quantity=1] - Number of numbers to quote (1-100)
|
|
151
|
-
* @param {string} [params.groupId] - Group to price for; staff only
|
|
152
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
153
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [quotes] }
|
|
154
|
-
*/
|
|
155
|
-
async getQuotes({ region, type, quantity = 1, groupId, options = {} }) {
|
|
156
|
-
this.client._require({ region, type });
|
|
157
|
-
const queryString = this.client._getQueryString({ region, type, quantity, groupId });
|
|
158
|
-
return this.client(`/registration/quotes${queryString}`, { method: "GET", ...options });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* List registrations for an authorized group; staff may omit groupId to read the review queue
|
|
163
|
-
* @async
|
|
164
|
-
* @roles api, admin, developer, billing, user
|
|
165
|
-
* @param {Object} [params] - The parameters for filtering the registrations
|
|
166
|
-
* @param {string} [params.groupId] - Filter by group ID
|
|
167
|
-
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
168
|
-
* @param {string|string[]} [params.region] - Filter by one ISO-2 jurisdiction or a list
|
|
169
|
-
* @param {string} [params.type] - Filter by registration type
|
|
170
|
-
* @param {string} [params.kind] - Filter by kind (identity, program, sender)
|
|
171
|
-
* @param {string|string[]} [params.status] - Filter by one registration status or a list
|
|
172
|
-
* @param {string} [params.parentRegistrationId] - Filter by the parent registration ID
|
|
173
|
-
* @param {string} [params.phoneNumber] - Filter to registrations holding this phone number
|
|
174
|
-
* @param {string} [params.sortBy] - Sort field: createdAt (default), subgroupId, registrationId, region or status
|
|
175
|
-
* @param {string} [params.sortOrder] - Sort direction: asc or desc (default)
|
|
176
|
-
* @param {number} [params.page] - Page number (default 1)
|
|
177
|
-
* @param {number} [params.limit] - Registrations per page (default 25, max 100)
|
|
178
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
179
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [registrations], totalCount, page, limit }
|
|
180
|
-
*/
|
|
181
|
-
async getRegistrations({ groupId, subgroupId, region, type, kind, status, parentRegistrationId, phoneNumber, sortBy, sortOrder, page, limit, options = {} } = {}) {
|
|
182
|
-
const queryString = this.client._getQueryString({ groupId, subgroupId, region, type, kind, status, parentRegistrationId, phoneNumber, sortBy, sortOrder, page, limit });
|
|
183
|
-
return this.client(`/registration${queryString}`, { method: "GET", ...options });
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Get a single registration with its review outcome, the type's public data and its status history
|
|
188
|
-
* @async
|
|
189
|
-
* @roles api, admin, developer, billing, user
|
|
190
|
-
* @param {Object} params - The parameters for getting the registration
|
|
191
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
192
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
193
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration
|
|
194
|
-
*/
|
|
195
|
-
async getRegistration({ registrationId, options = {} }) {
|
|
196
|
-
this.client._require({ registrationId });
|
|
197
|
-
const safeId = encodeURIComponent(registrationId);
|
|
198
|
-
return this.client(`/registration/${safeId}`, { method: "GET", ...options });
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Cancel a registration. Allowed from SIGNAL_HOUSE_REVIEW, SIGNAL_HOUSE_APPROVED, PENDING_PROVIDER, NEEDS_INFORMATION,
|
|
203
|
-
* PAYMENT_REQUIRED and APPROVED (409 otherwise). Numbers already allocated stay on the account and stop sending.
|
|
204
|
-
* @async
|
|
205
|
-
* @roles api, admin, developer, user
|
|
206
|
-
* @param {Object} params - The parameters for cancelling the registration
|
|
207
|
-
* @param {string} params.registrationId - The registration ID (e.g. GB8T9GTD5AZY)
|
|
208
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
209
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the cancelled registration
|
|
210
|
-
*/
|
|
211
|
-
async cancelRegistration({ registrationId, options = {} }) {
|
|
212
|
-
this.client._require({ registrationId });
|
|
213
|
-
const safeId = encodeURIComponent(registrationId);
|
|
214
|
-
return this.client(`/registration/${safeId}`, { method: "DELETE", ...options });
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Submit a registration. `type` selects the shape of `data`: for VIRTUAL_LONG_CODE it is { quantity (1-100),
|
|
219
|
-
* useCases (1-10 descriptions), voice? } where voice is required exactly when capabilities include VOICE. For GB
|
|
220
|
-
* ALPHANUMERIC_SENDER_ID (capabilities ["SMS"]) it is { requestedSenderId (3-11 letters/digits/space/dot/dash,
|
|
221
|
-
* at least one letter), trafficOrigin (LOCAL | INTERNATIONAL), trafficType (TRANSACTIONAL | PROMOTIONAL),
|
|
222
|
-
* companyName, companyCountry, companyWebsite, industry, messageExample, senderRelationship? } where
|
|
223
|
-
* senderRelationship is required when requestedSenderId differs from companyName; quantity is always 1 and
|
|
224
|
-
* data.phoneNumbers carries the granted sender (e.g. ["ACME"]) once APPROVED.
|
|
225
|
-
* Pass options.idempotencyKey to make a retry safe: an identical retry with the same key replays the first response.
|
|
226
|
-
* Unavailable (400) while the type cannot be acquired in the region.
|
|
227
|
-
* @async
|
|
228
|
-
* @roles api, admin, developer, billing, user
|
|
229
|
-
* @param {Object} params - The parameters for the registration
|
|
230
|
-
* @param {string} params.region - ISO-2 jurisdiction (any case of UK/GB/GBR/United Kingdom is accepted for GB)
|
|
231
|
-
* @param {string} params.type - Registration type (e.g. VIRTUAL_LONG_CODE, or ALPHANUMERIC_SENDER_ID for GB)
|
|
232
|
-
* @param {string} params.subgroupId - Subgroup that will own the registration and any allocated numbers
|
|
233
|
-
* @param {string[]} params.capabilities - One of the type's bundles, e.g. ["SMS"] or ["SMS", "VOICE"]
|
|
234
|
-
* @param {Object} params.data - The type's submission fields
|
|
235
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
236
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the created registration
|
|
237
|
-
*/
|
|
238
|
-
async createRegistration({ region, type, subgroupId, capabilities, data, options = {} }) {
|
|
239
|
-
this.client._require({ region, type, subgroupId, capabilities, data });
|
|
240
|
-
return this.client("/registration", {
|
|
241
|
-
method: "POST",
|
|
242
|
-
body: { region, type, subgroupId, capabilities, data },
|
|
243
|
-
...options,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
-
/**
|
|
3
|
-
* @template T
|
|
4
|
-
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export class Shortlinks {
|
|
8
|
-
constructor(client, enableAdmin) {
|
|
9
|
-
this.client = client;
|
|
10
|
-
this.enableAdmin = enableAdmin;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get the redirect URL for a shortlink by its ID
|
|
15
|
-
* @async
|
|
16
|
-
* @roles public
|
|
17
|
-
* @param {Object} params - The parameters for getting the shortlink redirect
|
|
18
|
-
* @param {string} params.shortlinkId - The ID of the shortlink
|
|
19
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
20
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the redirect URL for the shortlink
|
|
21
|
-
*/
|
|
22
|
-
async getShortlinkRedirect({ shortlinkId, options = {} }) {
|
|
23
|
-
this.client._require({ shortlinkId });
|
|
24
|
-
const safeShortlinkId = encodeURIComponent(shortlinkId);
|
|
25
|
-
return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Get the recipient opt-out details behind an alphanumeric-sender opt-out link (sihou.io/o/{code})
|
|
30
|
-
* @async
|
|
31
|
-
* @roles public
|
|
32
|
-
* @param {Object} params - The parameters for getting the opt-out details
|
|
33
|
-
* @param {string} params.code - The opt-out code from the link
|
|
34
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
35
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ code, senderName, maskedRecipient, optedOut }`
|
|
36
|
-
*/
|
|
37
|
-
async getOptOut({ code, options = {} }) {
|
|
38
|
-
this.client._require({ code });
|
|
39
|
-
const safeCode = encodeURIComponent(code);
|
|
40
|
-
return this.client(`/shortlink/optout/${safeCode}`, { method: "GET", ...options });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Confirm the recipient opt-out behind an alphanumeric-sender opt-out link; idempotent
|
|
45
|
-
* @async
|
|
46
|
-
* @roles public
|
|
47
|
-
* @param {Object} params - The parameters for confirming the opt-out
|
|
48
|
-
* @param {string} params.code - The opt-out code from the link
|
|
49
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
50
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ code, senderName, maskedRecipient, optedOut: true }`
|
|
51
|
-
*/
|
|
52
|
-
async confirmOptOut({ code, options = {} }) {
|
|
53
|
-
this.client._require({ code });
|
|
54
|
-
const safeCode = encodeURIComponent(code);
|
|
55
|
-
return this.client(`/shortlink/optout/${safeCode}`, { method: "POST", ...options });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get details of a shortlink by its ID, with optional filters
|
|
60
|
-
* @async
|
|
61
|
-
* @roles api, admin, developer, billing, user
|
|
62
|
-
* @param {Object} params - The parameters for getting the shortlink details
|
|
63
|
-
* @param {string} [params.shortlinkId] - The ID of the shortlink
|
|
64
|
-
* @param {string} [params.messageId] - Filter by associated message ID
|
|
65
|
-
* @param {string} [params.phoneNumber] - Filter by associated phone number
|
|
66
|
-
* @param {string} [params.campaignId] - Filter by associated campaign ID
|
|
67
|
-
* @param {string} [params.brandId] - Filter by associated brand ID
|
|
68
|
-
* @param {string} [params.subgroupId] - Filter by associated subgroup ID
|
|
69
|
-
* @param {string} [params.groupId] - Filter by associated group ID
|
|
70
|
-
* @param {number} [params.page] - The page number for pagination
|
|
71
|
-
* @param {number} [params.limit] - The number of items per page for pagination
|
|
72
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
73
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the shortlink details
|
|
74
|
-
*/
|
|
75
|
-
async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
|
|
76
|
-
const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
|
|
77
|
-
const queryString = this.client._getQueryString(filters);
|
|
78
|
-
return this.client(`/shortlink${queryString}`, { method: "GET", ...options });
|
|
79
|
-
}
|
|
80
|
-
}
|
package/src/domains/Subgroups.js
DELETED
|
@@ -1,136 +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 {Object} CreateSubgroupData
|
|
9
|
-
* @property {string} groupId - The ID of the parent group for the subgroup (must be at least 8 characters long and start with 'G')
|
|
10
|
-
* @property {string} subgroupName - The name of the subgroup (required)
|
|
11
|
-
* @property {string} [contactFirstName] - The first name of the contact person for the subgroup
|
|
12
|
-
* @property {string} [contactLastName] - The last name of the contact person for the subgroup
|
|
13
|
-
* @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
|
|
14
|
-
* @property {string} [subgroupCompanyName] - The company name associated with the subgroup
|
|
15
|
-
* @property {string} [addressLine1] - The first line of the address for the subgroup
|
|
16
|
-
* @property {string} [addressLine2] - The second line of the address for the subgroup
|
|
17
|
-
* @property {string} [city] - The city for the subgroup's address
|
|
18
|
-
* @property {string} [state] - The state for the subgroup's address
|
|
19
|
-
* @property {string} [country] - The country for the subgroup's address
|
|
20
|
-
* @property {string} [postalCode] - The postal code for the subgroup's address
|
|
21
|
-
* @property {string} [phone] - The phone number for the subgroup
|
|
22
|
-
* @property {string} [carrierIdFamily] - Optional agency-managed carrier ID selection ("Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop"). Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
|
|
23
|
-
* @property {string|null} [carrierIdRegion] - Optional ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} UpdateSubgroupData
|
|
28
|
-
* @property {string} [subgroupName] - The name of the subgroup
|
|
29
|
-
* @property {string} [contactFirstName] - The first name of the contact person for the subgroup
|
|
30
|
-
* @property {string} [contactLastName] - The last name of the contact person for the subgroup
|
|
31
|
-
* @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
|
|
32
|
-
* @property {string} [subgroupCompanyName] - The company name associated with the subgroup
|
|
33
|
-
* @property {string} [addressLine1] - The first line of the address for the subgroup
|
|
34
|
-
* @property {string} [addressLine2] - The second line of the address for the subgroup
|
|
35
|
-
* @property {string} [city] - The city for the subgroup's address
|
|
36
|
-
* @property {string} [state] - The state for the subgroup's address
|
|
37
|
-
* @property {string} [country] - The country for the subgroup's address
|
|
38
|
-
* @property {string} [postalCode] - The postal code for the subgroup's address
|
|
39
|
-
* @property {string} [phone] - The phone number for the subgroup
|
|
40
|
-
* @property {string} [status] - The status of the subgroup (e.g., "active", "inactive")
|
|
41
|
-
* @property {string} [carrierIdFamily] - Optional agency-managed carrier ID selection ("Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop"). Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
|
|
42
|
-
* @property {string|null} [carrierIdRegion] - Optional ClearSky region ("PRClaro", "GuamDocomo", "GuamGTA", "GuamITE") or null; only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, or billing role.
|
|
43
|
-
* @property {boolean} [cnamAutoApply] - Turn caller name (CNAM) auto-apply on or off: eligible numbers get their brand's registered name as the name shown on outbound calls. Requires signalhouse_api, signalhouse_admin, signalhouse_user, api, admin or developer role.
|
|
44
|
-
* @property {string|null} [cnamBrandId] - Default caller-ID brand for numbers with no campaign (e.g. voice-only). Must be a verified brand in this subgroup; required when turning auto-apply on in a subgroup with more than one verified brand.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
export class Subgroups {
|
|
48
|
-
constructor(client, enableAdmin) {
|
|
49
|
-
this.client = client;
|
|
50
|
-
this.enableAdmin = enableAdmin;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get a list of subgroups with optional filters
|
|
55
|
-
* @async
|
|
56
|
-
* @roles api, admin, developer, billing, user
|
|
57
|
-
* @param {Object} params - The parameters for getting subgroups
|
|
58
|
-
* @param {string} [params.id] - Filter by subgroup ID
|
|
59
|
-
* @param {string} [params.groupId] - Filter by parent group ID
|
|
60
|
-
* @param {number} [params.page] - The page number for pagination
|
|
61
|
-
* @param {number} [params.limit] - The number of items per page for pagination
|
|
62
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
63
|
-
* @returns {Promise<SdkResponse<any>>} - The list of subgroups returned from the server
|
|
64
|
-
*/
|
|
65
|
-
async getSubgroups({ id, groupId, page, limit, options = {} }) {
|
|
66
|
-
const filters = { id, groupId, page, limit };
|
|
67
|
-
const queryString = this.client._getQueryString(filters);
|
|
68
|
-
return this.client(`/subgroup${queryString}`, { method: "GET", ...options });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get resource counts grouped by subgroup ID. Only signalhouse_admin can query all groups;
|
|
73
|
-
* every other allowed role is restricted to its JWT group scope.
|
|
74
|
-
* @async
|
|
75
|
-
* @roles signalhouse, api, admin, developer, billing, user
|
|
76
|
-
* @param {Object} [params={}] - Optional count filters.
|
|
77
|
-
* @param {string} [params.groupId] - Restrict results to a group.
|
|
78
|
-
* @param {string} [params.subgroupId] - Restrict results to a subgroup.
|
|
79
|
-
* @param {number} [params.limit] - Maximum rows to return.
|
|
80
|
-
* @param {number} [params.offset] - Rows to skip; requires limit.
|
|
81
|
-
* @param {RequestOptions} [params.options] - Additional options for the request.
|
|
82
|
-
* @returns {Promise<SdkResponse<any>>} - Subgroup-level resource count rows.
|
|
83
|
-
*/
|
|
84
|
-
async getSubgroupCounts({ groupId, subgroupId, limit, offset, options = {} } = {}) {
|
|
85
|
-
const queryString = this.client._getQueryString({ groupId, subgroupId, limit, offset });
|
|
86
|
-
return this.client(`/subgroup/counts${queryString}`, { method: "GET", ...options });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Create a new subgroup with the specified subgroup data
|
|
91
|
-
* @async
|
|
92
|
-
* @roles api, admin, developer, billing, user
|
|
93
|
-
* @param {Object} params - The parameters for creating a subgroup (see CreateSubgroupData typedef for details)
|
|
94
|
-
* @param {CreateSubgroupData} params.subgroupData - The data for the subgroup to be created, including required fields such as groupId and subgroupName
|
|
95
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
96
|
-
* @throws {Error} Throws an error if the subgroupData parameter is missing or if required fields in subgroupData are missing
|
|
97
|
-
* @returns {Promise<SdkResponse<any>>} - The created subgroup object returned from the server
|
|
98
|
-
*/
|
|
99
|
-
async createSubgroup({ subgroupData, options = {} }) {
|
|
100
|
-
this.client._require({ subgroupData: subgroupData });
|
|
101
|
-
return this.client(`/subgroup`, { method: "POST", body: subgroupData, ...options });
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Update an existing subgroup with the specified subgroup data
|
|
106
|
-
* @async
|
|
107
|
-
* @roles api, admin, developer, billing, user
|
|
108
|
-
* @param {Object} params - The parameters for updating a subgroup (see UpdateSubgroupData typedef for details)
|
|
109
|
-
* @param {string} params.id - The ID of the subgroup to update
|
|
110
|
-
* @param {UpdateSubgroupData} params.updateData - The data for the subgroup to be updated, including fields such as subgroupName, contact information, and status
|
|
111
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
112
|
-
* @throws {Error} Throws an error if the id or updateData parameter is missing
|
|
113
|
-
* @returns {Promise<SdkResponse<any>>} - The updated subgroup object returned from the server
|
|
114
|
-
*/
|
|
115
|
-
async updateSubgroup({ id, updateData, options = {} }) {
|
|
116
|
-
this.client._require({ id, updateData });
|
|
117
|
-
const safeId = encodeURIComponent(id);
|
|
118
|
-
return this.client(`/subgroup/${safeId}`, { method: "PUT", body: updateData, ...options });
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Delete a subgroup by its ID (mark as inactive)
|
|
123
|
-
* @async
|
|
124
|
-
* @roles api, admin, developer, billing, user
|
|
125
|
-
* @param {Object} params - The parameters for deleting a subgroup
|
|
126
|
-
* @param {string} params.id - The ID of the subgroup to delete
|
|
127
|
-
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
128
|
-
* @throws {Error} Throws an error if the id parameter is missing
|
|
129
|
-
* @returns {Promise<SdkResponse<any>>} - The deleted subgroup object returned from the server
|
|
130
|
-
*/
|
|
131
|
-
async deleteSubgroup({ id, options = {} }) {
|
|
132
|
-
this.client._require({ id });
|
|
133
|
-
const safeId = encodeURIComponent(id);
|
|
134
|
-
return this.client(`/subgroup/${safeId}`, { method: "DELETE", ...options });
|
|
135
|
-
}
|
|
136
|
-
}
|