activitysmith 1.14.0 → 1.16.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +130 -12
  3. data/generated/activitysmith_openapi/api/app_icon_badges_api.rb +4 -4
  4. data/generated/activitysmith_openapi/api/devices_api.rb +100 -0
  5. data/generated/activitysmith_openapi/api/live_activities_api.rb +4 -4
  6. data/generated/activitysmith_openapi/api/metrics_api.rb +87 -4
  7. data/generated/activitysmith_openapi/api/push_notifications_api.rb +67 -0
  8. data/generated/activitysmith_openapi/models/account_device.rb +367 -0
  9. data/generated/activitysmith_openapi/models/account_device_list_response.rb +239 -0
  10. data/generated/activitysmith_openapi/models/account_device_list_response_meta.rb +299 -0
  11. data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +1 -1
  12. data/generated/activitysmith_openapi/models/content_state_start.rb +24 -3
  13. data/generated/activitysmith_openapi/models/content_state_update.rb +23 -2
  14. data/generated/activitysmith_openapi/models/live_activity_end_request.rb +42 -4
  15. data/generated/activitysmith_openapi/models/live_activity_start_request.rb +42 -4
  16. data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +42 -4
  17. data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +12 -1
  18. data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +42 -4
  19. data/generated/activitysmith_openapi/models/live_activity_update_request.rb +42 -4
  20. data/generated/activitysmith_openapi/models/metric.rb +411 -0
  21. data/generated/activitysmith_openapi/models/metric_response.rb +221 -0
  22. data/generated/activitysmith_openapi/models/metric_upsert_request.rb +370 -0
  23. data/generated/activitysmith_openapi/models/metric_value_update_response.rb +14 -4
  24. data/generated/activitysmith_openapi/models/no_recipients_error.rb +21 -1
  25. data/generated/activitysmith_openapi/models/push_notification_action.rb +1 -1
  26. data/generated/activitysmith_openapi/models/push_notification_dismiss_response.rb +257 -0
  27. data/generated/activitysmith_openapi/models/push_notification_replace_request.rb +1 -1
  28. data/generated/activitysmith_openapi/models/push_notification_request.rb +30 -1
  29. data/generated/activitysmith_openapi/models/stream_content_state.rb +24 -3
  30. data/generated/activitysmith_openapi/version.rb +1 -1
  31. data/generated/activitysmith_openapi.rb +8 -0
  32. data/generated/openapi-source.json +2 -2
  33. data/lib/activitysmith/client.rb +3 -1
  34. data/lib/activitysmith/devices.rb +30 -0
  35. data/lib/activitysmith/metrics.rb +15 -1
  36. data/lib/activitysmith/notifications.rb +11 -0
  37. data/lib/activitysmith/version.rb +1 -1
  38. data/lib/activitysmith.rb +1 -0
  39. metadata +11 -2
