activitysmith 1.0.0 → 1.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/README.md +213 -23
- package/dist/generated/apis/LiveActivitiesApi.d.ts +35 -7
- package/dist/generated/apis/LiveActivitiesApi.js +79 -6
- package/dist/generated/models/index.d.ts +491 -3
- package/dist/generated/models/index.js +127 -4
- package/dist/src/ActivitySmith.d.ts +11 -0
- package/dist/src/ActivitySmith.js +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,27 +111,212 @@ await activitysmith.notifications.send({
|
|
|
111
111
|
|
|
112
112
|
## Live Activities
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
<p align="center">
|
|
115
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Live Activities example" width="680" />
|
|
116
|
+
</p>
|
|
117
|
+
|
|
118
|
+
ActivitySmith supports two ways to drive Live Activities:
|
|
119
|
+
|
|
120
|
+
- Recommended: stream updates with `activitysmith.liveActivities.stream(...)`
|
|
121
|
+
- Advanced: manual lifecycle control with `start`, `update`, and `end`
|
|
122
|
+
|
|
123
|
+
Use stream updates when you want the easiest, stateless flow. You don't need to
|
|
124
|
+
store `activity_id` or manage lifecycle state yourself. Send the latest state
|
|
125
|
+
for a stable `streamKey` and ActivitySmith will start or update the Live
|
|
126
|
+
Activity for you. When the tracked process is over, call `endStream(...)`.
|
|
127
|
+
|
|
128
|
+
Use the manual lifecycle methods when you need direct control over a specific
|
|
129
|
+
Live Activity instance.
|
|
130
|
+
|
|
131
|
+
Live Activity UI types:
|
|
132
|
+
|
|
133
|
+
- `metrics`: best for live operational stats like server CPU and memory, queue depth, or replica lag
|
|
134
|
+
- `segmented_progress`: best for step-based workflows like deployments, backups, and ETL pipelines
|
|
135
|
+
- `progress`: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
|
|
136
|
+
|
|
137
|
+
### Recommended: Stream updates
|
|
138
|
+
|
|
139
|
+
Use a stable `streamKey` to identify the system or workflow you are tracking,
|
|
140
|
+
such as a server, deployment, build pipeline, cron job, or charging session.
|
|
141
|
+
This is especially useful for cron jobs and other scheduled tasks where you do
|
|
142
|
+
not want to store `activity_id` between runs.
|
|
143
|
+
|
|
144
|
+
#### Metrics
|
|
145
|
+
|
|
146
|
+
<p align="center">
|
|
147
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics stream example" width="680" />
|
|
148
|
+
</p>
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const status = await activitysmith.liveActivities.stream("prod-web-1", {
|
|
152
|
+
content_state: {
|
|
153
|
+
title: "Server Health",
|
|
154
|
+
subtitle: "prod-web-1",
|
|
155
|
+
type: "metrics",
|
|
156
|
+
metrics: [
|
|
157
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
158
|
+
{ label: "MEM", value: 45, unit: "%" },
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Segmented progress
|
|
165
|
+
|
|
166
|
+
<p align="center">
|
|
167
|
+
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress stream example" width="680" />
|
|
168
|
+
</p>
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
await activitysmith.liveActivities.stream("nightly-backup", {
|
|
172
|
+
content_state: {
|
|
173
|
+
title: "Nightly Backup",
|
|
174
|
+
subtitle: "upload archive",
|
|
175
|
+
type: "segmented_progress",
|
|
176
|
+
number_of_steps: 3,
|
|
177
|
+
current_step: 2,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### Progress
|
|
183
|
+
|
|
184
|
+
<p align="center">
|
|
185
|
+
<img src="https://cdn.activitysmith.com/features/progress-live-activity.png" alt="Progress stream example" width="680" />
|
|
186
|
+
</p>
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
await activitysmith.liveActivities.stream("search-reindex", {
|
|
190
|
+
content_state: {
|
|
191
|
+
title: "Search Reindex",
|
|
192
|
+
subtitle: "catalog-v2",
|
|
193
|
+
type: "progress",
|
|
194
|
+
percentage: 42,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Call `stream(...)` again with the same `streamKey` whenever the state changes.
|
|
200
|
+
|
|
201
|
+
#### End a stream
|
|
202
|
+
|
|
203
|
+
Use this when the tracked process is finished and you no longer want the Live
|
|
204
|
+
Activity on devices. `content_state` is optional here; include it if you want
|
|
205
|
+
to end the stream with a final state.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
await activitysmith.liveActivities.endStream("prod-web-1", {
|
|
209
|
+
content_state: {
|
|
210
|
+
title: "Server Health",
|
|
211
|
+
subtitle: "prod-web-1",
|
|
212
|
+
type: "metrics",
|
|
213
|
+
metrics: [
|
|
214
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
215
|
+
{ label: "MEM", value: 38, unit: "%" },
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
If you later send another `stream(...)` request with the same `streamKey`,
|
|
222
|
+
ActivitySmith starts a new Live Activity for that stream again.
|
|
223
|
+
|
|
224
|
+
Stream responses include an `operation` field:
|
|
225
|
+
|
|
226
|
+
- `started`: ActivitySmith started a new Live Activity for this `streamKey`
|
|
227
|
+
- `updated`: ActivitySmith updated the current Live Activity
|
|
228
|
+
- `rotated`: ActivitySmith ended the previous Live Activity and started a new one
|
|
229
|
+
- `noop`: the incoming state matched the current state, so no update was sent
|
|
230
|
+
- `paused`: the stream is paused, so no Live Activity was started or updated
|
|
231
|
+
- `ended`: returned by `endStream(...)` after the stream is ended
|
|
232
|
+
|
|
233
|
+
### Advanced: Manual lifecycle control
|
|
117
234
|
|
|
118
|
-
|
|
119
|
-
- `progress`: best for jobs tracked as a percentage or numeric range
|
|
235
|
+
Use these methods when you want to manage the Live Activity lifecycle yourself.
|
|
120
236
|
|
|
121
|
-
|
|
237
|
+
#### Shared flow
|
|
122
238
|
|
|
123
239
|
1. Call `activitysmith.liveActivities.start(...)`.
|
|
124
240
|
2. Save the returned `activity_id`.
|
|
125
241
|
3. Call `activitysmith.liveActivities.update(...)` as progress changes.
|
|
126
242
|
4. Call `activitysmith.liveActivities.end(...)` when the work is finished.
|
|
127
243
|
|
|
244
|
+
### Metrics Type
|
|
245
|
+
|
|
246
|
+
Use `metrics` when you want to keep a small set of live stats visible, such as
|
|
247
|
+
server health, queue pressure, or database load.
|
|
248
|
+
|
|
249
|
+
#### Start
|
|
250
|
+
|
|
251
|
+
<p align="center">
|
|
252
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics start example" width="680" />
|
|
253
|
+
</p>
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
const start = await activitysmith.liveActivities.start({
|
|
257
|
+
content_state: {
|
|
258
|
+
title: "Server Health",
|
|
259
|
+
subtitle: "prod-web-1",
|
|
260
|
+
type: "metrics",
|
|
261
|
+
metrics: [
|
|
262
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
263
|
+
{ label: "MEM", value: 45, unit: "%" },
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const activityId = start.activity_id;
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Update
|
|
272
|
+
|
|
273
|
+
<p align="center">
|
|
274
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-update.png" alt="Metrics update example" width="680" />
|
|
275
|
+
</p>
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
await activitysmith.liveActivities.update({
|
|
279
|
+
activity_id: activityId,
|
|
280
|
+
content_state: {
|
|
281
|
+
title: "Server Health",
|
|
282
|
+
subtitle: "prod-web-1",
|
|
283
|
+
type: "metrics",
|
|
284
|
+
metrics: [
|
|
285
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
286
|
+
{ label: "MEM", value: 52, unit: "%" },
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### End
|
|
293
|
+
|
|
294
|
+
<p align="center">
|
|
295
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-end.png" alt="Metrics end example" width="680" />
|
|
296
|
+
</p>
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
await activitysmith.liveActivities.end({
|
|
300
|
+
activity_id: activityId,
|
|
301
|
+
content_state: {
|
|
302
|
+
title: "Server Health",
|
|
303
|
+
subtitle: "prod-web-1",
|
|
304
|
+
type: "metrics",
|
|
305
|
+
metrics: [
|
|
306
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
307
|
+
{ label: "MEM", value: 38, unit: "%" },
|
|
308
|
+
],
|
|
309
|
+
auto_dismiss_minutes: 2,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
128
314
|
### Segmented Progress Type
|
|
129
315
|
|
|
130
316
|
Use `segmented_progress` when progress is easier to follow as steps instead of a
|
|
131
317
|
raw percentage. It fits jobs like backups, deployments, ETL pipelines, and
|
|
132
|
-
checklists where "step 2 of 3" is more useful than "67%".
|
|
133
|
-
|
|
134
|
-
workflow changes.
|
|
318
|
+
checklists where "step 2 of 3" is more useful than "67%". `number_of_steps` is
|
|
319
|
+
dynamic, so you can increase or decrease it later if the workflow changes.
|
|
135
320
|
|
|
136
321
|
#### Start
|
|
137
322
|
|
|
@@ -149,7 +334,6 @@ const start = await activitysmith.liveActivities.start({
|
|
|
149
334
|
type: "segmented_progress",
|
|
150
335
|
color: "yellow",
|
|
151
336
|
},
|
|
152
|
-
channels: ["devs", "ops"], // Optional
|
|
153
337
|
});
|
|
154
338
|
|
|
155
339
|
const activityId = start.activity_id;
|
|
@@ -167,7 +351,7 @@ await activitysmith.liveActivities.update({
|
|
|
167
351
|
content_state: {
|
|
168
352
|
title: "Nightly database backup",
|
|
169
353
|
subtitle: "upload archive",
|
|
170
|
-
number_of_steps:
|
|
354
|
+
number_of_steps: 3,
|
|
171
355
|
current_step: 2,
|
|
172
356
|
},
|
|
173
357
|
});
|
|
@@ -185,8 +369,8 @@ await activitysmith.liveActivities.end({
|
|
|
185
369
|
content_state: {
|
|
186
370
|
title: "Nightly database backup",
|
|
187
371
|
subtitle: "verify restore",
|
|
188
|
-
number_of_steps:
|
|
189
|
-
current_step:
|
|
372
|
+
number_of_steps: 3,
|
|
373
|
+
current_step: 3,
|
|
190
374
|
auto_dismiss_minutes: 2,
|
|
191
375
|
},
|
|
192
376
|
});
|
|
@@ -257,25 +441,27 @@ await activitysmith.liveActivities.end({
|
|
|
257
441
|
|
|
258
442
|
Just like Actionable Push Notifications, Live Activities can have a button that opens provided URL in a browser or triggers a webhook. Webhooks are executed by the ActivitySmith backend.
|
|
259
443
|
|
|
444
|
+
#### Open URL action
|
|
445
|
+
|
|
260
446
|
<p align="center">
|
|
261
|
-
<img src="https://cdn.activitysmith.com/features/live-activity-
|
|
447
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity with action" width="680" />
|
|
262
448
|
</p>
|
|
263
449
|
|
|
264
|
-
#### Open URL action
|
|
265
|
-
|
|
266
450
|
```ts
|
|
267
451
|
const start = await activitysmith.liveActivities.start({
|
|
268
452
|
content_state: {
|
|
269
|
-
title: "
|
|
270
|
-
subtitle: "
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
453
|
+
title: "Server Health",
|
|
454
|
+
subtitle: "prod-web-1",
|
|
455
|
+
type: "metrics",
|
|
456
|
+
metrics: [
|
|
457
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
458
|
+
{ label: "MEM", value: 52, unit: "%" },
|
|
459
|
+
],
|
|
274
460
|
},
|
|
275
461
|
action: {
|
|
276
|
-
title: "Open
|
|
462
|
+
title: "Open Dashboard",
|
|
277
463
|
type: "open_url",
|
|
278
|
-
url: "https://
|
|
464
|
+
url: "https://ops.example.com/servers/prod-web-1",
|
|
279
465
|
},
|
|
280
466
|
});
|
|
281
467
|
|
|
@@ -284,6 +470,10 @@ const activityId = start.activity_id;
|
|
|
284
470
|
|
|
285
471
|
#### Webhook action
|
|
286
472
|
|
|
473
|
+
<p align="center">
|
|
474
|
+
<img src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1" alt="Live Activity with action" width="680" />
|
|
475
|
+
</p>
|
|
476
|
+
|
|
287
477
|
```ts
|
|
288
478
|
await activitysmith.liveActivities.update({
|
|
289
479
|
activity_id: activityId,
|
|
@@ -10,10 +10,18 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
-
import type { LiveActivityEndRequest, LiveActivityEndResponse, LiveActivityStartRequest, LiveActivityStartResponse, LiveActivityUpdateRequest, LiveActivityUpdateResponse } from '../models/index';
|
|
13
|
+
import type { LiveActivityEndRequest, LiveActivityEndResponse, LiveActivityStartRequest, LiveActivityStartResponse, LiveActivityStreamDeleteRequest, LiveActivityStreamDeleteResponse, LiveActivityStreamPutResponse, LiveActivityStreamRequest, LiveActivityUpdateRequest, LiveActivityUpdateResponse } from '../models/index';
|
|
14
14
|
export interface EndLiveActivityRequest {
|
|
15
15
|
liveActivityEndRequest: LiveActivityEndRequest;
|
|
16
16
|
}
|
|
17
|
+
export interface EndLiveActivityStreamRequest {
|
|
18
|
+
streamKey: string;
|
|
19
|
+
liveActivityStreamDeleteRequest?: LiveActivityStreamDeleteRequest;
|
|
20
|
+
}
|
|
21
|
+
export interface ReconcileLiveActivityStreamRequest {
|
|
22
|
+
streamKey: string;
|
|
23
|
+
liveActivityStreamRequest: LiveActivityStreamRequest;
|
|
24
|
+
}
|
|
17
25
|
export interface StartLiveActivityRequest {
|
|
18
26
|
liveActivityStartRequest: LiveActivityStartRequest;
|
|
19
27
|
}
|
|
@@ -25,32 +33,52 @@ export interface UpdateLiveActivityRequest {
|
|
|
25
33
|
*/
|
|
26
34
|
export declare class LiveActivitiesApi extends runtime.BaseAPI {
|
|
27
35
|
/**
|
|
28
|
-
* Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
36
|
+
* Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
29
37
|
* End a Live Activity
|
|
30
38
|
*/
|
|
31
39
|
endLiveActivityRaw(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityEndResponse>>;
|
|
32
40
|
/**
|
|
33
|
-
* Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
41
|
+
* Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
34
42
|
* End a Live Activity
|
|
35
43
|
*/
|
|
36
44
|
endLiveActivity(requestParameters: EndLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityEndResponse>;
|
|
37
45
|
/**
|
|
38
|
-
*
|
|
46
|
+
* Use this endpoint when the process you are tracking is finished and you no longer want the Live Activity on your devices. ActivitySmith ends the current Live Activity for this stream and dismisses it from devices. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
47
|
+
* End a stream
|
|
48
|
+
*/
|
|
49
|
+
endLiveActivityStreamRaw(requestParameters: EndLiveActivityStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityStreamDeleteResponse>>;
|
|
50
|
+
/**
|
|
51
|
+
* Use this endpoint when the process you are tracking is finished and you no longer want the Live Activity on your devices. ActivitySmith ends the current Live Activity for this stream and dismisses it from devices. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
52
|
+
* End a stream
|
|
53
|
+
*/
|
|
54
|
+
endLiveActivityStream(requestParameters: EndLiveActivityStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityStreamDeleteResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Use this endpoint when you want the easiest, stateless way to trigger Live Activities. You do not need to store activity_id or manage the Live Activity lifecycle yourself. Send the latest state for a stable stream_key and ActivitySmith will handle the rest for you: if there is no Live Activity yet, it starts one; if there is already one for this stream, it updates it. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
57
|
+
* Send a stream update
|
|
58
|
+
*/
|
|
59
|
+
reconcileLiveActivityStreamRaw(requestParameters: ReconcileLiveActivityStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityStreamPutResponse>>;
|
|
60
|
+
/**
|
|
61
|
+
* Use this endpoint when you want the easiest, stateless way to trigger Live Activities. You do not need to store activity_id or manage the Live Activity lifecycle yourself. Send the latest state for a stable stream_key and ActivitySmith will handle the rest for you: if there is no Live Activity yet, it starts one; if there is already one for this stream, it updates it. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
62
|
+
* Send a stream update
|
|
63
|
+
*/
|
|
64
|
+
reconcileLiveActivityStream(requestParameters: ReconcileLiveActivityStreamRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityStreamPutResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
39
67
|
* Start a Live Activity
|
|
40
68
|
*/
|
|
41
69
|
startLiveActivityRaw(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityStartResponse>>;
|
|
42
70
|
/**
|
|
43
|
-
* Starts a Live Activity on devices matched by API key scope and optional target channels. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
71
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
44
72
|
* Start a Live Activity
|
|
45
73
|
*/
|
|
46
74
|
startLiveActivity(requestParameters: StartLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityStartResponse>;
|
|
47
75
|
/**
|
|
48
|
-
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
76
|
+
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
49
77
|
* Update a Live Activity
|
|
50
78
|
*/
|
|
51
79
|
updateLiveActivityRaw(requestParameters: UpdateLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<LiveActivityUpdateResponse>>;
|
|
52
80
|
/**
|
|
53
|
-
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
81
|
+
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
54
82
|
* Update a Live Activity
|
|
55
83
|
*/
|
|
56
84
|
updateLiveActivity(requestParameters: UpdateLiveActivityRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LiveActivityUpdateResponse>;
|
|
@@ -20,7 +20,7 @@ const runtime = require("../runtime");
|
|
|
20
20
|
*/
|
|
21
21
|
class LiveActivitiesApi extends runtime.BaseAPI {
|
|
22
22
|
/**
|
|
23
|
-
* Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
23
|
+
* Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
24
24
|
* End a Live Activity
|
|
25
25
|
*/
|
|
26
26
|
async endLiveActivityRaw(requestParameters, initOverrides) {
|
|
@@ -47,7 +47,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
47
47
|
return new runtime.JSONApiResponse(response);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Ends a Live Activity and archives its lifecycle. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
50
|
+
* Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
51
51
|
* End a Live Activity
|
|
52
52
|
*/
|
|
53
53
|
async endLiveActivity(requestParameters, initOverrides) {
|
|
@@ -55,7 +55,80 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
55
55
|
return await response.value();
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Use this endpoint when the process you are tracking is finished and you no longer want the Live Activity on your devices. ActivitySmith ends the current Live Activity for this stream and dismisses it from devices. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
59
|
+
* End a stream
|
|
60
|
+
*/
|
|
61
|
+
async endLiveActivityStreamRaw(requestParameters, initOverrides) {
|
|
62
|
+
if (requestParameters['streamKey'] == null) {
|
|
63
|
+
throw new runtime.RequiredError('streamKey', 'Required parameter "streamKey" was null or undefined when calling endLiveActivityStream().');
|
|
64
|
+
}
|
|
65
|
+
const queryParameters = {};
|
|
66
|
+
const headerParameters = {};
|
|
67
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
68
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
69
|
+
const token = this.configuration.accessToken;
|
|
70
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
71
|
+
if (tokenString) {
|
|
72
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const response = await this.request({
|
|
76
|
+
path: `/live-activity/stream/{stream_key}`.replace(`{${"stream_key"}}`, encodeURIComponent(String(requestParameters['streamKey']))),
|
|
77
|
+
method: 'DELETE',
|
|
78
|
+
headers: headerParameters,
|
|
79
|
+
query: queryParameters,
|
|
80
|
+
body: requestParameters['liveActivityStreamDeleteRequest'],
|
|
81
|
+
}, initOverrides);
|
|
82
|
+
return new runtime.JSONApiResponse(response);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Use this endpoint when the process you are tracking is finished and you no longer want the Live Activity on your devices. ActivitySmith ends the current Live Activity for this stream and dismisses it from devices. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
86
|
+
* End a stream
|
|
87
|
+
*/
|
|
88
|
+
async endLiveActivityStream(requestParameters, initOverrides) {
|
|
89
|
+
const response = await this.endLiveActivityStreamRaw(requestParameters, initOverrides);
|
|
90
|
+
return await response.value();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Use this endpoint when you want the easiest, stateless way to trigger Live Activities. You do not need to store activity_id or manage the Live Activity lifecycle yourself. Send the latest state for a stable stream_key and ActivitySmith will handle the rest for you: if there is no Live Activity yet, it starts one; if there is already one for this stream, it updates it. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
94
|
+
* Send a stream update
|
|
95
|
+
*/
|
|
96
|
+
async reconcileLiveActivityStreamRaw(requestParameters, initOverrides) {
|
|
97
|
+
if (requestParameters['streamKey'] == null) {
|
|
98
|
+
throw new runtime.RequiredError('streamKey', 'Required parameter "streamKey" was null or undefined when calling reconcileLiveActivityStream().');
|
|
99
|
+
}
|
|
100
|
+
if (requestParameters['liveActivityStreamRequest'] == null) {
|
|
101
|
+
throw new runtime.RequiredError('liveActivityStreamRequest', 'Required parameter "liveActivityStreamRequest" was null or undefined when calling reconcileLiveActivityStream().');
|
|
102
|
+
}
|
|
103
|
+
const queryParameters = {};
|
|
104
|
+
const headerParameters = {};
|
|
105
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
106
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
107
|
+
const token = this.configuration.accessToken;
|
|
108
|
+
const tokenString = await token("apiKeyAuth", []);
|
|
109
|
+
if (tokenString) {
|
|
110
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const response = await this.request({
|
|
114
|
+
path: `/live-activity/stream/{stream_key}`.replace(`{${"stream_key"}}`, encodeURIComponent(String(requestParameters['streamKey']))),
|
|
115
|
+
method: 'PUT',
|
|
116
|
+
headers: headerParameters,
|
|
117
|
+
query: queryParameters,
|
|
118
|
+
body: requestParameters['liveActivityStreamRequest'],
|
|
119
|
+
}, initOverrides);
|
|
120
|
+
return new runtime.JSONApiResponse(response);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Use this endpoint when you want the easiest, stateless way to trigger Live Activities. You do not need to store activity_id or manage the Live Activity lifecycle yourself. Send the latest state for a stable stream_key and ActivitySmith will handle the rest for you: if there is no Live Activity yet, it starts one; if there is already one for this stream, it updates it. If you need direct lifecycle control, use /live-activity/start, /live-activity/update, and /live-activity/end instead.
|
|
124
|
+
* Send a stream update
|
|
125
|
+
*/
|
|
126
|
+
async reconcileLiveActivityStream(requestParameters, initOverrides) {
|
|
127
|
+
const response = await this.reconcileLiveActivityStreamRaw(requestParameters, initOverrides);
|
|
128
|
+
return await response.value();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
59
132
|
* Start a Live Activity
|
|
60
133
|
*/
|
|
61
134
|
async startLiveActivityRaw(requestParameters, initOverrides) {
|
|
@@ -82,7 +155,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
82
155
|
return new runtime.JSONApiResponse(response);
|
|
83
156
|
}
|
|
84
157
|
/**
|
|
85
|
-
* Starts a Live Activity on devices matched by API key scope and optional target channels. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
158
|
+
* Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
86
159
|
* Start a Live Activity
|
|
87
160
|
*/
|
|
88
161
|
async startLiveActivity(requestParameters, initOverrides) {
|
|
@@ -90,7 +163,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
90
163
|
return await response.value();
|
|
91
164
|
}
|
|
92
165
|
/**
|
|
93
|
-
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
166
|
+
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
94
167
|
* Update a Live Activity
|
|
95
168
|
*/
|
|
96
169
|
async updateLiveActivityRaw(requestParameters, initOverrides) {
|
|
@@ -117,7 +190,7 @@ class LiveActivitiesApi extends runtime.BaseAPI {
|
|
|
117
190
|
return new runtime.JSONApiResponse(response);
|
|
118
191
|
}
|
|
119
192
|
/**
|
|
120
|
-
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
193
|
+
* Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, and the legacy counter/timer/countdown step-based activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
121
194
|
* Update a Live Activity
|
|
122
195
|
*/
|
|
123
196
|
async updateLiveActivity(requestParameters, initOverrides) {
|