@signalhousellc/sdk 1.0.39 → 1.0.41
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 +1 -1
- package/src/SignalHouseSDK.js +2 -0
- package/src/domains/Numbers.js +4 -5
- package/src/domains/Onboarding.js +39 -0
package/package.json
CHANGED
package/src/SignalHouseSDK.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Groups } from "./domains/Groups.js";
|
|
|
15
15
|
import { Landings } from "./domains/Landings.js";
|
|
16
16
|
import { Messages } from "./domains/Messages.js";
|
|
17
17
|
import { Numbers } from "./domains/Numbers.js";
|
|
18
|
+
import { Onboarding } from "./domains/Onboarding.js";
|
|
18
19
|
import { Shortlinks } from "./domains/Shortlinks.js";
|
|
19
20
|
import { Subgroups } from "./domains/Subgroups.js";
|
|
20
21
|
import { Subscriptions } from "./domains/Subscriptions.js";
|
|
@@ -58,6 +59,7 @@ export class SignalHouseSDK {
|
|
|
58
59
|
this.landings = new Landings(client, multipartClient, this.enableAdmin);
|
|
59
60
|
this.messages = new Messages(client, multipartClient, this.enableAdmin);
|
|
60
61
|
this.numbers = new Numbers(client, this.enableAdmin);
|
|
62
|
+
this.onboarding = new Onboarding(client, this.enableAdmin);
|
|
61
63
|
this.shortlinks = new Shortlinks(client, this.enableAdmin);
|
|
62
64
|
this.subgroups = new Subgroups(client, this.enableAdmin);
|
|
63
65
|
this.subscriptions = new Subscriptions(client, this.enableAdmin);
|
package/src/domains/Numbers.js
CHANGED
|
@@ -95,17 +95,16 @@ export class Numbers {
|
|
|
95
95
|
/**
|
|
96
96
|
* Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* with an error ONLY when every requested number is already owned.
|
|
98
|
+
* Each requested number is queued and processed independently. Per-number success or failure is
|
|
99
|
+
* delivered via `NUMBER_PURCHASE_SUCCESSFUL` / `NUMBER_PURCHASE_FAILED` webhooks — not in this response.
|
|
101
100
|
* @async
|
|
102
101
|
* @roles api, admin, developer, billing, user
|
|
103
102
|
* @param {Object} params - The parameters for purchasing phone numbers
|
|
104
103
|
* @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
|
|
105
104
|
* @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
|
|
106
105
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
107
|
-
* @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
|
|
108
|
-
* @returns {Promise<Object>} A promise that resolves to `{ message }
|
|
106
|
+
* @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
|
|
107
|
+
* @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
|
|
109
108
|
*/
|
|
110
109
|
async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
|
|
111
110
|
this.client._require({ phoneNumbers, subgroupId });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export class Onboarding {
|
|
2
|
+
constructor(client, enableAdmin) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
this.enableAdmin = enableAdmin;
|
|
5
|
+
|
|
6
|
+
// Hidden Admin namespace INSIDE the domain
|
|
7
|
+
if (enableAdmin) {
|
|
8
|
+
this.admin = {
|
|
9
|
+
/**
|
|
10
|
+
* Get all onboarding records (one per group). Staff-only.
|
|
11
|
+
* @async
|
|
12
|
+
* @roles signalhouse
|
|
13
|
+
* @param {Object} [params] - Optional parameters
|
|
14
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
15
|
+
* @returns {Promise<Object>} - Array of onboarding records
|
|
16
|
+
*/
|
|
17
|
+
getOnboardings: async ({ options = {} } = {}) => {
|
|
18
|
+
return this.client(`/group/onboarding`, { method: "GET", ...options });
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get a single onboarding record by group ID. Staff-only.
|
|
23
|
+
* @async
|
|
24
|
+
* @roles signalhouse
|
|
25
|
+
* @param {Object} params
|
|
26
|
+
* @param {string} params.groupId - The group ID whose onboarding record to retrieve
|
|
27
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
28
|
+
* @throws {Error} Throws an error if the groupId parameter is missing
|
|
29
|
+
* @returns {Promise<Object>} - The onboarding record
|
|
30
|
+
*/
|
|
31
|
+
getOnboarding: async ({ groupId, options = {} }) => {
|
|
32
|
+
this.client._require({ groupId });
|
|
33
|
+
const safeGroupId = encodeURIComponent(groupId);
|
|
34
|
+
return this.client(`/group/onboarding/${safeGroupId}`, { method: "GET", ...options });
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|