@signalhousellc/sdk 1.0.47 → 1.0.49

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhousellc/sdk",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -103,6 +103,17 @@ export class Campaigns {
103
103
  const safeCampaignId = encodeURIComponent(campaignId);
104
104
  return this.client(`/campaign/reject/${safeCampaignId}`, { method: "POST", ...options });
105
105
  },
106
+ /**
107
+ * Get CNP campaigns shared with Signal House
108
+ * @async
109
+ * @roles signalhouse
110
+ * @param {Object} params - The parameters for retrieving CNP campaigns
111
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
112
+ * @returns {Promise<Array>} The response from the server
113
+ */
114
+ getCNPCampaigns: async ({ options = {} } = {}) => {
115
+ return this.client(`/campaign/cnp`, { method: "GET", ...options });
116
+ },
106
117
  };
107
118
  }
108
119
  }
@@ -163,6 +174,23 @@ export class Campaigns {
163
174
  return this.client(`/campaign/${safeCampaignId}`, { method: "PUT", body: campaignData, ...options });
164
175
  }
165
176
 
177
+ /**
178
+ * Add an internal comment/note to a campaign
179
+ * @async
180
+ * @roles signalhouse_admin, signalhouse_user
181
+ * @param {Object} params - The parameters for adding the comment
182
+ * @param {string} params.campaignId - The ID of the campaign
183
+ * @param {string} params.comment - The comment/note text
184
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
185
+ * @throws {Error} Throws an error if the campaignId or comment parameter is missing
186
+ * @returns {Promise<Object>} The updated campaign object
187
+ */
188
+ async addCampaignComment({ campaignId, comment, options = {} }) {
189
+ this.client._require({ campaignId, comment });
190
+ const safeCampaignId = encodeURIComponent(campaignId);
191
+ return this.client(`/campaign/${safeCampaignId}/comments`, { method: "POST", body: { comment }, ...options });
192
+ }
193
+
166
194
  /**
167
195
  * Delete an existing campaign (mark it as EXPIRED). The campaign will still be retrievable
168
196
  * @async
@@ -1,90 +1,91 @@
1
- export class Groups {
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 a list of all groups with optional pagination parameters
11
- * @async
12
- * @roles signalhouse
13
- * @param {Object} params - The parameters for getting groups
14
- * @param {number} [params.page] - The page number for pagination
15
- * @param {number} [params.limit] - The number of items per page
16
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
17
- * @returns {Promise<Object>} - The list of groups returned from the server
18
- */
19
- getGroups: async ({ page, limit, options = {} }) => {
20
- const filters = { page, limit };
21
- const queryString = this.client._getQueryString(filters);
22
- return this.client(`/group${queryString}`, { method: "GET", ...options });
23
- },
24
-
25
- /**
26
- * Create a new group with the specified group data
27
- * @async
28
- * @roles signalhouse
29
- * @param {Object} params - The parameters for creating a new group
30
- * @param {Object} params.groupData - The data for the new group, including required fields such as groupName
31
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
32
- * @throws {Error} Throws an error if the groupData parameter is missing or if required fields within groupData are missing
33
- * @returns {Promise<Object>} - The created group object returned from the server
34
- */
35
- createGroup: async ({ groupData, options = {} }) => {
36
- this.client._require({ groupData: groupData });
37
- return this.client(`/group`, { method: "POST", body: groupData, ...options });
38
- },
39
-
40
- /**
41
- * Delete a group with the specified group ID
42
- * @async
43
- * @roles signalhouse
44
- * @param {Object} params - The parameters for deleting a group
45
- * @param {string} params.groupId - The ID of the group to delete
46
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
47
- * @throws {Error} Throws an error if the groupId parameter is missing
48
- * @returns {Promise<Object>} - The deleted group object returned from the server
49
- */
50
- deleteGroup: async ({ groupId, options = {} }) => {
51
- this.client._require({ groupId });
52
- const safeGroupId = encodeURIComponent(groupId);
53
- return this.client(`/group/${safeGroupId}`, { method: "DELETE", ...options });
54
- },
55
- };
56
- }
57
- }
58
-
59
- /**
60
- * Get details of a group by its ID
61
- * @async
62
- * @roles api, admin, developer, billing, user
63
- * @param {Object} params - The parameters for getting a group
64
- * @param {string} params.id - The ID of the group to retrieve
65
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
66
- * @returns {Promise<Object>} - The group object returned from the server
67
- */
68
- async getGroup({ id, options = {} }) {
69
- const filters = { id };
70
- const queryString = this.client._getQueryString(filters);
71
- return this.client(`/group${queryString}`, { method: "GET", ...options });
72
- }
73
-
74
- /**
75
- * Update a group with the specified group data
76
- * @async
77
- * @roles api, admin, developer, billing
78
- * @param {Object} params - The parameters for updating a group
79
- * @param {string} params.id - The ID of the group to update
80
- * @param {Object} params.groupData - The data for the group, including required fields such as groupName
81
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
82
- * @throws {Error} Throws an error if the id or groupData parameter is missing
83
- * @returns {Promise<Object>} - The updated group object returned from the server
84
- */
85
- async updateGroup({ id, groupData, options = {} }) {
86
- this.client._require({ id, groupData: groupData });
87
- const safeId = encodeURIComponent(id);
88
- return this.client(`/group/${safeId}`, { method: "PUT", body: groupData, ...options });
89
- }
90
- }
1
+ export class Groups {
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 a list of all groups with optional pagination parameters
11
+ * @async
12
+ * @roles signalhouse
13
+ * @param {Object} params - The parameters for getting groups
14
+ * @param {number} [params.page] - The page number for pagination
15
+ * @param {number} [params.limit] - The number of items per page
16
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
17
+ * @returns {Promise<Object>} - The list of groups returned from the server
18
+ */
19
+ getGroups: async ({ page, limit, options = {} }) => {
20
+ const filters = { page, limit };
21
+ const queryString = this.client._getQueryString(filters);
22
+ return this.client(`/group${queryString}`, { method: "GET", ...options });
23
+ },
24
+
25
+ /**
26
+ * Create a new group with the specified group data
27
+ * @async
28
+ * @roles signalhouse
29
+ * @param {Object} params - The parameters for creating a new group
30
+ * @param {Object} params.groupData - The data for the new group, including required fields such as groupName
31
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
32
+ * @throws {Error} Throws an error if the groupData parameter is missing or if required fields within groupData are missing
33
+ * @returns {Promise<Object>} - The created group object returned from the server
34
+ */
35
+ createGroup: async ({ groupData, options = {} }) => {
36
+ this.client._require({ groupData: groupData });
37
+ return this.client(`/group`, { method: "POST", body: groupData, ...options });
38
+ },
39
+
40
+ /**
41
+ * Delete a group with the specified group ID
42
+ * @async
43
+ * @roles signalhouse
44
+ * @param {Object} params - The parameters for deleting a group
45
+ * @param {string} params.groupId - The ID of the group to delete
46
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
47
+ * @throws {Error} Throws an error if the groupId parameter is missing
48
+ * @returns {Promise<Object>} - The deleted group object returned from the server
49
+ */
50
+ deleteGroup: async ({ groupId, options = {} }) => {
51
+ this.client._require({ groupId });
52
+ const safeGroupId = encodeURIComponent(groupId);
53
+ return this.client(`/group/${safeGroupId}`, { method: "DELETE", ...options });
54
+ },
55
+ };
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Get details of a group by its ID
61
+ * @async
62
+ * @roles api, admin, developer, billing, user
63
+ * @param {Object} params - The parameters for getting a group
64
+ * @param {string} params.id - The ID of the group to retrieve
65
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
66
+ * @returns {Promise<Object>} - The group object returned from the server
67
+ */
68
+ async getGroup({ id, options = {} }) {
69
+ const filters = { id };
70
+ const queryString = this.client._getQueryString(filters);
71
+ return this.client(`/group${queryString}`, { method: "GET", ...options });
72
+ }
73
+
74
+ /**
75
+ * Update a group with the specified group data
76
+ * @async
77
+ * @roles api, admin, developer, billing
78
+ * @param {Object} params - The parameters for updating a group
79
+ * @param {string} params.id - The ID of the group to update
80
+ * @param {Object} params.groupData - The data for the group, including required fields such as groupName.
81
+ * Optional CNP fields: cspId (string|null), defaultCnpSubgroupId (string|null)
82
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
83
+ * @throws {Error} Throws an error if the id or groupData parameter is missing
84
+ * @returns {Promise<Object>} - The updated group object returned from the server
85
+ */
86
+ async updateGroup({ id, groupData, options = {} }) {
87
+ this.client._require({ id, groupData: groupData });
88
+ const safeId = encodeURIComponent(id);
89
+ return this.client(`/group/${safeId}`, { method: "PUT", body: groupData, ...options });
90
+ }
91
+ }
@@ -1,106 +1,110 @@
1
- /**
2
- * @typedef {Object} CreateSubgroupData
3
- * @property {string} groupId - The ID of the parent group for the subgroup (must be at least 8 characters long and start with 'G')
4
- * @property {string} subgroupName - The name of the subgroup (required)
5
- * @property {string} [contactFirstName] - The first name of the contact person for the subgroup
6
- * @property {string} [contactLastName] - The last name of the contact person for the subgroup
7
- * @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
8
- * @property {string} [subgroupCompanyName] - The company name associated with the subgroup
9
- * @property {string} [addressLine1] - The first line of the address for the subgroup
10
- * @property {string} [addressLine2] - The second line of the address for the subgroup
11
- * @property {string} [city] - The city for the subgroup's address
12
- * @property {string} [state] - The state for the subgroup's address
13
- * @property {string} [country] - The country for the subgroup's address
14
- * @property {string} [postalCode] - The postal code for the subgroup's address
15
- * @property {string} [phone] - The phone number for the subgroup
16
- */
17
-
18
- /**
19
- * @typedef {Object} UpdateSubgroupData
20
- * @property {string} [subgroupName] - The name of the subgroup
21
- * @property {string} [contactFirstName] - The first name of the contact person for the subgroup
22
- * @property {string} [contactLastName] - The last name of the contact person for the subgroup
23
- * @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
24
- * @property {string} [subgroupCompanyName] - The company name associated with the subgroup
25
- * @property {string} [addressLine1] - The first line of the address for the subgroup
26
- * @property {string} [addressLine2] - The second line of the address for the subgroup
27
- * @property {string} [city] - The city for the subgroup's address
28
- * @property {string} [state] - The state for the subgroup's address
29
- * @property {string} [country] - The country for the subgroup's address
30
- * @property {string} [postalCode] - The postal code for the subgroup's address
31
- * @property {string} [phone] - The phone number for the subgroup
32
- * @property {string} [status] - The status of the subgroup (e.g., "active", "inactive")
33
- */
34
-
35
- export class Subgroups {
36
- constructor(client, enableAdmin) {
37
- this.client = client;
38
- this.enableAdmin = enableAdmin;
39
- }
40
-
41
- /**
42
- * Get a list of subgroups with optional filters
43
- * @async
44
- * @roles api, admin, developer, billing, user
45
- * @param {Object} params - The parameters for getting subgroups
46
- * @param {string} [params.id] - Filter by subgroup ID
47
- * @param {string} [params.groupId] - Filter by parent group ID
48
- * @param {number} [params.page] - The page number for pagination
49
- * @param {number} [params.limit] - The number of items per page for pagination
50
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
51
- * @returns {Promise<Object>} - The list of subgroups returned from the server
52
- */
53
- async getSubgroups({ id, groupId, page, limit, options = {} }) {
54
- const filters = { id, groupId, page, limit };
55
- const queryString = this.client._getQueryString(filters);
56
- return this.client(`/subgroup${queryString}`, { method: "GET", ...options });
57
- }
58
-
59
- /**
60
- * Create a new subgroup with the specified subgroup data
61
- * @async
62
- * @roles api, admin, developer, billing, user
63
- * @param {Object} params - The parameters for creating a subgroup (see CreateSubgroupData typedef for details)
64
- * @param {CreateSubgroupData} params.subgroupData - The data for the subgroup to be created, including required fields such as groupId and subgroupName
65
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
66
- * @throws {Error} Throws an error if the subgroupData parameter is missing or if required fields in subgroupData are missing
67
- * @returns {Promise<Object>} - The created subgroup object returned from the server
68
- */
69
- async createSubgroup({ subgroupData, options = {} }) {
70
- this.client._require({ subgroupData: subgroupData });
71
- return this.client(`/subgroup`, { method: "POST", body: subgroupData, ...options });
72
- }
73
-
74
- /**
75
- * Update an existing subgroup with the specified subgroup data
76
- * @async
77
- * @roles api, admin, developer, billing, user
78
- * @param {Object} params - The parameters for updating a subgroup (see UpdateSubgroupData typedef for details)
79
- * @param {string} params.id - The ID of the subgroup to update
80
- * @param {UpdateSubgroupData} params.updateData - The data for the subgroup to be updated, including fields such as subgroupName, contact information, and status
81
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
82
- * @throws {Error} Throws an error if the id or updateData parameter is missing
83
- * @returns {Promise<Object>} - The updated subgroup object returned from the server
84
- */
85
- async updateSubgroup({ id, updateData, options = {} }) {
86
- this.client._require({ id, updateData });
87
- const safeId = encodeURIComponent(id);
88
- return this.client(`/subgroup/${safeId}`, { method: "PUT", body: updateData, ...options });
89
- }
90
-
91
- /**
92
- * Delete a subgroup by its ID (mark as inactive)
93
- * @async
94
- * @roles api, admin, developer, billing, user
95
- * @param {Object} params - The parameters for deleting a subgroup
96
- * @param {string} params.id - The ID of the subgroup to delete
97
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
98
- * @throws {Error} Throws an error if the id parameter is missing
99
- * @returns {Promise<Object>} - The deleted subgroup object returned from the server
100
- */
101
- async deleteSubgroup({ id, options = {} }) {
102
- this.client._require({ id });
103
- const safeId = encodeURIComponent(id);
104
- return this.client(`/subgroup/${safeId}`, { method: "DELETE", ...options });
105
- }
106
- }
1
+ /**
2
+ * @typedef {Object} CreateSubgroupData
3
+ * @property {string} groupId - The ID of the parent group for the subgroup (must be at least 8 characters long and start with 'G')
4
+ * @property {string} subgroupName - The name of the subgroup (required)
5
+ * @property {string} [contactFirstName] - The first name of the contact person for the subgroup
6
+ * @property {string} [contactLastName] - The last name of the contact person for the subgroup
7
+ * @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
8
+ * @property {string} [subgroupCompanyName] - The company name associated with the subgroup
9
+ * @property {string} [addressLine1] - The first line of the address for the subgroup
10
+ * @property {string} [addressLine2] - The second line of the address for the subgroup
11
+ * @property {string} [city] - The city for the subgroup's address
12
+ * @property {string} [state] - The state for the subgroup's address
13
+ * @property {string} [country] - The country for the subgroup's address
14
+ * @property {string} [postalCode] - The postal code for the subgroup's address
15
+ * @property {string} [phone] - The phone number for the subgroup
16
+ * @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.
17
+ * @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.
18
+ */
19
+
20
+ /**
21
+ * @typedef {Object} UpdateSubgroupData
22
+ * @property {string} [subgroupName] - The name of the subgroup
23
+ * @property {string} [contactFirstName] - The first name of the contact person for the subgroup
24
+ * @property {string} [contactLastName] - The last name of the contact person for the subgroup
25
+ * @property {string} [contactMiddleName] - The middle name of the contact person for the subgroup
26
+ * @property {string} [subgroupCompanyName] - The company name associated with the subgroup
27
+ * @property {string} [addressLine1] - The first line of the address for the subgroup
28
+ * @property {string} [addressLine2] - The second line of the address for the subgroup
29
+ * @property {string} [city] - The city for the subgroup's address
30
+ * @property {string} [state] - The state for the subgroup's address
31
+ * @property {string} [country] - The country for the subgroup's address
32
+ * @property {string} [postalCode] - The postal code for the subgroup's address
33
+ * @property {string} [phone] - The phone number for the subgroup
34
+ * @property {string} [status] - The status of the subgroup (e.g., "active", "inactive")
35
+ * @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.
36
+ * @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.
37
+ */
38
+
39
+ export class Subgroups {
40
+ constructor(client, enableAdmin) {
41
+ this.client = client;
42
+ this.enableAdmin = enableAdmin;
43
+ }
44
+
45
+ /**
46
+ * Get a list of subgroups with optional filters
47
+ * @async
48
+ * @roles api, admin, developer, billing, user
49
+ * @param {Object} params - The parameters for getting subgroups
50
+ * @param {string} [params.id] - Filter by subgroup ID
51
+ * @param {string} [params.groupId] - Filter by parent group ID
52
+ * @param {number} [params.page] - The page number for pagination
53
+ * @param {number} [params.limit] - The number of items per page for pagination
54
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
55
+ * @returns {Promise<Object>} - The list of subgroups returned from the server
56
+ */
57
+ async getSubgroups({ id, groupId, page, limit, options = {} }) {
58
+ const filters = { id, groupId, page, limit };
59
+ const queryString = this.client._getQueryString(filters);
60
+ return this.client(`/subgroup${queryString}`, { method: "GET", ...options });
61
+ }
62
+
63
+ /**
64
+ * Create a new subgroup with the specified subgroup data
65
+ * @async
66
+ * @roles api, admin, developer, billing, user
67
+ * @param {Object} params - The parameters for creating a subgroup (see CreateSubgroupData typedef for details)
68
+ * @param {CreateSubgroupData} params.subgroupData - The data for the subgroup to be created, including required fields such as groupId and subgroupName
69
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
70
+ * @throws {Error} Throws an error if the subgroupData parameter is missing or if required fields in subgroupData are missing
71
+ * @returns {Promise<Object>} - The created subgroup object returned from the server
72
+ */
73
+ async createSubgroup({ subgroupData, options = {} }) {
74
+ this.client._require({ subgroupData: subgroupData });
75
+ return this.client(`/subgroup`, { method: "POST", body: subgroupData, ...options });
76
+ }
77
+
78
+ /**
79
+ * Update an existing subgroup with the specified subgroup data
80
+ * @async
81
+ * @roles api, admin, developer, billing, user
82
+ * @param {Object} params - The parameters for updating a subgroup (see UpdateSubgroupData typedef for details)
83
+ * @param {string} params.id - The ID of the subgroup to update
84
+ * @param {UpdateSubgroupData} params.updateData - The data for the subgroup to be updated, including fields such as subgroupName, contact information, and status
85
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
86
+ * @throws {Error} Throws an error if the id or updateData parameter is missing
87
+ * @returns {Promise<Object>} - The updated subgroup object returned from the server
88
+ */
89
+ async updateSubgroup({ id, updateData, options = {} }) {
90
+ this.client._require({ id, updateData });
91
+ const safeId = encodeURIComponent(id);
92
+ return this.client(`/subgroup/${safeId}`, { method: "PUT", body: updateData, ...options });
93
+ }
94
+
95
+ /**
96
+ * Delete a subgroup by its ID (mark as inactive)
97
+ * @async
98
+ * @roles api, admin, developer, billing, user
99
+ * @param {Object} params - The parameters for deleting a subgroup
100
+ * @param {string} params.id - The ID of the subgroup to delete
101
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
102
+ * @throws {Error} Throws an error if the id parameter is missing
103
+ * @returns {Promise<Object>} - The deleted subgroup object returned from the server
104
+ */
105
+ async deleteSubgroup({ id, options = {} }) {
106
+ this.client._require({ id });
107
+ const safeId = encodeURIComponent(id);
108
+ return this.client(`/subgroup/${safeId}`, { method: "DELETE", ...options });
109
+ }
110
+ }