activitysmith 1.3.1 → 1.4.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: 34f1236d70e7c0a571966c66fee6c6c336a4bb21c7dd139640e87c9221eee214
4
+ data.tar.gz: dc381048f626f8bee8d38309f802665f1b500d5867d762cc03d1d33285e5b18e
5
5
  SHA512:
6
- metadata.gz: 58df6742bc1758e8a1faba533f7a0f94f959c4e87e308d6306319026c5a37be285de28693bff0804fac2713e1aec8f9f81ae4ddf0561f07edd35e01557549863
7
- data.tar.gz: 04ac9df1919119396b7b4e014f0d0cf99e6ccb4000d10c166a68ce184d68e3ddaeb12a1444f6ac6ee7c9811db9ac5e74899f9a50051f5324de23d6a592b2bf4a
6
+ metadata.gz: 81ba38f68b643bd772b070cb1fe41a1508be65fee8a333dc2ab9612d3b1086862aa832523c2386b62c7704debf148df1a572ee8928e3c790c6c856dbf8c5a707
7
+ data.tar.gz: 5e4ff4d86a8ab98de278ebf84e6356b66592b14086cc0bcc324c0d7c08b1f5144264d9f152f7efa9175b45f26991cc4993e7cb6ddd70cf883e1122aaf7263f50
data/README.md CHANGED
@@ -120,12 +120,13 @@ activitysmith.notifications.send(
120
120
 
121
121
  ## Live Activities
122
122
 
123
- There are four types of Live Activities:
123
+ There are five types of Live Activities:
124
124
 
125
125
  - `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
126
  - `metrics`: best for live percentage values that change often, like server CPU, memory usage, disk usage, or error rate
127
127
  - `segmented_progress`: best for anything that moves through clear stages, like deployments, onboarding flows, backups, ETL pipelines, migrations, and AI agent runs
128
128
  - `progress`: best for tracking real-time progress with percentage, like tasks, backups, migrations, syncs, or uploads
129
+ - `alert`: best for status updates, such as feature adoption, reactivation, onboarding blockers, incidents, escalations, and other operational states
129
130
 
130
131
  ### Start & Update Live Activity
131
132
 
@@ -238,6 +239,39 @@ activitysmith.live_activities.stream(
238
239
  )
239
240
  ```
240
241
 
242
+ #### Alert
243
+
244
+ <p align="center">
245
+ <img
246
+ src="https://cdn.activitysmith.com/features/alert-live-activity.png"
247
+ alt="Alert Live Activity stream example"
248
+ width="680"
249
+ />
250
+ </p>
251
+
252
+ ```ruby
253
+ activitysmith.live_activities.stream(
254
+ "customer-ops",
255
+ {
256
+ content_state: ActivitySmith::LiveActivities.content_state(
257
+ title: "Reactivation",
258
+ message: "Lumen came back after 2 weeks",
259
+ type: ActivitySmith::LiveActivities::TYPE_ALERT,
260
+ icon: ActivitySmith::LiveActivities.alert_icon("cloud.sun", color: "yellow"),
261
+ badge: ActivitySmith::LiveActivities.alert_badge("Customer", color: "magenta")
262
+ )
263
+ }
264
+ )
265
+ ```
266
+
267
+ The `icon` symbol value is an Apple SF Symbol name. Browse the catalog with one of these tools:
268
+
269
+ - [ActivitySmith app](https://apps.apple.com/us/app/activitysmith/id6752254835) - Open Settings -> SF Symbols to browse 45 hand-picked icons ready to use
270
+ - [SF Symbols](https://developer.apple.com/sf-symbols/) - Apple's official macOS app
271
+ - [Interactful](https://apps.apple.com/app/interactful/id1528095640) - free third-party iOS app listing all SF Symbols under Foundations -> Iconography
272
+
273
+ `icon` and `badge` are optional. If you omit either one, that element is not shown in the Live Activity.
274
+
241
275
  ### End Live Activity
242
276
 
243
277
  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 +297,7 @@ activitysmith.live_activities.end_stream(
263
297
  ### Live Activity Action
264
298
 
265
299
  Live Activities can include one optional action button. Use it to open a URL from the Live Activity or trigger a backend webhook.
300
+ 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
301
 
267
302
  <p align="center">
268
303
  <img
@@ -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, with optional icon and badge. 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
 
@@ -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 for type=alert.
45
+ attr_accessor :icon
46
+
47
+ # Optional badge for type=alert.
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')
@@ -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
@@ -253,11 +282,12 @@ module OpenapiClient
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
@@ -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, with optional icon and badge. 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
 
@@ -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 for type=alert.
45
+ attr_accessor :icon
46
+
47
+ # Optional badge for type=alert.
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')
@@ -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
@@ -243,12 +272,13 @@ module OpenapiClient
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
@@ -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
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Update 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 updating an existing activity. You can increase or decrease number_of_steps during updates.
17
+ # Update 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, with optional icon and badge. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
18
18
  class ContentStateUpdate
19
19
  attr_accessor :title
20
20
 
@@ -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 for type=alert.
45
+ attr_accessor :icon
46
+
47
+ # Optional badge for type=alert.
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.
@@ -83,6 +92,9 @@ module OpenapiClient
83
92
  :'value' => :'value',
84
93
  :'upper_limit' => :'upper_limit',
85
94
  :'metrics' => :'metrics',
95
+ :'message' => :'message',
96
+ :'icon' => :'icon',
97
+ :'badge' => :'badge',
86
98
  :'type' => :'type',
87
99
  :'color' => :'color',
88
100
  :'step_color' => :'step_color',
@@ -106,6 +118,9 @@ module OpenapiClient
106
118
  :'value' => :'Float',
107
119
  :'upper_limit' => :'Float',
108
120
  :'metrics' => :'Array<ActivityMetric>',
121
+ :'message' => :'String',
122
+ :'icon' => :'LiveActivityAlertIcon',
123
+ :'badge' => :'LiveActivityAlertBadge',
109
124
  :'type' => :'String',
110
125
  :'color' => :'String',
111
126
  :'step_color' => :'String',
@@ -170,14 +185,24 @@ module OpenapiClient
170
185
  end
171
186
  end
172
187
 
188
+ if attributes.key?(:'message')
189
+ self.message = attributes[:'message']
190
+ end
191
+
192
+ if attributes.key?(:'icon')
193
+ self.icon = attributes[:'icon']
194
+ end
195
+
196
+ if attributes.key?(:'badge')
197
+ self.badge = attributes[:'badge']
198
+ end
199
+
173
200
  if attributes.key?(:'type')
174
201
  self.type = attributes[:'type']
175
202
  end
176
203
 
177
204
  if attributes.key?(:'color')
178
205
  self.color = attributes[:'color']
179
- else
180
- self.color = 'blue'
181
206
  end
182
207
 
183
208
  if attributes.key?(:'step_color')
@@ -224,6 +249,10 @@ module OpenapiClient
224
249
  invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
225
250
  end
226
251
 
252
+ if !@message.nil? && @message.to_s.length < 1
253
+ invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
254
+ end
255
+
227
256
  invalid_properties
228
257
  end
229
258
 
@@ -238,11 +267,12 @@ module OpenapiClient
238
267
  return false if !@percentage.nil? && @percentage < 0
239
268
  return false if !@metrics.nil? && @metrics.length > 8
240
269
  return false if !@metrics.nil? && @metrics.length < 1
241
- type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
270
+ return false if !@message.nil? && @message.to_s.length < 1
271
+ type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
242
272
  return false unless type_validator.valid?(@type)
243
- color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
273
+ color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
244
274
  return false unless color_validator.valid?(@color)
245
- step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
275
+ step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
246
276
  return false unless step_color_validator.valid?(@step_color)
247
277
  true
248
278
  end
@@ -311,10 +341,24 @@ module OpenapiClient
311
341
  @metrics = metrics
312
342
  end
313
343
 
344
+ # Custom attribute writer method with validation
345
+ # @param [Object] message Value to be assigned
346
+ def message=(message)
347
+ if message.nil?
348
+ fail ArgumentError, 'message cannot be nil'
349
+ end
350
+
351
+ if message.to_s.length < 1
352
+ fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
353
+ end
354
+
355
+ @message = message
356
+ end
357
+
314
358
  # Custom attribute writer method checking allowed values (enum).
315
359
  # @param [Object] type Object to be assigned
316
360
  def type=(type)
317
- validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
361
+ validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
318
362
  unless validator.valid?(type)
319
363
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
320
364
  end
@@ -324,7 +368,7 @@ module OpenapiClient
324
368
  # Custom attribute writer method checking allowed values (enum).
325
369
  # @param [Object] color Object to be assigned
326
370
  def color=(color)
327
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
371
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
328
372
  unless validator.valid?(color)
329
373
  fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
330
374
  end
@@ -334,7 +378,7 @@ module OpenapiClient
334
378
  # Custom attribute writer method checking allowed values (enum).
335
379
  # @param [Object] step_color Object to be assigned
336
380
  def step_color=(step_color)
337
- validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
381
+ validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
338
382
  unless validator.valid?(step_color)
339
383
  fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
340
384
  end
@@ -354,6 +398,9 @@ module OpenapiClient
354
398
  value == o.value &&
355
399
  upper_limit == o.upper_limit &&
356
400
  metrics == o.metrics &&
401
+ message == o.message &&
402
+ icon == o.icon &&
403
+ badge == o.badge &&
357
404
  type == o.type &&
358
405
  color == o.color &&
359
406
  step_color == o.step_color &&
@@ -369,7 +416,7 @@ module OpenapiClient
369
416
  # Calculates hash code according to all attributes.
370
417
  # @return [Integer] Hash code
371
418
  def hash
372
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors].hash
419
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, message, icon, badge, type, color, step_color, step_colors].hash
373
420
  end
374
421
 
375
422
  # Builds the object from hash