activitysmith 0.1.0 → 0.1.2
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 +103 -21
- package/dist/generated/apis/LiveActivitiesApi.js +9 -10
- package/dist/generated/apis/PushNotificationsApi.d.ts +31 -0
- package/dist/generated/apis/PushNotificationsApi.js +58 -0
- package/dist/generated/apis/index.d.ts +1 -1
- package/dist/generated/apis/index.js +1 -1
- package/dist/generated/models/index.d.ts +512 -14
- package/dist/generated/models/index.js +91 -30
- package/dist/generated/runtime.d.ts +0 -1
- package/dist/generated/runtime.js +0 -4
- package/dist/src/ActivitySmith.d.ts +36 -0
- package/dist/src/ActivitySmith.js +68 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +4 -0
- package/package.json +29 -13
package/README.md
CHANGED
|
@@ -1,42 +1,124 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ActivitySmith Node SDK
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
|
|
7
|
+
See [API reference](https://activitysmith.com/docs/api-reference/introduction)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
6
10
|
|
|
7
11
|
```sh
|
|
8
|
-
npm
|
|
12
|
+
npm install activitysmith
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
##
|
|
15
|
+
## Setup
|
|
12
16
|
|
|
13
17
|
```ts
|
|
14
|
-
import
|
|
18
|
+
import ActivitySmith from "activitysmith";
|
|
19
|
+
|
|
20
|
+
const activitysmith = new ActivitySmith({
|
|
21
|
+
apiKey: process.env.ACTIVITYSMITH_API_KEY,
|
|
22
|
+
});
|
|
23
|
+
```
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
CommonJS:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const ActivitySmith = require("activitysmith");
|
|
29
|
+
|
|
30
|
+
const activitysmith = new ActivitySmith({
|
|
31
|
+
apiKey: process.env.ACTIVITYSMITH_API_KEY,
|
|
18
32
|
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Send a Push Notification
|
|
19
38
|
|
|
20
|
-
|
|
21
|
-
await
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
```ts
|
|
40
|
+
const response = await activitysmith.notifications.send({
|
|
41
|
+
title: "Build Failed",
|
|
42
|
+
message: "CI pipeline failed on main branch",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(response.success);
|
|
46
|
+
console.log(response.devices_notified);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Start a Live Activity
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const start = await activitysmith.liveActivities.start({
|
|
53
|
+
content_state: {
|
|
54
|
+
title: "ActivitySmith API Deployment",
|
|
55
|
+
subtitle: "start",
|
|
56
|
+
number_of_steps: 4,
|
|
57
|
+
current_step: 1,
|
|
58
|
+
type: "segmented_progress",
|
|
59
|
+
color: "yellow",
|
|
24
60
|
},
|
|
25
61
|
});
|
|
26
62
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
63
|
+
const activityId = start.activity_id;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Update a Live Activity
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
const update = await activitysmith.liveActivities.update({
|
|
70
|
+
activity_id: activityId,
|
|
71
|
+
content_state: {
|
|
72
|
+
title: "ActivitySmith API Deployment",
|
|
73
|
+
subtitle: "npm i & pm2",
|
|
74
|
+
current_step: 3,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
console.log(update.devices_notified);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### End a Live Activity
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const end = await activitysmith.liveActivities.end({
|
|
85
|
+
activity_id: activityId,
|
|
86
|
+
content_state: {
|
|
87
|
+
title: "ActivitySmith API Deployment",
|
|
88
|
+
subtitle: "done",
|
|
89
|
+
current_step: 4,
|
|
90
|
+
auto_dismiss_minutes: 3,
|
|
31
91
|
},
|
|
32
92
|
});
|
|
93
|
+
|
|
94
|
+
console.log(end.success);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Error Handling
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
try {
|
|
101
|
+
await activitysmith.notifications.send({
|
|
102
|
+
title: "Build Failed",
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(error);
|
|
106
|
+
}
|
|
33
107
|
```
|
|
34
108
|
|
|
35
|
-
##
|
|
109
|
+
## API Surface
|
|
110
|
+
|
|
111
|
+
- `activitysmith.notifications`
|
|
112
|
+
- `activitysmith.liveActivities`
|
|
113
|
+
|
|
114
|
+
## TypeScript Support
|
|
115
|
+
|
|
116
|
+
This package is written in TypeScript and ships with type definitions out of the box.
|
|
117
|
+
|
|
118
|
+
## Requirements
|
|
36
119
|
|
|
37
|
-
-
|
|
38
|
-
- Override with `new Configuration({ basePath: "..." })`
|
|
120
|
+
- Node.js 18 or newer
|
|
39
121
|
|
|
40
|
-
##
|
|
122
|
+
## License
|
|
41
123
|
|
|
42
|
-
|
|
124
|
+
MIT
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.LiveActivitiesApi = void 0;
|
|
17
17
|
const runtime = require("../runtime");
|
|
18
|
-
const index_1 = require("../models/index");
|
|
19
18
|
/**
|
|
20
19
|
*
|
|
21
20
|
*/
|
|
@@ -33,7 +32,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
33
32
|
headerParameters['Content-Type'] = 'application/json';
|
|
34
33
|
if (this.configuration && this.configuration.accessToken) {
|
|
35
34
|
const token = this.configuration.accessToken;
|
|
36
|
-
const tokenString = await token("
|
|
35
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
37
36
|
if (tokenString) {
|
|
38
37
|
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
39
38
|
}
|
|
@@ -43,9 +42,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
43
42
|
method: 'POST',
|
|
44
43
|
headers: headerParameters,
|
|
45
44
|
query: queryParameters,
|
|
46
|
-
body:
|
|
45
|
+
body: requestParameters['liveActivityEndRequest'],
|
|
47
46
|
}, initOverrides);
|
|
48
|
-
return new runtime.JSONApiResponse(response
|
|
47
|
+
return new runtime.JSONApiResponse(response);
|
|
49
48
|
}
|
|
50
49
|
/**
|
|
51
50
|
* Ends a Live Activity and archives its lifecycle.
|
|
@@ -68,7 +67,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
68
67
|
headerParameters['Content-Type'] = 'application/json';
|
|
69
68
|
if (this.configuration && this.configuration.accessToken) {
|
|
70
69
|
const token = this.configuration.accessToken;
|
|
71
|
-
const tokenString = await token("
|
|
70
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
72
71
|
if (tokenString) {
|
|
73
72
|
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
74
73
|
}
|
|
@@ -78,9 +77,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
78
77
|
method: 'POST',
|
|
79
78
|
headers: headerParameters,
|
|
80
79
|
query: queryParameters,
|
|
81
|
-
body:
|
|
80
|
+
body: requestParameters['liveActivityStartRequest'],
|
|
82
81
|
}, initOverrides);
|
|
83
|
-
return new runtime.JSONApiResponse(response
|
|
82
|
+
return new runtime.JSONApiResponse(response);
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Starts a Live Activity on all registered devices and returns an activity_id.
|
|
@@ -103,7 +102,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
103
102
|
headerParameters['Content-Type'] = 'application/json';
|
|
104
103
|
if (this.configuration && this.configuration.accessToken) {
|
|
105
104
|
const token = this.configuration.accessToken;
|
|
106
|
-
const tokenString = await token("
|
|
105
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
107
106
|
if (tokenString) {
|
|
108
107
|
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
109
108
|
}
|
|
@@ -113,9 +112,9 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
113
112
|
method: 'POST',
|
|
114
113
|
headers: headerParameters,
|
|
115
114
|
query: queryParameters,
|
|
116
|
-
body:
|
|
115
|
+
body: requestParameters['liveActivityUpdateRequest'],
|
|
117
116
|
}, initOverrides);
|
|
118
|
-
return new runtime.JSONApiResponse(response
|
|
117
|
+
return new runtime.JSONApiResponse(response);
|
|
119
118
|
}
|
|
120
119
|
/**
|
|
121
120
|
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivitySmith API
|
|
3
|
+
* Send push notifications and Live Activities to your own devices via a single API key.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime';
|
|
13
|
+
import type { PushNotificationRequest, PushNotificationResponse } from '../models/index';
|
|
14
|
+
export interface SendPushNotificationRequest {
|
|
15
|
+
pushNotificationRequest: PushNotificationRequest;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare class PushNotificationsApi extends runtime.BaseAPI {
|
|
21
|
+
/**
|
|
22
|
+
* Sends a push notification to every paired device in your account.
|
|
23
|
+
* Send a push notification
|
|
24
|
+
*/
|
|
25
|
+
sendPushNotificationRaw(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PushNotificationResponse>>;
|
|
26
|
+
/**
|
|
27
|
+
* Sends a push notification to every paired device in your account.
|
|
28
|
+
* Send a push notification
|
|
29
|
+
*/
|
|
30
|
+
sendPushNotification(requestParameters: SendPushNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PushNotificationResponse>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* ActivitySmith API
|
|
6
|
+
* Send push notifications and Live Activities to your own devices via a single API key.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PushNotificationsApi = void 0;
|
|
17
|
+
const runtime = require("../runtime");
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
class PushNotificationsApi extends runtime.BaseAPI {
|
|
22
|
+
/**
|
|
23
|
+
* Sends a push notification to every paired device in your account.
|
|
24
|
+
* Send a push notification
|
|
25
|
+
*/
|
|
26
|
+
async sendPushNotificationRaw(requestParameters, initOverrides) {
|
|
27
|
+
if (requestParameters['pushNotificationRequest'] == null) {
|
|
28
|
+
throw new runtime.RequiredError('pushNotificationRequest', 'Required parameter "pushNotificationRequest" was null or undefined when calling sendPushNotification().');
|
|
29
|
+
}
|
|
30
|
+
const queryParameters = {};
|
|
31
|
+
const headerParameters = {};
|
|
32
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
33
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
34
|
+
const token = this.configuration.accessToken;
|
|
35
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
36
|
+
if (tokenString) {
|
|
37
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const response = await this.request({
|
|
41
|
+
path: `/push-notification`,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: headerParameters,
|
|
44
|
+
query: queryParameters,
|
|
45
|
+
body: requestParameters['pushNotificationRequest'],
|
|
46
|
+
}, initOverrides);
|
|
47
|
+
return new runtime.JSONApiResponse(response);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sends a push notification to every paired device in your account.
|
|
51
|
+
* Send a push notification
|
|
52
|
+
*/
|
|
53
|
+
async sendPushNotification(requestParameters, initOverrides) {
|
|
54
|
+
const response = await this.sendPushNotificationRaw(requestParameters, initOverrides);
|
|
55
|
+
return await response.value();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.PushNotificationsApi = PushNotificationsApi;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './LiveActivitiesApi';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './PushNotificationsApi';
|
|
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
/* tslint:disable */
|
|
18
18
|
/* eslint-disable */
|
|
19
19
|
__exportStar(require("./LiveActivitiesApi"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./PushNotificationsApi"), exports);
|
|
@@ -1,14 +1,512 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* End payload. Required fields are title and current_step. number_of_steps is optional.
|
|
3
|
+
* @export
|
|
4
|
+
* @interface ContentStateEnd
|
|
5
|
+
*/
|
|
6
|
+
export interface ContentStateEnd {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {string}
|
|
10
|
+
* @memberof ContentStateEnd
|
|
11
|
+
*/
|
|
12
|
+
title: string;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {string}
|
|
16
|
+
* @memberof ContentStateEnd
|
|
17
|
+
*/
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {number}
|
|
22
|
+
* @memberof ContentStateEnd
|
|
23
|
+
*/
|
|
24
|
+
number_of_steps?: number;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof ContentStateEnd
|
|
29
|
+
*/
|
|
30
|
+
current_step: number;
|
|
31
|
+
/**
|
|
32
|
+
* Optional. Accent color for the Live Activity. Defaults to blue.
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof ContentStateEnd
|
|
35
|
+
*/
|
|
36
|
+
color?: ContentStateEndColorEnum;
|
|
37
|
+
/**
|
|
38
|
+
* Optional. Overrides color for the current step.
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof ContentStateEnd
|
|
41
|
+
*/
|
|
42
|
+
step_color?: ContentStateEndStepColorEnum;
|
|
43
|
+
/**
|
|
44
|
+
* Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max.
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @memberof ContentStateEnd
|
|
47
|
+
*/
|
|
48
|
+
auto_dismiss_minutes?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @export
|
|
52
|
+
*/
|
|
53
|
+
export declare const ContentStateEndColorEnum: {
|
|
54
|
+
readonly Lime: "lime";
|
|
55
|
+
readonly Green: "green";
|
|
56
|
+
readonly Cyan: "cyan";
|
|
57
|
+
readonly Blue: "blue";
|
|
58
|
+
readonly Purple: "purple";
|
|
59
|
+
readonly Magenta: "magenta";
|
|
60
|
+
readonly Red: "red";
|
|
61
|
+
readonly Orange: "orange";
|
|
62
|
+
readonly Yellow: "yellow";
|
|
63
|
+
};
|
|
64
|
+
export type ContentStateEndColorEnum = typeof ContentStateEndColorEnum[keyof typeof ContentStateEndColorEnum];
|
|
65
|
+
/**
|
|
66
|
+
* @export
|
|
67
|
+
*/
|
|
68
|
+
export declare const ContentStateEndStepColorEnum: {
|
|
69
|
+
readonly Lime: "lime";
|
|
70
|
+
readonly Green: "green";
|
|
71
|
+
readonly Cyan: "cyan";
|
|
72
|
+
readonly Blue: "blue";
|
|
73
|
+
readonly Purple: "purple";
|
|
74
|
+
readonly Magenta: "magenta";
|
|
75
|
+
readonly Red: "red";
|
|
76
|
+
readonly Orange: "orange";
|
|
77
|
+
readonly Yellow: "yellow";
|
|
78
|
+
};
|
|
79
|
+
export type ContentStateEndStepColorEnum = typeof ContentStateEndStepColorEnum[keyof typeof ContentStateEndStepColorEnum];
|
|
80
|
+
/**
|
|
81
|
+
* Start payload requires title, number_of_steps, current_step, and type.
|
|
82
|
+
* @export
|
|
83
|
+
* @interface ContentStateStart
|
|
84
|
+
*/
|
|
85
|
+
export interface ContentStateStart {
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @type {string}
|
|
89
|
+
* @memberof ContentStateStart
|
|
90
|
+
*/
|
|
91
|
+
title: string;
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @memberof ContentStateStart
|
|
96
|
+
*/
|
|
97
|
+
subtitle?: string;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @type {number}
|
|
101
|
+
* @memberof ContentStateStart
|
|
102
|
+
*/
|
|
103
|
+
number_of_steps: number;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @type {number}
|
|
107
|
+
* @memberof ContentStateStart
|
|
108
|
+
*/
|
|
109
|
+
current_step: number;
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
* @type {string}
|
|
113
|
+
* @memberof ContentStateStart
|
|
114
|
+
*/
|
|
115
|
+
type: ContentStateStartTypeEnum;
|
|
116
|
+
/**
|
|
117
|
+
* Optional. Accent color for the Live Activity. Defaults to blue.
|
|
118
|
+
* @type {string}
|
|
119
|
+
* @memberof ContentStateStart
|
|
120
|
+
*/
|
|
121
|
+
color?: ContentStateStartColorEnum;
|
|
122
|
+
/**
|
|
123
|
+
* Optional. Overrides color for the current step.
|
|
124
|
+
* @type {string}
|
|
125
|
+
* @memberof ContentStateStart
|
|
126
|
+
*/
|
|
127
|
+
step_color?: ContentStateStartStepColorEnum;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @export
|
|
131
|
+
*/
|
|
132
|
+
export declare const ContentStateStartTypeEnum: {
|
|
133
|
+
readonly SegmentedProgress: "segmented_progress";
|
|
134
|
+
};
|
|
135
|
+
export type ContentStateStartTypeEnum = typeof ContentStateStartTypeEnum[keyof typeof ContentStateStartTypeEnum];
|
|
136
|
+
/**
|
|
137
|
+
* @export
|
|
138
|
+
*/
|
|
139
|
+
export declare const ContentStateStartColorEnum: {
|
|
140
|
+
readonly Lime: "lime";
|
|
141
|
+
readonly Green: "green";
|
|
142
|
+
readonly Cyan: "cyan";
|
|
143
|
+
readonly Blue: "blue";
|
|
144
|
+
readonly Purple: "purple";
|
|
145
|
+
readonly Magenta: "magenta";
|
|
146
|
+
readonly Red: "red";
|
|
147
|
+
readonly Orange: "orange";
|
|
148
|
+
readonly Yellow: "yellow";
|
|
149
|
+
};
|
|
150
|
+
export type ContentStateStartColorEnum = typeof ContentStateStartColorEnum[keyof typeof ContentStateStartColorEnum];
|
|
151
|
+
/**
|
|
152
|
+
* @export
|
|
153
|
+
*/
|
|
154
|
+
export declare const ContentStateStartStepColorEnum: {
|
|
155
|
+
readonly Lime: "lime";
|
|
156
|
+
readonly Green: "green";
|
|
157
|
+
readonly Cyan: "cyan";
|
|
158
|
+
readonly Blue: "blue";
|
|
159
|
+
readonly Purple: "purple";
|
|
160
|
+
readonly Magenta: "magenta";
|
|
161
|
+
readonly Red: "red";
|
|
162
|
+
readonly Orange: "orange";
|
|
163
|
+
readonly Yellow: "yellow";
|
|
164
|
+
};
|
|
165
|
+
export type ContentStateStartStepColorEnum = typeof ContentStateStartStepColorEnum[keyof typeof ContentStateStartStepColorEnum];
|
|
166
|
+
/**
|
|
167
|
+
* Update payload. Required fields are title and current_step. number_of_steps is optional.
|
|
168
|
+
* @export
|
|
169
|
+
* @interface ContentStateUpdate
|
|
170
|
+
*/
|
|
171
|
+
export interface ContentStateUpdate {
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
* @type {string}
|
|
175
|
+
* @memberof ContentStateUpdate
|
|
176
|
+
*/
|
|
177
|
+
title: string;
|
|
178
|
+
/**
|
|
179
|
+
*
|
|
180
|
+
* @type {string}
|
|
181
|
+
* @memberof ContentStateUpdate
|
|
182
|
+
*/
|
|
183
|
+
subtitle?: string;
|
|
184
|
+
/**
|
|
185
|
+
*
|
|
186
|
+
* @type {number}
|
|
187
|
+
* @memberof ContentStateUpdate
|
|
188
|
+
*/
|
|
189
|
+
number_of_steps?: number;
|
|
190
|
+
/**
|
|
191
|
+
*
|
|
192
|
+
* @type {number}
|
|
193
|
+
* @memberof ContentStateUpdate
|
|
194
|
+
*/
|
|
195
|
+
current_step: number;
|
|
196
|
+
/**
|
|
197
|
+
* Optional. Accent color for the Live Activity. Defaults to blue.
|
|
198
|
+
* @type {string}
|
|
199
|
+
* @memberof ContentStateUpdate
|
|
200
|
+
*/
|
|
201
|
+
color?: ContentStateUpdateColorEnum;
|
|
202
|
+
/**
|
|
203
|
+
* Optional. Overrides color for the current step.
|
|
204
|
+
* @type {string}
|
|
205
|
+
* @memberof ContentStateUpdate
|
|
206
|
+
*/
|
|
207
|
+
step_color?: ContentStateUpdateStepColorEnum;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* @export
|
|
211
|
+
*/
|
|
212
|
+
export declare const ContentStateUpdateColorEnum: {
|
|
213
|
+
readonly Lime: "lime";
|
|
214
|
+
readonly Green: "green";
|
|
215
|
+
readonly Cyan: "cyan";
|
|
216
|
+
readonly Blue: "blue";
|
|
217
|
+
readonly Purple: "purple";
|
|
218
|
+
readonly Magenta: "magenta";
|
|
219
|
+
readonly Red: "red";
|
|
220
|
+
readonly Orange: "orange";
|
|
221
|
+
readonly Yellow: "yellow";
|
|
222
|
+
};
|
|
223
|
+
export type ContentStateUpdateColorEnum = typeof ContentStateUpdateColorEnum[keyof typeof ContentStateUpdateColorEnum];
|
|
224
|
+
/**
|
|
225
|
+
* @export
|
|
226
|
+
*/
|
|
227
|
+
export declare const ContentStateUpdateStepColorEnum: {
|
|
228
|
+
readonly Lime: "lime";
|
|
229
|
+
readonly Green: "green";
|
|
230
|
+
readonly Cyan: "cyan";
|
|
231
|
+
readonly Blue: "blue";
|
|
232
|
+
readonly Purple: "purple";
|
|
233
|
+
readonly Magenta: "magenta";
|
|
234
|
+
readonly Red: "red";
|
|
235
|
+
readonly Orange: "orange";
|
|
236
|
+
readonly Yellow: "yellow";
|
|
237
|
+
};
|
|
238
|
+
export type ContentStateUpdateStepColorEnum = typeof ContentStateUpdateStepColorEnum[keyof typeof ContentStateUpdateStepColorEnum];
|
|
239
|
+
/**
|
|
240
|
+
*
|
|
241
|
+
* @export
|
|
242
|
+
* @interface LiveActivityEndRequest
|
|
243
|
+
*/
|
|
244
|
+
export interface LiveActivityEndRequest {
|
|
245
|
+
/**
|
|
246
|
+
*
|
|
247
|
+
* @type {string}
|
|
248
|
+
* @memberof LiveActivityEndRequest
|
|
249
|
+
*/
|
|
250
|
+
activity_id: string;
|
|
251
|
+
/**
|
|
252
|
+
*
|
|
253
|
+
* @type {ContentStateEnd}
|
|
254
|
+
* @memberof LiveActivityEndRequest
|
|
255
|
+
*/
|
|
256
|
+
content_state: ContentStateEnd;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @export
|
|
261
|
+
* @interface LiveActivityEndResponse
|
|
262
|
+
*/
|
|
263
|
+
export interface LiveActivityEndResponse {
|
|
264
|
+
/**
|
|
265
|
+
*
|
|
266
|
+
* @type {boolean}
|
|
267
|
+
* @memberof LiveActivityEndResponse
|
|
268
|
+
*/
|
|
269
|
+
success: boolean;
|
|
270
|
+
/**
|
|
271
|
+
*
|
|
272
|
+
* @type {string}
|
|
273
|
+
* @memberof LiveActivityEndResponse
|
|
274
|
+
*/
|
|
275
|
+
activity_id: string;
|
|
276
|
+
/**
|
|
277
|
+
*
|
|
278
|
+
* @type {number}
|
|
279
|
+
* @memberof LiveActivityEndResponse
|
|
280
|
+
*/
|
|
281
|
+
devices_queued?: number;
|
|
282
|
+
/**
|
|
283
|
+
*
|
|
284
|
+
* @type {number}
|
|
285
|
+
* @memberof LiveActivityEndResponse
|
|
286
|
+
*/
|
|
287
|
+
devices_notified?: number;
|
|
288
|
+
/**
|
|
289
|
+
*
|
|
290
|
+
* @type {string}
|
|
291
|
+
* @memberof LiveActivityEndResponse
|
|
292
|
+
*/
|
|
293
|
+
timestamp: string;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
*
|
|
297
|
+
* @export
|
|
298
|
+
* @interface LiveActivityLimitError
|
|
299
|
+
*/
|
|
300
|
+
export interface LiveActivityLimitError {
|
|
301
|
+
/**
|
|
302
|
+
*
|
|
303
|
+
* @type {string}
|
|
304
|
+
* @memberof LiveActivityLimitError
|
|
305
|
+
*/
|
|
306
|
+
error: string;
|
|
307
|
+
/**
|
|
308
|
+
*
|
|
309
|
+
* @type {string}
|
|
310
|
+
* @memberof LiveActivityLimitError
|
|
311
|
+
*/
|
|
312
|
+
message: string;
|
|
313
|
+
/**
|
|
314
|
+
*
|
|
315
|
+
* @type {number}
|
|
316
|
+
* @memberof LiveActivityLimitError
|
|
317
|
+
*/
|
|
318
|
+
limit: number;
|
|
319
|
+
/**
|
|
320
|
+
* Current number of active Live Activities.
|
|
321
|
+
* @type {number}
|
|
322
|
+
* @memberof LiveActivityLimitError
|
|
323
|
+
*/
|
|
324
|
+
active: number;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
*
|
|
328
|
+
* @export
|
|
329
|
+
* @interface LiveActivityStartRequest
|
|
330
|
+
*/
|
|
331
|
+
export interface LiveActivityStartRequest {
|
|
332
|
+
/**
|
|
333
|
+
*
|
|
334
|
+
* @type {ContentStateStart}
|
|
335
|
+
* @memberof LiveActivityStartRequest
|
|
336
|
+
*/
|
|
337
|
+
content_state: ContentStateStart;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
*
|
|
341
|
+
* @export
|
|
342
|
+
* @interface LiveActivityStartResponse
|
|
343
|
+
*/
|
|
344
|
+
export interface LiveActivityStartResponse {
|
|
345
|
+
/**
|
|
346
|
+
*
|
|
347
|
+
* @type {boolean}
|
|
348
|
+
* @memberof LiveActivityStartResponse
|
|
349
|
+
*/
|
|
350
|
+
success: boolean;
|
|
351
|
+
/**
|
|
352
|
+
*
|
|
353
|
+
* @type {number}
|
|
354
|
+
* @memberof LiveActivityStartResponse
|
|
355
|
+
*/
|
|
356
|
+
devices_notified?: number;
|
|
357
|
+
/**
|
|
358
|
+
*
|
|
359
|
+
* @type {number}
|
|
360
|
+
* @memberof LiveActivityStartResponse
|
|
361
|
+
*/
|
|
362
|
+
users_notified?: number;
|
|
363
|
+
/**
|
|
364
|
+
*
|
|
365
|
+
* @type {string}
|
|
366
|
+
* @memberof LiveActivityStartResponse
|
|
367
|
+
*/
|
|
368
|
+
activity_id: string;
|
|
369
|
+
/**
|
|
370
|
+
*
|
|
371
|
+
* @type {string}
|
|
372
|
+
* @memberof LiveActivityStartResponse
|
|
373
|
+
*/
|
|
374
|
+
timestamp: string;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
*
|
|
378
|
+
* @export
|
|
379
|
+
* @interface LiveActivityUpdateRequest
|
|
380
|
+
*/
|
|
381
|
+
export interface LiveActivityUpdateRequest {
|
|
382
|
+
/**
|
|
383
|
+
*
|
|
384
|
+
* @type {string}
|
|
385
|
+
* @memberof LiveActivityUpdateRequest
|
|
386
|
+
*/
|
|
387
|
+
activity_id: string;
|
|
388
|
+
/**
|
|
389
|
+
*
|
|
390
|
+
* @type {ContentStateUpdate}
|
|
391
|
+
* @memberof LiveActivityUpdateRequest
|
|
392
|
+
*/
|
|
393
|
+
content_state: ContentStateUpdate;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
*
|
|
397
|
+
* @export
|
|
398
|
+
* @interface LiveActivityUpdateResponse
|
|
399
|
+
*/
|
|
400
|
+
export interface LiveActivityUpdateResponse {
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
* @type {boolean}
|
|
404
|
+
* @memberof LiveActivityUpdateResponse
|
|
405
|
+
*/
|
|
406
|
+
success: boolean;
|
|
407
|
+
/**
|
|
408
|
+
*
|
|
409
|
+
* @type {string}
|
|
410
|
+
* @memberof LiveActivityUpdateResponse
|
|
411
|
+
*/
|
|
412
|
+
activity_id: string;
|
|
413
|
+
/**
|
|
414
|
+
*
|
|
415
|
+
* @type {number}
|
|
416
|
+
* @memberof LiveActivityUpdateResponse
|
|
417
|
+
*/
|
|
418
|
+
devices_queued?: number;
|
|
419
|
+
/**
|
|
420
|
+
*
|
|
421
|
+
* @type {number}
|
|
422
|
+
* @memberof LiveActivityUpdateResponse
|
|
423
|
+
*/
|
|
424
|
+
devices_notified?: number;
|
|
425
|
+
/**
|
|
426
|
+
*
|
|
427
|
+
* @type {string}
|
|
428
|
+
* @memberof LiveActivityUpdateResponse
|
|
429
|
+
*/
|
|
430
|
+
timestamp: string;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
*
|
|
434
|
+
* @export
|
|
435
|
+
* @interface PushNotificationRequest
|
|
436
|
+
*/
|
|
437
|
+
export interface PushNotificationRequest {
|
|
438
|
+
/**
|
|
439
|
+
*
|
|
440
|
+
* @type {string}
|
|
441
|
+
* @memberof PushNotificationRequest
|
|
442
|
+
*/
|
|
443
|
+
title: string;
|
|
444
|
+
/**
|
|
445
|
+
*
|
|
446
|
+
* @type {string}
|
|
447
|
+
* @memberof PushNotificationRequest
|
|
448
|
+
*/
|
|
449
|
+
message?: string;
|
|
450
|
+
/**
|
|
451
|
+
*
|
|
452
|
+
* @type {string}
|
|
453
|
+
* @memberof PushNotificationRequest
|
|
454
|
+
*/
|
|
455
|
+
subtitle?: string;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
*
|
|
459
|
+
* @export
|
|
460
|
+
* @interface PushNotificationResponse
|
|
461
|
+
*/
|
|
462
|
+
export interface PushNotificationResponse {
|
|
463
|
+
/**
|
|
464
|
+
*
|
|
465
|
+
* @type {boolean}
|
|
466
|
+
* @memberof PushNotificationResponse
|
|
467
|
+
*/
|
|
468
|
+
success: boolean;
|
|
469
|
+
/**
|
|
470
|
+
*
|
|
471
|
+
* @type {number}
|
|
472
|
+
* @memberof PushNotificationResponse
|
|
473
|
+
*/
|
|
474
|
+
devices_notified?: number;
|
|
475
|
+
/**
|
|
476
|
+
*
|
|
477
|
+
* @type {number}
|
|
478
|
+
* @memberof PushNotificationResponse
|
|
479
|
+
*/
|
|
480
|
+
users_notified?: number;
|
|
481
|
+
/**
|
|
482
|
+
*
|
|
483
|
+
* @type {string}
|
|
484
|
+
* @memberof PushNotificationResponse
|
|
485
|
+
*/
|
|
486
|
+
timestamp: string;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
*
|
|
490
|
+
* @export
|
|
491
|
+
* @interface RateLimitError
|
|
492
|
+
*/
|
|
493
|
+
export interface RateLimitError {
|
|
494
|
+
/**
|
|
495
|
+
*
|
|
496
|
+
* @type {string}
|
|
497
|
+
* @memberof RateLimitError
|
|
498
|
+
*/
|
|
499
|
+
error: string;
|
|
500
|
+
/**
|
|
501
|
+
*
|
|
502
|
+
* @type {string}
|
|
503
|
+
* @memberof RateLimitError
|
|
504
|
+
*/
|
|
505
|
+
message: string;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* @type SendPushNotification429Response
|
|
509
|
+
*
|
|
510
|
+
* @export
|
|
511
|
+
*/
|
|
512
|
+
export type SendPushNotification429Response = LiveActivityLimitError | RateLimitError;
|
|
@@ -1,32 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
3
|
+
exports.ContentStateUpdateStepColorEnum = exports.ContentStateUpdateColorEnum = exports.ContentStateStartStepColorEnum = exports.ContentStateStartColorEnum = exports.ContentStateStartTypeEnum = exports.ContentStateEndStepColorEnum = exports.ContentStateEndColorEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @export
|
|
6
|
+
*/
|
|
7
|
+
exports.ContentStateEndColorEnum = {
|
|
8
|
+
Lime: 'lime',
|
|
9
|
+
Green: 'green',
|
|
10
|
+
Cyan: 'cyan',
|
|
11
|
+
Blue: 'blue',
|
|
12
|
+
Purple: 'purple',
|
|
13
|
+
Magenta: 'magenta',
|
|
14
|
+
Red: 'red',
|
|
15
|
+
Orange: 'orange',
|
|
16
|
+
Yellow: 'yellow'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @export
|
|
20
|
+
*/
|
|
21
|
+
exports.ContentStateEndStepColorEnum = {
|
|
22
|
+
Lime: 'lime',
|
|
23
|
+
Green: 'green',
|
|
24
|
+
Cyan: 'cyan',
|
|
25
|
+
Blue: 'blue',
|
|
26
|
+
Purple: 'purple',
|
|
27
|
+
Magenta: 'magenta',
|
|
28
|
+
Red: 'red',
|
|
29
|
+
Orange: 'orange',
|
|
30
|
+
Yellow: 'yellow'
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @export
|
|
34
|
+
*/
|
|
35
|
+
exports.ContentStateStartTypeEnum = {
|
|
36
|
+
SegmentedProgress: 'segmented_progress'
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @export
|
|
40
|
+
*/
|
|
41
|
+
exports.ContentStateStartColorEnum = {
|
|
42
|
+
Lime: 'lime',
|
|
43
|
+
Green: 'green',
|
|
44
|
+
Cyan: 'cyan',
|
|
45
|
+
Blue: 'blue',
|
|
46
|
+
Purple: 'purple',
|
|
47
|
+
Magenta: 'magenta',
|
|
48
|
+
Red: 'red',
|
|
49
|
+
Orange: 'orange',
|
|
50
|
+
Yellow: 'yellow'
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
exports.ContentStateStartStepColorEnum = {
|
|
56
|
+
Lime: 'lime',
|
|
57
|
+
Green: 'green',
|
|
58
|
+
Cyan: 'cyan',
|
|
59
|
+
Blue: 'blue',
|
|
60
|
+
Purple: 'purple',
|
|
61
|
+
Magenta: 'magenta',
|
|
62
|
+
Red: 'red',
|
|
63
|
+
Orange: 'orange',
|
|
64
|
+
Yellow: 'yellow'
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @export
|
|
68
|
+
*/
|
|
69
|
+
exports.ContentStateUpdateColorEnum = {
|
|
70
|
+
Lime: 'lime',
|
|
71
|
+
Green: 'green',
|
|
72
|
+
Cyan: 'cyan',
|
|
73
|
+
Blue: 'blue',
|
|
74
|
+
Purple: 'purple',
|
|
75
|
+
Magenta: 'magenta',
|
|
76
|
+
Red: 'red',
|
|
77
|
+
Orange: 'orange',
|
|
78
|
+
Yellow: 'yellow'
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @export
|
|
82
|
+
*/
|
|
83
|
+
exports.ContentStateUpdateStepColorEnum = {
|
|
84
|
+
Lime: 'lime',
|
|
85
|
+
Green: 'green',
|
|
86
|
+
Cyan: 'cyan',
|
|
87
|
+
Blue: 'blue',
|
|
88
|
+
Purple: 'purple',
|
|
89
|
+
Magenta: 'magenta',
|
|
90
|
+
Red: 'red',
|
|
91
|
+
Orange: 'orange',
|
|
92
|
+
Yellow: 'yellow'
|
|
93
|
+
};
|
|
@@ -123,7 +123,6 @@ export interface RequestOpts {
|
|
|
123
123
|
body?: HTTPBody;
|
|
124
124
|
}
|
|
125
125
|
export declare function querystring(params: HTTPQuery, prefix?: string): string;
|
|
126
|
-
export declare function mapValues(data: any, fn: (item: any) => any): {};
|
|
127
126
|
export declare function canConsumeForm(consumes: Consume[]): boolean;
|
|
128
127
|
export interface Consume {
|
|
129
128
|
contentType: string;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
|
|
17
17
|
exports.querystring = querystring;
|
|
18
|
-
exports.mapValues = mapValues;
|
|
19
18
|
exports.canConsumeForm = canConsumeForm;
|
|
20
19
|
exports.BASE_PATH = "https://activitysmith.com/api".replace(/\/+$/, "");
|
|
21
20
|
class Configuration {
|
|
@@ -277,9 +276,6 @@ function querystringSingleKey(key, value, keyPrefix = '') {
|
|
|
277
276
|
}
|
|
278
277
|
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
|
|
279
278
|
}
|
|
280
|
-
function mapValues(data, fn) {
|
|
281
|
-
return Object.keys(data).reduce((acc, key) => ({ ...acc, [key]: fn(data[key]) }), {});
|
|
282
|
-
}
|
|
283
279
|
function canConsumeForm(consumes) {
|
|
284
280
|
for (const consume of consumes) {
|
|
285
281
|
if ('multipart/form-data' === consume.contentType) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PushNotificationsApi, LiveActivitiesApi } from "../generated/index";
|
|
2
|
+
export interface ActivitySmithOptions {
|
|
3
|
+
apiKey: string;
|
|
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
|
+
export declare class NotificationsResource {
|
|
12
|
+
private readonly api;
|
|
13
|
+
constructor(api: PushNotificationsApi);
|
|
14
|
+
send(request: PushRequestBody, initOverrides?: SendInitOverrides): Promise<import("../generated/models").PushNotificationResponse>;
|
|
15
|
+
sendPushNotification(...args: Parameters<PushNotificationsApi["sendPushNotification"]>): Promise<import("../generated/models").PushNotificationResponse>;
|
|
16
|
+
sendPushNotificationRaw(...args: Parameters<PushNotificationsApi["sendPushNotificationRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").PushNotificationResponse>>;
|
|
17
|
+
}
|
|
18
|
+
export declare class LiveActivitiesResource {
|
|
19
|
+
private readonly api;
|
|
20
|
+
constructor(api: LiveActivitiesApi);
|
|
21
|
+
start(request: StartRequestBody, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityStartResponse>;
|
|
22
|
+
update(request: UpdateRequestBody, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityUpdateResponse>;
|
|
23
|
+
end(request: EndRequestBody, initOverrides?: LiveInitOverrides): Promise<import("../generated/models").LiveActivityEndResponse>;
|
|
24
|
+
startLiveActivity(...args: Parameters<LiveActivitiesApi["startLiveActivity"]>): Promise<import("../generated/models").LiveActivityStartResponse>;
|
|
25
|
+
updateLiveActivity(...args: Parameters<LiveActivitiesApi["updateLiveActivity"]>): Promise<import("../generated/models").LiveActivityUpdateResponse>;
|
|
26
|
+
endLiveActivity(...args: Parameters<LiveActivitiesApi["endLiveActivity"]>): Promise<import("../generated/models").LiveActivityEndResponse>;
|
|
27
|
+
startLiveActivityRaw(...args: Parameters<LiveActivitiesApi["startLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityStartResponse>>;
|
|
28
|
+
updateLiveActivityRaw(...args: Parameters<LiveActivitiesApi["updateLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityUpdateResponse>>;
|
|
29
|
+
endLiveActivityRaw(...args: Parameters<LiveActivitiesApi["endLiveActivityRaw"]>): Promise<import("../generated/runtime").ApiResponse<import("../generated/models").LiveActivityEndResponse>>;
|
|
30
|
+
}
|
|
31
|
+
export declare class ActivitySmith {
|
|
32
|
+
readonly notifications: NotificationsResource;
|
|
33
|
+
readonly liveActivities: LiveActivitiesResource;
|
|
34
|
+
constructor(opts: ActivitySmithOptions);
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivitySmith = exports.LiveActivitiesResource = exports.NotificationsResource = void 0;
|
|
4
|
+
const index_1 = require("../generated/index");
|
|
5
|
+
class NotificationsResource {
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
send(request, initOverrides) {
|
|
10
|
+
return this.api.sendPushNotification({ pushNotificationRequest: request }, initOverrides);
|
|
11
|
+
}
|
|
12
|
+
// Backward-compatible alias.
|
|
13
|
+
sendPushNotification(...args) {
|
|
14
|
+
return this.api.sendPushNotification(...args);
|
|
15
|
+
}
|
|
16
|
+
sendPushNotificationRaw(...args) {
|
|
17
|
+
return this.api.sendPushNotificationRaw(...args);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NotificationsResource = NotificationsResource;
|
|
21
|
+
class LiveActivitiesResource {
|
|
22
|
+
constructor(api) {
|
|
23
|
+
this.api = api;
|
|
24
|
+
}
|
|
25
|
+
start(request, initOverrides) {
|
|
26
|
+
return this.api.startLiveActivity({ liveActivityStartRequest: request }, initOverrides);
|
|
27
|
+
}
|
|
28
|
+
update(request, initOverrides) {
|
|
29
|
+
return this.api.updateLiveActivity({ liveActivityUpdateRequest: request }, initOverrides);
|
|
30
|
+
}
|
|
31
|
+
end(request, initOverrides) {
|
|
32
|
+
return this.api.endLiveActivity({ liveActivityEndRequest: request }, initOverrides);
|
|
33
|
+
}
|
|
34
|
+
// Backward-compatible aliases.
|
|
35
|
+
startLiveActivity(...args) {
|
|
36
|
+
return this.api.startLiveActivity(...args);
|
|
37
|
+
}
|
|
38
|
+
updateLiveActivity(...args) {
|
|
39
|
+
return this.api.updateLiveActivity(...args);
|
|
40
|
+
}
|
|
41
|
+
endLiveActivity(...args) {
|
|
42
|
+
return this.api.endLiveActivity(...args);
|
|
43
|
+
}
|
|
44
|
+
startLiveActivityRaw(...args) {
|
|
45
|
+
return this.api.startLiveActivityRaw(...args);
|
|
46
|
+
}
|
|
47
|
+
updateLiveActivityRaw(...args) {
|
|
48
|
+
return this.api.updateLiveActivityRaw(...args);
|
|
49
|
+
}
|
|
50
|
+
endLiveActivityRaw(...args) {
|
|
51
|
+
return this.api.endLiveActivityRaw(...args);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.LiveActivitiesResource = LiveActivitiesResource;
|
|
55
|
+
class ActivitySmith {
|
|
56
|
+
constructor(opts) {
|
|
57
|
+
if (!opts?.apiKey) {
|
|
58
|
+
throw new Error("ActivitySmith: apiKey is required");
|
|
59
|
+
}
|
|
60
|
+
// basePath omitted on purpose — it will use the default from the generated runtime
|
|
61
|
+
const config = new index_1.Configuration({
|
|
62
|
+
accessToken: opts.apiKey,
|
|
63
|
+
});
|
|
64
|
+
this.notifications = new NotificationsResource(new index_1.PushNotificationsApi(config));
|
|
65
|
+
this.liveActivities = new LiveActivitiesResource(new index_1.LiveActivitiesApi(config));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ActivitySmith = ActivitySmith;
|
package/package.json
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "activitysmith",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
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",
|
|
28
|
+
"main": "dist/src/index.js",
|
|
29
|
+
"types": "dist/src/index.d.ts",
|
|
14
30
|
"exports": {
|
|
15
31
|
".": {
|
|
16
|
-
"types": "./dist/
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"default": "./dist/generated/index.js"
|
|
32
|
+
"types": "./dist/src/index.d.ts",
|
|
33
|
+
"require": "./dist/src/index.js",
|
|
34
|
+
"default": "./dist/src/index.js"
|
|
20
35
|
}
|
|
21
36
|
},
|
|
22
37
|
"files": [
|
|
38
|
+
"dist/src",
|
|
23
39
|
"dist/generated",
|
|
24
40
|
"README.md",
|
|
25
41
|
"LICENSE"
|
|
26
42
|
],
|
|
27
|
-
"license": "MIT",
|
|
28
43
|
"engines": {
|
|
29
44
|
"node": ">=18"
|
|
30
45
|
},
|
|
31
46
|
"scripts": {
|
|
32
|
-
"
|
|
47
|
+
"clean": "tsc -b --clean",
|
|
48
|
+
"build": "npm run clean && tsc -b",
|
|
33
49
|
"prepublishOnly": "npm run build",
|
|
34
50
|
"test": "npm run build && vitest run"
|
|
35
51
|
},
|