activitysmith 1.7.0 → 1.9.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.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +113 -18
  3. data/generated/activitysmith_openapi/api/app_icon_badges_api.rb +90 -0
  4. data/generated/activitysmith_openapi/api/live_activities_api.rb +10 -10
  5. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_request.rb +260 -0
  6. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +331 -0
  7. data/generated/activitysmith_openapi/models/content_state_end.rb +1 -1
  8. data/generated/activitysmith_openapi/models/content_state_start.rb +1 -1
  9. data/generated/activitysmith_openapi/models/content_state_update.rb +1 -1
  10. data/generated/activitysmith_openapi/models/live_activity_action.rb +3 -5
  11. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +14 -4
  12. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +11 -1
  13. data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +11 -1
  14. data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +11 -1
  15. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +14 -4
  16. data/generated/activitysmith_openapi/models/push_notification_action.rb +2 -4
  17. data/generated/activitysmith_openapi/models/push_notification_request.rb +2 -4
  18. data/generated/activitysmith_openapi/models/stream_content_state.rb +1 -1
  19. data/generated/activitysmith_openapi/version.rb +1 -1
  20. data/generated/activitysmith_openapi.rb +3 -0
  21. data/lib/activitysmith/client.rb +15 -1
  22. data/lib/activitysmith/version.rb +1 -1
  23. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17820f972e80244f813c791d40dd85f577e20138ab932a03360586b749fb0435
4
- data.tar.gz: 7505405af1b3bccd651c14aa1961e514db8faddcec679d902771310b6fd50792
3
+ metadata.gz: 3c618daeffaa021171b3dc5c77d820ea1c4abb8eec2545dcf7238a00fefa98e5
4
+ data.tar.gz: 499260d8e84bb8c20dddfdbd0e26a19b3fbfdee738f1d9d802ea3505cb8aa17c
5
5
  SHA512:
