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.
- checksums.yaml +4 -4
- data/README.md +238 -32
- data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
- 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/not_found_error.rb +237 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
- data/generated/activitysmith_openapi.rb +7 -0
- data/lib/activitysmith/live_activities.rb +19 -0
- data/lib/activitysmith/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9ca64934e2eee58c310acc66bcff641a6b8e8bd7223701702d1cf913a81f7ae0
|
|
4
|
+
data.tar.gz: 752924606d9ffb0d623e81a7c3ea1c159d8eeff827e15bfea86f9350c7d10537
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5dcf355adad083329d44b3b42fbd691e60996165ccb0af954027b08d2af27fe913f6bb45cb33a225581790589b1f2ff9d42a9cacff32fbf8b23159e5ed7cbfea
|
|
7
|
+
data.tar.gz: fbd8e68d0fcf453c4431780db2883ffd906e972e5e8b240e4dc68471da0f0919730b4ee61728045e958c624a3df15b81cdc7a79bd876bb7a1d029d141630cd37
|
data/README.md
CHANGED
|
@@ -105,27 +105,230 @@ activitysmith.notifications.send(
|
|
|
105
105
|
|
|
106
106
|
## Live Activities
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
<p align="center">
|
|
109
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Live Activities example" width="680" />
|
|
110
|
+
</p>
|
|
111
|
+
|
|
112
|
+
ActivitySmith supports two ways to drive Live Activities:
|
|
113
|
+
|
|
114
|
+
- Recommended: stream updates with `activitysmith.live_activities.stream(...)`
|
|
115
|
+
- Advanced: manual lifecycle control with `start`, `update`, and `end`
|
|
116
|
+
|
|
117
|
+
Use stream updates when you want the easiest, stateless flow. You don't need to
|
|
118
|
+
store `activity_id` or manage lifecycle state yourself. Send the latest state
|
|
119
|
+
for a stable `stream_key` and ActivitySmith will start or update the Live
|
|
120
|
+
Activity for you. When the tracked process is over, call `end_stream(...)`.
|
|
121
|
+
|
|
122
|
+
Use the manual lifecycle methods when you need direct control over a specific
|
|
123
|
+
Live Activity instance.
|
|
124
|
+
|
|
125
|
+
Live Activity UI types:
|
|
126
|
+
|
|
127
|
+
- `metrics`: best for live operational stats like server CPU and memory, queue depth, or replica lag
|
|
128
|
+
- `segmented_progress`: best for step-based workflows like deployments, backups, and ETL pipelines
|
|
129
|
+
- `progress`: best for continuous jobs like uploads, reindexes, and long-running migrations tracked as a percentage
|
|
111
130
|
|
|
112
|
-
|
|
113
|
-
|
|
131
|
+
### Recommended: Stream updates
|
|
132
|
+
|
|
133
|
+
Use a stable `stream_key` to identify the system or workflow you are tracking,
|
|
134
|
+
such as a server, deployment, build pipeline, cron job, or charging session.
|
|
135
|
+
This is especially useful for cron jobs and other scheduled tasks where you do
|
|
136
|
+
not want to store `activity_id` between runs.
|
|
137
|
+
|
|
138
|
+
#### Metrics
|
|
139
|
+
|
|
140
|
+
<p align="center">
|
|
141
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics stream example" width="680" />
|
|
142
|
+
</p>
|
|
143
|
+
|
|
144
|
+
```ruby
|
|
145
|
+
status = activitysmith.live_activities.stream(
|
|
146
|
+
"prod-web-1",
|
|
147
|
+
{
|
|
148
|
+
content_state: {
|
|
149
|
+
title: "Server Health",
|
|
150
|
+
subtitle: "prod-web-1",
|
|
151
|
+
type: "metrics",
|
|
152
|
+
metrics: [
|
|
153
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
154
|
+
{ label: "MEM", value: 45, unit: "%" }
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Segmented progress
|
|
162
|
+
|
|
163
|
+
<p align="center">
|
|
164
|
+
<img src="https://cdn.activitysmith.com/features/update-live-activity.png" alt="Segmented progress stream example" width="680" />
|
|
165
|
+
</p>
|
|
166
|
+
|
|
167
|
+
```ruby
|
|
168
|
+
activitysmith.live_activities.stream(
|
|
169
|
+
"nightly-backup",
|
|
170
|
+
{
|
|
171
|
+
content_state: {
|
|
172
|
+
title: "Nightly Backup",
|
|
173
|
+
subtitle: "upload archive",
|
|
174
|
+
type: "segmented_progress",
|
|
175
|
+
number_of_steps: 3,
|
|
176
|
+
current_step: 2
|
|
177
|
+
}
|
|
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
|
+
```ruby
|
|
189
|
+
activitysmith.live_activities.stream(
|
|
190
|
+
"search-reindex",
|
|
191
|
+
{
|
|
192
|
+
content_state: {
|
|
193
|
+
title: "Search Reindex",
|
|
194
|
+
subtitle: "catalog-v2",
|
|
195
|
+
type: "progress",
|
|
196
|
+
percentage: 42
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Call `stream(...)` again with the same `stream_key` whenever the state changes.
|
|
203
|
+
|
|
204
|
+
#### End a stream
|
|
205
|
+
|
|
206
|
+
Use this when the tracked process is finished and you no longer want the Live
|
|
207
|
+
Activity on devices. `content_state` is optional here; include it if you want
|
|
208
|
+
to end the stream with a final state.
|
|
209
|
+
|
|
210
|
+
```ruby
|
|
211
|
+
activitysmith.live_activities.end_stream(
|
|
212
|
+
"prod-web-1",
|
|
213
|
+
{
|
|
214
|
+
content_state: {
|
|
215
|
+
title: "Server Health",
|
|
216
|
+
subtitle: "prod-web-1",
|
|
217
|
+
type: "metrics",
|
|
218
|
+
metrics: [
|
|
219
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
220
|
+
{ label: "MEM", value: 38, unit: "%" }
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
```
|
|
114
226
|
|
|
115
|
-
|
|
227
|
+
If you later send another `stream(...)` request with the same `stream_key`,
|
|
228
|
+
ActivitySmith starts a new Live Activity for that stream again.
|
|
229
|
+
|
|
230
|
+
Stream responses include an `operation` field:
|
|
231
|
+
|
|
232
|
+
- `started`: ActivitySmith started a new Live Activity for this `stream_key`
|
|
233
|
+
- `updated`: ActivitySmith updated the current Live Activity
|
|
234
|
+
- `rotated`: ActivitySmith ended the previous Live Activity and started a new one
|
|
235
|
+
- `noop`: the incoming state matched the current state, so no update was sent
|
|
236
|
+
- `paused`: the stream is paused, so no Live Activity was started or updated
|
|
237
|
+
- `ended`: returned by `end_stream(...)` after the stream is ended
|
|
238
|
+
|
|
239
|
+
### Advanced: Manual lifecycle control
|
|
240
|
+
|
|
241
|
+
Use these methods when you want to manage the Live Activity lifecycle yourself.
|
|
242
|
+
|
|
243
|
+
#### Shared flow
|
|
116
244
|
|
|
117
245
|
1. Call `activitysmith.live_activities.start(...)`.
|
|
118
246
|
2. Save the returned `activity_id`.
|
|
119
247
|
3. Call `activitysmith.live_activities.update(...)` as progress changes.
|
|
120
248
|
4. Call `activitysmith.live_activities.end(...)` when the work is finished.
|
|
121
249
|
|
|
250
|
+
### Metrics Type
|
|
251
|
+
|
|
252
|
+
Use `metrics` when you want to keep a small set of live stats visible, such as
|
|
253
|
+
server health, queue pressure, or database load.
|
|
254
|
+
|
|
255
|
+
#### Start
|
|
256
|
+
|
|
257
|
+
<p align="center">
|
|
258
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-start.png" alt="Metrics start example" width="680" />
|
|
259
|
+
</p>
|
|
260
|
+
|
|
261
|
+
```ruby
|
|
262
|
+
start = activitysmith.live_activities.start(
|
|
263
|
+
{
|
|
264
|
+
content_state: {
|
|
265
|
+
title: "Server Health",
|
|
266
|
+
subtitle: "prod-web-1",
|
|
267
|
+
type: "metrics",
|
|
268
|
+
metrics: [
|
|
269
|
+
{ label: "CPU", value: 9, unit: "%" },
|
|
270
|
+
{ label: "MEM", value: 45, unit: "%" }
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
activity_id = start.activity_id
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### Update
|
|
280
|
+
|
|
281
|
+
<p align="center">
|
|
282
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-update.png" alt="Metrics update example" width="680" />
|
|
283
|
+
</p>
|
|
284
|
+
|
|
285
|
+
```ruby
|
|
286
|
+
activitysmith.live_activities.update(
|
|
287
|
+
{
|
|
288
|
+
activity_id: activity_id,
|
|
289
|
+
content_state: {
|
|
290
|
+
title: "Server Health",
|
|
291
|
+
subtitle: "prod-web-1",
|
|
292
|
+
type: "metrics",
|
|
293
|
+
metrics: [
|
|
294
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
295
|
+
{ label: "MEM", value: 52, unit: "%" }
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### End
|
|
303
|
+
|
|
304
|
+
<p align="center">
|
|
305
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-end.png" alt="Metrics end example" width="680" />
|
|
306
|
+
</p>
|
|
307
|
+
|
|
308
|
+
```ruby
|
|
309
|
+
activitysmith.live_activities.end(
|
|
310
|
+
{
|
|
311
|
+
activity_id: activity_id,
|
|
312
|
+
content_state: {
|
|
313
|
+
title: "Server Health",
|
|
314
|
+
subtitle: "prod-web-1",
|
|
315
|
+
type: "metrics",
|
|
316
|
+
metrics: [
|
|
317
|
+
{ label: "CPU", value: 7, unit: "%" },
|
|
318
|
+
{ label: "MEM", value: 38, unit: "%" }
|
|
319
|
+
],
|
|
320
|
+
auto_dismiss_minutes: 2
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
```
|
|
325
|
+
|
|
122
326
|
### Segmented Progress Type
|
|
123
327
|
|
|
124
328
|
Use `segmented_progress` when progress is easier to follow as steps instead of a
|
|
125
329
|
raw percentage. It fits jobs like backups, deployments, ETL pipelines, and
|
|
126
|
-
checklists where "step 2 of 3" is more useful than "67%".
|
|
127
|
-
|
|
128
|
-
workflow changes.
|
|
330
|
+
checklists where "step 2 of 3" is more useful than "67%". `number_of_steps` is
|
|
331
|
+
dynamic, so you can increase or decrease it later if the workflow changes.
|
|
129
332
|
|
|
130
333
|
#### Start
|
|
131
334
|
|
|
@@ -143,8 +346,7 @@ start = activitysmith.live_activities.start(
|
|
|
143
346
|
current_step: 1,
|
|
144
347
|
type: "segmented_progress",
|
|
145
348
|
color: "yellow"
|
|
146
|
-
}
|
|
147
|
-
channels: ["devs", "ops"] # Optional
|
|
349
|
+
}
|
|
148
350
|
}
|
|
149
351
|
)
|
|
150
352
|
|
|
@@ -164,7 +366,7 @@ activitysmith.live_activities.update(
|
|
|
164
366
|
content_state: {
|
|
165
367
|
title: "Nightly database backup",
|
|
166
368
|
subtitle: "upload archive",
|
|
167
|
-
number_of_steps:
|
|
369
|
+
number_of_steps: 3,
|
|
168
370
|
current_step: 2
|
|
169
371
|
}
|
|
170
372
|
}
|
|
@@ -184,8 +386,8 @@ activitysmith.live_activities.end(
|
|
|
184
386
|
content_state: {
|
|
185
387
|
title: "Nightly database backup",
|
|
186
388
|
subtitle: "verify restore",
|
|
187
|
-
number_of_steps:
|
|
188
|
-
current_step:
|
|
389
|
+
number_of_steps: 3,
|
|
390
|
+
current_step: 3,
|
|
189
391
|
auto_dismiss_minutes: 2
|
|
190
392
|
}
|
|
191
393
|
}
|
|
@@ -211,8 +413,7 @@ start = activitysmith.live_activities.start(
|
|
|
211
413
|
title: "EV Charging",
|
|
212
414
|
subtitle: "Added 30 mi range",
|
|
213
415
|
type: "progress",
|
|
214
|
-
percentage: 15
|
|
215
|
-
color: "lime"
|
|
416
|
+
percentage: 15
|
|
216
417
|
}
|
|
217
418
|
}
|
|
218
419
|
)
|
|
@@ -261,10 +462,10 @@ activitysmith.live_activities.end(
|
|
|
261
462
|
|
|
262
463
|
### Live Activity Action
|
|
263
464
|
|
|
264
|
-
Just like Actionable Push Notifications, Live Activities can have a button that opens
|
|
465
|
+
Just like Actionable Push Notifications, Live Activities can have a button that opens a URL in a browser or triggers a webhook. Webhooks are executed by the ActivitySmith backend.
|
|
265
466
|
|
|
266
467
|
<p align="center">
|
|
267
|
-
<img src="https://cdn.activitysmith.com/features/live-activity-
|
|
468
|
+
<img src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png" alt="Metrics Live Activity with action" width="680" />
|
|
268
469
|
</p>
|
|
269
470
|
|
|
270
471
|
#### Open URL action
|
|
@@ -273,16 +474,18 @@ Just like Actionable Push Notifications, Live Activities can have a button that
|
|
|
273
474
|
start = activitysmith.live_activities.start(
|
|
274
475
|
{
|
|
275
476
|
content_state: {
|
|
276
|
-
title: "
|
|
277
|
-
subtitle: "
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
477
|
+
title: "Server Health",
|
|
478
|
+
subtitle: "prod-web-1",
|
|
479
|
+
type: "metrics",
|
|
480
|
+
metrics: [
|
|
481
|
+
{ label: "CPU", value: 76, unit: "%" },
|
|
482
|
+
{ label: "MEM", value: 52, unit: "%" }
|
|
483
|
+
]
|
|
281
484
|
},
|
|
282
485
|
action: {
|
|
283
|
-
title: "Open
|
|
486
|
+
title: "Open Dashboard",
|
|
284
487
|
type: "open_url",
|
|
285
|
-
url: "https://
|
|
488
|
+
url: "https://ops.example.com/servers/prod-web-1"
|
|
286
489
|
}
|
|
287
490
|
}
|
|
288
491
|
)
|
|
@@ -297,18 +500,21 @@ activitysmith.live_activities.update(
|
|
|
297
500
|
{
|
|
298
501
|
activity_id: activity_id,
|
|
299
502
|
content_state: {
|
|
300
|
-
title: "
|
|
301
|
-
subtitle: "
|
|
302
|
-
|
|
303
|
-
|
|
503
|
+
title: "Server Health",
|
|
504
|
+
subtitle: "prod-web-1",
|
|
505
|
+
type: "metrics",
|
|
506
|
+
metrics: [
|
|
507
|
+
{ label: "CPU", value: 91, unit: "%" },
|
|
508
|
+
{ label: "MEM", value: 57, unit: "%" }
|
|
509
|
+
]
|
|
304
510
|
},
|
|
305
511
|
action: {
|
|
306
|
-
title: "
|
|
512
|
+
title: "Restart Service",
|
|
307
513
|
type: "webhook",
|
|
308
|
-
url: "https://ops.example.com/hooks/
|
|
514
|
+
url: "https://ops.example.com/hooks/servers/prod-web-1/restart",
|
|
309
515
|
method: "POST",
|
|
310
516
|
body: {
|
|
311
|
-
|
|
517
|
+
server_id: "prod-web-1",
|
|
312
518
|
requested_by: "activitysmith-ruby"
|
|
313
519
|
}
|
|
314
520
|
}
|
|
@@ -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, 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
|
# @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, 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
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, 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.
|
|
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, 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.
|
|
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, 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.
|
|
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, 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.
|
|
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
|