@signalhousellc/sdk 1.0.47 → 1.0.48
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/Campaigns.js +17 -0
- package/src/domains/Groups.js +90 -90
- package/src/domains/Landings.js +132 -132
- package/src/domains/Notifications.js +56 -56
- package/src/domains/Shortlinks.js +44 -44
- package/src/domains/Subgroups.js +110 -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|