@rivium/push-node 0.1.0
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/LICENSE +21 -0
- package/README.md +369 -0
- package/dist/client.d.ts +18 -0
- package/dist/client.js +99 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +48 -0
- package/dist/modules/ab-testing.d.ts +59 -0
- package/dist/modules/ab-testing.js +69 -0
- package/dist/modules/analytics.d.ts +36 -0
- package/dist/modules/analytics.js +45 -0
- package/dist/modules/devices.d.ts +47 -0
- package/dist/modules/devices.js +51 -0
- package/dist/modules/in-app.d.ts +44 -0
- package/dist/modules/in-app.js +63 -0
- package/dist/modules/inbox.d.ts +59 -0
- package/dist/modules/inbox.js +69 -0
- package/dist/modules/push.d.ts +30 -0
- package/dist/modules/push.js +45 -0
- package/dist/modules/scheduled.d.ts +36 -0
- package/dist/modules/scheduled.js +51 -0
- package/dist/modules/segments.d.ts +44 -0
- package/dist/modules/segments.js +57 -0
- package/dist/modules/templates.d.ts +40 -0
- package/dist/modules/templates.js +51 -0
- package/dist/modules/webhooks.d.ts +52 -0
- package/dist/modules/webhooks.js +63 -0
- package/dist/types.d.ts +333 -0
- package/dist/types.js +3 -0
- package/package.json +38 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ABTesting = void 0;
|
|
4
|
+
class ABTesting {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a new A/B test.
|
|
10
|
+
*/
|
|
11
|
+
async create(options) {
|
|
12
|
+
return this.client.post('/ab-tests', options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all A/B tests for an app.
|
|
16
|
+
*/
|
|
17
|
+
async list(appId) {
|
|
18
|
+
return this.client.get(`/ab-tests/app/${appId}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get an A/B test by ID.
|
|
22
|
+
*/
|
|
23
|
+
async get(id) {
|
|
24
|
+
return this.client.get(`/ab-tests/${id}`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get results for an A/B test.
|
|
28
|
+
*/
|
|
29
|
+
async getResults(id) {
|
|
30
|
+
return this.client.get(`/ab-tests/${id}/results`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Start an A/B test.
|
|
34
|
+
*/
|
|
35
|
+
async start(id) {
|
|
36
|
+
return this.client.post(`/ab-tests/${id}/start`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Pause an A/B test.
|
|
40
|
+
*/
|
|
41
|
+
async pause(id) {
|
|
42
|
+
return this.client.post(`/ab-tests/${id}/pause`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Complete an A/B test.
|
|
46
|
+
*/
|
|
47
|
+
async complete(id, winnerId) {
|
|
48
|
+
return this.client.post(`/ab-tests/${id}/complete`, winnerId ? { winnerId } : undefined);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Delete an A/B test.
|
|
52
|
+
*/
|
|
53
|
+
async delete(id) {
|
|
54
|
+
return this.client.delete(`/ab-tests/${id}`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Send an A/B test to targeted devices.
|
|
58
|
+
*/
|
|
59
|
+
async send(id) {
|
|
60
|
+
return this.client.post(`/ab-tests/${id}/send`);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Calculate audience size for targeting options.
|
|
64
|
+
*/
|
|
65
|
+
async getAudienceSize(options) {
|
|
66
|
+
return this.client.post('/ab-tests/audience-size', options);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ABTesting = ABTesting;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { AnalyticsOverview, DailyStats, AppStats } from '../types';
|
|
3
|
+
export declare class Analytics {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Get analytics overview.
|
|
8
|
+
*/
|
|
9
|
+
getOverview(): Promise<AnalyticsOverview>;
|
|
10
|
+
/**
|
|
11
|
+
* Get daily analytics.
|
|
12
|
+
*/
|
|
13
|
+
getDaily(days?: number): Promise<DailyStats[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Get message type distribution.
|
|
16
|
+
*/
|
|
17
|
+
getMessageTypes(): Promise<{
|
|
18
|
+
type: string;
|
|
19
|
+
count: number;
|
|
20
|
+
}[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get hourly distribution.
|
|
23
|
+
*/
|
|
24
|
+
getHourly(days?: number): Promise<{
|
|
25
|
+
hour: number;
|
|
26
|
+
count: number;
|
|
27
|
+
}[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get recent messages.
|
|
30
|
+
*/
|
|
31
|
+
getRecent(limit?: number): Promise<any[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Get app stats (devices, topics, etc.).
|
|
34
|
+
*/
|
|
35
|
+
getStats(): Promise<AppStats>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Analytics = void 0;
|
|
4
|
+
class Analytics {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get analytics overview.
|
|
10
|
+
*/
|
|
11
|
+
async getOverview() {
|
|
12
|
+
return this.client.get('/analytics/overview');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get daily analytics.
|
|
16
|
+
*/
|
|
17
|
+
async getDaily(days) {
|
|
18
|
+
return this.client.get('/analytics/daily', { days });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get message type distribution.
|
|
22
|
+
*/
|
|
23
|
+
async getMessageTypes() {
|
|
24
|
+
return this.client.get('/analytics/message-types');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get hourly distribution.
|
|
28
|
+
*/
|
|
29
|
+
async getHourly(days) {
|
|
30
|
+
return this.client.get('/analytics/hourly', { days });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get recent messages.
|
|
34
|
+
*/
|
|
35
|
+
async getRecent(limit) {
|
|
36
|
+
return this.client.get('/analytics/recent', { limit });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get app stats (devices, topics, etc.).
|
|
40
|
+
*/
|
|
41
|
+
async getStats() {
|
|
42
|
+
return this.client.get('/stats');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Analytics = Analytics;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { Device } from '../types';
|
|
3
|
+
export declare class Devices {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* List all registered devices.
|
|
8
|
+
*/
|
|
9
|
+
list(): Promise<Device[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Delete a device by its deviceId.
|
|
12
|
+
*/
|
|
13
|
+
delete(deviceId: string): Promise<{
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Delete multiple devices at once.
|
|
18
|
+
*/
|
|
19
|
+
bulkDelete(deviceIds: string[]): Promise<{
|
|
20
|
+
message: string;
|
|
21
|
+
deleted: number;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Subscribe a device to a topic.
|
|
25
|
+
*/
|
|
26
|
+
subscribeTopic(deviceId: string, topic: string): Promise<{
|
|
27
|
+
message: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Unsubscribe a device from a topic.
|
|
31
|
+
*/
|
|
32
|
+
unsubscribeTopic(deviceId: string, topic: string): Promise<{
|
|
33
|
+
message: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Associate a device with a user.
|
|
37
|
+
*/
|
|
38
|
+
setUserId(deviceId: string, userId: string): Promise<{
|
|
39
|
+
message: string;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Disassociate a device from its user.
|
|
43
|
+
*/
|
|
44
|
+
clearUserId(deviceId: string): Promise<{
|
|
45
|
+
message: string;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Devices = void 0;
|
|
4
|
+
class Devices {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* List all registered devices.
|
|
10
|
+
*/
|
|
11
|
+
async list() {
|
|
12
|
+
return this.client.get('/devices');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Delete a device by its deviceId.
|
|
16
|
+
*/
|
|
17
|
+
async delete(deviceId) {
|
|
18
|
+
return this.client.delete(`/devices/${deviceId}`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Delete multiple devices at once.
|
|
22
|
+
*/
|
|
23
|
+
async bulkDelete(deviceIds) {
|
|
24
|
+
return this.client.post('/devices/bulk-delete', { deviceIds });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Subscribe a device to a topic.
|
|
28
|
+
*/
|
|
29
|
+
async subscribeTopic(deviceId, topic) {
|
|
30
|
+
return this.client.post(`/devices/${deviceId}/topics/${topic}`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Unsubscribe a device from a topic.
|
|
34
|
+
*/
|
|
35
|
+
async unsubscribeTopic(deviceId, topic) {
|
|
36
|
+
return this.client.delete(`/devices/${deviceId}/topics/${topic}`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Associate a device with a user.
|
|
40
|
+
*/
|
|
41
|
+
async setUserId(deviceId, userId) {
|
|
42
|
+
return this.client.post(`/devices/${deviceId}/user`, { userId });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Disassociate a device from its user.
|
|
46
|
+
*/
|
|
47
|
+
async clearUserId(deviceId) {
|
|
48
|
+
return this.client.delete(`/devices/${deviceId}/user`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Devices = Devices;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { InAppMessage, CreateInAppOptions, UpdateInAppOptions } from '../types';
|
|
3
|
+
export declare class InApp {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new in-app message.
|
|
8
|
+
*/
|
|
9
|
+
create(appId: string, options: CreateInAppOptions): Promise<InAppMessage>;
|
|
10
|
+
/**
|
|
11
|
+
* List all in-app messages.
|
|
12
|
+
*/
|
|
13
|
+
list(appId: string): Promise<InAppMessage[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Get an in-app message by ID.
|
|
16
|
+
*/
|
|
17
|
+
get(appId: string, id: string): Promise<InAppMessage>;
|
|
18
|
+
/**
|
|
19
|
+
* Update an in-app message.
|
|
20
|
+
*/
|
|
21
|
+
update(appId: string, id: string, options: UpdateInAppOptions): Promise<InAppMessage>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete an in-app message.
|
|
24
|
+
*/
|
|
25
|
+
delete(appId: string, id: string): Promise<{
|
|
26
|
+
success: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Activate an in-app message.
|
|
30
|
+
*/
|
|
31
|
+
activate(appId: string, id: string): Promise<InAppMessage>;
|
|
32
|
+
/**
|
|
33
|
+
* Pause an in-app message.
|
|
34
|
+
*/
|
|
35
|
+
pause(appId: string, id: string): Promise<InAppMessage>;
|
|
36
|
+
/**
|
|
37
|
+
* Duplicate an in-app message.
|
|
38
|
+
*/
|
|
39
|
+
duplicate(appId: string, id: string): Promise<InAppMessage>;
|
|
40
|
+
/**
|
|
41
|
+
* Get analytics for an in-app message.
|
|
42
|
+
*/
|
|
43
|
+
getAnalytics(appId: string, id: string): Promise<any>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InApp = void 0;
|
|
4
|
+
class InApp {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a new in-app message.
|
|
10
|
+
*/
|
|
11
|
+
async create(appId, options) {
|
|
12
|
+
return this.client.post('/in-app', options, { appId });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all in-app messages.
|
|
16
|
+
*/
|
|
17
|
+
async list(appId) {
|
|
18
|
+
return this.client.get('/in-app', { appId });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get an in-app message by ID.
|
|
22
|
+
*/
|
|
23
|
+
async get(appId, id) {
|
|
24
|
+
return this.client.get(`/in-app/${id}`, { appId });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Update an in-app message.
|
|
28
|
+
*/
|
|
29
|
+
async update(appId, id, options) {
|
|
30
|
+
return this.client.put(`/in-app/${id}`, options, { appId });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Delete an in-app message.
|
|
34
|
+
*/
|
|
35
|
+
async delete(appId, id) {
|
|
36
|
+
return this.client.delete(`/in-app/${id}`, undefined, { appId });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Activate an in-app message.
|
|
40
|
+
*/
|
|
41
|
+
async activate(appId, id) {
|
|
42
|
+
return this.client.post(`/in-app/${id}/activate`, undefined, { appId });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Pause an in-app message.
|
|
46
|
+
*/
|
|
47
|
+
async pause(appId, id) {
|
|
48
|
+
return this.client.post(`/in-app/${id}/pause`, undefined, { appId });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Duplicate an in-app message.
|
|
52
|
+
*/
|
|
53
|
+
async duplicate(appId, id) {
|
|
54
|
+
return this.client.post(`/in-app/${id}/duplicate`, undefined, { appId });
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get analytics for an in-app message.
|
|
58
|
+
*/
|
|
59
|
+
async getAnalytics(appId, id) {
|
|
60
|
+
return this.client.get(`/in-app/${id}/analytics`, { appId });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.InApp = InApp;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { InboxMessage, SendToUserInboxOptions, SendToUsersInboxOptions, SendToDeviceInboxOptions, SendInboxOptions, GetInboxOptions, InboxStatus } from '../types';
|
|
3
|
+
export declare class Inbox {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Send an inbox message to a user.
|
|
8
|
+
*/
|
|
9
|
+
sendToUser(options: SendToUserInboxOptions): Promise<InboxMessage>;
|
|
10
|
+
/**
|
|
11
|
+
* Send an inbox message to multiple users.
|
|
12
|
+
*/
|
|
13
|
+
sendToUsers(options: SendToUsersInboxOptions): Promise<{
|
|
14
|
+
sentCount: number;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Send an inbox message to a specific device.
|
|
18
|
+
*/
|
|
19
|
+
sendToDevice(options: SendToDeviceInboxOptions): Promise<InboxMessage>;
|
|
20
|
+
/**
|
|
21
|
+
* Broadcast an inbox message to all users.
|
|
22
|
+
*/
|
|
23
|
+
broadcast(options: SendInboxOptions): Promise<{
|
|
24
|
+
sentCount: number;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Get inbox messages for a user or device.
|
|
28
|
+
*/
|
|
29
|
+
getMessages(options: GetInboxOptions): Promise<InboxMessage[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a single inbox message.
|
|
32
|
+
*/
|
|
33
|
+
getMessage(id: string): Promise<InboxMessage>;
|
|
34
|
+
/**
|
|
35
|
+
* Update message status (read, archived, deleted).
|
|
36
|
+
*/
|
|
37
|
+
updateStatus(id: string, status: InboxStatus): Promise<InboxMessage>;
|
|
38
|
+
/**
|
|
39
|
+
* Update status for multiple messages.
|
|
40
|
+
*/
|
|
41
|
+
updateMultiple(messageIds: string[], status: InboxStatus): Promise<{
|
|
42
|
+
updated: number;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Mark all messages as read for a user or device.
|
|
46
|
+
*/
|
|
47
|
+
markAllRead(options: {
|
|
48
|
+
userId?: string;
|
|
49
|
+
deviceId?: string;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
updated: number;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Delete an inbox message.
|
|
55
|
+
*/
|
|
56
|
+
delete(id: string): Promise<{
|
|
57
|
+
success: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Inbox = void 0;
|
|
4
|
+
class Inbox {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Send an inbox message to a user.
|
|
10
|
+
*/
|
|
11
|
+
async sendToUser(options) {
|
|
12
|
+
return this.client.post('/inbox/api/send-to-user', options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send an inbox message to multiple users.
|
|
16
|
+
*/
|
|
17
|
+
async sendToUsers(options) {
|
|
18
|
+
return this.client.post('/inbox/api/send-to-users', options);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Send an inbox message to a specific device.
|
|
22
|
+
*/
|
|
23
|
+
async sendToDevice(options) {
|
|
24
|
+
return this.client.post('/inbox/api/send-to-device', options);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Broadcast an inbox message to all users.
|
|
28
|
+
*/
|
|
29
|
+
async broadcast(options) {
|
|
30
|
+
return this.client.post('/inbox/api/broadcast', options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get inbox messages for a user or device.
|
|
34
|
+
*/
|
|
35
|
+
async getMessages(options) {
|
|
36
|
+
return this.client.post('/inbox/messages', options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a single inbox message.
|
|
40
|
+
*/
|
|
41
|
+
async getMessage(id) {
|
|
42
|
+
return this.client.get(`/inbox/messages/${id}`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Update message status (read, archived, deleted).
|
|
46
|
+
*/
|
|
47
|
+
async updateStatus(id, status) {
|
|
48
|
+
return this.client.put(`/inbox/messages/${id}`, { status });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Update status for multiple messages.
|
|
52
|
+
*/
|
|
53
|
+
async updateMultiple(messageIds, status) {
|
|
54
|
+
return this.client.post('/inbox/messages/mark-multiple', { messageIds, status });
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Mark all messages as read for a user or device.
|
|
58
|
+
*/
|
|
59
|
+
async markAllRead(options) {
|
|
60
|
+
return this.client.post('/inbox/messages/mark-all-read', options);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Delete an inbox message.
|
|
64
|
+
*/
|
|
65
|
+
async delete(id) {
|
|
66
|
+
return this.client.delete(`/inbox/messages/${id}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.Inbox = Inbox;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { SendPushOptions, SendToDeviceOptions, SendToUserOptions, SendToDevicesOptions, SendToTopicOptions, SendToSegmentOptions, SendResult } from '../types';
|
|
3
|
+
export declare class Push {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Send a push notification to a specific device.
|
|
8
|
+
*/
|
|
9
|
+
sendToDevice(options: SendToDeviceOptions): Promise<SendResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Send a push notification to all devices belonging to a user.
|
|
12
|
+
*/
|
|
13
|
+
sendToUser(options: SendToUserOptions): Promise<SendResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Send a push notification to multiple devices.
|
|
16
|
+
*/
|
|
17
|
+
sendToDevices(options: SendToDevicesOptions): Promise<SendResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Broadcast a push notification to all devices.
|
|
20
|
+
*/
|
|
21
|
+
broadcast(options: SendPushOptions): Promise<SendResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Send a push notification to all devices subscribed to a topic.
|
|
24
|
+
*/
|
|
25
|
+
sendToTopic(options: SendToTopicOptions): Promise<SendResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Send a push notification to all devices in a segment.
|
|
28
|
+
*/
|
|
29
|
+
sendToSegment(options: SendToSegmentOptions): Promise<SendResult>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Push = void 0;
|
|
4
|
+
class Push {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Send a push notification to a specific device.
|
|
10
|
+
*/
|
|
11
|
+
async sendToDevice(options) {
|
|
12
|
+
return this.client.post('/push/send', options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Send a push notification to all devices belonging to a user.
|
|
16
|
+
*/
|
|
17
|
+
async sendToUser(options) {
|
|
18
|
+
return this.client.post('/push/send-to-user', options);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Send a push notification to multiple devices.
|
|
22
|
+
*/
|
|
23
|
+
async sendToDevices(options) {
|
|
24
|
+
return this.client.post('/push/send-to-devices', options);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Broadcast a push notification to all devices.
|
|
28
|
+
*/
|
|
29
|
+
async broadcast(options) {
|
|
30
|
+
return this.client.post('/push/broadcast', options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Send a push notification to all devices subscribed to a topic.
|
|
34
|
+
*/
|
|
35
|
+
async sendToTopic(options) {
|
|
36
|
+
return this.client.post('/push/send-to-topic', options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Send a push notification to all devices in a segment.
|
|
40
|
+
*/
|
|
41
|
+
async sendToSegment(options) {
|
|
42
|
+
return this.client.post('/push/send-to-segment', options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Push = Push;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { ScheduledMessage, CreateScheduledOptions, UpdateScheduledOptions } from '../types';
|
|
3
|
+
export declare class Scheduled {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Schedule a new message.
|
|
8
|
+
*/
|
|
9
|
+
create(options: CreateScheduledOptions): Promise<ScheduledMessage>;
|
|
10
|
+
/**
|
|
11
|
+
* List all scheduled messages.
|
|
12
|
+
*/
|
|
13
|
+
list(): Promise<ScheduledMessage[]>;
|
|
14
|
+
/**
|
|
15
|
+
* List pending scheduled messages.
|
|
16
|
+
*/
|
|
17
|
+
listPending(): Promise<ScheduledMessage[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get a scheduled message by ID.
|
|
20
|
+
*/
|
|
21
|
+
get(id: string): Promise<ScheduledMessage>;
|
|
22
|
+
/**
|
|
23
|
+
* Update a scheduled message.
|
|
24
|
+
*/
|
|
25
|
+
update(id: string, options: UpdateScheduledOptions): Promise<ScheduledMessage>;
|
|
26
|
+
/**
|
|
27
|
+
* Cancel a scheduled message.
|
|
28
|
+
*/
|
|
29
|
+
cancel(id: string): Promise<ScheduledMessage>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete a scheduled message.
|
|
32
|
+
*/
|
|
33
|
+
delete(id: string): Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Scheduled = void 0;
|
|
4
|
+
class Scheduled {
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Schedule a new message.
|
|
10
|
+
*/
|
|
11
|
+
async create(options) {
|
|
12
|
+
return this.client.post('/scheduled', options);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* List all scheduled messages.
|
|
16
|
+
*/
|
|
17
|
+
async list() {
|
|
18
|
+
return this.client.get('/scheduled');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List pending scheduled messages.
|
|
22
|
+
*/
|
|
23
|
+
async listPending() {
|
|
24
|
+
return this.client.get('/scheduled/pending');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get a scheduled message by ID.
|
|
28
|
+
*/
|
|
29
|
+
async get(id) {
|
|
30
|
+
return this.client.get(`/scheduled/${id}`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Update a scheduled message.
|
|
34
|
+
*/
|
|
35
|
+
async update(id, options) {
|
|
36
|
+
return this.client.put(`/scheduled/${id}`, options);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Cancel a scheduled message.
|
|
40
|
+
*/
|
|
41
|
+
async cancel(id) {
|
|
42
|
+
return this.client.post(`/scheduled/${id}/cancel`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Delete a scheduled message.
|
|
46
|
+
*/
|
|
47
|
+
async delete(id) {
|
|
48
|
+
return this.client.delete(`/scheduled/${id}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Scheduled = Scheduled;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HttpClient } from '../client';
|
|
2
|
+
import { Segment, CreateSegmentOptions, UpdateSegmentOptions, Device } from '../types';
|
|
3
|
+
export declare class Segments {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Create a new segment.
|
|
8
|
+
*/
|
|
9
|
+
create(options: CreateSegmentOptions): Promise<Segment>;
|
|
10
|
+
/**
|
|
11
|
+
* List all segments.
|
|
12
|
+
*/
|
|
13
|
+
list(): Promise<Segment[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a segment by ID.
|
|
16
|
+
*/
|
|
17
|
+
get(id: string): Promise<Segment>;
|
|
18
|
+
/**
|
|
19
|
+
* Update a segment.
|
|
20
|
+
*/
|
|
21
|
+
update(id: string, options: UpdateSegmentOptions): Promise<Segment>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete a segment.
|
|
24
|
+
*/
|
|
25
|
+
delete(id: string): Promise<{
|
|
26
|
+
success: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Get devices in a segment.
|
|
30
|
+
*/
|
|
31
|
+
getDevices(id: string): Promise<Device[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Recalculate segment membership.
|
|
34
|
+
*/
|
|
35
|
+
recalculate(id: string): Promise<{
|
|
36
|
+
deviceCount: number;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Recalculate all segments.
|
|
40
|
+
*/
|
|
41
|
+
recalculateAll(): Promise<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
}
|