6
- metadata.gz: 9b4b5da68c74c193b9b7eb87adca266b4573ebf56fb7c5a96133c4c6b45fb3eff85fbf168ae914951321359e4effd0c1ca3188a2c5cae14f0c838478862ab437
7
- data.tar.gz: 1c21388cb1a583fa807fc8959db0286a0d65f937c031bde333120028e7508f45080e1f9dec46edfbe656cdb9bb9d667f5baa5845104dac6d772290f3eda1663c
6
+ metadata.gz: 8d19ad31e4d0377df4885ba054933aa87a78368056735e4877e637ec9035aecb9b7436f83342a5e8db8415b0ccb0a0f532effb5269587a7dde72dc2e2a5b0b6d
7
+ data.tar.gz: 91d7f07629f5ce83cffc2273bbb803b5710331d347d674005d1de3cfdd1fbe22291a9407b5c7b4f27593ea7e73437ab1e363f891aa8933b82b15f70f03becafc
data/README.md CHANGED
@@ -20,8 +20,9 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
20
20
  - [Live Activity Action](#live-activity-action)
21
21
  - [Icons and Badges](#icons-and-badges)
22
22
  - [Live Activity Colors](#live-activity-colors)
23
- - [Channels](#channels)
24
23
  - [Widgets](#widgets)
24
+ - [App Icon Badge Count](#app-icon-badge-count)
25
+ - [Channels](#channels)
25
26
 
26
27
  ## Installation
27
28
 
@@ -325,15 +326,15 @@ activitysmith.live_activities.end_stream(
325
326
 
326
327
  ### Live Activity Action
327
328
 
328
- Live Activities can include one optional action button.
329
+ Live Activities can include an action button.
329
330
 
330
331
  - `open_url`: open an HTTPS URL.
331
- - `open_url` with a `shortcuts://run-shortcut?name=...` URL: run a specific iPhone Shortcut, for example to open an app.
332
+ - `open_url` with a `shortcuts://` URL: run an Apple Shortcut, for example to open an app.
332
333
  - `webhook`: trigger a backend GET/POST workflow.
333
334
 
334
335
  <p align="center">
335
336
  <img
336
- src="https://cdn.activitysmith.com/features/live-activity-with-action.png?v=20260319-1"
337
+ src="https://cdn.activitysmith.com/features/metrics-live-activity-action.png"
337
338
  alt="Live Activity with action button"
338
339
  width="680"
339
340
  />
@@ -412,6 +413,56 @@ activitysmith.live_activities.stream(
412
413
  )
413
414
  ```
414
415
 
416
+ #### Secondary action
417
+
418
+ <p align="center">
419
+ <img
420
+ src="https://cdn.activitysmith.com/features/live-activity-secondary-action.png"
421
+ alt="Alert Live Activity with primary and secondary action buttons"
422
+ width="680"
423
+ />
424
+ </p>
425
+
426
+ Use `secondary_action` when you want a second button beside the primary `action`.
427
+
428
+ The secondary action button is supported for `alert`, `progress`, and `segmented_progress` Live Activities. Both buttons use the same `open_url`, `webhook`, and Apple Shortcut payload shapes.
429
+
430
+ ```ruby
431
+ activitysmith.live_activities.stream(
432
+ "agent-approval",
433
+ {
434
+ content_state: ActivitySmith::LiveActivities.content_state(
435
+ title: "Approval Needed",
436
+ message: "Should I send the follow-up email to Brightlane?",
437
+ type: "alert",
438
+ color: "green",
439
+ icon: ActivitySmith::LiveActivities.alert_icon("sparkles", color: "green"),
440
+ badge: ActivitySmith::LiveActivities.alert_badge("Agent", color: "green")
441
+ ),
442
+ action: {
443
+ title: "Send",
444
+ type: "webhook",
445
+ url: "https://agent.example.com/live-activity/approve",
446
+ method: "POST",
447
+ body: {
448
+ approval_id: "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
449
+ decision: "send"
450
+ }
451
+ },
452
+ secondary_action: {
453
+ title: "Deny",
454
+ type: "webhook",
455
+ url: "https://agent.example.com/live-activity/deny",
456
+ method: "POST",
457
+ body: {
458
+ approval_id: "approval_01JY3J7Q9S0P8M1V5PZK7DR4M2",
459
+ decision: "deny"
460
+ }
461
+ }
462
+ }
463
+ )
464
+ ```
465
+
415
466
  ### Icons and Badges
416
467
 
417
468
  Add more context to Live Activities with icons and badges.
@@ -485,20 +536,6 @@ Choose from these colors for the Live Activity accent, including progress bars a
485
536
 
486
537
  `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
487
538
 
488
- ## Channels
489
-
490
- Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
491
-
492
- ```ruby
493
- activitysmith.notifications.send(
494
- {
495
- title: "New subscription 💸",
496
- message: "Customer upgraded to Pro plan",
497
- channels: ["sales", "customer-success"] # Optional
498
- }
499
- )
500
- ```
501
-
502
539
  ## Widgets
503
540
 
504
541
  <p align="center">
@@ -521,6 +558,64 @@ String metric values work too.
521
558
  activitysmith.metrics.update("prod.status", "healthy")
522
559
  ```
523
560
 
561
+ ## App Icon Badge Count
562
+
563
+ <p align="center">
564
+ <img src="https://cdn.activitysmith.com/features/badge-count.png" alt="ActivitySmith app icon with an App Icon Badge Count" width="680" />
565
+ </p>
566
+
567
+ Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
568
+
569
+ Set or update the badge value.
570
+
571
+ ```ruby
572
+ activitysmith.badge_count(8333)
573
+ ```
574
+
575
+ To clear the badge, set its value to 0.
576
+
577
+ ```ruby
578
+ activitysmith.badge_count(0)
579
+ ```
580
+
581
+ ## Channels
582
+
583
+ Use `channels` to target specific team members or devices
584
+
585
+ ### Push Notifications
586
+
587
+ ```ruby
588
+ activitysmith.notifications.send(
589
+ {
590
+ title: "New subscription 💸",
591
+ message: "Customer upgraded to Pro plan",
592
+ channels: ["sales", "customer-success"]
593
+ }
594
+ )
595
+ ```
596
+
597
+ ### Live Activities
598
+
599
+ ```ruby
600
+ activitysmith.live_activities.start(
601
+ {
602
+ content_state: {
603
+ title: "Nightly Database Backup",
604
+ subtitle: "verify restore",
605
+ type: "progress",
606
+ percentage: 62
607
+ },
608
+ channels: ["sales", "customer-success"]
609
+ }
610
+ )
611
+ ```
612
+
613
+ ### App Icon Badge Count
614
+
615
+ ```ruby
616
+ activitysmith.badge_count(3, channels: ["sales", "customer-success"])
617
+ ```
618
+
524
619
  ## Error Handling
525
620
 
526
621
  ```ruby
@@ -0,0 +1,90 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class AppIconBadgesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Update App Icon Badge Count
23
+ # Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
24
+ # @param app_icon_badge_count_update_request [AppIconBadgeCountUpdateRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [AppIconBadgeCountUpdateResponse]
27
+ def update_app_icon_badge_count(app_icon_badge_count_update_request, opts = {})
28
+ data, _status_code, _headers = update_app_icon_badge_count_with_http_info(app_icon_badge_count_update_request, opts)
29
+ data
30
+ end
31
+
32
+ # Update App Icon Badge Count
33
+ # Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send &#x60;badge: 0&#x60; to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
34
+ # @param app_icon_badge_count_update_request [AppIconBadgeCountUpdateRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(AppIconBadgeCountUpdateResponse, Integer, Hash)>] AppIconBadgeCountUpdateResponse data, response status code and response headers
37
+ def update_app_icon_badge_count_with_http_info(app_icon_badge_count_update_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AppIconBadgesApi.update_app_icon_badge_count ...'
40
+ end
41
+ # verify the required parameter 'app_icon_badge_count_update_request' is set
42
+ if @api_client.config.client_side_validation && app_icon_badge_count_update_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'app_icon_badge_count_update_request' when calling AppIconBadgesApi.update_app_icon_badge_count"
44
+ end
45
+ # resource path
46
+ local_var_path = '/badge'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app_icon_badge_count_update_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'AppIconBadgeCountUpdateResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['apiKeyAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AppIconBadgesApi.update_app_icon_badge_count",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: AppIconBadgesApi#update_app_icon_badge_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+ end
90
+ end
@@ -20,7 +20,7 @@ module OpenapiClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # End a Live Activity (legacy manual lifecycle)
23
- # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
23
+ # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
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 (legacy manual lifecycle)
33
- # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start.
33
+ # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
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
@@ -88,7 +88,7 @@ module OpenapiClient
88
88
  end
89
89
 
90
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.
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. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
92
92
  # @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
93
93
  # @param [Hash] opts the optional parameters
94
94
  # @option opts [LiveActivityStreamDeleteRequest] :live_activity_stream_delete_request
@@ -99,7 +99,7 @@ module OpenapiClient
99
99
  end
100
100
 
101
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.
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. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
103
103
  # @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
104
104
  # @param [Hash] opts the optional parameters
105
105
  # @option opts [LiveActivityStreamDeleteRequest] :live_activity_stream_delete_request
@@ -167,7 +167,7 @@ module OpenapiClient
167
167
  end
168
168
 
169
169
  # Start a new Live Activity or update an existing one
170
- # Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window.
170
+ # Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
171
171
  # @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
172
172
  # @param live_activity_stream_request [LiveActivityStreamRequest]
173
173
  # @param [Hash] opts the optional parameters
@@ -178,7 +178,7 @@ module OpenapiClient
178
178
  end
179
179
 
180
180
  # Start a new Live Activity or update an existing one
181
- # Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window.
181
+ # Use a stable stream_key for each ongoing thing you want to show as a Live Activity. Send the latest content_state whenever it changes, and ActivitySmith will keep the Live Activity in sync. For timer streams, send duration_seconds to start or reset the timer; omit duration_seconds on later updates to preserve the existing timer window. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
182
182
  # @param stream_key [String] Stable identifier for one ongoing thing. Allowed characters: letters, numbers, underscores, and hyphens.
183
183
  # @param live_activity_stream_request [LiveActivityStreamRequest]
184
184
  # @param [Hash] opts the optional parameters
@@ -250,7 +250,7 @@ module OpenapiClient
250
250
  end
251
251
 
252
252
  # Start a Live Activity (legacy manual lifecycle)
253
- # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
253
+ # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
254
254
  # @param live_activity_start_request [LiveActivityStartRequest]
255
255
  # @param [Hash] opts the optional parameters
256
256
  # @return [LiveActivityStartResponse]
@@ -260,7 +260,7 @@ module OpenapiClient
260
260
  end
261
261
 
262
262
  # Start a Live Activity (legacy manual lifecycle)
263
- # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
263
+ # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Starts a Live Activity on devices matched by API key scope and optional target channels. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
264
264
  # @param live_activity_start_request [LiveActivityStartRequest]
265
265
  # @param [Hash] opts the optional parameters
266
266
  # @return [Array<(LiveActivityStartResponse, Integer, Hash)>] LiveActivityStartResponse data, response status code and response headers
@@ -318,7 +318,7 @@ module OpenapiClient
318
318
  end
319
319
 
320
320
  # Update a Live Activity (legacy manual lifecycle)
321
- # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. For timer activities, send duration_seconds only when you want to reset the timer window; omit it to keep the current timer running.
321
+ # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. For timer activities, send duration_seconds only when you want to reset the timer window; omit it to keep the current timer running. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
322
322
  # @param live_activity_update_request [LiveActivityUpdateRequest]
323
323
  # @param [Hash] opts the optional parameters
324
324
  # @return [LiveActivityUpdateResponse]
@@ -328,7 +328,7 @@ module OpenapiClient
328
328
  end
329
329
 
330
330
  # Update a Live Activity (legacy manual lifecycle)
331
- # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. For timer activities, send duration_seconds only when you want to reset the timer window; omit it to keep the current timer running.
331
+ # Legacy manual lifecycle endpoint. For new integrations, use PUT /live-activity/stream/{stream_key} so ActivitySmith can manage start, update, rotation, and end state for you. This endpoint remains supported for existing integrations and advanced lifecycle control. Updates an existing Live Activity. If the per-activity token is not registered yet, the update is queued. Supports segmented_progress, progress, metrics, stats, alert, and timer activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes. For timer activities, send duration_seconds only when you want to reset the timer window; omit it to keep the current timer running. Use secondary_action for a second button on alert, progress, and segmented_progress Live Activities only.
332
332
  # @param live_activity_update_request [LiveActivityUpdateRequest]
333
333
  # @param [Hash] opts the optional parameters
334
334
  # @return [Array<(LiveActivityUpdateResponse, Integer, Hash)>] LiveActivityUpdateResponse data, response status code and response headers
@@ -0,0 +1,260 @@
1
+ =begin
2
+ #ActivitySmith API
3
+
4
+ #Send push notifications and Live Activities to your own devices via a single API key.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ # App Icon Badge Count update. Send badge 0 to clear the count.
18
+ class AppIconBadgeCountUpdateRequest
19
+ # The count to show on the ActivitySmith app icon. Send 0 to clear it.
20
+ attr_accessor :badge
21
+
22
+ attr_accessor :target
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'badge' => :'badge',
28
+ :'target' => :'target'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'badge' => :'Integer',
41
+ :'target' => :'ChannelTarget'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AppIconBadgeCountUpdateRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AppIconBadgeCountUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'badge')
67
+ self.badge = attributes[:'badge']
68
+ else
69
+ self.badge = nil
70
+ end
71
+
72
+ if attributes.key?(:'target')
73
+ self.target = attributes[:'target']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @badge.nil?
83
+ invalid_properties.push('invalid value for "badge", badge cannot be nil.')
84
+ end
85
+
86
+ if @badge > 2147483647
87
+ invalid_properties.push('invalid value for "badge", must be smaller than or equal to 2147483647.')
88
+ end
89
+
90
+ if @badge < 0
91
+ invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if @badge.nil?
102
+ return false if @badge > 2147483647
103
+ return false if @badge < 0
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] badge Value to be assigned
109
+ def badge=(badge)
110
+ if badge.nil?
111
+ fail ArgumentError, 'badge cannot be nil'
112
+ end
113
+
114
+ if badge > 2147483647
115
+ fail ArgumentError, 'invalid value for "badge", must be smaller than or equal to 2147483647.'
116
+ end
117
+
118
+ if badge < 0
119
+ fail ArgumentError, 'invalid value for "badge", must be greater than or equal to 0.'
120
+ end
121
+
122
+ @badge = badge
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ badge == o.badge &&
131
+ target == o.target
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [badge, target].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ attributes = attributes.transform_keys(&:to_sym)
152
+ transformed_hash = {}
153
+ openapi_types.each_pair do |key, type|
154
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
155
+ transformed_hash["#{key}"] = nil
156
+ elsif type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[attribute_map[key]].is_a?(Array)
160
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
161
+ end
162
+ elsif !attributes[attribute_map[key]].nil?
163
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
164
+ end
165
+ end
166
+ new(transformed_hash)
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def self._deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = OpenapiClient.const_get(type)
208
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end