activitysmith 1.0.0 → 1.2.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.
- checksums.yaml +4 -4
- data/README.md +271 -24
- data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
- data/generated/activitysmith_openapi/api/metrics_api.rb +109 -0
- data/generated/activitysmith_openapi/models/activity_metric.rb +293 -0
- data/generated/activitysmith_openapi/models/content_state_end.rb +47 -4
- data/generated/activitysmith_openapi/models/content_state_start.rb +50 -7
- data/generated/activitysmith_openapi/models/content_state_update.rb +50 -7
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +233 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +332 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +361 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +280 -0
- data/generated/activitysmith_openapi/models/metric_error.rb +230 -0
- data/generated/activitysmith_openapi/models/metric_format.rb +43 -0
- data/generated/activitysmith_openapi/models/metric_unit_spacing.rb +40 -0
- data/generated/activitysmith_openapi/models/metric_value_update_request.rb +232 -0
- data/generated/activitysmith_openapi/models/metric_value_update_request_value.rb +105 -0
- data/generated/activitysmith_openapi/models/metric_value_update_response.rb +221 -0
- data/generated/activitysmith_openapi/models/not_found_error.rb +237 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
- data/generated/activitysmith_openapi/models/widget_metric.rb +507 -0
- data/generated/activitysmith_openapi/models/widget_metric_latest_value.rb +105 -0
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +16 -0
- data/lib/activitysmith/client.rb +22 -10
- data/lib/activitysmith/live_activities.rb +19 -0
- data/lib/activitysmith/metrics.rb +42 -0
- data/lib/activitysmith/version.rb +1 -1
- data/lib/activitysmith.rb +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7049fc74d1e6413d076f29460c876e25eed8288a443f083d4f67286098efcb72
|
|
4
|
+
data.tar.gz: 6240b7a43f373237b794dcbf04654211b5a1c97f3796b949f16bdf9a8a17d92b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d033284e3d2e932d928096037880a61a34650e233578244cc70819b4d8bf04a019dc67b74c42d693a372978a2bf1e7882bb674aa8c6e4830b722642246dc8fbd
|
|
7
|
+
data.tar.gz: be32ed8bc216d5710ab192b542df9e3f8ac4528e476acdccfb35502997cc561d14a603e839f5529e47b1b32a0273fd46f92ca468f2c1330b9f3acc95f2306ecc
|
data/README.md
CHANGED
|
@@ -6,6 +6,24 @@ The ActivitySmith Ruby SDK provides convenient access to the ActivitySmith API f
|
|
|
6
6
|
|
|
7
7
|
See [API reference](https://activitysmith.com/docs/api-reference/introduction).
|
|
8
8
|
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Setup](#setup)
|
|
13
|
+
- [Push Notifications](#push-notifications)
|
|
14
|
+
- [Send a Push Notification](#send-a-push-notification)
|
|
15
|
+
- [Rich Push Notifications with Media](#rich-push-notifications-with-media)
|
|
16
|
+
- [Actionable Push Notifications](#actionable-push-notifications)
|
|
17
|
+
- [Live Activities](#live-activities)
|
|
18
|
+
- [Simple: Let ActivitySmith manage the Live Activity for you](#simple-let-activitysmith-manage-the-live-activity-for-you)
|
|
19
|
+
- [Advanced: Full lifecycle control](#advanced-full-lifecycle-control)
|
|
20
|
+
- [Metrics Type](#metrics-type)
|
|
21
|
+
- [Segmented Progress Type](#segmented-progress-type)
|
|
22
|
+
- [Progress Type](#progress-type)
|
|
23
|
+
- [Live Activity Action](#live-activity-action)
|
|
24
|
+
- [Channels](#channels)
|
|
25
|
+
- [Widgets](#widgets)
|
|
26
|
+
|
|
9
27
|
## Installation
|
|
10
28
|
|
|
11
29
|
```sh
|
|
@@ -105,25 +123,228 @@ activitysmith.notifications.send(
|
|
|
105
123
|
|
|
106
124
|
## Live Activities
|
|
107
125
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
<p align="center">
|
|
127
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity screenshot" width="680" />
|
|
128
|
+
</p>
|
|
129
|
+
|
|
130
|
+
There are three types of Live Activities:
|
|
131
|
+
|
|
132
|
+
- `metrics`: best for live operational stats like server CPU and memory, queue depth, or replica lag
|
|
133
|
+
- `segmented_progress`: best for step-based workflows like deployments, backups, and ETL pipelines
|
|
134
|
+
- `progress`: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
|
|
135
|
+
|
|
136
|
+
When working with Live Activities via our API, you have two approaches tailored
|
|
137
|
+
to different needs. First, the stateless mode is the simplest path - one API
|
|
138
|
+
call can initiate or update an activity, and another ends it - no state
|
|
139
|
+
tracking on your side.
|
|
140
|
+
|
|
141
|
+
This is ideal if you want minimal complexity, perfect for automated workflows
|
|
142
|
+
like cron jobs.
|
|
143
|
+
|
|
144
|
+
In contrast, if you need precise lifecycle control, the classic approach offers
|
|
145
|
+
distinct calls for start, updates, and end, giving you full control over the
|
|
146
|
+
activity's state.
|
|
147
|
+
|
|
148
|
+
In the following sections, we'll break down how to implement each method so you
|
|
149
|
+
can choose what fits your use case best.
|
|
150
|
+
|
|
151
|
+
### Simple: Let ActivitySmith manage the Live Activity for you
|
|
152
|
+
|
|
153
|
+
Use a stable `stream_key` to identify the system or workflow you are tracking,
|
|
154
|
+
such as a server, deployment, build pipeline, cron job, or charging session.
|
|
155
|
+
This is especially useful for cron jobs and other scheduled tasks where you do
|
|
156
|
+
not want to store `activity_id` between runs.
|
|
157
|
+
|
|
158
|
+
#### Metrics
|
|
159
|
+
|
|
160
|
+
<p align="center">
|
|
161
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics stream example" width="680" />
|
|
162
|
+
</p>
|
|
163
|
+
|
|
164
|
+
```ruby
|
|
165
|
+
status = activitysmith.live_activities.stream(
|
|
166
|
+
"prod-web-1",
|
|
167
|
+
{
|
|
168
|
+
content_state: {
|
|
169
|
+
title: "Server Health",
|
|
170
|
+
subtitle: "prod-web-1",
|
|
171
|
+
type: "metrics",
|
|
172
|
+
metrics: [
|
|
173
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
174
|
+
{ label: "MEM", value: 45, unit: "%" }
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
```
|
|
111
180
|
|
|
112
|
-
|
|
113
|
-
- `progress`: best for jobs tracked as a percentage or numeric range
|
|
181
|
+
#### Segmented progress
|
|
114
182
|
|
|
115
|
-
|
|
183
|
+
<p align="center">
|
|
184
|
+
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress stream example" width="680" />
|
|
185
|
+
</p>
|
|
186
|
+
|
|
187
|
+
```ruby
|
|
188
|
+
activitysmith.live_activities.stream(
|
|
189
|
+
"nightly-backup",
|
|
190
|
+
{
|
|
191
|
+
content_state: {
|
|
192
|
+
title: "Nightly Backup",
|
|
193
|
+
subtitle: "upload archive",
|
|
194
|
+
type: "segmented_progress",
|
|
195
|
+
number_of_steps: 3,
|
|
196
|
+
current_step: 2
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Progress
|
|
203
|
+
|
|
204
|
+
<p align="center">
|
|
205
|
+
<img src="https://cdn.activitysmith.com/features/progress-live-activity.png" alt="Progress stream example" width="680" />
|
|
206
|
+
</p>
|
|
207
|
+
|
|
208
|
+
```ruby
|
|
209
|
+
activitysmith.live_activities.stream(
|
|
210
|
+
"search-reindex",
|
|
211
|
+
{
|
|
212
|
+
content_state: {
|
|
213
|
+
title: "Search Reindex",
|
|
214
|
+
subtitle: "catalog-v2",
|
|
215
|
+
type: "progress",
|
|
216
|
+
percentage: 42
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Call `stream(...)` again with the same `stream_key` whenever the state changes.
|
|
223
|
+
|
|
224
|
+
#### End a stream
|
|
225
|
+
|
|
226
|
+
Use this when the tracked process is finished and you no longer want the Live
|
|
227
|
+
Activity on devices. `content_state` is optional here; include it if you want
|
|
228
|
+
to end the stream with a final state.
|
|
229
|
+
|
|
230
|
+
```ruby
|
|
231
|
+
activitysmith.live_activities.end_stream(
|
|
232
|
+
"prod-web-1",
|
|
233
|
+
{
|
|
234
|
+
content_state: {
|
|
235
|
+
title: "Server Health",
|
|
236
|
+
subtitle: "prod-web-1",
|
|
237
|
+
type: "metrics",
|
|
238
|
+
metrics: [
|
|
239
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
240
|
+
{ label: "MEM", value: 38, unit: "%" }
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
If you later send another `stream(...)` request with the same `stream_key`,
|
|
248
|
+
ActivitySmith starts a new Live Activity for that stream again.
|
|
249
|
+
|
|
250
|
+
Stream responses include an `operation` field:
|
|
251
|
+
|
|
252
|
+
- `started`: ActivitySmith started a new Live Activity for this `stream_key`
|
|
253
|
+
- `updated`: ActivitySmith updated the current Live Activity
|
|
254
|
+
- `rotated`: ActivitySmith ended the previous Live Activity and started a new one
|
|
255
|
+
- `noop`: the incoming state matched the current state, so no update was sent
|
|
256
|
+
- `paused`: the stream is paused, so no Live Activity was started or updated
|
|
257
|
+
- `ended`: returned by `end_stream(...)` after the stream is ended
|
|
258
|
+
|
|
259
|
+
### Advanced: Full lifecycle control
|
|
260
|
+
|
|
261
|
+
Use these methods when you want to manage the Live Activity lifecycle yourself:
|
|
116
262
|
|
|
117
263
|
1. Call `activitysmith.live_activities.start(...)`.
|
|
118
264
|
2. Save the returned `activity_id`.
|
|
119
265
|
3. Call `activitysmith.live_activities.update(...)` as progress changes.
|
|
120
266
|
4. Call `activitysmith.live_activities.end(...)` when the work is finished.
|
|
121
267
|
|
|
268
|
+
### Metrics Type
|
|
269
|
+
|
|
270
|
+
Use `metrics` when you want to keep a small set of live stats visible, such as
|
|
271
|
+
server health, queue pressure, or database load.
|
|
272
|
+
|
|
273
|
+
#### Start
|
|
274
|
+
|
|
275
|
+
<p align="center">
|
|
276
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics start example" width="680" />
|
|
277
|
+
</p>
|
|
278
|
+
|
|
279
|
+
```ruby
|
|
280
|
+
start = activitysmith.live_activities.start(
|
|
281
|
+
{
|
|
282
|
+
content_state: {
|
|
283
|
+
title: "Server Health",
|
|
284
|
+
subtitle: "prod-web-1",
|
|
285
|
+
type: "metrics",
|
|
286
|
+
metrics: [
|
|
287
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
288
|
+
{ label: "MEM", value: 45, unit: "%" }
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
activity_id = start.activity_id
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### Update
|
|
298
|
+
|
|
299
|
+
<p align="center">
|
|
300
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-update.png" alt="Metrics update example" width="680" />
|
|
301
|
+
</p>
|
|
302
|
+
|
|
303
|
+
```ruby
|
|
304
|
+
activitysmith.live_activities.update(
|
|
305
|
+
{
|
|
306
|
+
activity_id: activity_id,
|
|
307
|
+
content_state: {
|
|
308
|
+
title: "Server Health",
|
|
309
|
+
subtitle: "prod-web-1",
|
|
310
|
+
type: "metrics",
|
|
311
|
+
metrics: [
|
|
312
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
313
|
+
{ label: "MEM", value: 52, unit: "%" }
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
#### End
|
|
321
|
+
|
|
322
|
+
<p align="center">
|
|
323
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-end.png" alt="Metrics end example" width="680" />
|
|
324
|
+
</p>
|
|
325
|
+
|
|
326
|
+
```ruby
|
|
327
|
+
activitysmith.live_activities.end(
|
|
328
|
+
{
|
|
329
|
+
activity_id: activity_id,
|
|
330
|
+
content_state: {
|
|
331
|
+
title: "Server Health",
|
|
332
|
+
subtitle: "prod-web-1",
|
|
333
|
+
type: "metrics",
|
|
334
|
+
metrics: [
|
|
335
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
336
|
+
{ label: "MEM", value: 38, unit: "%" }
|
|
337
|
+
],
|
|
338
|
+
auto_dismiss_minutes: 2
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
```
|
|
343
|
+
|
|
122
344
|
### Segmented Progress Type
|
|
123
345
|
|
|
124
|
-
Use `segmented_progress`
|
|
125
|
-
|
|
126
|
-
checklists where "step 2 of 3" is more useful than "67%".
|
|
346
|
+
Use `segmented_progress` for jobs and workflows that move through clear steps or
|
|
347
|
+
phases. It fits jobs like backups, deployments, ETL pipelines, and checklists.
|
|
127
348
|
`number_of_steps` is dynamic, so you can increase or decrease it later if the
|
|
128
349
|
workflow changes.
|
|
129
350
|
|
|
@@ -143,8 +364,7 @@ start = activitysmith.live_activities.start(
|
|
|
143
364
|
current_step: 1,
|
|
144
365
|
type: "segmented_progress",
|
|
145
366
|
color: "yellow"
|
|
146
|
-
}
|
|
147
|
-
channels: ["devs", "ops"] # Optional
|
|
367
|
+
}
|
|
148
368
|
}
|
|
149
369
|
)
|
|
150
370
|
|
|
@@ -164,7 +384,7 @@ activitysmith.live_activities.update(
|
|
|
164
384
|
content_state: {
|
|
165
385
|
title: "Nightly database backup",
|
|
166
386
|
subtitle: "upload archive",
|
|
167
|
-
number_of_steps:
|
|
387
|
+
number_of_steps: 3,
|
|
168
388
|
current_step: 2
|
|
169
389
|
}
|
|
170
390
|
}
|
|
@@ -184,8 +404,8 @@ activitysmith.live_activities.end(
|
|
|
184
404
|
content_state: {
|
|
185
405
|
title: "Nightly database backup",
|
|
186
406
|
subtitle: "verify restore",
|
|
187
|
-
number_of_steps:
|
|
188
|
-
current_step:
|
|
407
|
+
number_of_steps: 3,
|
|
408
|
+
current_step: 3,
|
|
189
409
|
auto_dismiss_minutes: 2
|
|
190
410
|
}
|
|
191
411
|
}
|
|
@@ -211,8 +431,7 @@ start = activitysmith.live_activities.start(
|
|
|
211
431
|
title: "EV Charging",
|
|
212
432
|
subtitle: "Added 30 mi range",
|
|
213
433
|
type: "progress",
|
|
214
|
-
percentage: 15
|
|
215
|
-
color: "lime"
|
|
434
|
+
percentage: 15
|
|
216
435
|
}
|
|
217
436
|
}
|
|
218
437
|
)
|
|
@@ -264,7 +483,7 @@ activitysmith.live_activities.end(
|
|
|
264
483
|
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.
|
|
265
484
|
|
|
266
485
|
<p align="center">
|
|
267
|
-
<img src="https://cdn.activitysmith.com/features/live-activity-
|
|
486
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity with action" width="680" />
|
|
268
487
|
</p>
|
|
269
488
|
|
|
270
489
|
#### Open URL action
|
|
@@ -273,16 +492,18 @@ Just like Actionable Push Notifications, Live Activities can have a button that
|
|
|
273
492
|
start = activitysmith.live_activities.start(
|
|
274
493
|
{
|
|
275
494
|
content_state: {
|
|
276
|
-
title: "
|
|
277
|
-
subtitle: "
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
495
|
+
title: "Server Health",
|
|
496
|
+
subtitle: "prod-web-1",
|
|
497
|
+
type: "metrics",
|
|
498
|
+
metrics: [
|
|
499
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
500
|
+
{ label: "MEM", value: 52, unit: "%" }
|
|
501
|
+
]
|
|
281
502
|
},
|
|
282
503
|
action: {
|
|
283
|
-
title: "Open
|
|
504
|
+
title: "Open Dashboard",
|
|
284
505
|
type: "open_url",
|
|
285
|
-
url: "https://
|
|
506
|
+
url: "https://ops.example.com/servers/prod-web-1"
|
|
286
507
|
}
|
|
287
508
|
}
|
|
288
509
|
)
|
|
@@ -292,6 +513,10 @@ activity_id = start.activity_id
|
|
|
292
513
|
|
|
293
514
|
#### Webhook action
|
|
294
515
|
|
|
516
|
+
<p align="center">
|
|
517
|
+
<img src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1" alt="Live Activity with action" width="680" />
|
|
518
|
+
</p>
|
|
519
|
+
|
|
295
520
|
```ruby
|
|
296
521
|
activitysmith.live_activities.update(
|
|
297
522
|
{
|
|
@@ -330,6 +555,28 @@ activitysmith.notifications.send(
|
|
|
330
555
|
)
|
|
331
556
|
```
|
|
332
557
|
|
|
558
|
+
## Widgets
|
|
559
|
+
|
|
560
|
+
<p align="center">
|
|
561
|
+
<img src="https://cdn.activitysmith.com/features/lock-screen-widgets.png" alt="Lock screen widgets" width="680" />
|
|
562
|
+
</p>
|
|
563
|
+
|
|
564
|
+
ActivitySmith lets you display any value on your Lock Screen with widgets - SaaS metrics, revenue, signups, uptime, habits, or anything else you want to track. Create a metric in the web app, then update the metric value using our API, add a widget to your lock screen and it will fetch the latest update automatically.
|
|
565
|
+
|
|
566
|
+
<p align="center">
|
|
567
|
+
<img src="https://cdn.activitysmith.com/features/create-widget-metric.png" alt="Create widget metric" width="680" />
|
|
568
|
+
</p>
|
|
569
|
+
|
|
570
|
+
```ruby
|
|
571
|
+
activitysmith.metrics.update("deploy.success_rate", 99.9)
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
String metric values work too.
|
|
575
|
+
|
|
576
|
+
```ruby
|
|
577
|
+
activitysmith.metrics.update("prod.status", "healthy")
|
|
578
|
+
```
|
|
579
|
+
|
|
333
580
|
## Error Handling
|
|
334
581
|
|
|
335
582
|
```ruby
|
|
@@ -20,7 +20,7 @@ module OpenapiClient
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# End a Live Activity
|
|
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, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
24
24
|
# @param live_activity_end_request [LiveActivityEndRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @return [LiveActivityEndResponse]
|
|
@@ -30,7 +30,7 @@ module OpenapiClient
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# End a Live Activity
|
|
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.
|
|
33
|
+
# Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
|
|
34
34
|
# @param live_activity_end_request [LiveActivityEndRequest]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
36
|
# @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers
|
|
@@ -87,8 +87,170 @@ module OpenapiClient
|
|
|
87
87
|
return data, status_code, headers
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
+
# End a stream
|
|
91
|
+
# 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.
|
|
92
|
+
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
93
|
+
# @param [Hash] opts the optional parameters
|
|
94
|
+
# @option opts [LiveActivityStreamDeleteRequest] :live_activity_stream_delete_request
|
|
95
|
+
# @return [LiveActivityStreamDeleteResponse]
|
|
96
|
+
def end_live_activity_stream(stream_key, opts = {})
|
|
97
|
+
data, _status_code, _headers = end_live_activity_stream_with_http_info(stream_key, opts)
|
|
98
|
+
data
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# End a stream
|
|
102
|
+
# 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.
|
|
103
|
+
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
104
|
+
# @param [Hash] opts the optional parameters
|
|
105
|
+
# @option opts [LiveActivityStreamDeleteRequest] :live_activity_stream_delete_request
|
|
106
|
+
# @return [Array<(LiveActivityStreamDeleteResponse, Integer, Hash)>] LiveActivityStreamDeleteResponse data, response status code and response headers
|
|
107
|
+
def end_live_activity_stream_with_http_info(stream_key, opts = {})
|
|
108
|
+
if @api_client.config.debugging
|
|
109
|
+
@api_client.config.logger.debug 'Calling API: LiveActivitiesApi.end_live_activity_stream ...'
|
|
110
|
+
end
|
|
111
|
+
# verify the required parameter 'stream_key' is set
|
|
112
|
+
if @api_client.config.client_side_validation && stream_key.nil?
|
|
113
|
+
fail ArgumentError, "Missing the required parameter 'stream_key' when calling LiveActivitiesApi.end_live_activity_stream"
|
|
114
|
+
end
|
|
115
|
+
if @api_client.config.client_side_validation && stream_key.to_s.length > 255
|
|
116
|
+
fail ArgumentError, 'invalid value for "stream_key" when calling LiveActivitiesApi.end_live_activity_stream, the character length must be smaller than or equal to 255.'
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
pattern = Regexp.new(/^[A-Za-z0-9_-]+$/)
|
|
120
|
+
if @api_client.config.client_side_validation && stream_key !~ pattern
|
|
121
|
+
fail ArgumentError, "invalid value for 'stream_key' when calling LiveActivitiesApi.end_live_activity_stream, must conform to the pattern #{pattern}."
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# resource path
|
|
125
|
+
local_var_path = '/live-activity/stream/{stream_key}'.sub('{' + 'stream_key' + '}', CGI.escape(stream_key.to_s))
|
|
126
|
+
|
|
127
|
+
# query parameters
|
|
128
|
+
query_params = opts[:query_params] || {}
|
|
129
|
+
|
|
130
|
+
# header parameters
|
|
131
|
+
header_params = opts[:header_params] || {}
|
|
132
|
+
# HTTP header 'Accept' (if needed)
|
|
133
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
134
|
+
# HTTP header 'Content-Type'
|
|
135
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
136
|
+
if !content_type.nil?
|
|
137
|
+
header_params['Content-Type'] = content_type
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# form parameters
|
|
141
|
+
form_params = opts[:form_params] || {}
|
|
142
|
+
|
|
143
|
+
# http body (model)
|
|
144
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'live_activity_stream_delete_request'])
|
|
145
|
+
|
|
146
|
+
# return_type
|
|
147
|
+
return_type = opts[:debug_return_type] || 'LiveActivityStreamDeleteResponse'
|
|
148
|
+
|
|
149
|
+
# auth_names
|
|
150
|
+
auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
|
|
151
|
+
|
|
152
|
+
new_options = opts.merge(
|
|
153
|
+
:operation => :"LiveActivitiesApi.end_live_activity_stream",
|
|
154
|
+
:header_params => header_params,
|
|
155
|
+
:query_params => query_params,
|
|
156
|
+
:form_params => form_params,
|
|
157
|
+
:body => post_body,
|
|
158
|
+
:auth_names => auth_names,
|
|
159
|
+
:return_type => return_type
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
163
|
+
if @api_client.config.debugging
|
|
164
|
+
@api_client.config.logger.debug "API called: LiveActivitiesApi#end_live_activity_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
165
|
+
end
|
|
166
|
+
return data, status_code, headers
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Send a stream update
|
|
170
|
+
# 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.
|
|
171
|
+
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
172
|
+
# @param live_activity_stream_request [LiveActivityStreamRequest]
|
|
173
|
+
# @param [Hash] opts the optional parameters
|
|
174
|
+
# @return [LiveActivityStreamPutResponse]
|
|
175
|
+
def reconcile_live_activity_stream(stream_key, live_activity_stream_request, opts = {})
|
|
176
|
+
data, _status_code, _headers = reconcile_live_activity_stream_with_http_info(stream_key, live_activity_stream_request, opts)
|
|
177
|
+
data
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Send a stream update
|
|
181
|
+
# 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.
|
|
182
|
+
# @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
|
|
183
|
+
# @param live_activity_stream_request [LiveActivityStreamRequest]
|
|
184
|
+
# @param [Hash] opts the optional parameters
|
|
185
|
+
# @return [Array<(LiveActivityStreamPutResponse, Integer, Hash)>] LiveActivityStreamPutResponse data, response status code and response headers
|
|
186
|
+
def reconcile_live_activity_stream_with_http_info(stream_key, live_activity_stream_request, opts = {})
|
|
187
|
+
if @api_client.config.debugging
|
|
188
|
+
@api_client.config.logger.debug 'Calling API: LiveActivitiesApi.reconcile_live_activity_stream ...'
|
|
189
|
+
end
|
|
190
|
+
# verify the required parameter 'stream_key' is set
|
|
191
|
+
if @api_client.config.client_side_validation && stream_key.nil?
|
|
192
|
+
fail ArgumentError, "Missing the required parameter 'stream_key' when calling LiveActivitiesApi.reconcile_live_activity_stream"
|
|
193
|
+
end
|
|
194
|
+
if @api_client.config.client_side_validation && stream_key.to_s.length > 255
|
|
195
|
+
fail ArgumentError, 'invalid value for "stream_key" when calling LiveActivitiesApi.reconcile_live_activity_stream, the character length must be smaller than or equal to 255.'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
pattern = Regexp.new(/^[A-Za-z0-9_-]+$/)
|
|
199
|
+
if @api_client.config.client_side_validation && stream_key !~ pattern
|
|
200
|
+
fail ArgumentError, "invalid value for 'stream_key' when calling LiveActivitiesApi.reconcile_live_activity_stream, must conform to the pattern #{pattern}."
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# verify the required parameter 'live_activity_stream_request' is set
|
|
204
|
+
if @api_client.config.client_side_validation && live_activity_stream_request.nil?
|
|
205
|
+
fail ArgumentError, "Missing the required parameter 'live_activity_stream_request' when calling LiveActivitiesApi.reconcile_live_activity_stream"
|
|
206
|
+
end
|
|
207
|
+
# resource path
|
|
208
|
+
local_var_path = '/live-activity/stream/{stream_key}'.sub('{' + 'stream_key' + '}', CGI.escape(stream_key.to_s))
|
|
209
|
+
|
|
210
|
+
# query parameters
|
|
211
|
+
query_params = opts[:query_params] || {}
|
|
212
|
+
|
|
213
|
+
# header parameters
|
|
214
|
+
header_params = opts[:header_params] || {}
|
|
215
|
+
# HTTP header 'Accept' (if needed)
|
|
216
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
217
|
+
# HTTP header 'Content-Type'
|
|
218
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
219
|
+
if !content_type.nil?
|
|
220
|
+
header_params['Content-Type'] = content_type
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# form parameters
|
|
224
|
+
form_params = opts[:form_params] || {}
|
|
225
|
+
|
|
226
|
+
# http body (model)
|
|
227
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(live_activity_stream_request)
|
|
228
|
+
|
|
229
|
+
# return_type
|
|
230
|
+
return_type = opts[:debug_return_type] || 'LiveActivityStreamPutResponse'
|
|
231
|
+
|
|
232
|
+
# auth_names
|
|
233
|
+
auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
|
|
234
|
+
|
|
235
|
+
new_options = opts.merge(
|
|
236
|
+
:operation => :"LiveActivitiesApi.reconcile_live_activity_stream",
|
|
237
|
+
:header_params => header_params,
|
|
238
|
+
:query_params => query_params,
|
|
239
|
+
:form_params => form_params,
|
|
240
|
+
:body => post_body,
|
|
241
|
+
:auth_names => auth_names,
|
|
242
|
+
:return_type => return_type
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
246
|
+
if @api_client.config.debugging
|
|
247
|
+
@api_client.config.logger.debug "API called: LiveActivitiesApi#reconcile_live_activity_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
248
|
+
end
|
|
249
|
+
return data, status_code, headers
|
|
250
|
+
end
|
|
251
|
+
|
|
90
252
|
# Start a Live Activity
|
|
91
|
-
# 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.
|
|
253
|
+
# Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
92
254
|
# @param live_activity_start_request [LiveActivityStartRequest]
|
|
93
255
|
# @param [Hash] opts the optional parameters
|
|
94
256
|
# @return [LiveActivityStartResponse]
|
|
@@ -98,7 +260,7 @@ module OpenapiClient
|
|
|
98
260
|
end
|
|
99
261
|
|
|
100
262
|
# Start a Live Activity
|
|
101
|
-
# 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.
|
|
263
|
+
# Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
|
|
102
264
|
# @param live_activity_start_request [LiveActivityStartRequest]
|
|
103
265
|
# @param [Hash] opts the optional parameters
|
|
104
266
|
# @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
|
|
@@ -156,7 +318,7 @@ module OpenapiClient
|
|
|
156
318
|
end
|
|
157
319
|
|
|
158
320
|
# Update a Live Activity
|
|
159
|
-
# 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.
|
|
321
|
+
# Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
160
322
|
# @param live_activity_update_request [LiveActivityUpdateRequest]
|
|
161
323
|
# @param [Hash] opts the optional parameters
|
|
162
324
|
# @return [LiveActivityUpdateResponse]
|
|
@@ -166,7 +328,7 @@ module OpenapiClient
|
|
|
166
328
|
end
|
|
167
329
|
|
|
168
330
|
# Update a Live Activity
|
|
169
|
-
# 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.
|
|
331
|
+
# Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, and metrics activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
|
|
170
332
|
# @param live_activity_update_request [LiveActivityUpdateRequest]
|
|
171
333
|
# @param [Hash] opts the optional parameters
|
|
172
334
|
# @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
|