activitysmith 1.10.0 → 1.11.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.
@@ -15,6 +15,9 @@ require 'time'
15
15
 
16
16
  module OpenapiClient
17
17
  class PushNotificationRequest
18
+ # Additional information shown in notification and Live Activity details in ActivitySmith. Not displayed in the Push Notification or Live Activity on the device. Values must be strings, finite numbers, or booleans. At most 50 entries and 16 KB of serialized UTF-8 JSON. Omit on updates to preserve existing Metadata; send {} to clear it.
19
+ attr_accessor :metadata
20
+
18
21
  attr_accessor :title
19
22
 
20
23
  attr_accessor :message
@@ -24,7 +27,7 @@ module OpenapiClient
24
27
  # 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`.
25
28
  attr_accessor :media
26
29
 
27
- # Optional HTTP URL, HTTPS URL, or shortcuts://run-shortcut?name=... URL opened when the user taps the notification body. Use shortcuts://run-shortcut?name=... to run a specific iPhone Shortcut that already exists on the user's device. Overrides the default tap target from `media` when both are provided.
30
+ # 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.
28
31
  attr_accessor :redirection
29
32
 
30
33
  # Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
@@ -44,6 +47,7 @@ module OpenapiClient
44
47
  # Attribute mapping from ruby-style variable name to JSON key.
45
48
  def self.attribute_map
