activitysmith 1.10.0 → 1.12.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 +4 -4
- data/README.md +273 -254
- data/generated/activitysmith_openapi/api/live_activities_api.rb +10 -10
- data/generated/activitysmith_openapi/api/metrics_api.rb +2 -2
- data/generated/activitysmith_openapi/configuration.rb +7 -0
- data/generated/activitysmith_openapi/models/app_icon_badge_count_update_error.rb +386 -0
- data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +33 -11
- data/generated/activitysmith_openapi/models/content_state_end.rb +8 -8
- data/generated/activitysmith_openapi/models/content_state_start.rb +8 -8
- data/generated/activitysmith_openapi/models/content_state_update.rb +8 -8
- data/generated/activitysmith_openapi/models/live_activity_action.rb +23 -1
- data/generated/activitysmith_openapi/models/live_activity_end_request.rb +64 -2
- data/generated/activitysmith_openapi/models/live_activity_limit_error.rb +25 -5
- data/generated/activitysmith_openapi/models/live_activity_start_request.rb +33 -2
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +45 -2
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +33 -2
- data/generated/activitysmith_openapi/models/live_activity_update_request.rb +64 -2
- data/generated/activitysmith_openapi/models/live_activity_value.rb +106 -0
- data/generated/activitysmith_openapi/models/metadata_value.rb +106 -0
- data/generated/activitysmith_openapi/models/push_notification_action.rb +23 -1
- data/generated/activitysmith_openapi/models/push_notification_request.rb +45 -5
- data/generated/activitysmith_openapi/models/rate_limit_error.rb +44 -1
- data/generated/activitysmith_openapi/models/stream_content_state.rb +8 -8
- data/generated/activitysmith_openapi/models/update_app_icon_badge_count422_response.rb +105 -0
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +4 -0
- data/generated/openapi-source.json +6 -0
- data/lib/activitysmith/live_activities.rb +7 -6
- data/lib/activitysmith/version.rb +1 -1
- metadata +7 -2
|
@@ -16,11 +16,14 @@ require 'time'
|
|
|
16
16
|
module OpenapiClient
|
|
17
17
|
# Send the latest state for a managed Live Activity stream. channels is the streamlined form for stream targeting. target.channels is also accepted for compatibility. If both are provided, they must match.
|
|
18
18
|
class LiveActivityStreamRequest
|
|
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 :content_state
|
|
20
23
|
|
|
21
24
|
attr_accessor :action
|
|
22
25
|
|
|
23
|
-
# Optional secondary action button. Supported for alert, progress, and
|
|
26
|
+
# Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
|
|
24
27
|
attr_accessor :secondary_action
|
|
25
28
|
|
|
26
29
|
attr_accessor :alert
|
|
@@ -36,6 +39,7 @@ module OpenapiClient
|
|
|
36
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
40
|
def self.attribute_map
|
|
38
41
|
{
|
|
42
|
+
:'metadata' => :'metadata',
|
|
39
43
|
:'content_state' => :'content_state',
|
|
40
44
|
:'action' => :'action',
|
|
41
45
|
:'secondary_action' => :'secondary_action',
|
|
@@ -54,6 +58,7 @@ module OpenapiClient
|
|
|
54
58
|
# Attribute type mapping.
|
|
55
59
|
def self.openapi_types
|
|
56
60
|
{
|
|
61
|
+
:'metadata' => :'Hash<String, MetadataValue>',
|
|
57
62
|
:'content_state' => :'StreamContentState',
|
|
58
63
|
:'action' => :'LiveActivityAction',
|
|
59
64
|
:'secondary_action' => :'LiveActivityAction',
|
|
@@ -85,6 +90,12 @@ module OpenapiClient
|
|
|
85
90
|
h[k.to_sym] = v
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
if attributes.key?(:'metadata')
|
|
94
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
95
|
+
self.metadata = value
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
88
99
|
if attributes.key?(:'content_state')
|
|
89
100
|
self.content_state = attributes[:'content_state']
|
|
90
101
|
else
|
|
@@ -125,6 +136,10 @@ module OpenapiClient
|
|
|
125
136
|
def list_invalid_properties
|
|
126
137
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
127
138
|
invalid_properties = Array.new
|
|
139
|
+
if !@metadata.nil? && @metadata.length > 50
|
|
140
|
+
invalid_properties.push('invalid value for "metadata", number of items must be less than or equal to 50.')
|
|
141
|
+
end
|
|
142
|
+
|
|
128
143
|
if @content_state.nil?
|
|
129
144
|
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
|
|
130
145
|
end
|
|
@@ -140,11 +155,26 @@ module OpenapiClient
|
|
|
140
155
|
# @return true if the model is valid
|
|
141
156
|
def valid?
|
|
142
157
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
158
|
+
return false if !@metadata.nil? && @metadata.length > 50
|
|
143
159
|
return false if @content_state.nil?
|
|
144
160
|
return false if !@channels.nil? && @channels.length < 1
|
|
145
161
|
true
|
|
146
162
|
end
|
|
147
163
|
|
|
164
|
+
# Custom attribute writer method with validation
|
|
165
|
+
# @param [Object] metadata Value to be assigned
|
|
166
|
+
def metadata=(metadata)
|
|
167
|
+
if metadata.nil?
|
|
168
|
+
fail ArgumentError, 'metadata cannot be nil'
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if metadata.length > 50
|
|
172
|
+
fail ArgumentError, 'invalid value for "metadata", number of items must be less than or equal to 50.'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
@metadata = metadata
|
|
176
|
+
end
|
|
177
|
+
|
|
148
178
|
# Custom attribute writer method with validation
|
|
149
179
|
# @param [Object] channels Value to be assigned
|
|
150
180
|
def channels=(channels)
|
|
@@ -164,6 +194,7 @@ module OpenapiClient
|
|
|
164
194
|
def ==(o)
|
|
165
195
|
return true if self.equal?(o)
|
|
166
196
|
self.class == o.class &&
|
|
197
|
+
metadata == o.metadata &&
|
|
167
198
|
content_state == o.content_state &&
|
|
168
199
|
action == o.action &&
|
|
169
200
|
secondary_action == o.secondary_action &&
|
|
@@ -182,7 +213,7 @@ module OpenapiClient
|
|
|
182
213
|
# Calculates hash code according to all attributes.
|
|
183
214
|
# @return [Integer] Hash code
|
|
184
215
|
def hash
|
|
185
|
-
[content_state, action, secondary_action, alert, channels, target, tags].hash
|
|
216
|
+
[metadata, content_state, action, secondary_action, alert, channels, target, tags].hash
|
|
186
217
|
end
|
|
187
218
|
|
|
188
219
|
# Builds the object from hash
|
|
@@ -16,19 +16,27 @@ require 'time'
|
|
|
16
16
|
module OpenapiClient
|
|
17
17
|
# Update an existing Live Activity by activity_id.
|
|
18
18
|
class LiveActivityUpdateRequest
|
|
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
|
|
24
30
|
|
|
25
|
-
# Optional secondary action button. Supported for alert, progress, and
|
|
31
|
+
# Optional secondary action button. Supported for alert, progress, segmented_progress, and value Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
|
|
26
32
|
attr_accessor :secondary_action
|
|
27
33
|
|
|
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' => :'ContentStateUpdate',
|
|
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
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
# A formatted string or finite numeric Live Activity value. String formatting is preserved.
|
|
18
|
+
module LiveActivityValue
|
|
19
|
+
class << self
|
|
20
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
21
|
+
def openapi_one_of
|
|
22
|
+
[
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - We do not attempt to check whether exactly one item matches.
|
|
35
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
36
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
37
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
38
|
+
# - TODO: logging when debugging is set.
|
|
39
|
+
openapi_one_of.each do |klass|
|
|
40
|
+
begin
|
|
41
|
+
next if klass == :AnyType # "nullable: true"
|
|
42
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
43
|
+
return typed_data if typed_data
|
|
44
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
54
|
+
|
|
55
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
56
|
+
def find_and_cast_into_type(klass, data)
|
|
57
|
+
return if data.nil?
|
|
58
|
+
|
|
59
|
+
case klass.to_s
|
|
60
|
+
when 'Boolean'
|
|
61
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
62
|
+
when 'Float'
|
|
63
|
+
return data if data.instance_of?(Float)
|
|
64
|
+
when 'Integer'
|
|
65
|
+
return data if data.instance_of?(Integer)
|
|
66
|
+
when 'Time'
|
|
67
|
+
return Time.parse(data)
|
|
68
|
+
when 'Date'
|
|
69
|
+
return Date.parse(data)
|
|
70
|
+
when 'String'
|
|
71
|
+
return data if data.instance_of?(String)
|
|
72
|
+
when 'Object' # "type: object"
|
|
73
|
+
return data if data.instance_of?(Hash)
|
|
74
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
75
|
+
if data.instance_of?(Array)
|
|
76
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
77
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
78
|
+
end
|
|
79
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
80
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
81
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
82
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
83
|
+
end
|
|
84
|
+
else # model
|
|
85
|
+
const = OpenapiClient.const_get(klass)
|
|
86
|
+
if const
|
|
87
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
88
|
+
model = const.build(data)
|
|
89
|
+
return model if model
|
|
90
|
+
else
|
|
91
|
+
# raise if data contains keys that are not known to the model
|
|
92
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
93
|
+
model = const.build_from_hash(data)
|
|
94
|
+
return model if model
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
raise # if no match by now, raise
|
|
100
|
+
rescue
|
|
101
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
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 MetadataValue
|
|
18
|
+
class << self
|
|
19
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
20
|
+
def openapi_one_of
|
|
21
|
+
[
|
|
22
|
+
:'Boolean',
|
|
23
|
+
:'Float',
|
|
24
|
+
:'String'
|
|
25
|
+
]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Builds the object
|
|
29
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
30
|
+
# @return [Object] Returns the model or the data itself
|
|
31
|
+
def build(data)
|
|
32
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
33
|
+
# Note:
|
|
34
|
+
# - We do not attempt to check whether exactly one item matches.
|
|
35
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
36
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
37
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
38
|
+
# - TODO: logging when debugging is set.
|
|
39
|
+
openapi_one_of.each do |klass|
|
|
40
|
+
begin
|
|
41
|
+
next if klass == :AnyType # "nullable: true"
|
|
42
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
43
|
+
return typed_data if typed_data
|
|
44
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
54
|
+
|
|
55
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
56
|
+
def find_and_cast_into_type(klass, data)
|
|
57
|
+
return if data.nil?
|
|
58
|
+
|
|
59
|
+
case klass.to_s
|
|
60
|
+
when 'Boolean'
|
|
61
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
62
|
+
when 'Float'
|
|
63
|
+
return data if data.instance_of?(Float)
|
|
64
|
+
when 'Integer'
|
|
65
|
+
return data if data.instance_of?(Integer)
|
|
66
|
+
when 'Time'
|
|
67
|
+
return Time.parse(data)
|
|
68
|
+
when 'Date'
|
|
69
|
+
return Date.parse(data)
|
|
70
|
+
when 'String'
|
|
71
|
+
return data if data.instance_of?(String)
|
|
72
|
+
when 'Object' # "type: object"
|
|
73
|
+
return data if data.instance_of?(Hash)
|
|
74
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
75
|
+
if data.instance_of?(Array)
|
|
76
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
77
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
78
|
+
end
|
|
79
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
80
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
81
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
82
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
83
|
+
end
|
|
84
|
+
else # model
|
|
85
|
+
const = OpenapiClient.const_get(klass)
|
|
86
|
+
if const
|
|
87
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
88
|
+
model = const.build(data)
|
|
89
|
+
return model if model
|
|
90
|
+
else
|
|
91
|
+
# raise if data contains keys that are not known to the model
|
|
92
|
+
raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
|
|
93
|
+
model = const.build_from_hash(data)
|
|
94
|
+
return model if model
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
raise # if no match by now, raise
|
|
100
|
+
rescue
|
|
101
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
@@ -20,7 +20,7 @@ module OpenapiClient
|
|
|
20
20
|
|
|
21
21
|
attr_accessor :type
|
|
22
22
|
|
|
23
|
-
# Action URL. For open_url, use
|
|
23
|
+
# Action URL. For open_url, use HTTP, HTTPS, Shortcuts, or an installed app’s custom URL scheme, such as spotify:// or spotify:track:123. Custom app schemes require iOS 1.13.4 build 2 or later; no web fallback is provided. Internal and executable schemes are blocked. For webhook, use an HTTPS URL called by the ActivitySmith backend.
|
|
24
24
|
attr_accessor :url
|
|
25
25
|
|
|
26
26
|
# Webhook HTTP method. Used only when type=webhook.
|
|
@@ -29,6 +29,28 @@ module OpenapiClient
|
|
|
29
29
|
# Optional webhook payload body. Used only when type=webhook.
|
|
30
30
|
attr_accessor :body
|
|
31
31
|
|
|
32
|
+
class EnumAttributeValidator
|
|
33
|
+
attr_reader :datatype
|
|
34
|
+
attr_reader :allowable_values
|
|
35
|
+
|
|
36
|
+
def initialize(datatype, allowable_values)
|
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
|
38
|
+
case datatype.to_s
|
|
39
|
+
when /Integer/i
|
|
40
|
+
value.to_i
|
|
41
|
+
when /Float/i
|
|
42
|
+
value.to_f
|
|
43
|
+
else
|
|
44
|
+
value
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def valid?(value)
|
|
50
|
+
!value || allowable_values.include?(value)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
32
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
55
|
def self.attribute_map
|
|
34
56
|
{
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|