@signalhousellc/sdk 1.0.41 → 1.0.43

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 CHANGED
@@ -1,38 +1,38 @@
1
- # @signalhouse/sdk
2
-
3
- A lightweight Node.js SDK for the Signal House platform.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @signalhouse/sdk
9
- ```
10
-
11
- Quick Start
12
-
13
- ```bash
14
- import { SignalHouseSDK } from '@signalhouse/sdk';
15
-
16
- const sdk = new SignalHouseSDK({
17
- apiKey: 'your-api-key',
18
- baseUrl: 'api url'
19
- });
20
-
21
- const token = await sdk.auth.login({
22
- email: 'youremail',
23
- password: 'yourpassword'
24
- });
25
-
26
- console.log(token);
27
- ```
28
-
29
- Features
30
- Full support for Signal House API v2
31
- Integrated Axios with standardized returns
32
- Lightweight and tree-shakeable
33
-
34
- Documentation
35
- For full API reference and advanced usage, visit https://api.signalhouse.io
36
-
37
- License
38
- ISC © Signal House
1
+ # @signalhouse/sdk
2
+
3
+ A lightweight Node.js SDK for the Signal House platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @signalhouse/sdk
9
+ ```
10
+
11
+ Quick Start
12
+
13
+ ```bash
14
+ import { SignalHouseSDK } from '@signalhouse/sdk';
15
+
16
+ const sdk = new SignalHouseSDK({
17
+ apiKey: 'your-api-key',
18
+ baseUrl: 'api url'
19
+ });
20
+
21
+ const token = await sdk.auth.login({
22
+ email: 'youremail',
23
+ password: 'yourpassword'
24
+ });
25
+
26
+ console.log(token);
27
+ ```
28
+
29
+ Features
30
+ Full support for Signal House API v2
31
+ Integrated Axios with standardized returns
32
+ Lightweight and tree-shakeable
33
+
34
+ Documentation
35
+ For full API reference and advanced usage, visit https://api.signalhouse.io
36
+
37
+ License
38
+ ISC © Signal House
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalhousellc/sdk",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "Signal House SDK for use with the Signal House platform",
5
5
  "type": "module",
6
6
  "main": "src/SignalHouseSDK.js",