@@ -0,0 +1,257 @@
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
+ # Dismissal result. Devices clear the notification after this response, so it does not confirm that any device has cleared it.
18
+ class PushNotificationDismissResponse
19
+ # True when the dismissal is recorded.
20
+ attr_accessor :success
21
+
22
+ # ID of the dismissed Push Notification.
23
+ attr_accessor :notification_id
24
+
25
+ # When the notification was first dismissed. Repeat calls return the same time.
26
+ attr_accessor :dismissed_at
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'success' => :'success',
32
+ :'notification_id' => :'notification_id',
33
+ :'dismissed_at' => :'dismissed_at'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'success' => :'Boolean',
46
+ :'notification_id' => :'String',
47
+ :'dismissed_at' => :'Time'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PushNotificationDismissResponse` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PushNotificationDismissResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'success')
73
+ self.success = attributes[:'success']
74
+ else
75
+ self.success = nil
76
+ end
77
+
78
+ if attributes.key?(:'notification_id')
79
+ self.notification_id = attributes[:'notification_id']
80
+ else
81
+ self.notification_id = nil
82
+ end
83
+
84
+ if attributes.key?(:'dismissed_at')
85
+ self.dismissed_at = attributes[:'dismissed_at']
86
+ else
87
+ self.dismissed_at = nil
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if @success.nil?
97
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
98
+ end
99
+
100
+ if @notification_id.nil?
101
+ invalid_properties.push('invalid value for "notification_id", notification_id cannot be nil.')
102
+ end
103
+
104
+ if @dismissed_at.nil?
105
+ invalid_properties.push('invalid value for "dismissed_at", dismissed_at cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @success.nil?
116
+ return false if @notification_id.nil?
117
+ return false if @dismissed_at.nil?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ success == o.success &&
127
+ notification_id == o.notification_id &&
128
+ dismissed_at == o.dismissed_at
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [success, notification_id, dismissed_at].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = OpenapiClient.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end
@@ -31,7 +31,7 @@ module OpenapiClient
31
31
  # Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
32
32
  attr_accessor :media
33
33
 
34
- # Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
34
+ # Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
35
35
  attr_accessor :redirection
36
36
 
37
37
  # Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
@@ -33,7 +33,7 @@ module OpenapiClient
33
33
  # Optional HTTPS URL for an image, audio file, or video that users can preview or play when they expand the notification. If `redirection` is omitted, tapping the notification opens this URL. Cannot be combined with `actions`.
34
34
  attr_accessor :media
35
35
 
36
- # Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require iOS 1.13.4 build 2 or later and an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
36
+ # Optional HTTP, HTTPS, Shortcuts, or installed app URL opened when the user taps the notification body. Custom schemes such as spotify:// and spotify:track:123 require an installed handler; no web fallback is provided. Internal and executable schemes are blocked. Overrides the default tap target from media.
37
37
  attr_accessor :redirection
38
38
 
39
39
  # Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
@@ -43,6 +43,7 @@ module OpenapiClient
43
43
 
44
44
  attr_accessor :badge
45
45
 
46
+ # Optional sound for this Push Notification. Omit it to play the Push Notifications sound picked on the device. Passive Push Notifications play no sound. Sounds bundled with the ActivitySmith app: `arrive`, `bell`, `bells`, `bitflip`, `bloom`, `callout`, `chime`, `coin`, `corrupt`, `crest`, `cue`, `ding`, `drop`, `ember`, `emblem`, `flourish`, `glimmer`, `glint`, `glitch`, `lantern`, `nightfall`, `nudge`, `pixel`, `pop`, `signal`, `streak`, `tally`, `wand`, `whoosh`, `zip`. Use `default` for the sound picked on the device, or `none` for no sound.
46
47
  attr_accessor :sound
47
48
 
48
49
  attr_accessor :target
@@ -239,6 +240,14 @@ module OpenapiClient
239
240
  invalid_properties.push('invalid value for "actions", number of items must be less than or equal to 4.')
240
241
  end
241
242
 
243
+ if !@sound.nil? && @sound.to_s.length > 50
244
+ invalid_properties.push('invalid value for "sound", the character length must be smaller than or equal to 50.')
245
+ end
246
+
247
+ if !@sound.nil? && @sound.to_s.length < 1
248
+ invalid_properties.push('invalid value for "sound", the character length must be great than or equal to 1.')
249
+ end
250
+
242
251
  invalid_properties
243
252
  end
244
253
 
@@ -253,6 +262,8 @@ module OpenapiClient
253
262
  return false if !@redirection.nil? && @redirection.to_s.length > 2048
254
263
  return false if !@redirection.nil? && @redirection !~ Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
255
264
  return false if !@actions.nil? && @actions.length > 4
265
+ return false if !@sound.nil? && @sound.to_s.length > 50
266
+ return false if !@sound.nil? && @sound.to_s.length < 1
256
267
  true
257
268
  end
258
269
 
@@ -333,6 +344,24 @@ module OpenapiClient
333
344
  @actions = actions
334
345
  end
335
346
 
347
+ # Custom attribute writer method with validation
348
+ # @param [Object] sound Value to be assigned
349
+ def sound=(sound)
350
+ if sound.nil?
351
+ fail ArgumentError, 'sound cannot be nil'
352
+ end
353
+
354
+ if sound.to_s.length > 50
355
+ fail ArgumentError, 'invalid value for "sound", the character length must be smaller than or equal to 50.'
356
+ end
357
+
358
+ if sound.to_s.length < 1
359
+ fail ArgumentError, 'invalid value for "sound", the character length must be great than or equal to 1.'
360
+ end
361
+
362
+ @sound = sound
363
+ end
364
+
336
365
  # Checks equality by comparing each attribute.
337
366
  # @param [Object] Object to be compared
338
367
  def ==(o)
@@ -14,8 +14,9 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OpenapiClient
17
- # Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds to start or reset a bounded timer; omit duration_seconds on later updates to preserve the existing timer window.
17
+ # Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, alert, timer, and value types. For timer, send duration_seconds or timer_end_at to start or reset a bounded timer, and timer_start_at for a timer that started earlier. Omit them on later updates to preserve the existing timer window.
18
18
  class StreamContentState
19
+ # Title shown on the Live Activity. Send an empty string to show no title.
19
20
  attr_accessor :title
20
21
 
21
22
  attr_accessor :subtitle
@@ -35,9 +36,15 @@ module OpenapiClient
35
36
  # Maximum progress value. Use with value for progress.
36
37
  attr_accessor :upper_limit
37
38
 
38
- # Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window; omit it on later stream updates to preserve the existing timer window.
39
+ # Timer duration in seconds. For type=timer, send duration_seconds to start or reset the timer window, counted from timer_start_at when you send it. Omit it on later stream updates to preserve the existing timer window.
39
40
  attr_accessor :duration_seconds
40
41
 
42
+ # Use with type=timer. ISO 8601 date and time when the timer started. It can be in the past, so a countdown that started earlier shows the time already gone in its progress bar. Defaults to the request time. Must not be in the future.
43
+ attr_accessor :timer_start_at
44
+
45
+ # Use with type=timer. ISO 8601 date and time when the countdown ends. Must be after timer_start_at, or in the future when timer_start_at is omitted. Send duration_seconds or timer_end_at, not both. On later stream updates, send timer_end_at alone to move the end and keep the current start.
46
+ attr_accessor :timer_end_at
47
+
41
48
  # Use with type=timer. When true or omitted, the timer counts down from duration_seconds. Set false for an elapsed timer; omit duration_seconds for an open-ended elapsed timer.
42
49
  attr_accessor :counts_down
43
50
 
@@ -107,6 +114,8 @@ module OpenapiClient
107
114
  :'value' => :'value',
108
115
  :'upper_limit' => :'upper_limit',
109
116
  :'duration_seconds' => :'duration_seconds',
117
+ :'timer_start_at' => :'timer_start_at',
118
+ :'timer_end_at' => :'timer_end_at',
110
119
  :'counts_down' => :'counts_down',
111
120
  :'is_running' => :'is_running',
112
121
  :'type' => :'type',
@@ -138,6 +147,8 @@ module OpenapiClient
138
147
  :'value' => :'LiveActivityValue',
139
148
  :'upper_limit' => :'Float',
140
149
  :'duration_seconds' => :'Float',
150
+ :'timer_start_at' => :'Time',
151
+ :'timer_end_at' => :'Time',
141
152
  :'counts_down' => :'Boolean',
142
153
  :'is_running' => :'Boolean',
143
154
  :'type' => :'String',
@@ -208,6 +219,14 @@ module OpenapiClient
208
219
  self.duration_seconds = attributes[:'duration_seconds']
209
220
  end
210
221
 
222
+ if attributes.key?(:'timer_start_at')
223
+ self.timer_start_at = attributes[:'timer_start_at']
224
+ end
225
+
226
+ if attributes.key?(:'timer_end_at')
227
+ self.timer_end_at = attributes[:'timer_end_at']
228
+ end
229
+
211
230
  if attributes.key?(:'counts_down')
212
231
  self.counts_down = attributes[:'counts_down']
213
232
  else
@@ -485,6 +504,8 @@ module OpenapiClient
485
504
  value == o.value &&
486
505
  upper_limit == o.upper_limit &&
487
506
  duration_seconds == o.duration_seconds &&
507
+ timer_start_at == o.timer_start_at &&
508
+ timer_end_at == o.timer_end_at &&
488
509
  counts_down == o.counts_down &&
489
510
  is_running == o.is_running &&
490
511
  type == o.type &&
@@ -508,7 +529,7 @@ module OpenapiClient
508
529
  # Calculates hash code according to all attributes.
509
530
  # @return [Integer] Hash code
510
531
  def hash
511
- [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, duration_seconds, counts_down, is_running, type, color, step_color, step_colors, metrics, message, icon, badge, auto_dismiss_seconds, auto_dismiss_minutes].hash
532
+ [title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, duration_seconds, timer_start_at, timer_end_at, counts_down, is_running, type, color, step_color, step_colors, metrics, message, icon, badge, auto_dismiss_seconds, auto_dismiss_minutes].hash
512
533
  end
513
534
 
514
535
  # Builds the object from hash
@@ -11,5 +11,5 @@ Generator version: 7.7.0
11
11
  =end
12
12
 
13
13
  module OpenapiClient
14
- VERSION = '1.13.0'
14
+ VERSION = '1.15.0'
15
15
  end
@@ -17,6 +17,9 @@ require 'activitysmith_openapi/version'
17
17
  require 'activitysmith_openapi/configuration'
18
18
 
19
19
  # Models
20
+ require 'activitysmith_openapi/models/account_device'
21
+ require 'activitysmith_openapi/models/account_device_list_response'
22
+ require 'activitysmith_openapi/models/account_device_list_response_meta'
20
23
  require 'activitysmith_openapi/models/activity_metric'
21
24
  require 'activitysmith_openapi/models/activity_metric_value'
22
25
  require 'activitysmith_openapi/models/alert_payload'
@@ -50,7 +53,10 @@ require 'activitysmith_openapi/models/live_activity_update_response'
50
53
  require 'activitysmith_openapi/models/live_activity_value'
51
54
  require 'activitysmith_openapi/models/live_activity_webhook_method'
52
55
  require 'activitysmith_openapi/models/metadata_value'
56
+ require 'activitysmith_openapi/models/metric'
53
57
  require 'activitysmith_openapi/models/metric_error'
58
+ require 'activitysmith_openapi/models/metric_response'
59
+ require 'activitysmith_openapi/models/metric_upsert_request'
54
60
  require 'activitysmith_openapi/models/metric_value_update_request'
55
61
  require 'activitysmith_openapi/models/metric_value_update_request_value'
56
62
  require 'activitysmith_openapi/models/metric_value_update_response'
@@ -59,6 +65,7 @@ require 'activitysmith_openapi/models/not_found_error'
59
65
  require 'activitysmith_openapi/models/push_interruption_level'
60
66
  require 'activitysmith_openapi/models/push_notification_action'
61
67
  require 'activitysmith_openapi/models/push_notification_action_type'
68
+ require 'activitysmith_openapi/models/push_notification_dismiss_response'
62
69
  require 'activitysmith_openapi/models/push_notification_replace_request'
63
70
  require 'activitysmith_openapi/models/push_notification_replace_response'
64
71
  require 'activitysmith_openapi/models/push_notification_request'
@@ -71,6 +78,7 @@ require 'activitysmith_openapi/models/update_app_icon_badge_count422_response'
71
78
 
72
79
  # APIs
73
80
  require 'activitysmith_openapi/api/app_icon_badges_api'
81
+ require 'activitysmith_openapi/api/devices_api'
74
82
  require 'activitysmith_openapi/api/live_activities_api'
75
83
  require 'activitysmith_openapi/api/metrics_api'
76
84
  require 'activitysmith_openapi/api/push_notifications_api'
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "repository": "ActivitySmithHQ/activitysmith-backend",
3
- "commit": "dd6757c5defa3d1e6524faef789b6829184fb852",
3
+ "commit": "0e64cfe1c855105aff7c2719df28759ae2f2d1cf",
4
4
  "path": "openapi.json",
5
- "sha256": "24dae2d064095351d5e5cf800228e64a2d23c40b1e31a9754503081ddf31c5d8"
5
+ "sha256": "72b820a2f8447c24f2f11a3a9b4bf89709e668f39037715498c07565cf075642"
6
6
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ActivitySmith
4
4
  class Client
5
- attr_reader :notifications, :live_activities, :metrics
5
+ attr_reader :notifications, :live_activities, :metrics, :devices
6
6
 
7
7
  def initialize(api_key:)
8
8
  raise ArgumentError, "ActivitySmith: api_key is required" if api_key.to_s.strip.empty?
@@ -19,6 +19,7 @@ module ActivitySmith
19
19
  @notifications = Notifications.new(OpenapiClient::PushNotificationsApi.new(api_client))
20
20
  @live_activities = LiveActivities.new(OpenapiClient::LiveActivitiesApi.new(api_client))
21
21
  @metrics = Metrics.new(OpenapiClient::MetricsApi.new(api_client))
22
+ @devices = Devices.new(OpenapiClient::DevicesApi.new(api_client))
22
23
  @app_icon_badges = OpenapiClient::AppIconBadgesApi.new(api_client)
23
24
  end
24
25
 
@@ -53,6 +54,7 @@ module ActivitySmith
53
54
  "OpenapiClient::PushNotificationsApi",
54
55
  "OpenapiClient::LiveActivitiesApi",
55
56
  "OpenapiClient::MetricsApi",
57
+ "OpenapiClient::DevicesApi",
56
58
  "OpenapiClient::AppIconBadgesApi"
57
59
  ].reject { |name| constant_defined?(name) }
58
60
 
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivitySmith
4
+ class Devices
5
+ def initialize(api)
6
+ @api = api
7
+ end
8
+
9
+ # Lists the iPhones and iPads paired to the account, active devices first.
10
+ def list(limit: nil, offset: nil, include_inactive: nil, **opts)
11
+ query = { limit: limit, offset: offset, include_inactive: include_inactive }.compact
12
+ @api.list_account_devices(opts.merge(query))
13
+ end
14
+
15
+ # Generated-style alias.
16
+ def list_account_devices(opts = {})
17
+ @api.list_account_devices(opts)
18
+ end
19
+
20
+ def method_missing(name, *args, &block)
21
+ return @api.public_send(name, *args, &block) if @api.respond_to?(name)
22
+
23
+ super
24
+ end
25
+
26
+ def respond_to_missing?(name, include_private = false)
27
+ @api.respond_to?(name, include_private) || super
28
+ end
29
+ end
30
+ end
@@ -10,7 +10,21 @@ module ActivitySmith
10
10
  @api.update_metric_value(key, metric_value_request(value_or_request, timestamp), opts)
11
11
  end
12
12
 
13
- # Backward-compatible generated-style alias.
13
+ # Creates the metric, or updates the fields sent for an existing one.
14
+ # Omitted fields keep their current values, so it is safe to call on every start.
15
+ def create(key, definition = nil, label: nil, format: nil, currency_code: nil, unit: nil, unit_spacing: nil, **opts)
16
+ fields = { label: label, format: format, currency_code: currency_code, unit: unit, unit_spacing: unit_spacing }.compact
17
+ request = fields.empty? ? definition : (definition || {}).to_h.merge(fields)
18
+ request = nil if request.respond_to?(:empty?) && request.empty?
19
+ opts = opts.merge(metric_upsert_request: request) unless request.nil?
20
+ @api.upsert_metric(key, opts)
21
+ end
22
+
23
+ # Backward-compatible generated-style aliases.
24
+ def upsert_metric(key, opts = {})
25
+ @api.upsert_metric(key, opts)
26
+ end
27
+
14
28
  def update_metric_value(key, metric_value_update_request, opts = {})
15
29
  @api.update_metric_value(key, metric_value_update_request, opts)
16
30
  end
@@ -30,6 +30,17 @@ module ActivitySmith
30
30
  replace(notification_id, push_notification_replace_request, opts, tags: tags, **request_fields)
31
31
  end
32
32
 
33
+ # Clears a sent Push Notification from the Lock Screen and Notification Center,
34
+ # using the notification_id returned by send. History keeps it.
35
+ def dismiss(notification_id, opts = {})
36
+ @api.dismiss_push_notification(notification_id, opts)
37
+ end
38
+
39
+ # Generated-style alias.
40
+ def dismiss_push_notification(notification_id, opts = {})
41
+ dismiss(notification_id, opts)
42
+ end
43
+
33
44
  def method_missing(name, *args, &block)
34
45
  return @api.public_send(name, *args, &block) if @api.respond_to?(name)
35
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivitySmith
4
- VERSION = "1.14.0"
4
+ VERSION = "1.16.0"
5
5
  end
data/lib/activitysmith.rb CHANGED
@@ -6,4 +6,5 @@ require_relative "activitysmith/push_interruption_level"
6
6
  require_relative "activitysmith/notifications"
7
7
  require_relative "activitysmith/live_activities"
8
8
  require_relative "activitysmith/metrics"
9
+ require_relative "activitysmith/devices"
9
10
  require_relative "activitysmith/client"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activitysmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ActivitySmith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-12 00:00:00.000000000 Z
11
+ date: 2026-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -77,12 +77,16 @@ files:
77
77
  - README.md
78
78
  - generated/activitysmith_openapi.rb
79
79
  - generated/activitysmith_openapi/api/app_icon_badges_api.rb
80
+ - generated/activitysmith_openapi/api/devices_api.rb
80
81
  - generated/activitysmith_openapi/api/live_activities_api.rb
81
82
  - generated/activitysmith_openapi/api/metrics_api.rb
82
83
  - generated/activitysmith_openapi/api/push_notifications_api.rb
83
84
  - generated/activitysmith_openapi/api_client.rb
84
85
  - generated/activitysmith_openapi/api_error.rb
85
86
  - generated/activitysmith_openapi/configuration.rb
87
+ - generated/activitysmith_openapi/models/account_device.rb
88
+ - generated/activitysmith_openapi/models/account_device_list_response.rb
89
+ - generated/activitysmith_openapi/models/account_device_list_response_meta.rb
86
90
  - generated/activitysmith_openapi/models/activity_metric.rb
87
91
  - generated/activitysmith_openapi/models/activity_metric_value.rb
88
92
  - generated/activitysmith_openapi/models/alert_payload.rb
@@ -116,7 +120,10 @@ files:
116
120
  - generated/activitysmith_openapi/models/live_activity_value.rb
117
121
  - generated/activitysmith_openapi/models/live_activity_webhook_method.rb
118
122
  - generated/activitysmith_openapi/models/metadata_value.rb
123
+ - generated/activitysmith_openapi/models/metric.rb
119
124
  - generated/activitysmith_openapi/models/metric_error.rb
125
+ - generated/activitysmith_openapi/models/metric_response.rb
126
+ - generated/activitysmith_openapi/models/metric_upsert_request.rb
120
127
  - generated/activitysmith_openapi/models/metric_value_update_request.rb
121
128
  - generated/activitysmith_openapi/models/metric_value_update_request_value.rb
122
129
  - generated/activitysmith_openapi/models/metric_value_update_response.rb
@@ -125,6 +132,7 @@ files:
125
132
  - generated/activitysmith_openapi/models/push_interruption_level.rb
126
133
  - generated/activitysmith_openapi/models/push_notification_action.rb
127
134
  - generated/activitysmith_openapi/models/push_notification_action_type.rb
135
+ - generated/activitysmith_openapi/models/push_notification_dismiss_response.rb
128
136
  - generated/activitysmith_openapi/models/push_notification_replace_request.rb
129
137
  - generated/activitysmith_openapi/models/push_notification_replace_response.rb
130
138
  - generated/activitysmith_openapi/models/push_notification_request.rb
@@ -138,6 +146,7 @@ files:
138
146
  - generated/openapi-source.json
139
147
  - lib/activitysmith.rb
140
148
  - lib/activitysmith/client.rb
149
+ - lib/activitysmith/devices.rb
141
150
  - lib/activitysmith/live_activities.rb
142
151
  - lib/activitysmith/metrics.rb
143
152
  - lib/activitysmith/notifications.rb