activitysmith 0.1.1 → 0.1.3
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 +81 -25
- package/dist/generated/apis/LiveActivitiesApi.d.ts +2 -2
- package/dist/generated/apis/LiveActivitiesApi.js +2 -2
- package/dist/generated/apis/PushNotificationsApi.d.ts +2 -2
- package/dist/generated/apis/PushNotificationsApi.js +2 -2
- package/dist/generated/models/index.d.ts +163 -0
- package/dist/src/ActivitySmith.d.ts +35 -2
- package/dist/src/ActivitySmith.js +65 -3
- package/package.json +21 -6
- package/dist/generated/apis/NotificationsApi.d.ts +0 -31
- package/dist/generated/apis/NotificationsApi.js +0 -59
- package/dist/generated/models/ContentStateEnd.d.ts +0 -97
- package/dist/generated/models/ContentStateEnd.js +0 -89
- package/dist/generated/models/ContentStateStart.d.ts +0 -104
- package/dist/generated/models/ContentStateStart.js +0 -99
- package/dist/generated/models/ContentStateUpdate.d.ts +0 -91
- package/dist/generated/models/ContentStateUpdate.js +0 -87
- package/dist/generated/models/LiveActivityEndRequest.d.ts +0 -38
- package/dist/generated/models/LiveActivityEndRequest.js +0 -51
- package/dist/generated/models/LiveActivityEndResponse.d.ts +0 -55
- package/dist/generated/models/LiveActivityEndResponse.js +0 -58
- package/dist/generated/models/LiveActivityLimitError.d.ts +0 -49
- package/dist/generated/models/LiveActivityLimitError.js +0 -58
- package/dist/generated/models/LiveActivityStartRequest.d.ts +0 -32
- package/dist/generated/models/LiveActivityStartRequest.js +0 -47
- package/dist/generated/models/LiveActivityStartResponse.d.ts +0 -55
- package/dist/generated/models/LiveActivityStartResponse.js +0 -58
- package/dist/generated/models/LiveActivityUpdateRequest.d.ts +0 -38
- package/dist/generated/models/LiveActivityUpdateRequest.js +0 -51
- package/dist/generated/models/LiveActivityUpdateResponse.d.ts +0 -55
- package/dist/generated/models/LiveActivityUpdateResponse.js +0 -58
- package/dist/generated/models/PushNotificationRequest.d.ts +0 -43
- package/dist/generated/models/PushNotificationRequest.js +0 -50
- package/dist/generated/models/PushNotificationResponse.d.ts +0 -49
- package/dist/generated/models/PushNotificationResponse.js +0 -54
- package/dist/generated/models/RateLimitError.d.ts +0 -37
- package/dist/generated/models/RateLimitError.js +0 -50
- package/dist/generated/models/SendPushNotification429Response.d.ts +0 -22
- package/dist/generated/models/SendPushNotification429Response.js +0 -46
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# ActivitySmith Node
|
|
1
|
+
# ActivitySmith Node SDK
|
|
2
2
|
|
|
3
|
-
The ActivitySmith Node
|
|
3
|
+
The ActivitySmith Node SDK provides convenient access to the ActivitySmith API from server-side JavaScript and TypeScript applications.
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
@@ -12,50 +12,106 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction)
|
|
|
12
12
|
npm install activitysmith
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
ESM:
|
|
15
|
+
## Setup
|
|
18
16
|
|
|
19
17
|
```ts
|
|
20
18
|
import ActivitySmith from "activitysmith";
|
|
21
19
|
|
|
22
|
-
const
|
|
20
|
+
const activitysmith = new ActivitySmith({
|
|
23
21
|
apiKey: process.env.ACTIVITYSMITH_API_KEY,
|
|
24
22
|
});
|
|
23
|
+
```
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
CommonJS:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const ActivitySmith = require("activitysmith");
|
|
29
|
+
|
|
30
|
+
const activitysmith = new ActivitySmith({
|
|
31
|
+
apiKey: process.env.ACTIVITYSMITH_API_KEY,
|
|
31
32
|
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Send a Push Notification
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const response = await activitysmith.notifications.send({
|
|
41
|
+
title: "Build Failed",
|
|
42
|
+
message: "CI pipeline failed on main branch",
|
|
43
|
+
channels: ["devs", "ops"], // Optional
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(response.success);
|
|
47
|
+
console.log(response.devices_notified);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Start a Live Activity
|
|
32
51
|
|
|
33
|
-
|
|
34
|
-
await
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
```ts
|
|
53
|
+
const start = await activitysmith.liveActivities.start({
|
|
54
|
+
content_state: {
|
|
55
|
+
title: "ActivitySmith API Deployment",
|
|
56
|
+
subtitle: "start",
|
|
57
|
+
number_of_steps: 4,
|
|
58
|
+
current_step: 1,
|
|
59
|
+
type: "segmented_progress",
|
|
60
|
+
color: "yellow",
|
|
37
61
|
},
|
|
62
|
+
channels: ["devs", "ops"], // Optional
|
|
38
63
|
});
|
|
64
|
+
|
|
65
|
+
const activityId = start.activity_id;
|
|
39
66
|
```
|
|
40
67
|
|
|
41
|
-
|
|
68
|
+
### Update a Live Activity
|
|
42
69
|
|
|
43
|
-
```
|
|
44
|
-
const
|
|
70
|
+
```ts
|
|
71
|
+
const update = await activitysmith.liveActivities.update({
|
|
72
|
+
activity_id: activityId,
|
|
73
|
+
content_state: {
|
|
74
|
+
title: "ActivitySmith API Deployment",
|
|
75
|
+
subtitle: "npm i & pm2",
|
|
76
|
+
current_step: 3,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
45
79
|
|
|
46
|
-
|
|
47
|
-
|
|
80
|
+
console.log(update.devices_notified);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### End a Live Activity
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const end = await activitysmith.liveActivities.end({
|
|
87
|
+
activity_id: activityId,
|
|
88
|
+
content_state: {
|
|
89
|
+
title: "ActivitySmith API Deployment",
|
|
90
|
+
subtitle: "done",
|
|
91
|
+
current_step: 4,
|
|
92
|
+
auto_dismiss_minutes: 3,
|
|
93
|
+
},
|
|
48
94
|
});
|
|
95
|
+
|
|
96
|
+
console.log(end.success);
|
|
49
97
|
```
|
|
50
98
|
|
|
51
|
-
##
|
|
99
|
+
## Error Handling
|
|
52
100
|
|
|
53
|
-
|
|
101
|
+
```ts
|
|
102
|
+
try {
|
|
103
|
+
await activitysmith.notifications.send({
|
|
104
|
+
title: "Build Failed",
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error(error);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
54
110
|
|
|
55
|
-
|
|
56
|
-
- `client.notifications`
|
|
111
|
+
## API Surface
|
|
57
112
|
|
|
58
|
-
|
|
113
|
+
- `activitysmith.notifications`
|
|
114
|
+
- `activitysmith.liveActivities`
|
|
59
115
|
|
|
60
116
|
## TypeScript Support
|
|
61
117
|
|
|
@@ -35,12 +35,12 @@ export declare class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
35
35
|
*/
|
|
36
36
|
endLiveActivity(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityEndResponse>;
|
|
37
37
|
/**
|
|
38
|
-
* Starts a Live Activity on
|
|
38
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels.
|
|
39
39
|
* Start a Live Activity
|
|
40
40
|
*/
|
|
41
41
|
startLiveActivityRaw(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityStartResponse>>;
|
|
42
42
|
/**
|
|
43
|
-
* Starts a Live Activity on
|
|
43
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels.
|
|
44
44
|
* Start a Live Activity
|
|
45
45
|
*/
|
|
46
46
|
startLiveActivity(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityStartResponse>;
|
|
@@ -55,7 +55,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
55
55
|
return await response.value();
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Starts a Live Activity on
|
|
58
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels.
|
|
59
59
|
* Start a Live Activity
|
|
60
60
|
*/
|
|
61
61
|
async startLiveActivityRaw(requestParameters, initOverrides) {
|
|
@@ -82,7 +82,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
82
82
|
return new runtime.JSONApiResponse(response);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Starts a Live Activity on
|
|
85
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels.
|
|
86
86
|
* Start a Live Activity
|
|
87
87
|
*/
|
|
88
88
|
async startLiveActivity(requestParameters, initOverrides) {
|
|
@@ -19,12 +19,12 @@ export interface SendPushNotificationRequest {
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class PushNotificationsApi extends runtime.BaseAPI {
|
|
21
21
|
/**
|
|
22
|
-
* Sends a push notification to
|
|
22
|
+
* Sends a push notification to devices matched by API key scope and optional target channels.
|
|
23
23
|
* Send a push notification
|
|
24
24
|
*/
|
|
25
25
|
sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
|
|
26
26
|
/**
|
|
27
|
-
* Sends a push notification to
|
|
27
|
+
* Sends a push notification to devices matched by API key scope and optional target channels.
|
|
28
28
|
* Send a push notification
|
|
29
29
|
*/
|
|
30
30
|
sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
|
|
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
|
|
|
20
20
|
*/
|
|
21
21
|
class PushNotificationsApi extends runtime.BaseAPI {
|
|
22
22
|
/**
|
|
23
|
-
* Sends a push notification to
|
|
23
|
+
* Sends a push notification to devices matched by API key scope and optional target channels.
|
|
24
24
|
* Send a push notification
|
|
25
25
|
*/
|
|
26
26
|
async sendPushNotificationRaw(requestParameters, initOverrides) {
|
|
@@ -47,7 +47,7 @@ class PushNotificationsApi extends runtime.BaseAPI {
|
|
|
47
47
|
return new runtime.JSONApiResponse(response);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Sends a push notification to
|
|
50
|
+
* Sends a push notification to devices matched by API key scope and optional target channels.
|
|
51
51
|
* Send a push notification
|
|
52
52
|
*/
|
|
53
53
|
async sendPushNotification(requestParameters, initOverrides) {
|
|
@@ -1,9 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @export
|
|
4
|
+
* @interface AlertPayload
|
|
5
|
+
*/
|
|
6
|
+
export interface AlertPayload {
|
|
7
|
+
[key: string]: any | any;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @type {string}
|
|
11
|
+
* @memberof AlertPayload
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {string}
|
|
17
|
+
* @memberof AlertPayload
|
|
18
|
+
*/
|
|
19
|
+
body?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
* @interface BadRequestError
|
|
25
|
+
*/
|
|
26
|
+
export interface BadRequestError {
|
|
27
|
+
[key: string]: any | any;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof BadRequestError
|
|
32
|
+
*/
|
|
33
|
+
error: string;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof BadRequestError
|
|
38
|
+
*/
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
* @interface ChannelTarget
|
|
45
|
+
*/
|
|
46
|
+
export interface ChannelTarget {
|
|
47
|
+
[key: string]: any | any;
|
|
48
|
+
/**
|
|
49
|
+
* Channel slugs. When omitted, API key scope determines recipients.
|
|
50
|
+
* @type {Array<string>}
|
|
51
|
+
* @memberof ChannelTarget
|
|
52
|
+
*/
|
|
53
|
+
channels: Array<string>;
|
|
54
|
+
}
|
|
1
55
|
/**
|
|
2
56
|
* End payload. Required fields are title and current_step. number_of_steps is optional.
|
|
3
57
|
* @export
|
|
4
58
|
* @interface ContentStateEnd
|
|
5
59
|
*/
|
|
6
60
|
export interface ContentStateEnd {
|
|
61
|
+
[key: string]: any | any;
|
|
7
62
|
/**
|
|
8
63
|
*
|
|
9
64
|
* @type {string}
|
|
@@ -83,6 +138,7 @@ export type ContentStateEndStepColorEnum = typeof ContentStateEndStepColorEnum[k
|
|
|
83
138
|
* @interface ContentStateStart
|
|
84
139
|
*/
|
|
85
140
|
export interface ContentStateStart {
|
|
141
|
+
[key: string]: any | any;
|
|
86
142
|
/**
|
|
87
143
|
*
|
|
88
144
|
* @type {string}
|
|
@@ -169,6 +225,7 @@ export type ContentStateStartStepColorEnum = typeof ContentStateStartStepColorEn
|
|
|
169
225
|
* @interface ContentStateUpdate
|
|
170
226
|
*/
|
|
171
227
|
export interface ContentStateUpdate {
|
|
228
|
+
[key: string]: any | any;
|
|
172
229
|
/**
|
|
173
230
|
*
|
|
174
231
|
* @type {string}
|
|
@@ -236,12 +293,33 @@ export declare const ContentStateUpdateStepColorEnum: {
|
|
|
236
293
|
readonly Yellow: "yellow";
|
|
237
294
|
};
|
|
238
295
|
export type ContentStateUpdateStepColorEnum = typeof ContentStateUpdateStepColorEnum[keyof typeof ContentStateUpdateStepColorEnum];
|
|
296
|
+
/**
|
|
297
|
+
*
|
|
298
|
+
* @export
|
|
299
|
+
* @interface ForbiddenError
|
|
300
|
+
*/
|
|
301
|
+
export interface ForbiddenError {
|
|
302
|
+
[key: string]: any | any;
|
|
303
|
+
/**
|
|
304
|
+
*
|
|
305
|
+
* @type {string}
|
|
306
|
+
* @memberof ForbiddenError
|
|
307
|
+
*/
|
|
308
|
+
error: string;
|
|
309
|
+
/**
|
|
310
|
+
*
|
|
311
|
+
* @type {string}
|
|
312
|
+
* @memberof ForbiddenError
|
|
313
|
+
*/
|
|
314
|
+
message: string;
|
|
315
|
+
}
|
|
239
316
|
/**
|
|
240
317
|
*
|
|
241
318
|
* @export
|
|
242
319
|
* @interface LiveActivityEndRequest
|
|
243
320
|
*/
|
|
244
321
|
export interface LiveActivityEndRequest {
|
|
322
|
+
[key: string]: any | any;
|
|
245
323
|
/**
|
|
246
324
|
*
|
|
247
325
|
* @type {string}
|
|
@@ -261,6 +339,7 @@ export interface LiveActivityEndRequest {
|
|
|
261
339
|
* @interface LiveActivityEndResponse
|
|
262
340
|
*/
|
|
263
341
|
export interface LiveActivityEndResponse {
|
|
342
|
+
[key: string]: any | any;
|
|
264
343
|
/**
|
|
265
344
|
*
|
|
266
345
|
* @type {boolean}
|
|
@@ -298,6 +377,7 @@ export interface LiveActivityEndResponse {
|
|
|
298
377
|
* @interface LiveActivityLimitError
|
|
299
378
|
*/
|
|
300
379
|
export interface LiveActivityLimitError {
|
|
380
|
+
[key: string]: any | any;
|
|
301
381
|
/**
|
|
302
382
|
*
|
|
303
383
|
* @type {string}
|
|
@@ -329,12 +409,25 @@ export interface LiveActivityLimitError {
|
|
|
329
409
|
* @interface LiveActivityStartRequest
|
|
330
410
|
*/
|
|
331
411
|
export interface LiveActivityStartRequest {
|
|
412
|
+
[key: string]: any | any;
|
|
332
413
|
/**
|
|
333
414
|
*
|
|
334
415
|
* @type {ContentStateStart}
|
|
335
416
|
* @memberof LiveActivityStartRequest
|
|
336
417
|
*/
|
|
337
418
|
content_state: ContentStateStart;
|
|
419
|
+
/**
|
|
420
|
+
*
|
|
421
|
+
* @type {AlertPayload}
|
|
422
|
+
* @memberof LiveActivityStartRequest
|
|
423
|
+
*/
|
|
424
|
+
alert?: AlertPayload;
|
|
425
|
+
/**
|
|
426
|
+
*
|
|
427
|
+
* @type {ChannelTarget}
|
|
428
|
+
* @memberof LiveActivityStartRequest
|
|
429
|
+
*/
|
|
430
|
+
target?: ChannelTarget;
|
|
338
431
|
}
|
|
339
432
|
/**
|
|
340
433
|
*
|
|
@@ -342,6 +435,7 @@ export interface LiveActivityStartRequest {
|
|
|
342
435
|
* @interface LiveActivityStartResponse
|
|
343
436
|
*/
|
|
344
437
|
export interface LiveActivityStartResponse {
|
|
438
|
+
[key: string]: any | any;
|
|
345
439
|
/**
|
|
346
440
|
*
|
|
347
441
|
* @type {boolean}
|
|
@@ -366,6 +460,12 @@ export interface LiveActivityStartResponse {
|
|
|
366
460
|
* @memberof LiveActivityStartResponse
|
|
367
461
|
*/
|
|
368
462
|
activity_id: string;
|
|
463
|
+
/**
|
|
464
|
+
*
|
|
465
|
+
* @type {Array<string>}
|
|
466
|
+
* @memberof LiveActivityStartResponse
|
|
467
|
+
*/
|
|
468
|
+
effective_channel_slugs?: Array<string>;
|
|
369
469
|
/**
|
|
370
470
|
*
|
|
371
471
|
* @type {string}
|
|
@@ -379,6 +479,7 @@ export interface LiveActivityStartResponse {
|
|
|
379
479
|
* @interface LiveActivityUpdateRequest
|
|
380
480
|
*/
|
|
381
481
|
export interface LiveActivityUpdateRequest {
|
|
482
|
+
[key: string]: any | any;
|
|
382
483
|
/**
|
|
383
484
|
*
|
|
384
485
|
* @type {string}
|
|
@@ -398,6 +499,7 @@ export interface LiveActivityUpdateRequest {
|
|
|
398
499
|
* @interface LiveActivityUpdateResponse
|
|
399
500
|
*/
|
|
400
501
|
export interface LiveActivityUpdateResponse {
|
|
502
|
+
[key: string]: any | any;
|
|
401
503
|
/**
|
|
402
504
|
*
|
|
403
505
|
* @type {boolean}
|
|
@@ -429,12 +531,39 @@ export interface LiveActivityUpdateResponse {
|
|
|
429
531
|
*/
|
|
430
532
|
timestamp: string;
|
|
431
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
*
|
|
536
|
+
* @export
|
|
537
|
+
* @interface NoRecipientsError
|
|
538
|
+
*/
|
|
539
|
+
export interface NoRecipientsError {
|
|
540
|
+
[key: string]: any | any;
|
|
541
|
+
/**
|
|
542
|
+
*
|
|
543
|
+
* @type {string}
|
|
544
|
+
* @memberof NoRecipientsError
|
|
545
|
+
*/
|
|
546
|
+
error: string;
|
|
547
|
+
/**
|
|
548
|
+
*
|
|
549
|
+
* @type {string}
|
|
550
|
+
* @memberof NoRecipientsError
|
|
551
|
+
*/
|
|
552
|
+
message: string;
|
|
553
|
+
/**
|
|
554
|
+
*
|
|
555
|
+
* @type {Array<string>}
|
|
556
|
+
* @memberof NoRecipientsError
|
|
557
|
+
*/
|
|
558
|
+
effective_channel_slugs?: Array<string>;
|
|
559
|
+
}
|
|
432
560
|
/**
|
|
433
561
|
*
|
|
434
562
|
* @export
|
|
435
563
|
* @interface PushNotificationRequest
|
|
436
564
|
*/
|
|
437
565
|
export interface PushNotificationRequest {
|
|
566
|
+
[key: string]: any | any;
|
|
438
567
|
/**
|
|
439
568
|
*
|
|
440
569
|
* @type {string}
|
|
@@ -453,6 +582,32 @@ export interface PushNotificationRequest {
|
|
|
453
582
|
* @memberof PushNotificationRequest
|
|
454
583
|
*/
|
|
455
584
|
subtitle?: string;
|
|
585
|
+
/**
|
|
586
|
+
*
|
|
587
|
+
* @type {{ [key: string]: any; }}
|
|
588
|
+
* @memberof PushNotificationRequest
|
|
589
|
+
*/
|
|
590
|
+
payload?: {
|
|
591
|
+
[key: string]: any;
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
*
|
|
595
|
+
* @type {number}
|
|
596
|
+
* @memberof PushNotificationRequest
|
|
597
|
+
*/
|
|
598
|
+
badge?: number;
|
|
599
|
+
/**
|
|
600
|
+
*
|
|
601
|
+
* @type {string}
|
|
602
|
+
* @memberof PushNotificationRequest
|
|
603
|
+
*/
|
|
604
|
+
sound?: string;
|
|
605
|
+
/**
|
|
606
|
+
*
|
|
607
|
+
* @type {ChannelTarget}
|
|
608
|
+
* @memberof PushNotificationRequest
|
|
609
|
+
*/
|
|
610
|
+
target?: ChannelTarget;
|
|
456
611
|
}
|
|
457
612
|
/**
|
|
458
613
|
*
|
|
@@ -460,6 +615,7 @@ export interface PushNotificationRequest {
|
|
|
460
615
|
* @interface PushNotificationResponse
|
|
461
616
|
*/
|
|
462
617
|
export interface PushNotificationResponse {
|
|
618
|
+
[key: string]: any | any;
|
|
463
619
|
/**
|
|
464
620
|
*
|
|
465
621
|
* @type {boolean}
|
|
@@ -478,6 +634,12 @@ export interface PushNotificationResponse {
|
|
|
478
634
|
* @memberof PushNotificationResponse
|
|
479
635
|
*/
|
|
480
636
|
users_notified?: number;
|
|
637
|
+
/**
|
|
638
|
+
*
|
|
639
|
+
* @type {Array<string>}
|
|
640
|
+
* @memberof PushNotificationResponse
|
|
641
|
+
*/
|
|
642
|
+
effective_channel_slugs?: Array<string>;
|
|
481
643
|
/**
|
|
482
644
|
*
|
|
483
645
|
* @type {string}
|
|
@@ -491,6 +653,7 @@ export interface PushNotificationResponse {
|
|
|
491
653
|
* @interface RateLimitError
|
|
492
654
|
*/
|
|
493
655
|
export interface RateLimitError {
|
|
656
|
+
[key: string]: any | any;
|
|
494
657
|
/**
|
|
495
658
|
*
|
|
496
659
|
* @type {string}
|
|
@@ -2,8 +2,41 @@ import { PushNotificationsApi, LiveActivitiesApi } from "../generated/index";
|
|
|
2
2
|
export interface ActivitySmithOptions {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
}
|
|
5
|
+
type PushRequestBody = Parameters<PushNotificationsApi["sendPushNotification"]>[0]["pushNotificationRequest"];
|
|
6
|
+
type SendInitOverrides = Parameters<PushNotificationsApi["sendPushNotification"]>[1];
|
|
7
|
+
type StartRequestBody = Parameters<LiveActivitiesApi["startLiveActivity"]>[0]["liveActivityStartRequest"];
|
|
8
|
+
type UpdateRequestBody = Parameters<LiveActivitiesApi["updateLiveActivity"]>[0]["liveActivityUpdateRequest"];
|
|
9
|
+
type EndRequestBody = Parameters<LiveActivitiesApi["endLiveActivity"]>[0]["liveActivityEndRequest"];
|
|
10
|
+
type LiveInitOverrides = Parameters<LiveActivitiesApi["startLiveActivity"]>[1];
|
|
11
|
+
type PushSendRequest = PushRequestBody & {
|
|
12
|
+
channels?: string[];
|
|
13
|
+
};
|
|
14
|
+
type LiveStartSendRequest = StartRequestBody & {
|
|
15
|
+
channels?: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare class NotificationsResource {
|
|
18
|
+
private readonly api;
|
|
19
|
+
constructor(api: PushNotificationsApi);
|
|
20
|
+
send(request: PushSendRequest, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
|
|
21
|
+
sendPushNotification(...args: Parameters<PushNotificationsApi["sendPushNotification"]>): Promise<import("../generated/models").PushNotificationResponse>;
|
|
22
|
+
sendPushNotificationRaw(...args: Parameters<PushNotificationsApi["sendPushNotificationRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").PushNotificationResponse>>;
|
|
23
|
+
}
|
|
24
|
+
export declare class LiveActivitiesResource {
|
|
25
|
+
private readonly api;
|
|
26
|
+
constructor(api: LiveActivitiesApi);
|
|
27
|
+
start(request: LiveStartSendRequest, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityStartResponse>;
|
|
28
|
+
update(request: UpdateRequestBody, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityUpdateResponse>;
|
|
29
|
+
end(request: EndRequestBody, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityEndResponse>;
|
|
30
|
+
startLiveActivity(...args: Parameters<LiveActivitiesApi["startLiveActivity"]>): Promise<import("../generated/models").LiveActivityStartResponse>;
|
|
31
|
+
updateLiveActivity(...args: Parameters<LiveActivitiesApi["updateLiveActivity"]>): Promise<import("../generated/models").LiveActivityUpdateResponse>;
|
|
32
|
+
endLiveActivity(...args: Parameters<LiveActivitiesApi["endLiveActivity"]>): Promise<import("../generated/models").LiveActivityEndResponse>;
|
|
33
|
+
startLiveActivityRaw(...args: Parameters<LiveActivitiesApi["startLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityStartResponse>>;
|
|
34
|
+
updateLiveActivityRaw(...args: Parameters<LiveActivitiesApi["updateLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityUpdateResponse>>;
|
|
35
|
+
endLiveActivityRaw(...args: Parameters<LiveActivitiesApi["endLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityEndResponse>>;
|
|
36
|
+
}
|
|
5
37
|
export declare class ActivitySmith {
|
|
6
|
-
readonly notifications:
|
|
7
|
-
readonly liveActivities:
|
|
38
|
+
readonly notifications: NotificationsResource;
|
|
39
|
+
readonly liveActivities: LiveActivitiesResource;
|
|
8
40
|
constructor(opts: ActivitySmithOptions);
|
|
9
41
|
}
|
|
42
|
+
export {};
|
|
@@ -1,7 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActivitySmith = void 0;
|
|
3
|
+
exports.ActivitySmith = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
|
|
4
4
|
const index_1 = require("../generated/index");
|
|
5
|
+
function withTargetChannels(request) {
|
|
6
|
+
const channels = request.channels;
|
|
7
|
+
if (!channels || channels.length === 0 || request.target) {
|
|
8
|
+
const { channels: _ignored, ...rest } = request;
|
|
9
|
+
return rest;
|
|
10
|
+
}
|
|
11
|
+
const { channels: _ignored, ...rest } = request;
|
|
12
|
+
return {
|
|
13
|
+
...rest,
|
|
14
|
+
target: { channels },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
class NotificationsResource {
|
|
18
|
+
constructor(api) {
|
|
19
|
+
this.api = api;
|
|
20
|
+
}
|
|
21
|
+
send(request, initOverrides) {
|
|
22
|
+
return this.api.sendPushNotification({ pushNotificationRequest: withTargetChannels(request) }, initOverrides);
|
|
23
|
+
}
|
|
24
|
+
// Backward-compatible alias.
|
|
25
|
+
sendPushNotification(...args) {
|
|
26
|
+
return this.api.sendPushNotification(...args);
|
|
27
|
+
}
|
|
28
|
+
sendPushNotificationRaw(...args) {
|
|
29
|
+
return this.api.sendPushNotificationRaw(...args);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.NotificationsResource = NotificationsResource;
|
|
33
|
+
class LiveActivitiesResource {
|
|
34
|
+
constructor(api) {
|
|
35
|
+
this.api = api;
|
|
36
|
+
}
|
|
37
|
+
start(request, initOverrides) {
|
|
38
|
+
return this.api.startLiveActivity({ liveActivityStartRequest: withTargetChannels(request) }, initOverrides);
|
|
39
|
+
}
|
|
40
|
+
update(request, initOverrides) {
|
|
41
|
+
return this.api.updateLiveActivity({ liveActivityUpdateRequest: request }, initOverrides);
|
|
42
|
+
}
|
|
43
|
+
end(request, initOverrides) {
|
|
44
|
+
return this.api.endLiveActivity({ liveActivityEndRequest: request }, initOverrides);
|
|
45
|
+
}
|
|
46
|
+
// Backward-compatible aliases.
|
|
47
|
+
startLiveActivity(...args) {
|
|
48
|
+
return this.api.startLiveActivity(...args);
|
|
49
|
+
}
|
|
50
|
+
updateLiveActivity(...args) {
|
|
51
|
+
return this.api.updateLiveActivity(...args);
|
|
52
|
+
}
|
|
53
|
+
endLiveActivity(...args) {
|
|
54
|
+
return this.api.endLiveActivity(...args);
|
|
55
|
+
}
|
|
56
|
+
startLiveActivityRaw(...args) {
|
|
57
|
+
return this.api.startLiveActivityRaw(...args);
|
|
58
|
+
}
|
|
59
|
+
updateLiveActivityRaw(...args) {
|
|
60
|
+
return this.api.updateLiveActivityRaw(...args);
|
|
61
|
+
}
|
|
62
|
+
endLiveActivityRaw(...args) {
|
|
63
|
+
return this.api.endLiveActivityRaw(...args);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.LiveActivitiesResource = LiveActivitiesResource;
|
|
5
67
|
class ActivitySmith {
|
|
6
68
|
constructor(opts) {
|
|
7
69
|
if (!opts?.apiKey) {
|
|
@@ -11,8 +73,8 @@ class ActivitySmith {
|
|
|
11
73
|
const config = new index_1.Configuration({
|
|
12
74
|
accessToken: opts.apiKey,
|
|
13
75
|
});
|
|
14
|
-
this.notifications = new index_1.PushNotificationsApi(config);
|
|
15
|
-
this.liveActivities = new index_1.LiveActivitiesApi(config);
|
|
76
|
+
this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
|
|
77
|
+
this.liveActivities = new LiveActivitiesResource(new index_1.LiveActivitiesApi(config));
|
|
16
78
|
}
|
|
17
79
|
}
|
|
18
80
|
exports.ActivitySmith = ActivitySmith;
|
package/package.json
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Official ActivitySmith Node.js SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"activitysmith",
|
|
7
|
-
"live
|
|
8
|
-
"push
|
|
9
|
-
"api"
|
|
7
|
+
"live-activities",
|
|
8
|
+
"push-notifications",
|
|
9
|
+
"api",
|
|
10
|
+
"sdk",
|
|
11
|
+
"deployment",
|
|
12
|
+
"publishing",
|
|
13
|
+
"monitoring",
|
|
14
|
+
"observability",
|
|
15
|
+
"logging",
|
|
16
|
+
"logs",
|
|
17
|
+
"automation",
|
|
18
|
+
"tracking",
|
|
19
|
+
"reporting"
|
|
10
20
|
],
|
|
11
|
-
"
|
|
21
|
+
"author": "ActivitySmith",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/ActivitySmithHQ/activitysmith-node.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://activitysmith.com/docs/sdks/node",
|
|
12
28
|
"main": "dist/src/index.js",
|
|
13
29
|
"types": "dist/src/index.d.ts",
|
|
14
30
|
"exports": {
|
|
@@ -24,7 +40,6 @@
|
|
|
24
40
|
"README.md",
|
|
25
41
|
"LICENSE"
|
|
26
42
|
],
|
|
27
|
-
"license": "MIT",
|
|
28
43
|
"engines": {
|
|
29
44
|
"node": ">=18"
|
|
30
45
|
},
|