@@ -1,54 +1,54 @@
1
- export class Auth {
2
- constructor(client, enableAdmin) {
3
- this.client = client;
4
- this.enableAdmin = enableAdmin;
5
- }
6
-
7
- /**
8
- * Login with email and password
9
- * @async
10
- * @roles public
11
- * @param {Object} params
12
- * @param {string} params.email - The user's email address
13
- * @param {string} params.password - The user's password
14
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
- * @returns {Promise<Object>} The response from the server
16
- */
17
- async login({ email, password, options = {} }) {
18
- return this.client(`/auth`, { method: "POST", body: { email, password }, ...options });
19
- }
20
-
21
- /**
22
- * Reset a user's password
23
- * @async
24
- * @roles api, admin, self
25
- * @param {Object} params
26
- * @param {string} params.userId - The id of the user
27
- * @param {string} params.newPassword - The new password to set for the user
28
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
29
- * @returns {Promise<Object>} The response from the server
30
- */
31
- async resetPassword({ userId, newPassword, options = {} }) {
32
- this.client._require({ userId, newPassword });
33
- const safeUserId = encodeURIComponent(userId);
34
- return this.client(`/auth/resetpassword/${safeUserId}`, { method: "PUT", body: { newPassword }, ...options });
35
- }
36
-
37
- /**
38
- * Get token login history for a group or user
39
- * @async
40
- * @roles signalhouse_admin, signalhouse_api, signalhouse_user, admin, api (groupId query); self (userId query)
41
- * @param {Object} params
42
- * @param {string} [params.groupId] - Returns history for all users in the group (one of groupId/userId required)
43
- * @param {string} [params.userId] - Returns history for a specific user (one of groupId/userId required)
44
- * @param {number} [params.page] - Page number (min 1, default 1)
45
- * @param {number} [params.limit] - Results per page (min 1, max 100, default 20)
46
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
47
- * @returns {Promise<Object>} The response from the server
48
- */
49
- async getAuthHistory({ groupId, userId, page, limit, options = {} }) {
50
- this.client._require({ "groupId or userId": groupId ?? userId });
51
- const queryString = this.client._getQueryString({ groupId, userId, page, limit });
52
- return this.client(`/auth/history${queryString}`, { method: "GET", ...options });
53
- }
54
- }
1
+ export class Auth {
2
+ constructor(client, enableAdmin) {
3
+ this.client = client;
4
+ this.enableAdmin = enableAdmin;
5
+ }
6
+
7
+ /**
8
+ * Login with email and password
9
+ * @async
10
+ * @roles public
11
+ * @param {Object} params
12
+ * @param {string} params.email - The user's email address
13
+ * @param {string} params.password - The user's password
14
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
15
+ * @returns {Promise<Object>} The response from the server
16
+ */
17
+ async login({ email, password, options = {} }) {
18
+ return this.client(`/auth`, { method: "POST", body: { email, password }, ...options });
19
+ }
20
+
21
+ /**
22
+ * Reset a user's password
23
+ * @async
24
+ * @roles api, admin, self
25
+ * @param {Object} params
26
+ * @param {string} params.userId - The id of the user
27
+ * @param {string} params.newPassword - The new password to set for the user
28
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
29
+ * @returns {Promise<Object>} The response from the server
30
+ */
31
+ async resetPassword({ userId, newPassword, options = {} }) {
32
+ this.client._require({ userId, newPassword });
33
+ const safeUserId = encodeURIComponent(userId);
34
+ return this.client(`/auth/resetpassword/${safeUserId}`, { method: "PUT", body: { newPassword }, ...options });
35
+ }
36
+
37
+ /**
38
+ * Get token login history for a group or user
39
+ * @async
40
+ * @roles signalhouse_admin, signalhouse_api, signalhouse_user, admin, api (groupId query); self (userId query)
41
+ * @param {Object} params
42
+ * @param {string} [params.groupId] - Returns history for all users in the group (one of groupId/userId required)
43
+ * @param {string} [params.userId] - Returns history for a specific user (one of groupId/userId required)
44
+ * @param {number} [params.page] - Page number (min 1, default 1)
45
+ * @param {number} [params.limit] - Results per page (min 1, max 100, default 20)
46
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
47
+ * @returns {Promise<Object>} The response from the server
48
+ */
49
+ async getAuthHistory({ groupId, userId, page, limit, options = {} }) {
50
+ this.client._require({ "groupId or userId": groupId ?? userId });
51
+ const queryString = this.client._getQueryString({ groupId, userId, page, limit });
52
+ return this.client(`/auth/history${queryString}`, { method: "GET", ...options });
53
+ }
54
+ }
@@ -62,8 +62,8 @@ export class Billing {
62
62
  * @param {string} [params.campaignId] - The campaign ID to filter by
63
63
  * @param {string} [params.entryType] - The type of entry to filter by
64
64
  * @param {string} [params.transactionType] - The type of transaction to filter by
65
- * @param {string} [params.startDate] - The start date for the filter
66
- * @param {string} [params.endDate] - The end date for the filter
65
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
66
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
67
67
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
68
68
  * @returns {Promise<Array>} The response from the server
69
69
  */
@@ -190,8 +190,8 @@ export class Billing {
190
190
  * @param {Object} params - The parameters for filtering the invoice details
191
191
  * @param {string} [params.groupId] - The ID of the group to filter by
192
192
  * @param {string} [params.subgroupId] - The ID of the subgroup to filter by
193
- * @param {string} [params.startDate] - The start date for the filter
194
- * @param {string} [params.endDate] - The end date for the filter
193
+ * @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
194
+ * @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
195
195
  * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
196
196
  * @returns {Promise<Object>} The response from the server
197
197
  */
@@ -1,90 +1,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
- * @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
+ * @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
+ }