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.
@@ -252,6 +252,13 @@ module OpenapiClient
252
252
  key: 'Authorization',
253
253
  value: "Bearer #{access_token_with_refresh}"
254
254
  },
255
+ 'mcpOAuth' =>
256
+ {
257
+ type: 'oauth2',
258
+ in: 'header',
259
+ key: 'Authorization',
260
+ value: "Bearer #{access_token_with_refresh}"
261
+ },
255
262
  }
256
263
  end
257
264
 
@@ -0,0 +1,386 @@
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
+ class AppIconBadgeCountUpdateError
18
+ attr_accessor :error
19
+
20
+ attr_accessor :code
21
+
22
+ attr_accessor :message
23
+
24
+ attr_accessor :badge
25
+
26
+ attr_accessor :devices_targeted
27
+
28
+ attr_accessor :devices_updated
29
+
30
+ attr_accessor :users_updated
31
+
32
+ # Deprecated compatibility alias for devices_updated.
33
+ attr_accessor :devices_notified
34
+
35
+ attr_accessor :effective_channel_slugs
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'error' => :'error',
63
+ :'code' => :'code',
64
+ :'message' => :'message',
65
+ :'badge' => :'badge',
66
+ :'devices_targeted' => :'devices_targeted',
67
+ :'devices_updated' => :'devices_updated',
68
+ :'users_updated' => :'users_updated',
69
+ :'devices_notified' => :'devices_notified',
70
+ :'effective_channel_slugs' => :'effective_channel_slugs'
71
+ }
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'error' => :'String',
83
+ :'code' => :'String',
84
+ :'message' => :'String',
85
+ :'badge' => :'Integer',
86
+ :'devices_targeted' => :'Integer',
87
+ :'devices_updated' => :'Integer',
88
+ :'users_updated' => :'Integer',
89
+ :'devices_notified' => :'Integer',
90
+ :'effective_channel_slugs' => :'Array<String>'
91
+ }
92
+ end
93
+
94
+ # List of attributes with nullable: true
95
+ def self.openapi_nullable
96
+ Set.new([
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AppIconBadgeCountUpdateError` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AppIconBadgeCountUpdateError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'error')
116
+ self.error = attributes[:'error']
117
+ else
118
+ self.error = nil
119
+ end
120
+
121
+ if attributes.key?(:'code')
122
+ self.code = attributes[:'code']
123
+ else
124
+ self.code = nil
125
+ end
126
+
127
+ if attributes.key?(:'message')
128
+ self.message = attributes[:'message']
129
+ else
130
+ self.message = nil
131
+ end
132
+
133
+ if attributes.key?(:'badge')
134
+ self.badge = attributes[:'badge']
135
+ else
136
+ self.badge = nil
137
+ end
138
+
139
+ if attributes.key?(:'devices_targeted')
140
+ self.devices_targeted = attributes[:'devices_targeted']
141
+ end
142
+
143
+ if attributes.key?(:'devices_updated')
144
+ self.devices_updated = attributes[:'devices_updated']
145
+ else
146
+ self.devices_updated = nil
147
+ end
148
+
149
+ if attributes.key?(:'users_updated')
150
+ self.users_updated = attributes[:'users_updated']
151
+ end
152
+
153
+ if attributes.key?(:'devices_notified')
154
+ self.devices_notified = attributes[:'devices_notified']
155
+ end
156
+
157
+ if attributes.key?(:'effective_channel_slugs')
158
+ if (value = attributes[:'effective_channel_slugs']).is_a?(Array)
159
+ self.effective_channel_slugs = value
160
+ end
161
+ end
162
+ end
163
+
164
+ # Show invalid properties with the reasons. Usually used together with valid?
165
+ # @return Array for valid properties with the reasons
166
+ def list_invalid_properties
167
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
168
+ invalid_properties = Array.new
169
+ if @error.nil?
170
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
171
+ end
172
+
173
+ if @code.nil?
174
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
175
+ end
176
+
177
+ if @message.nil?
178
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
179
+ end
180
+
181
+ if @badge.nil?
182
+ invalid_properties.push('invalid value for "badge", badge cannot be nil.')
183
+ end
184
+
185
+ if @badge > 2147483647
186
+ invalid_properties.push('invalid value for "badge", must be smaller than or equal to 2147483647.')
187
+ end
188
+
189
+ if @badge < 0
190
+ invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
191
+ end
192
+
193
+ if @devices_updated.nil?
194
+ invalid_properties.push('invalid value for "devices_updated", devices_updated cannot be nil.')
195
+ end
196
+
197
+ invalid_properties
198
+ end
199
+
200
+ # Check to see if the all the properties in the model are valid
201
+ # @return true if the model is valid
202
+ def valid?
203
+ warn '[DEPRECATED] the `valid?` method is obsolete'
204
+ return false if @error.nil?
205
+ return false if @code.nil?
206
+ code_validator = EnumAttributeValidator.new('String', ["badge_device_disconnected", "badge_update_failed"])
207
+ return false unless code_validator.valid?(@code)
208
+ return false if @message.nil?
209
+ return false if @badge.nil?
210
+ return false if @badge > 2147483647
211
+ return false if @badge < 0
212
+ return false if @devices_updated.nil?
213
+ true
214
+ end
215
+
216
+ # Custom attribute writer method checking allowed values (enum).
217
+ # @param [Object] code Object to be assigned
218
+ def code=(code)
219
+ validator = EnumAttributeValidator.new('String', ["badge_device_disconnected", "badge_update_failed"])
220
+ unless validator.valid?(code)
221
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
222
+ end
223
+ @code = code
224
+ end
225
+
226
+ # Custom attribute writer method with validation
227
+ # @param [Object] badge Value to be assigned
228
+ def badge=(badge)
229
+ if badge.nil?
230
+ fail ArgumentError, 'badge cannot be nil'
231
+ end
232
+
233
+ if badge > 2147483647
234
+ fail ArgumentError, 'invalid value for "badge", must be smaller than or equal to 2147483647.'
235
+ end
236
+
237
+ if badge < 0
238
+ fail ArgumentError, 'invalid value for "badge", must be greater than or equal to 0.'
239
+ end
240
+
241
+ @badge = badge
242
+ end
243
+
244
+ # Checks equality by comparing each attribute.
245
+ # @param [Object] Object to be compared
246
+ def ==(o)
247
+ return true if self.equal?(o)
248
+ self.class == o.class &&
249
+ error == o.error &&
250
+ code == o.code &&
251
+ message == o.message &&
252
+ badge == o.badge &&
253
+ devices_targeted == o.devices_targeted &&
254
+ devices_updated == o.devices_updated &&
255
+ users_updated == o.users_updated &&
256
+ devices_notified == o.devices_notified &&
257
+ effective_channel_slugs == o.effective_channel_slugs
258
+ end
259
+
260
+ # @see the `==` method
261
+ # @param [Object] Object to be compared
262
+ def eql?(o)
263
+ self == o
264
+ end
265
+
266
+ # Calculates hash code according to all attributes.
267
+ # @return [Integer] Hash code
268
+ def hash
269
+ [error, code, message, badge, devices_targeted, devices_updated, users_updated, devices_notified, effective_channel_slugs].hash
270
+ end
271
+
272
+ # Builds the object from hash
273
+ # @param [Hash] attributes Model attributes in the form of hash
274
+ # @return [Object] Returns the model itself
275
+ def self.build_from_hash(attributes)
276
+ return nil unless attributes.is_a?(Hash)
277
+ attributes = attributes.transform_keys(&:to_sym)
278
+ transformed_hash = {}
279
+ openapi_types.each_pair do |key, type|
280
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
281
+ transformed_hash["#{key}"] = nil
282
+ elsif type =~ /\AArray<(.*)>/i
283
+ # check to ensure the input is an array given that the attribute
284
+ # is documented as an array but the input is not
285
+ if attributes[attribute_map[key]].is_a?(Array)
286
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
287
+ end
288
+ elsif !attributes[attribute_map[key]].nil?
289
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
290
+ end
291
+ end
292
+ new(transformed_hash)
293
+ end
294
+
295
+ # Deserializes the data based on type
296
+ # @param string type Data type
297
+ # @param string value Value to be deserialized
298
+ # @return [Object] Deserialized data
299
+ def self._deserialize(type, value)
300
+ case type.to_sym
301
+ when :Time
302
+ Time.parse(value)
303
+ when :Date
304
+ Date.parse(value)
305
+ when :String
306
+ value.to_s
307
+ when :Integer
308
+ value.to_i
309
+ when :Float
310
+ value.to_f
311
+ when :Boolean
312
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
313
+ true
314
+ else
315
+ false
316
+ end
317
+ when :Object
318
+ # generic object (usually a Hash), return directly
319
+ value
320
+ when /\AArray<(?<inner_type>.+)>\z/
321
+ inner_type = Regexp.last_match[:inner_type]
322
+ value.map { |v| _deserialize(inner_type, v) }
323
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
324
+ k_type = Regexp.last_match[:k_type]
325
+ v_type = Regexp.last_match[:v_type]
326
+ {}.tap do |hash|
327
+ value.each do |k, v|
328
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
329
+ end
330
+ end
331
+ else # model
332
+ # models (e.g. Pet) or oneOf
333
+ klass = OpenapiClient.const_get(type)
334
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
335
+ end
336
+ end
337
+
338
+ # Returns the string representation of the object
339
+ # @return [String] String presentation of the object
340
+ def to_s
341
+ to_hash.to_s
342
+ end
343
+
344
+ # to_body is an alias to to_hash (backward compatibility)
345
+ # @return [Hash] Returns the object in the form of hash
346
+ def to_body
347
+ to_hash
348
+ end
349
+
350
+ # Returns the object in the form of hash
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_hash
353
+ hash = {}
354
+ self.class.attribute_map.each_pair do |attr, param|
355
+ value = self.send(attr)
356
+ if value.nil?
357
+ is_nullable = self.class.openapi_nullable.include?(attr)
358
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
359
+ end
360
+
361
+ hash[param] = _to_hash(value)
362
+ end
363
+ hash
364
+ end
365
+
366
+ # Outputs non-array value in the form of hash
367
+ # For object, use to_hash. Otherwise, just return the value
368
+ # @param [Object] value Any valid value
369
+ # @return [Hash] Returns the value in the form of hash
370
+ def _to_hash(value)
371
+ if value.is_a?(Array)
372
+ value.compact.map { |v| _to_hash(v) }
373
+ elsif value.is_a?(Hash)
374
+ {}.tap do |hash|
375
+ value.each { |k, v| hash[k] = _to_hash(v) }
376
+ end
377
+ elsif value.respond_to? :to_hash
378
+ value.to_hash
379
+ else
380
+ value
381
+ end
382
+ end
383
+
384
+ end
385
+
386
+ end
@@ -19,8 +19,16 @@ module OpenapiClient
19
19
 
20
20
  attr_accessor :badge
21
21
 
22
+ # Number of devices whose App Icon Badge Count was updated.
23
+ attr_accessor :devices_updated
24
+
25
+ # Number of account users with at least one updated device.
26
+ attr_accessor :users_updated
27
+
28
+ # Deprecated compatibility alias for devices_updated.
22
29
  attr_accessor :devices_notified
23
30
 
31
+ # Deprecated compatibility alias for users_updated.
24
32
  attr_accessor :users_notified
25
33
 
26
34
  attr_accessor :effective_channel_slugs
@@ -32,6 +40,8 @@ module OpenapiClient
32
40
  {
33
41
  :'success' => :'success',
34
42
  :'badge' => :'badge',
43
+ :'devices_updated' => :'devices_updated',
44
+ :'users_updated' => :'users_updated',
35
45
  :'devices_notified' => :'devices_notified',
36
46
  :'users_notified' => :'users_notified',
37
47
  :'effective_channel_slugs' => :'effective_channel_slugs',
@@ -49,6 +59,8 @@ module OpenapiClient
49
59
  {
50
60
  :'success' => :'Boolean',
51
61
  :'badge' => :'Integer',
62
+ :'devices_updated' => :'Integer',
63
+ :'users_updated' => :'Integer',
52
64
  :'devices_notified' => :'Integer',
53
65
  :'users_notified' => :'Integer',
54
66
  :'effective_channel_slugs' => :'Array<String>',
@@ -89,16 +101,24 @@ module OpenapiClient
89
101
  self.badge = nil
90
102
  end
91
103
 
104
+ if attributes.key?(:'devices_updated')
105
+ self.devices_updated = attributes[:'devices_updated']
106
+ else
107
+ self.devices_updated = nil
108
+ end
109
+
110
+ if attributes.key?(:'users_updated')
111
+ self.users_updated = attributes[:'users_updated']
112
+ else
113
+ self.users_updated = nil
114
+ end
115
+
92
116
  if attributes.key?(:'devices_notified')
93
117
  self.devices_notified = attributes[:'devices_notified']
94
- else
95
- self.devices_notified = nil
96
118
  end
97
119
 
98
120
  if attributes.key?(:'users_notified')
99
121
  self.users_notified = attributes[:'users_notified']
100
- else
101
- self.users_notified = nil
102
122
  end
103
123
 
104
124
  if attributes.key?(:'effective_channel_slugs')
@@ -137,12 +157,12 @@ module OpenapiClient
137
157
  invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
138
158
  end
139
159
 
140
- if @devices_notified.nil?
141
- invalid_properties.push('invalid value for "devices_notified", devices_notified cannot be nil.')
160
+ if @devices_updated.nil?
161
+ invalid_properties.push('invalid value for "devices_updated", devices_updated cannot be nil.')
142
162
  end
143
163
 
144
- if @users_notified.nil?
145
- invalid_properties.push('invalid value for "users_notified", users_notified cannot be nil.')
164
+ if @users_updated.nil?
165
+ invalid_properties.push('invalid value for "users_updated", users_updated cannot be nil.')
146
166
  end
147
167
 
148
168
  if @effective_channel_slugs.nil?
@@ -164,8 +184,8 @@ module OpenapiClient
164
184
  return false if @badge.nil?
165
185
  return false if @badge > 2147483647
166
186
  return false if @badge < 0
167
- return false if @devices_notified.nil?
168
- return false if @users_notified.nil?
187
+ return false if @devices_updated.nil?
188
+ return false if @users_updated.nil?
169
189
  return false if @effective_channel_slugs.nil?
170
190
  return false if @timestamp.nil?
171
191
  true
@@ -196,6 +216,8 @@ module OpenapiClient
196
216
  self.class == o.class &&
197
217
  success == o.success &&
198
218
  badge == o.badge &&
219
+ devices_updated == o.devices_updated &&
220
+ users_updated == o.users_updated &&
199
221
  devices_notified == o.devices_notified &&
200
222
  users_notified == o.users_notified &&
201
223
  effective_channel_slugs == o.effective_channel_slugs &&
@@ -211,7 +233,7 @@ module OpenapiClient
211
233
  # Calculates hash code according to all attributes.
212
234
  # @return [Integer] Hash code
213
235
  def hash
214
- [success, badge, devices_notified, users_notified, effective_channel_slugs, timestamp].hash
236
+ [success, badge, devices_updated, users_updated, devices_notified, users_notified, effective_channel_slugs, timestamp].hash
215
237
  end
216
238
 
217
239
  # Builds the object from hash
@@ -16,8 +16,14 @@ require 'time'
16
16
  module OpenapiClient
17
17
  # End an existing Live Activity by activity_id.
18
18
  class LiveActivityEndRequest
19
+ # 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.
20
+ attr_accessor :metadata
21
+
19
22
  attr_accessor :activity_id
20
23
 
24
+ # Tags for notification history. Omit to keep existing Tags, supply an array to replace them, or send an empty array to clear them.
25
+ attr_accessor :tags
26
+
21
27
  attr_accessor :content_state
22
28
 
23
29
  attr_accessor :action
@@ -28,7 +34,9 @@ module OpenapiClient
28
34
  # Attribute mapping from ruby-style variable name to JSON key.
29
35
  def self.attribute_map
30
36
  {
37
+ :'metadata' => :'metadata',
31
38
  :'activity_id' => :'activity_id',
39
+ :'tags' => :'tags',
32
40
  :'content_state' => :'content_state',
33
41
  :'action' => :'action',
34
42
  :'secondary_action' => :'secondary_action'
@@ -43,7 +51,9 @@ module OpenapiClient
43
51
  # Attribute type mapping.
44
52
  def self.openapi_types
45
53
  {
54
+ :'metadata' => :'Hash<String, MetadataValue>',
46
55
  :'activity_id' => :'String',
56
+ :'tags' => :'Array<String>',
47
57
  :'content_state' => :'ContentStateEnd',
48
58
  :'action' => :'LiveActivityAction',
49
59
  :'secondary_action' => :'LiveActivityAction'
@@ -71,12 +81,24 @@ module OpenapiClient
71
81
  h[k.to_sym] = v
72
82
  }
73
83
 
84
+ if attributes.key?(:'metadata')
85
+ if (value = attributes[:'metadata']).is_a?(Hash)
86
+ self.metadata = value
87
+ end
88
+ end
89
+
74
90
  if attributes.key?(:'activity_id')
75
91
  self.activity_id = attributes[:'activity_id']
76
92
  else
77
93
  self.activity_id = nil
78
94
  end
79
95
 
96
+ if attributes.key?(:'tags')
97
+ if (value = attributes[:'tags']).is_a?(Array)
98
+ self.tags = value
99
+ end
100
+ end
101
+
80
102
  if attributes.key?(:'content_state')
81
103
  self.content_state = attributes[:'content_state']
82
104
  else
@@ -97,10 +119,18 @@ module OpenapiClient
97
119
  def list_invalid_properties
98
120
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
121
  invalid_properties = Array.new
122
+ if !@metadata.nil? && @metadata.length > 50
123
+ invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
124
+ end
125
+
100
126
  if @activity_id.nil?
101
127
  invalid_properties.push('invalid value for "activity_id", activity_id cannot be nil.')
102
128
  end
103
129
 
130
+ if !@tags.nil? && @tags.length > 20
131
+ invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 20.')
132
+ end
133
+
104
134
  if @content_state.nil?
105
135
  invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
106
136
  end
@@ -112,17 +142,49 @@ module OpenapiClient
112
142
  # @return true if the model is valid
113
143
  def valid?
114
144
  warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if !@metadata.nil? && @metadata.length > 50
115
146
  return false if @activity_id.nil?
147
+ return false if !@tags.nil? && @tags.length > 20
116
148
  return false if @content_state.nil?
117
149
  true
118
150
  end
119
151
 
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] metadata Value to be assigned
154
+ def metadata=(metadata)
155
+ if metadata.nil?
156
+ fail ArgumentError, 'metadata cannot be nil'
157
+ end
158
+
159
+ if metadata.length > 50
160
+ fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
161
+ end
162
+
163
+ @metadata = metadata
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] tags Value to be assigned
168
+ def tags=(tags)
169
+ if tags.nil?
170
+ fail ArgumentError, 'tags cannot be nil'
171
+ end
172
+
173
+ if tags.length > 20
174
+ fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 20.'
175
+ end
176
+
177
+ @tags = tags
178
+ end
179
+
120
180
  # Checks equality by comparing each attribute.
121
181
  # @param [Object] Object to be compared
122
182
  def ==(o)
123
183
  return true if self.equal?(o)
124
184
  self.class == o.class &&
185
+ metadata == o.metadata &&
125
186
  activity_id == o.activity_id &&
187
+ tags == o.tags &&
126
188
  content_state == o.content_state &&
127
189
  action == o.action &&
128
190
  secondary_action == o.secondary_action
@@ -137,7 +199,7 @@ module OpenapiClient
137
199
  # Calculates hash code according to all attributes.
138
200
  # @return [Integer] Hash code
139
201
  def hash
140
- [activity_id, content_state, action, secondary_action].hash
202
+ [metadata, activity_id, tags, content_state, action, secondary_action].hash
141
203
  end
142
204
 
143
205
  # Builds the object from hash