46
49
  {
50
+ :'metadata' => :'metadata',
47
51
  :'title' => :'title',
48
52
  :'message' => :'message',
49
53
  :'subtitle' => :'subtitle',
@@ -66,6 +70,7 @@ module OpenapiClient
66
70
  # Attribute type mapping.
67
71
  def self.openapi_types
68
72
  {
73
+ :'metadata' => :'Hash<String, MetadataValue>',
69
74
  :'title' => :'String',
70
75
  :'message' => :'String',
71
76
  :'subtitle' => :'String',
@@ -101,6 +106,12 @@ module OpenapiClient
101
106
  h[k.to_sym] = v
102
107
  }
103
108
 
109
+ if attributes.key?(:'metadata')
110
+ if (value = attributes[:'metadata']).is_a?(Hash)
111
+ self.metadata = value
112
+ end
113
+ end
114
+
104
115
  if attributes.key?(:'title')
105
116
  self.title = attributes[:'title']
106
117
  else
@@ -157,6 +168,10 @@ module OpenapiClient
157
168
  def list_invalid_properties
158
169
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
159
170
  invalid_properties = Array.new
171
+ if !@metadata.nil? && @metadata.length > 50
172
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
173
+ end
174
+
160
175
  if @title.nil?
161
176
  invalid_properties.push('invalid value for "title", title cannot be nil.')
162
177
  end
@@ -166,7 +181,11 @@ module OpenapiClient
166
181
  invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
167
182
  end
168
183
 
169
- pattern = Regexp.new(/^(http|https|shortcuts):\/\//)
184
+ if !@redirection.nil? && @redirection.to_s.length > 2048
185
+ invalid_properties.push('invalid value for "redirection", the character length must be smaller than or equal to 2048.')
186
+ end
187
+
188
+ pattern = Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
170
189
  if !@redirection.nil? && @redirection !~ pattern
171
190
  invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
172
191
  end
@@ -182,13 +201,29 @@ module OpenapiClient
182
201
  # @return true if the model is valid
183
202
  def valid?
184
203
  warn '[DEPRECATED] the `valid?` method is obsolete'
204
+ return false if !@metadata.nil? && @metadata.length > 50
185
205
  return false if @title.nil?
186
206
  return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
187
- return false if !@redirection.nil? && @redirection !~ Regexp.new(/^(http|https|shortcuts):\/\//)
207
+ return false if !@redirection.nil? && @redirection.to_s.length > 2048
208
+ return false if !@redirection.nil? && @redirection !~ Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
188
209
  return false if !@actions.nil? && @actions.length > 4
189
210
  true
190
211
  end
191
212
 
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] metadata Value to be assigned
215
+ def metadata=(metadata)
216
+ if metadata.nil?
217
+ fail ArgumentError, 'metadata cannot be nil'
218
+ end
219
+
220
+ if metadata.length > 50
221
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
222
+ end
223
+
224
+ @metadata = metadata
225
+ end
226
+
192
227
  # Custom attribute writer method with validation
193
228
  # @param [Object] media Value to be assigned
194
229
  def media=(media)
@@ -211,7 +246,11 @@ module OpenapiClient
211
246
  fail ArgumentError, 'redirection cannot be nil'
212
247
  end
213
248
 
214
- pattern = Regexp.new(/^(http|https|shortcuts):\/\//)
249
+ if redirection.to_s.length > 2048
250
+ fail ArgumentError, 'invalid value for "redirection", the character length must be smaller than or equal to 2048.'
251
+ end
252
+
253
+ pattern = Regexp.new(/^[A-Za-z][A-Za-z0-9+.-]*:/)
215
254
  if redirection !~ pattern
216
255
  fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
217
256
  end
@@ -238,6 +277,7 @@ module OpenapiClient
238
277
  def ==(o)
239
278
  return true if self.equal?(o)
240
279
  self.class == o.class &&
280
+ metadata == o.metadata &&
241
281
  title == o.title &&
242
282
  message == o.message &&
243
283
  subtitle == o.subtitle &&
@@ -260,7 +300,7 @@ module OpenapiClient
260
300
  # Calculates hash code according to all attributes.
261
301
  # @return [Integer] Hash code
262
302
  def hash
263
- [title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
303
+ [metadata, title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
264
304
  end
265
305
 
266
306
  # Builds the object from hash
@@ -0,0 +1,105 @@
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
+ module UpdateAppIconBadgeCount422Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'AppIconBadgeCountUpdateError',
23
+ :'NoRecipientsError'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_one_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = OpenapiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -11,5 +11,5 @@ Generator version: 7.7.0
11
11
  =end
12
12
 
13
13
  module OpenapiClient
14
- VERSION = '1.10.0'
14
+ VERSION = '1.11.0'
15
15
  end
@@ -20,6 +20,7 @@ require 'activitysmith_openapi/configuration'
20
20
  require 'activitysmith_openapi/models/activity_metric'
21
21
  require 'activitysmith_openapi/models/activity_metric_value'
22
22
  require 'activitysmith_openapi/models/alert_payload'
23
+ require 'activitysmith_openapi/models/app_icon_badge_count_update_error'
23
24
  require 'activitysmith_openapi/models/app_icon_badge_count_update_request'
24
25
  require 'activitysmith_openapi/models/app_icon_badge_count_update_response'
25
26
  require 'activitysmith_openapi/models/bad_request_error'
@@ -45,6 +46,7 @@ require 'activitysmith_openapi/models/live_activity_stream_request'
45
46
  require 'activitysmith_openapi/models/live_activity_update_request'
46
47
  require 'activitysmith_openapi/models/live_activity_update_response'
47
48
  require 'activitysmith_openapi/models/live_activity_webhook_method'
49
+ require 'activitysmith_openapi/models/metadata_value'
48
50
  require 'activitysmith_openapi/models/metric_error'
49
51
  require 'activitysmith_openapi/models/metric_value_update_request'
50
52
  require 'activitysmith_openapi/models/metric_value_update_request_value'
@@ -59,6 +61,7 @@ require 'activitysmith_openapi/models/push_notification_webhook_method'
59
61
  require 'activitysmith_openapi/models/rate_limit_error'
60
62
  require 'activitysmith_openapi/models/send_push_notification429_response'
61
63
  require 'activitysmith_openapi/models/stream_content_state'
64
+ require 'activitysmith_openapi/models/update_app_icon_badge_count422_response'
62
65
 
63
66
  # APIs
64
67
  require 'activitysmith_openapi/api/app_icon_badges_api'
@@ -0,0 +1,6 @@
1
+ {
2
+ "repository": "ActivitySmithHQ/activitysmith-backend",
3
+ "commit": "49ad7b083b50f53bc3d81edb77ca6597845160a2",
4
+ "path": "openapi.json",
5
+ "sha256": "b7e33cd485df8ddc5d7fb7b57b61106fd6f8ff3ffa7cc7bef4ac1ccbbb0cede7"
6
+ }
@@ -47,12 +47,12 @@ module ActivitySmith
47
47
  )
48
48
  end
49
49
 
50
- def update(request, opts = {})
51
- @api.update_live_activity(normalize_live_activity_request(request), opts)
50
+ def update(request = nil, opts = {}, tags: nil, **request_fields)
51
+ @api.update_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
52
52
  end
53
53
 
54
- def end(request, opts = {})
55
- @api.end_live_activity(normalize_live_activity_request(request), opts)
54
+ def end(request = nil, opts = {}, tags: nil, **request_fields)
55
+ @api.end_live_activity(normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)), opts)
56
56
  end
57
57
 
58
58
  def stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
@@ -65,10 +65,10 @@ module ActivitySmith
65
65
  )
66
66
  end
67
67
 
68
- def end_stream(stream_key, request = nil, opts = {})
68
+ def end_stream(stream_key, request = nil, opts = {}, tags: nil, **request_fields)
69
69
  @api.end_live_activity_stream(
70
70
  stream_key,
71
- { live_activity_stream_delete_request: normalize_live_activity_request(request) }.merge(opts)
71
+ { live_activity_stream_delete_request: normalize_live_activity_request(with_tags(combine_request(request, request_fields), tags)) }.merge(opts)
72
72
  )
73
73
  end
74
74
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActivitySmith
4
- VERSION = "1.10.0"
4
+ VERSION = "1.11.0"
5
5
  end
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.10.0
4
+ version: 1.11.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-07-25 00:00:00.000000000 Z
11
+ date: 2026-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -86,6 +86,7 @@ files:
86
86
  - generated/activitysmith_openapi/models/activity_metric.rb
87
87
  - generated/activitysmith_openapi/models/activity_metric_value.rb
88
88
  - generated/activitysmith_openapi/models/alert_payload.rb
89
+ - generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb
89
90
  - generated/activitysmith_openapi/models/app_icon_badge_count_update_request.rb
90
91
  - generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb
91
92
  - generated/activitysmith_openapi/models/bad_request_error.rb
@@ -111,6 +112,7 @@ files:
111
112
  - generated/activitysmith_openapi/models/live_activity_update_request.rb
112
113
  - generated/activitysmith_openapi/models/live_activity_update_response.rb
113
114
  - generated/activitysmith_openapi/models/live_activity_webhook_method.rb
115
+ - generated/activitysmith_openapi/models/metadata_value.rb
114
116
  - generated/activitysmith_openapi/models/metric_error.rb
115
117
  - generated/activitysmith_openapi/models/metric_value_update_request.rb
116
118
  - generated/activitysmith_openapi/models/metric_value_update_request_value.rb
@@ -125,7 +127,9 @@ files:
125
127
  - generated/activitysmith_openapi/models/rate_limit_error.rb
126
128
  - generated/activitysmith_openapi/models/send_push_notification429_response.rb
127
129
  - generated/activitysmith_openapi/models/stream_content_state.rb
130
+ - generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb
128
131
  - generated/activitysmith_openapi/version.rb
132
+ - generated/openapi-source.json
129
133
  - lib/activitysmith.rb
130
134
  - lib/activitysmith/client.rb
131
135
  - lib/activitysmith/live_activities.rb