activitysmith 1.3.1 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72834442fc339c835883f57e5911a1df7b5b425ca72e9378c8bf4875b19d26ec
4
- data.tar.gz: 6ed94939eb8886ac94102e3ca7dc70efa39c02432a8f945d7da793fa5920a67e
3
+ metadata.gz: c57318695ada7f8c3d33082a4a60616ddbc0616919f66cd8d9f8bf752b393f4b
4
+ data.tar.gz: b16241c1481014632938a841c71c483dc2fa70a22ede37668e1851ae367732de
5
5
  SHA512:
6
- metadata.gz: 58df6742bc1758e8a1faba533f7a0f94f959c4e87e308d6306319026c5a37be285de28693bff0804fac2713e1aec8f9f81ae4ddf0561f07edd35e01557549863
7
- data.tar.gz: 04ac9df1919119396b7b4e014f0d0cf99e6ccb4000d10c166a68ce184d68e3ddaeb12a1444f6ac6ee7c9811db9ac5e74899f9a50051f5324de23d6a592b2bf4a
6
+ metadata.gz: 2cb2947432a4e3b44523632d5b49443e8703c097365be08e087d69f3745457240d940f0eb9a91261b43a7a16d15cf31532bd03203e27bda0c79ea6ce5cec1379
7
+ data.tar.gz: 726fe1d3ecf9edaad5d428ea24ba0c41a5174cd2d51232605fe89343c2f750c5732e36c39b40a6e49b79a49da353229d2bfa0f3644fb2840180341dded57ae86
data/README.md CHANGED
@@ -18,6 +18,8 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
18
18
  - [Start & Update Live Activity](#start--update-live-activity)
19
19
  - [End Live Activity](#end-live-activity)
20
20
  - [Live Activity Action](#live-activity-action)
21
+ - [Icons and Badges](#icons-and-badges)
22
+ - [Live Activity Colors](#live-activity-colors)
21
23
  - [Channels](#channels)
22
24
  - [Widgets](#widgets)
23
25
 
@@ -120,12 +122,13 @@ activitysmith.notifications.send(
120
122
 
121
123
  ## Live Activities
122
124
 
123
- There are four types of Live Activities:
125
+ There are five types of Live Activities:
124
126
 
125
127
  - `stats`: best for showing business numbers side by side, such as revenue, sales, new users, conversion, refunds, or any other value you want visible at a glance
126
128
  - `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
127
129
  - `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
128
130
  - `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
131
+ - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
129
132
 
130
133
  ### Start & Update Live Activity
131
134
 
@@ -238,6 +241,31 @@ activitysmith.live_activities.stream(
238
241
  )
239
242
  ```
240
243
 
244
+ #### Alert
245
+
246
+ <p align="center">
247
+ <img
248
+ src="https://cdn.activitysmith.com/features/alert-live-activity.png"
249
+ alt="Alert Live Activity stream example"
250
+ width="680"
251
+ />
252
+ </p>
253
+
254
+ ```ruby
255
+ activitysmith.live_activities.stream(
256
+ "customer-ops",
257
+ {
258
+ content_state: ActivitySmith::LiveActivities.content_state(
259
+ title: "Reactivation",
260
+ message: "Lumen came back after 2 weeks",
261
+ type: ActivitySmith::LiveActivities::TYPE_ALERT,
262
+ icon: ActivitySmith::LiveActivities.alert_icon("cloud.sun", color: "yellow"),
263
+ badge: ActivitySmith::LiveActivities.alert_badge("Customer", color: "magenta")
264
+ )
265
+ }
266
+ )
267
+ ```
268
+
241
269
  ### End Live Activity
242
270
 
243
271
  Call `end_stream(...)` with the same `stream_key` to dismiss the Live Activity. You can include final values before it is removed. By default, iOS removes the Live Activity after two minutes. Set `auto_dismiss_minutes` to choose a different dismissal time, including `0` for immediate dismissal.
@@ -263,6 +291,7 @@ activitysmith.live_activities.end_stream(
263
291
  ### Live Activity Action
264
292
 
265
293
  Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
294
+ For Alert Live Activities, set `color` in `content_state` to tint the action button. Icon and badge colors only affect the icon and badge.
266
295
 
267
296
  <p align="center">
268
297
  <img
@@ -323,6 +352,79 @@ activitysmith.live_activities.stream(
323
352
  )
324
353
  ```
325
354
 
355
+ ### Icons and Badges
356
+
357
+ Add more context to Live Activities with icons and badges.
358
+
359
+ #### Icon
360
+
361
+ Supported Live Activity types: `stats`, `metrics`, `progress`, `segmented_progress`, and `alert`.
362
+
363
+ <p align="center">
364
+ <img
365
+ src="https://cdn.activitysmith.com/features/metrics-live-activity-with-icon.png"
366
+ alt="Metrics Live Activity with an SF Symbol icon on the iPhone Lock Screen"
367
+ width="680"
368
+ />
369
+ </p>
370
+
371
+ ```ruby
372
+ activitysmith.live_activities.stream(
373
+ "prod-web-1",
374
+ {
375
+ content_state: ActivitySmith::LiveActivities.content_state(
376
+ title: "Server Health",
377
+ subtitle: "prod-web-1",
378
+ type: "metrics",
379
+ icon: ActivitySmith::LiveActivities.alert_icon("server.rack", color: "blue"),
380
+ metrics: [
381
+ { label: "CPU", value: 18, unit: "%" },
382
+ { label: "MEM", value: 42, unit: "%" }
383
+ ]
384
+ )
385
+ }
386
+ )
387
+ ```
388
+
389
+ The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
390
+
391
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
392
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
393
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
394
+
395
+ #### Badge
396
+
397
+ Badges are supported by `alert`, `progress`, and `segmented_progress` Live Activities.
398
+
399
+ <p align="center">
400
+ <img
401
+ src="https://cdn.activitysmith.com/features/progress-live-activity-with-badge.png"
402
+ alt="Progress Live Activity with a badge on the iPhone Lock Screen"
403
+ width="680"
404
+ />
405
+ </p>
406
+
407
+ ```ruby
408
+ activitysmith.live_activities.stream(
409
+ "nightly-database-backup",
410
+ {
411
+ content_state: ActivitySmith::LiveActivities.content_state(
412
+ title: "Nightly Database Backup",
413
+ subtitle: "verify restore",
414
+ type: "progress",
415
+ badge: ActivitySmith::LiveActivities.alert_badge("S3", color: "cyan"),
416
+ percentage: 62
417
+ )
418
+ }
419
+ )
420
+ ```
421
+
422
+ ### Live Activity Colors
423
+
424
+ Choose from these colors for the Live Activity accent, including progress bars and action buttons, or apply them to an individual icon or badge:
425
+
426
+ `lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
427
+
326
428
  ## Channels
327
429
 
328
430
  Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
@@ -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, and stats 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, and alert 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 (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, and stats 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, and alert 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
@@ -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, and stats 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, and alert activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
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, and stats 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, and alert activity types. For segmented_progress activities, number_of_steps can be changed later during update or end calls if the workflow changes.
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, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
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, and alert activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
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, and stats activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
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, and alert activity types. For segmented_progress activities, you can increase or decrease number_of_steps here as the workflow changes.
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
@@ -140,7 +140,7 @@ module OpenapiClient
140
140
  return false if @label.nil?
141
141
  return false if @label.to_s.length < 1
142
142
  return false if @value.nil?
143
- color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
143
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
144
144
  return false unless color_validator.valid?(@color)
145
145
  true
146
146
  end
@@ -162,7 +162,7 @@ module OpenapiClient
162
162
  # Custom attribute writer method checking allowed values (enum).
163
163
  # @param [Object] color Object to be assigned
164
164
  def color=(color)
165
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
165
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
166
166
  unless validator.valid?(color)
167
167
  fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
168
168
  end
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
17
+ # End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
18
18
  class ContentStateEnd
19
19
  attr_accessor :title
20
20
 
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Total number of steps. Use for type=segmented_progress. Optional on end, and safe to change if the final workflow used more or fewer steps than originally planned.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Current step. Use for type=segmented_progress.
26
+ # Current completed step count. Use for type=segmented_progress. Must be less than or equal to number_of_steps when number_of_steps is provided.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
@@ -38,10 +38,19 @@ module OpenapiClient
38
38
  # Use for type=metrics or type=stats.
39
39
  attr_accessor :metrics
40
40
 
41
+ # Alert message. Use for type=alert.
42
+ attr_accessor :message
43
+
44
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
45
+ attr_accessor :icon
46
+
47
+ # Optional badge. Supported by alert, progress, and segmented_progress.
48
+ attr_accessor :badge
49
+
41
50
  # Optional. When omitted, the API uses the existing Live Activity type.
42
51
  attr_accessor :type
43
52
 
44
- # Optional. Accent color for the Live Activity. Defaults to blue.
53
+ # Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included.
45
54
  attr_accessor :color
46
55
 
47
56
  # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
@@ -86,6 +95,9 @@ module OpenapiClient
86
95
  :'value' => :'value',
87
96
  :'upper_limit' => :'upper_limit',
88
97
  :'metrics' => :'metrics',
98
+ :'message' => :'message',
99
+ :'icon' => :'icon',
100
+ :'badge' => :'badge',
89
101
  :'type' => :'type',
90
102
  :'color' => :'color',
91
103
  :'step_color' => :'step_color',
@@ -110,6 +122,9 @@ module OpenapiClient
110
122
  :'value' => :'Float',
111
123
  :'upper_limit' => :'Float',
112
124
  :'metrics' => :'Array<ActivityMetric>',
125
+ :'message' => :'String',
126
+ :'icon' => :'LiveActivityAlertIcon',
127
+ :'badge' => :'LiveActivityAlertBadge',
113
128
  :'type' => :'String',
114
129
  :'color' => :'String',
115
130
  :'step_color' => :'String',
@@ -175,14 +190,24 @@ module OpenapiClient
175
190
  end
176
191
  end
177
192
 
193
+ if attributes.key?(:'message')
194
+ self.message = attributes[:'message']
195
+ end
196
+
197
+ if attributes.key?(:'icon')
198
+ self.icon = attributes[:'icon']
199
+ end
200
+
201
+ if attributes.key?(:'badge')
202
+ self.badge = attributes[:'badge']
203
+ end
204
+
178
205
  if attributes.key?(:'type')
179
206
  self.type = attributes[:'type']
180
207
  end
181
208
 
182
209
  if attributes.key?(:'color')
183
210
  self.color = attributes[:'color']
184
- else
185
- self.color = 'blue'
186
211
  end
187
212
 
188
213
  if attributes.key?(:'step_color')
@@ -215,8 +240,8 @@ module OpenapiClient
215
240
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
216
241
  end
217
242
 
218
- if !@current_step.nil? && @current_step < 1
219
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
243
+ if !@current_step.nil? && @current_step < 0
244
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
220
245
  end
221
246
 
222
247
  if !@percentage.nil? && @percentage > 100
@@ -235,6 +260,10 @@ module OpenapiClient
235
260
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
236
261
  end
237
262
 
263
+ if !@message.nil? && @message.to_s.length < 1
264
+ invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
265
+ end
266
+
238
267
  if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
239
268
  invalid_properties.push('invalid value for "auto_dismiss_minutes", must be greater than or equal to 0.')
240
269
  end
@@ -248,16 +277,17 @@ module OpenapiClient
248
277
  warn '[DEPRECATED] the `valid?` method is obsolete'
249
278
  return false if @title.nil?
250
279
  return false if !@number_of_steps.nil? && @number_of_steps < 1
251
- return false if !@current_step.nil? && @current_step < 1
280
+ return false if !@current_step.nil? && @current_step < 0
252
281
  return false if !@percentage.nil? && @percentage > 100
253
282
  return false if !@percentage.nil? && @percentage < 0
254
283
  return false if !@metrics.nil? && @metrics.length > 8
255
284
  return false if !@metrics.nil? && @metrics.length < 1
256
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
285
+ return false if !@message.nil? && @message.to_s.length < 1
286
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
257
287
  return false unless type_validator.valid?(@type)
258
- color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
288
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
259
289
  return false unless color_validator.valid?(@color)
260
- step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
290
+ step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
261
291
  return false unless step_color_validator.valid?(@step_color)
262
292
  return false if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
263
293
  true
@@ -284,8 +314,8 @@ module OpenapiClient
284
314
  fail ArgumentError, 'current_step cannot be nil'
285
315
  end
286
316
 
287
- if current_step < 1
288
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
317
+ if current_step < 0
318
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
289
319
  end
290
320
 
291
321
  @current_step = current_step
@@ -327,10 +357,24 @@ module OpenapiClient
327
357
  @metrics = metrics
328
358
  end
329
359
 
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] message Value to be assigned
362
+ def message=(message)
363
+ if message.nil?
364
+ fail ArgumentError, 'message cannot be nil'
365
+ end
366
+
367
+ if message.to_s.length < 1
368
+ fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
369
+ end
370
+
371
+ @message = message
372
+ end
373
+
330
374
  # Custom attribute writer method checking allowed values (enum).
331
375
  # @param [Object] type Object to be assigned
332
376
  def type=(type)
333
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
377
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
334
378
  unless validator.valid?(type)
335
379
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
336
380
  end
@@ -340,7 +384,7 @@ module OpenapiClient
340
384
  # Custom attribute writer method checking allowed values (enum).
341
385
  # @param [Object] color Object to be assigned
342
386
  def color=(color)
343
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
387
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
344
388
  unless validator.valid?(color)
345
389
  fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
346
390
  end
@@ -350,7 +394,7 @@ module OpenapiClient
350
394
  # Custom attribute writer method checking allowed values (enum).
351
395
  # @param [Object] step_color Object to be assigned
352
396
  def step_color=(step_color)
353
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
397
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
354
398
  unless validator.valid?(step_color)
355
399
  fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
356
400
  end
@@ -384,6 +428,9 @@ module OpenapiClient
384
428
  value == o.value &&
385
429
  upper_limit == o.upper_limit &&
386
430
  metrics == o.metrics &&
431
+ message == o.message &&
432
+ icon == o.icon &&
433
+ badge == o.badge &&
387
434
  type == o.type &&
388
435
  color == o.color &&
389
436
  step_color == o.step_color &&
@@ -400,7 +447,7 @@ module OpenapiClient
400
447
  # Calculates hash code according to all attributes.
401
448
  # @return [Integer] Hash code
402
449
  def hash
403
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors, auto_dismiss_minutes].hash
450
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, message, icon, badge, type, color, step_color, step_colors, auto_dismiss_minutes].hash
404
451
  end
405
452
 
406
453
  # Builds the object from hash
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
17
+ # Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics and stats include a non-empty metrics array. For alert include message. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and segmented_progress. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
18
18
  class ContentStateStart
19
19
  attr_accessor :title
20
20
 
@@ -23,7 +23,7 @@ module OpenapiClient
23
23
  # Total number of steps. Use for type=segmented_progress. This value can be increased or decreased later when updating or ending the same activity.
24
24
  attr_accessor :number_of_steps
25
25
 
26
- # Current step. Use for type=segmented_progress.
26
+ # Current completed step count. Use for type=segmented_progress. Set 0 when the activity has started but no segment is complete yet. Must be less than or equal to number_of_steps.
27
27
  attr_accessor :current_step
28
28
 
29
29
  # Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
@@ -38,9 +38,18 @@ module OpenapiClient
38
38
  # Use for type=metrics or type=stats.
39
39
  attr_accessor :metrics
40
40
 
41
+ # Required for type=alert.
42
+ attr_accessor :message
43
+
44
+ # Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
45
+ attr_accessor :icon
46
+
47
+ # Optional badge. Supported by alert, progress, and segmented_progress.
48
+ attr_accessor :badge
49
+
41
50
  attr_accessor :type
42
51
 
43
- # Optional. Accent color for the Live Activity. Defaults to blue.
52
+ # Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included.
44
53
  attr_accessor :color
45
54
 
46
55
  # Optional. Overrides color for the current step. Only applies to type=segmented_progress.
@@ -82,6 +91,9 @@ module OpenapiClient
82
91
  :'value' => :'value',
83
92
  :'upper_limit' => :'upper_limit',
84
93
  :'metrics' => :'metrics',
94
+ :'message' => :'message',
95
+ :'icon' => :'icon',
96
+ :'badge' => :'badge',
85
97
  :'type' => :'type',
86
98
  :'color' => :'color',
87
99
  :'step_color' => :'step_color',
@@ -105,6 +117,9 @@ module OpenapiClient
105
117
  :'value' => :'Float',
106
118
  :'upper_limit' => :'Float',
107
119
  :'metrics' => :'Array<ActivityMetric>',
120
+ :'message' => :'String',
121
+ :'icon' => :'LiveActivityAlertIcon',
122
+ :'badge' => :'LiveActivityAlertBadge',
108
123
  :'type' => :'String',
109
124
  :'color' => :'String',
110
125
  :'step_color' => :'String',
@@ -169,6 +184,18 @@ module OpenapiClient
169
184
  end
170
185
  end
171
186
 
187
+ if attributes.key?(:'message')
188
+ self.message = attributes[:'message']
189
+ end
190
+
191
+ if attributes.key?(:'icon')
192
+ self.icon = attributes[:'icon']
193
+ end
194
+
195
+ if attributes.key?(:'badge')
196
+ self.badge = attributes[:'badge']
197
+ end
198
+
172
199
  if attributes.key?(:'type')
173
200
  self.type = attributes[:'type']
174
201
  else
@@ -177,8 +204,6 @@ module OpenapiClient
177
204
 
178
205
  if attributes.key?(:'color')
179
206
  self.color = attributes[:'color']
180
- else
181
- self.color = 'blue'
182
207
  end
183
208
 
184
209
  if attributes.key?(:'step_color')
@@ -205,8 +230,8 @@ module OpenapiClient
205
230
  invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
206
231
  end
207
232
 
208
- if !@current_step.nil? && @current_step < 1
209
- invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
233
+ if !@current_step.nil? && @current_step < 0
234
+ invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
210
235
  end
211
236
 
212
237
  if !@percentage.nil? && @percentage > 100
@@ -225,6 +250,10 @@ module OpenapiClient
225
250
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
226
251
  end
227
252
 
253
+ if !@message.nil? && @message.to_s.length < 1
254
+ invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
255
+ end
256
+
228
257
  if @type.nil?
229
258
  invalid_properties.push('invalid value for "type", type cannot be nil.')
230
259
  end
@@ -238,17 +267,18 @@ module OpenapiClient
238
267
  warn '[DEPRECATED] the `valid?` method is obsolete'
239
268
  return false if @title.nil?
240
269
  return false if !@number_of_steps.nil? && @number_of_steps < 1
241
- return false if !@current_step.nil? && @current_step < 1
270
+ return false if !@current_step.nil? && @current_step < 0
242
271
  return false if !@percentage.nil? && @percentage > 100
243
272
  return false if !@percentage.nil? && @percentage < 0
244
273
  return false if !@metrics.nil? && @metrics.length > 8
245
274
  return false if !@metrics.nil? && @metrics.length < 1
275
+ return false if !@message.nil? && @message.to_s.length < 1
246
276
  return false if @type.nil?
247
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
277
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
248
278
  return false unless type_validator.valid?(@type)
249
- color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
279
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
250
280
  return false unless color_validator.valid?(@color)
251
- step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
281
+ step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
252
282
  return false unless step_color_validator.valid?(@step_color)
253
283
  true
254
284
  end
@@ -274,8 +304,8 @@ module OpenapiClient
274
304
  fail ArgumentError, 'current_step cannot be nil'
275
305
  end
276
306
 
277
- if current_step < 1
278
- fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 1.'
307
+ if current_step < 0
308
+ fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
279
309
  end
280
310
 
281
311
  @current_step = current_step
@@ -317,10 +347,24 @@ module OpenapiClient
317
347
  @metrics = metrics
318
348
  end
319
349
 
350
+ # Custom attribute writer method with validation
351
+ # @param [Object] message Value to be assigned
352
+ def message=(message)
353
+ if message.nil?
354
+ fail ArgumentError, 'message cannot be nil'
355
+ end
356
+
357
+ if message.to_s.length < 1
358
+ fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
359
+ end
360
+
361
+ @message = message
362
+ end
363
+
320
364
  # Custom attribute writer method checking allowed values (enum).
321
365
  # @param [Object] type Object to be assigned
322
366
  def type=(type)
323
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
367
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
324
368
  unless validator.valid?(type)
325
369
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
326
370
  end
@@ -330,7 +374,7 @@ module OpenapiClient
330
374
  # Custom attribute writer method checking allowed values (enum).
331
375
  # @param [Object] color Object to be assigned
332
376
  def color=(color)
333
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
377
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
334
378
  unless validator.valid?(color)
335
379
  fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
336
380
  end
@@ -340,7 +384,7 @@ module OpenapiClient
340
384
  # Custom attribute writer method checking allowed values (enum).
341
385
  # @param [Object] step_color Object to be assigned
342
386
  def step_color=(step_color)
343
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
387
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
344
388
  unless validator.valid?(step_color)
345
389
  fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
346
390
  end
@@ -360,6 +404,9 @@ module OpenapiClient
360
404
  value == o.value &&
361
405
  upper_limit == o.upper_limit &&
362
406
  metrics == o.metrics &&
407
+ message == o.message &&
408
+ icon == o.icon &&
409
+ badge == o.badge &&
363
410
  type == o.type &&
364
411
  color == o.color &&
365
412
  step_color == o.step_color &&
@@ -375,7 +422,7 @@ module OpenapiClient
375
422
  # Calculates hash code according to all attributes.
376
423
  # @return [Integer] Hash code
377
424
  def hash
378
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors].hash
425
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, message, icon, badge, type, color, step_color, step_colors].hash
379
426
  end
380
427
 
381
428
  # Builds the object from hash