@signalhousellc/sdk 1.0.44 → 1.0.46
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 +38 -38
- package/package.json +1 -1
- package/src/domains/Auth.js +54 -54
- package/src/domains/Billing.js +19 -0
- package/src/domains/Groups.js +90 -90
- package/src/domains/Landings.js +132 -132
- package/src/domains/Messages.js +53 -1
- package/src/domains/Notifications.js +56 -56
- package/src/domains/Onboarding.js +27 -0
- package/src/domains/Shortlinks.js +44 -44
- package/src/domains/Subgroups.js +106 -106
- package/src/domains/Subscriptions.js +140 -140
- package/src/domains/Webhooks.js +74 -74
package/src/domains/Landings.js
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} CreateLandingData
|
|
3
|
-
* @property {string} brandId - The ID of the brand to associate with the landing page
|
|
4
|
-
* @property {string} description - A description of the landing page
|
|
5
|
-
* @property {string} primaryBackgroundColor - The primary background color for the landing page (e.g., "#FFFFFF")
|
|
6
|
-
* @property {string} secondaryBackgroundColor - The secondary background color for the landing page (e.g., "#F0F0F0")
|
|
7
|
-
* @property {string} primaryTextColor - The primary text color for the landing page (e.g., "#000000")
|
|
8
|
-
* @property {string} secondaryTextColor - The secondary text color for the landing page (e.g., "#333333")
|
|
9
|
-
* @property {Buffer} logo - A logo image file for the landing page, provided as a Buffer
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {Object} UpdateLandingData
|
|
14
|
-
* @property {string} [description] - A description of the landing page
|
|
15
|
-
* @property {string} [primaryBackgroundColor] - The primary background color for the landing page (e.g., "#FFFFFF")
|
|
16
|
-
* @property {string} [secondaryBackgroundColor] - The secondary background color for the landing page (e.g., "#F0F0F0")
|
|
17
|
-
* @property {string} [primaryTextColor] - The primary text color for the landing page (e.g., "#000000")
|
|
18
|
-
* @property {string} [secondaryTextColor] - The secondary text color for the landing page (e.g., "#333333")
|
|
19
|
-
* @property {Buffer} [logo] - A logo image file for the landing page, provided as a Buffer
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export class Landings {
|
|
23
|
-
constructor(client, multipartClient, enableAdmin) {
|
|
24
|
-
this.client = client;
|
|
25
|
-
this.multipartClient = multipartClient;
|
|
26
|
-
this.enableAdmin = enableAdmin;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get details of a landing page by its ID
|
|
31
|
-
* @async
|
|
32
|
-
* @roles api, admin, developer, billing, user
|
|
33
|
-
* @param {Object} params - The parameters for getting a landing page
|
|
34
|
-
* @param {string} params.landingId - The ID of the landing page to retrieve
|
|
35
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
36
|
-
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
37
|
-
* @returns {Promise<Object>} - The landing page object returned from the server
|
|
38
|
-
*/
|
|
39
|
-
async getLandings({ landingId, options = {} }) {
|
|
40
|
-
this.client._require({ landingId });
|
|
41
|
-
const safeLandingId = encodeURIComponent(landingId);
|
|
42
|
-
return this.client(`/landing/${safeLandingId}`, { method: "GET", ...options });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create a new landing page with the specified landing data and logo file
|
|
47
|
-
* @async
|
|
48
|
-
* @roles api, admin, developer, billing, user
|
|
49
|
-
* @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
|
|
50
|
-
* @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
|
|
51
|
-
* @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
|
|
52
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
53
|
-
* @returns {Promise<Object>} - The newly created landing page object returned from the server
|
|
54
|
-
*/
|
|
55
|
-
async createLanding({ landingData, file, options = {} }) {
|
|
56
|
-
const formData = new FormData();
|
|
57
|
-
|
|
58
|
-
if (file) {
|
|
59
|
-
formData.append("file", file);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
Object.entries(landingData).forEach(([key, value]) => {
|
|
63
|
-
if (value !== undefined) {
|
|
64
|
-
formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
return this.multipartClient(`/landing`, { method: "POST", body: formData, ...options });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Update an existing landing page with the specified landing data and logo file
|
|
73
|
-
* @async
|
|
74
|
-
* @roles api, admin, developer, billing, user
|
|
75
|
-
* @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
|
|
76
|
-
* @param {string} params.landingId - The ID of the landing page to update
|
|
77
|
-
* @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
|
|
78
|
-
* @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
|
|
79
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
80
|
-
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
81
|
-
* @returns {Promise<Object>} - The updated landing page object returned from the server
|
|
82
|
-
*/
|
|
83
|
-
async updateLanding({ landingId, landingData, file, options = {} }) {
|
|
84
|
-
this.client._require({ landingId });
|
|
85
|
-
const safeLandingId = encodeURIComponent(landingId);
|
|
86
|
-
const formData = new FormData();
|
|
87
|
-
|
|
88
|
-
if (file) {
|
|
89
|
-
formData.append("file", file);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Object.entries(landingData).forEach(([key, value]) => {
|
|
93
|
-
if (value !== undefined) {
|
|
94
|
-
formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Delete a landing page by its ID
|
|
103
|
-
* @async
|
|
104
|
-
* @roles api, admin, developer, billing, user
|
|
105
|
-
* @param {Object} params - The parameters for deleting a landing page
|
|
106
|
-
* @param {string} params.landingId - The ID of the landing page to delete
|
|
107
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
108
|
-
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
109
|
-
* @returns {Promise<Object>} - The response from the server after deleting the landing page
|
|
110
|
-
*/
|
|
111
|
-
/**
|
|
112
|
-
* Get a landing page by its associated brand ID
|
|
113
|
-
* @async
|
|
114
|
-
* @roles api, admin, developer, billing, user
|
|
115
|
-
* @param {Object} params - The parameters for getting a landing page by brand
|
|
116
|
-
* @param {string} params.brandId - The brand ID to look up the landing page for
|
|
117
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
118
|
-
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
119
|
-
* @returns {Promise<Object>} - The landing page object returned from the server
|
|
120
|
-
*/
|
|
121
|
-
async getLandingByBrandId({ brandId, options = {} }) {
|
|
122
|
-
this.client._require({ brandId });
|
|
123
|
-
const safeBrandId = encodeURIComponent(brandId);
|
|
124
|
-
return this.client(`/landing/brand/${safeBrandId}`, { method: "GET", ...options });
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async deleteLanding({ landingId, options = {} }) {
|
|
128
|
-
this.client._require({ landingId });
|
|
129
|
-
const safeLandingId = encodeURIComponent(landingId);
|
|
130
|
-
return this.client(`/landing/${safeLandingId}`, { method: "DELETE", ...options });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} CreateLandingData
|
|
3
|
+
* @property {string} brandId - The ID of the brand to associate with the landing page
|
|
4
|
+
* @property {string} description - A description of the landing page
|
|
5
|
+
* @property {string} primaryBackgroundColor - The primary background color for the landing page (e.g., "#FFFFFF")
|
|
6
|
+
* @property {string} secondaryBackgroundColor - The secondary background color for the landing page (e.g., "#F0F0F0")
|
|
7
|
+
* @property {string} primaryTextColor - The primary text color for the landing page (e.g., "#000000")
|
|
8
|
+
* @property {string} secondaryTextColor - The secondary text color for the landing page (e.g., "#333333")
|
|
9
|
+
* @property {Buffer} logo - A logo image file for the landing page, provided as a Buffer
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} UpdateLandingData
|
|
14
|
+
* @property {string} [description] - A description of the landing page
|
|
15
|
+
* @property {string} [primaryBackgroundColor] - The primary background color for the landing page (e.g., "#FFFFFF")
|
|
16
|
+
* @property {string} [secondaryBackgroundColor] - The secondary background color for the landing page (e.g., "#F0F0F0")
|
|
17
|
+
* @property {string} [primaryTextColor] - The primary text color for the landing page (e.g., "#000000")
|
|
18
|
+
* @property {string} [secondaryTextColor] - The secondary text color for the landing page (e.g., "#333333")
|
|
19
|
+
* @property {Buffer} [logo] - A logo image file for the landing page, provided as a Buffer
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export class Landings {
|
|
23
|
+
constructor(client, multipartClient, enableAdmin) {
|
|
24
|
+
this.client = client;
|
|
25
|
+
this.multipartClient = multipartClient;
|
|
26
|
+
this.enableAdmin = enableAdmin;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get details of a landing page by its ID
|
|
31
|
+
* @async
|
|
32
|
+
* @roles api, admin, developer, billing, user
|
|
33
|
+
* @param {Object} params - The parameters for getting a landing page
|
|
34
|
+
* @param {string} params.landingId - The ID of the landing page to retrieve
|
|
35
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
36
|
+
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
37
|
+
* @returns {Promise<Object>} - The landing page object returned from the server
|
|
38
|
+
*/
|
|
39
|
+
async getLandings({ landingId, options = {} }) {
|
|
40
|
+
this.client._require({ landingId });
|
|
41
|
+
const safeLandingId = encodeURIComponent(landingId);
|
|
42
|
+
return this.client(`/landing/${safeLandingId}`, { method: "GET", ...options });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Create a new landing page with the specified landing data and logo file
|
|
47
|
+
* @async
|
|
48
|
+
* @roles api, admin, developer, billing, user
|
|
49
|
+
* @param {Object} params - The parameters for creating a new landing page (see CreateLandingData typedef for details)
|
|
50
|
+
* @param {CreateLandingData} params.landingData - The data for the new landing page, including required fields such as brandId and description
|
|
51
|
+
* @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
|
|
52
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
53
|
+
* @returns {Promise<Object>} - The newly created landing page object returned from the server
|
|
54
|
+
*/
|
|
55
|
+
async createLanding({ landingData, file, options = {} }) {
|
|
56
|
+
const formData = new FormData();
|
|
57
|
+
|
|
58
|
+
if (file) {
|
|
59
|
+
formData.append("file", file);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Object.entries(landingData).forEach(([key, value]) => {
|
|
63
|
+
if (value !== undefined) {
|
|
64
|
+
formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return this.multipartClient(`/landing`, { method: "POST", body: formData, ...options });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update an existing landing page with the specified landing data and logo file
|
|
73
|
+
* @async
|
|
74
|
+
* @roles api, admin, developer, billing, user
|
|
75
|
+
* @param {Object} params - The parameters for updating a landing page (see UpdateLandingData typedef for details)
|
|
76
|
+
* @param {string} params.landingId - The ID of the landing page to update
|
|
77
|
+
* @param {UpdateLandingData} params.landingData - The data for the landing page, including required fields such as brandId and description
|
|
78
|
+
* @param {Buffer} params.file - A logo image file for the landing page, provided as a Buffer
|
|
79
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
80
|
+
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
81
|
+
* @returns {Promise<Object>} - The updated landing page object returned from the server
|
|
82
|
+
*/
|
|
83
|
+
async updateLanding({ landingId, landingData, file, options = {} }) {
|
|
84
|
+
this.client._require({ landingId });
|
|
85
|
+
const safeLandingId = encodeURIComponent(landingId);
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
|
|
88
|
+
if (file) {
|
|
89
|
+
formData.append("file", file);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Object.entries(landingData).forEach(([key, value]) => {
|
|
93
|
+
if (value !== undefined) {
|
|
94
|
+
formData.append(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return this.multipartClient(`/landing/${safeLandingId}`, { method: "PUT", body: formData, ...options });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Delete a landing page by its ID
|
|
103
|
+
* @async
|
|
104
|
+
* @roles api, admin, developer, billing, user
|
|
105
|
+
* @param {Object} params - The parameters for deleting a landing page
|
|
106
|
+
* @param {string} params.landingId - The ID of the landing page to delete
|
|
107
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
108
|
+
* @throws {Error} Throws an error if the landingId parameter is missing
|
|
109
|
+
* @returns {Promise<Object>} - The response from the server after deleting the landing page
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* Get a landing page by its associated brand ID
|
|
113
|
+
* @async
|
|
114
|
+
* @roles api, admin, developer, billing, user
|
|
115
|
+
* @param {Object} params - The parameters for getting a landing page by brand
|
|
116
|
+
* @param {string} params.brandId - The brand ID to look up the landing page for
|
|
117
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
118
|
+
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
119
|
+
* @returns {Promise<Object>} - The landing page object returned from the server
|
|
120
|
+
*/
|
|
121
|
+
async getLandingByBrandId({ brandId, options = {} }) {
|
|
122
|
+
this.client._require({ brandId });
|
|
123
|
+
const safeBrandId = encodeURIComponent(brandId);
|
|
124
|
+
return this.client(`/landing/brand/${safeBrandId}`, { method: "GET", ...options });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async deleteLanding({ landingId, options = {} }) {
|
|
128
|
+
this.client._require({ landingId });
|
|
129
|
+
const safeLandingId = encodeURIComponent(landingId);
|
|
130
|
+
return this.client(`/landing/${safeLandingId}`, { method: "DELETE", ...options });
|
|
131
|
+
}
|
|
132
|
+
}
|
package/src/domains/Messages.js
CHANGED
|
@@ -17,7 +17,7 @@ export class Messages {
|
|
|
17
17
|
* @param {string} [params.groupId] - Filter messages by the ID of the associated group
|
|
18
18
|
* @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
|
|
19
19
|
* @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
|
|
20
|
-
* @param {string} [params.messageType] - Filter messages by their type (SMS, MMS)
|
|
20
|
+
* @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
|
|
21
21
|
* @param {string} [params.carrier] - Filter messages by the carrier used for sending
|
|
22
22
|
* @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
|
|
23
23
|
* @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
|
|
@@ -116,6 +116,58 @@ export class Messages {
|
|
|
116
116
|
return this.client(`/message/analytics/filter-options${queryString}`, { method: "GET", ...options });
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Get a paginated breakdown of message metrics grouped by subgroup. Each row carries the
|
|
121
|
+
* full set of sms/mms/p2p metric columns so the caller can apply channel toggles client-side.
|
|
122
|
+
* @async
|
|
123
|
+
* @roles api, admin, developer, billing, user
|
|
124
|
+
* @param {Object} params
|
|
125
|
+
* @param {string} params.groupId - The Group ID
|
|
126
|
+
* @param {string|string[]} [params.subgroupId]
|
|
127
|
+
* @param {string|string[]} [params.brandId]
|
|
128
|
+
* @param {string|string[]} [params.campaignId]
|
|
129
|
+
* @param {string|string[]} [params.phoneNumber]
|
|
130
|
+
* @param {string|string[]} [params.carrier]
|
|
131
|
+
* @param {string} [params.startDate]
|
|
132
|
+
* @param {string} [params.endDate]
|
|
133
|
+
* @param {number} [params.page=1]
|
|
134
|
+
* @param {number} [params.limit=50] - max 50 per page
|
|
135
|
+
* @param {"tenDLC"|"p2p"|"both"} [params.channel="both"] - Scope the ORDER BY + row inclusion. "tenDLC" excludes rows with no SMS/MMS activity; "p2p" excludes rows with no P2P activity; "both" returns rows with any activity.
|
|
136
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options]
|
|
137
|
+
* @returns {Promise<Object>} - { rows, totalCount, page, limit }
|
|
138
|
+
*/
|
|
139
|
+
async getAnalyticsBySubgroup({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel, options = {} }) {
|
|
140
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel };
|
|
141
|
+
const queryString = this.client._getQueryString(filters);
|
|
142
|
+
return this.client(`/message/analytics/by-subgroup${queryString}`, { method: "GET", ...options });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Get a paginated breakdown of failed messages grouped by error code.
|
|
147
|
+
* Each row contains per-channel (sms/mms/p2p) error counts plus an enriched description.
|
|
148
|
+
* @async
|
|
149
|
+
* @roles api, admin, developer, billing, user
|
|
150
|
+
* @param {Object} params
|
|
151
|
+
* @param {string} params.groupId - The Group ID
|
|
152
|
+
* @param {string|string[]} [params.subgroupId]
|
|
153
|
+
* @param {string|string[]} [params.brandId]
|
|
154
|
+
* @param {string|string[]} [params.campaignId]
|
|
155
|
+
* @param {string|string[]} [params.phoneNumber]
|
|
156
|
+
* @param {string|string[]} [params.carrier]
|
|
157
|
+
* @param {string} [params.startDate]
|
|
158
|
+
* @param {string} [params.endDate]
|
|
159
|
+
* @param {number} [params.page=1]
|
|
160
|
+
* @param {number} [params.limit=50] - max 50 per page
|
|
161
|
+
* @param {"tenDLC"|"p2p"|"both"} [params.channel="both"] - Scope the ORDER BY + totalCount. "tenDLC" excludes rows with no SMS/MMS errors; "p2p" excludes rows with no P2P errors; "both" returns rows with any error.
|
|
162
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options]
|
|
163
|
+
* @returns {Promise<Object>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
|
|
164
|
+
*/
|
|
165
|
+
async getAnalyticsByErrorCode({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel, options = {} }) {
|
|
166
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, channel };
|
|
167
|
+
const queryString = this.client._getQueryString(filters);
|
|
168
|
+
return this.client(`/message/analytics/by-error-code${queryString}`, { method: "GET", ...options });
|
|
169
|
+
}
|
|
170
|
+
|
|
119
171
|
/**
|
|
120
172
|
* Get aggregated DNC (Do Not Contact) opt-out analytics with optional filters
|
|
121
173
|
* @async
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
export class Notifications {
|
|
2
|
-
constructor(client, enableAdmin) {
|
|
3
|
-
this.client = client;
|
|
4
|
-
this.enableAdmin = enableAdmin;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get notifications by id or by groupId with optional filters
|
|
9
|
-
* @async
|
|
10
|
-
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
11
|
-
* @param {Object} params
|
|
12
|
-
* @param {string} [params.id] - Notification id (one of id/groupId required)
|
|
13
|
-
* @param {string} [params.groupId] - Group id to fetch notifications for (one of id/groupId required)
|
|
14
|
-
* @param {number} [params.page] - Page number (min 1, default 1)
|
|
15
|
-
* @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
|
|
16
|
-
* @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
|
|
17
|
-
* @param {string|string[]} [params.eventTypes] - Event types to filter by (comma-separated string or array)
|
|
18
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
19
|
-
* @returns {Promise<Object>} The response from the server
|
|
20
|
-
*/
|
|
21
|
-
async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
|
|
22
|
-
this.client._require({ "id or groupId": id ?? groupId });
|
|
23
|
-
const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
|
|
24
|
-
return this.client(`/notification${queryString}`, { method: "GET", ...options });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Update the status of one or more notifications
|
|
29
|
-
* @async
|
|
30
|
-
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
31
|
-
* @param {Object} params
|
|
32
|
-
* @param {string|string[]} params.ids - Notification id or array of notification ids
|
|
33
|
-
* @param {string} params.status - New status: "READ" or "UNREAD"
|
|
34
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
35
|
-
* @returns {Promise<Object>} The response from the server
|
|
36
|
-
*/
|
|
37
|
-
async updateNotificationStatus({ ids, status, options = {} }) {
|
|
38
|
-
this.client._require({ ids, status });
|
|
39
|
-
return this.client(`/notification/status`, { method: "PUT", body: { ids, status }, ...options });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Delete a notification by id
|
|
44
|
-
* @async
|
|
45
|
-
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
46
|
-
* @param {Object} params
|
|
47
|
-
* @param {string} params.id - The notification id to delete
|
|
48
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
49
|
-
* @returns {Promise<Object>} The response from the server
|
|
50
|
-
*/
|
|
51
|
-
async deleteNotification({ id, options = {} }) {
|
|
52
|
-
this.client._require({ id });
|
|
53
|
-
const safeId = encodeURIComponent(id);
|
|
54
|
-
return this.client(`/notification/${safeId}`, { method: "DELETE", ...options });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
export class Notifications {
|
|
2
|
+
constructor(client, enableAdmin) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
this.enableAdmin = enableAdmin;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get notifications by id or by groupId with optional filters
|
|
9
|
+
* @async
|
|
10
|
+
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
11
|
+
* @param {Object} params
|
|
12
|
+
* @param {string} [params.id] - Notification id (one of id/groupId required)
|
|
13
|
+
* @param {string} [params.groupId] - Group id to fetch notifications for (one of id/groupId required)
|
|
14
|
+
* @param {number} [params.page] - Page number (min 1, default 1)
|
|
15
|
+
* @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
|
|
16
|
+
* @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
|
|
17
|
+
* @param {string|string[]} [params.eventTypes] - Event types to filter by (comma-separated string or array)
|
|
18
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
19
|
+
* @returns {Promise<Object>} The response from the server
|
|
20
|
+
*/
|
|
21
|
+
async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
|
|
22
|
+
this.client._require({ "id or groupId": id ?? groupId });
|
|
23
|
+
const queryString = this.client._getQueryString({ id, groupId, page, limit, status, eventTypes });
|
|
24
|
+
return this.client(`/notification${queryString}`, { method: "GET", ...options });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Update the status of one or more notifications
|
|
29
|
+
* @async
|
|
30
|
+
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
31
|
+
* @param {Object} params
|
|
32
|
+
* @param {string|string[]} params.ids - Notification id or array of notification ids
|
|
33
|
+
* @param {string} params.status - New status: "READ" or "UNREAD"
|
|
34
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
35
|
+
* @returns {Promise<Object>} The response from the server
|
|
36
|
+
*/
|
|
37
|
+
async updateNotificationStatus({ ids, status, options = {} }) {
|
|
38
|
+
this.client._require({ ids, status });
|
|
39
|
+
return this.client(`/notification/status`, { method: "PUT", body: { ids, status }, ...options });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Delete a notification by id
|
|
44
|
+
* @async
|
|
45
|
+
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
46
|
+
* @param {Object} params
|
|
47
|
+
* @param {string} params.id - The notification id to delete
|
|
48
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
49
|
+
* @returns {Promise<Object>} The response from the server
|
|
50
|
+
*/
|
|
51
|
+
async deleteNotification({ id, options = {} }) {
|
|
52
|
+
this.client._require({ id });
|
|
53
|
+
const safeId = encodeURIComponent(id);
|
|
54
|
+
return this.client(`/notification/${safeId}`, { method: "DELETE", ...options });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -36,4 +36,31 @@ export class Onboarding {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get the caller's own onboarding record (customer-safe projection).
|
|
42
|
+
* Returns `{ acceptedTermsOfService: boolean }`.
|
|
43
|
+
* @async
|
|
44
|
+
* @param {Object} [params] - Optional parameters
|
|
45
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
46
|
+
* @returns {Promise<Object>} - `{ acceptedTermsOfService: boolean }`
|
|
47
|
+
*/
|
|
48
|
+
async getMyOnboarding({ options = {} } = {}) {
|
|
49
|
+
return this.client(`/group/onboarding/my`, { method: "GET", ...options });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Accept the Terms of Service for the caller's active group.
|
|
54
|
+
* @async
|
|
55
|
+
* @param {Object} [params] - Optional parameters
|
|
56
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
57
|
+
* @returns {Promise<Object>} - `{ acceptedTermsOfService: true }`
|
|
58
|
+
*/
|
|
59
|
+
async acceptTermsOfService({ options = {} } = {}) {
|
|
60
|
+
return this.client(`/group/onboarding/my/accept-terms`, {
|
|
61
|
+
method: "PUT",
|
|
62
|
+
body: { acceptedTermsOfService: true },
|
|
63
|
+
...options,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
39
66
|
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
export class Shortlinks {
|
|
2
|
-
constructor(client, enableAdmin) {
|
|
3
|
-
this.client = client;
|
|
4
|
-
this.enableAdmin = enableAdmin;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get the redirect URL for a shortlink by its ID
|
|
9
|
-
* @async
|
|
10
|
-
* @roles public
|
|
11
|
-
* @param {Object} params - The parameters for getting the shortlink redirect
|
|
12
|
-
* @param {string} params.shortlinkId - The ID of the shortlink
|
|
13
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
14
|
-
* @returns {Promise<Object>} A promise that resolves to the redirect URL for the shortlink
|
|
15
|
-
*/
|
|
16
|
-
async getShortlinkRedirect({ shortlinkId, options = {} }) {
|
|
17
|
-
this.client._require({ shortlinkId });
|
|
18
|
-
const safeShortlinkId = encodeURIComponent(shortlinkId);
|
|
19
|
-
return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get details of a shortlink by its ID, with optional filters
|
|
24
|
-
* @async
|
|
25
|
-
* @roles api, admin, developer, billing, user
|
|
26
|
-
* @param {Object} params - The parameters for getting the shortlink details
|
|
27
|
-
* @param {string} [params.shortlinkId] - The ID of the shortlink
|
|
28
|
-
* @param {string} [params.messageId] - Filter by associated message ID
|
|
29
|
-
* @param {string} [params.phoneNumber] - Filter by associated phone number
|
|
30
|
-
* @param {string} [params.campaignId] - Filter by associated campaign ID
|
|
31
|
-
* @param {string} [params.brandId] - Filter by associated brand ID
|
|
32
|
-
* @param {string} [params.subgroupId] - Filter by associated subgroup ID
|
|
33
|
-
* @param {string} [params.groupId] - Filter by associated group ID
|
|
34
|
-
* @param {number} [params.page] - The page number for pagination
|
|
35
|
-
* @param {number} [params.limit] - The number of items per page for pagination
|
|
36
|
-
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
37
|
-
* @returns {Promise<Object>} A promise that resolves to the shortlink details
|
|
38
|
-
*/
|
|
39
|
-
async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
|
|
40
|
-
const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
|
|
41
|
-
const queryString = this.client._getQueryString(filters);
|
|
42
|
-
return this.client(`/shortlink${queryString}`, { method: "GET", ...options });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
export class Shortlinks {
|
|
2
|
+
constructor(client, enableAdmin) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
this.enableAdmin = enableAdmin;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Get the redirect URL for a shortlink by its ID
|
|
9
|
+
* @async
|
|
10
|
+
* @roles public
|
|
11
|
+
* @param {Object} params - The parameters for getting the shortlink redirect
|
|
12
|
+
* @param {string} params.shortlinkId - The ID of the shortlink
|
|
13
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
14
|
+
* @returns {Promise<Object>} A promise that resolves to the redirect URL for the shortlink
|
|
15
|
+
*/
|
|
16
|
+
async getShortlinkRedirect({ shortlinkId, options = {} }) {
|
|
17
|
+
this.client._require({ shortlinkId });
|
|
18
|
+
const safeShortlinkId = encodeURIComponent(shortlinkId);
|
|
19
|
+
return this.client(`/shortlink/redirect/${safeShortlinkId}`, { method: "GET", ...options });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get details of a shortlink by its ID, with optional filters
|
|
24
|
+
* @async
|
|
25
|
+
* @roles api, admin, developer, billing, user
|
|
26
|
+
* @param {Object} params - The parameters for getting the shortlink details
|
|
27
|
+
* @param {string} [params.shortlinkId] - The ID of the shortlink
|
|
28
|
+
* @param {string} [params.messageId] - Filter by associated message ID
|
|
29
|
+
* @param {string} [params.phoneNumber] - Filter by associated phone number
|
|
30
|
+
* @param {string} [params.campaignId] - Filter by associated campaign ID
|
|
31
|
+
* @param {string} [params.brandId] - Filter by associated brand ID
|
|
32
|
+
* @param {string} [params.subgroupId] - Filter by associated subgroup ID
|
|
33
|
+
* @param {string} [params.groupId] - Filter by associated group ID
|
|
34
|
+
* @param {number} [params.page] - The page number for pagination
|
|
35
|
+
* @param {number} [params.limit] - The number of items per page for pagination
|
|
36
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
37
|
+
* @returns {Promise<Object>} A promise that resolves to the shortlink details
|
|
38
|
+
*/
|
|
39
|
+
async getShortlink({ shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
|
|
40
|
+
const filters = { shortlinkId, messageId, phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
|
|
41
|
+
const queryString = this.client._getQueryString(filters);
|
|
42
|
+
return this.client(`/shortlink${queryString}`, { method: "GET", ...options });
|
|
43
|
+
}
|
|
44
|
+
}
|