activitysmith 1.9.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.
- checksums.yaml +4 -4
- data/README.md +243 -225
- data/generated/activitysmith_openapi/api/app_icon_badges_api.rb +4 -4
- data/generated/activitysmith_openapi/api/live_activities_api.rb +10 -10
- data/generated/activitysmith_openapi/api/push_notifications_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_request.rb +0 -1
- data/generated/activitysmith_openapi/models/app_icon_badge_count_update_response.rb +33 -11
- data/generated/activitysmith_openapi/models/live_activity_action.rb +1 -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 +48 -5
- data/generated/activitysmith_openapi/models/live_activity_start_response.rb +13 -1
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +45 -2
- data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +13 -1
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +48 -5
- data/generated/activitysmith_openapi/models/live_activity_update_request.rb +64 -2
- data/generated/activitysmith_openapi/models/metadata_value.rb +106 -0
- data/generated/activitysmith_openapi/models/push_notification_action.rb +1 -1
- data/generated/activitysmith_openapi/models/push_notification_request.rb +60 -8
- data/generated/activitysmith_openapi/models/push_notification_response.rb +13 -1
- 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 +3 -0
- data/generated/openapi-source.json +6 -0
- data/lib/activitysmith/live_activities.rb +36 -14
- data/lib/activitysmith/notifications.rb +19 -4
- data/lib/activitysmith/version.rb +1 -1
- metadata +6 -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
|
|
26
|
+
# Optional secondary action button. Supported for alert, progress, and segmented_progress 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
|
|
@@ -30,15 +33,20 @@ module OpenapiClient
|
|
|
30
33
|
|
|
31
34
|
attr_accessor :target
|
|
32
35
|
|
|
36
|
+
# Optional tags to organize and filter notification history.
|
|
37
|
+
attr_accessor :tags
|
|
38
|
+
|
|
33
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
40
|
def self.attribute_map
|
|
35
41
|
{
|
|
42
|
+
:'metadata' => :'metadata',
|
|
36
43
|
:'content_state' => :'content_state',
|
|
37
44
|
:'action' => :'action',
|
|
38
45
|
:'secondary_action' => :'secondary_action',
|
|
39
46
|
:'alert' => :'alert',
|
|
40
47
|
:'channels' => :'channels',
|
|
41
|
-
:'target' => :'target'
|
|
48
|
+
:'target' => :'target',
|
|
49
|
+
:'tags' => :'tags'
|
|
42
50
|
}
|
|
43
51
|
end
|
|
44
52
|
|
|
@@ -50,12 +58,14 @@ module OpenapiClient
|
|
|
50
58
|
# Attribute type mapping.
|
|
51
59
|
def self.openapi_types
|
|
52
60
|
{
|
|
61
|
+
:'metadata' => :'Hash<String, MetadataValue>',
|
|
53
62
|
:'content_state' => :'StreamContentState',
|
|
54
63
|
:'action' => :'LiveActivityAction',
|
|
55
64
|
:'secondary_action' => :'LiveActivityAction',
|
|
56
65
|
:'alert' => :'AlertPayload',
|
|
57
66
|
:'channels' => :'Array<String>',
|
|
58
|
-
:'target' => :'ChannelTarget'
|
|
67
|
+
:'target' => :'ChannelTarget',
|
|
68
|
+
:'tags' => :'Array<String>'
|
|
59
69
|
}
|
|
60
70
|
end
|
|
61
71
|
|
|
@@ -80,6 +90,12 @@ module OpenapiClient
|
|
|
80
90
|
h[k.to_sym] = v
|
|
81
91
|
}
|
|
82
92
|
|
|
93
|
+
if attributes.key?(:'metadata')
|
|
94
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
95
|
+
self.metadata = value
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
83
99
|
if attributes.key?(:'content_state')
|
|
84
100
|
self.content_state = attributes[:'content_state']
|
|
85
101
|
else
|
|
@@ -107,6 +123,12 @@ module OpenapiClient
|
|
|
107
123
|
if attributes.key?(:'target')
|
|
108
124
|
self.target = attributes[:'target']
|
|
109
125
|
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'tags')
|
|
128
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
129
|
+
self.tags = value
|
|
130
|
+
end
|
|
131
|
+
end
|
|
110
132
|
end
|
|
111
133
|
|
|
112
134
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -114,6 +136,10 @@ module OpenapiClient
|
|
|
114
136
|
def list_invalid_properties
|
|
115
137
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
116
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
|
+
|
|
117
143
|
if @content_state.nil?
|
|
118
144
|
invalid_properties.push('invalid value for "content_state", content_state cannot be nil.')
|
|
119
145
|
end
|
|
@@ -129,11 +155,26 @@ module OpenapiClient
|
|
|
129
155
|
# @return true if the model is valid
|
|
130
156
|
def valid?
|
|
131
157
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
158
|
+
return false if !@metadata.nil? && @metadata.length > 50
|
|
132
159
|
return false if @content_state.nil?
|
|
133
160
|
return false if !@channels.nil? && @channels.length < 1
|
|
134
161
|
true
|
|
135
162
|
end
|
|
136
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
|
+
|
|
137
178
|
# Custom attribute writer method with validation
|
|
138
179
|
# @param [Object] channels Value to be assigned
|
|
139
180
|
def channels=(channels)
|
|
@@ -153,12 +194,14 @@ module OpenapiClient
|
|
|
153
194
|
def ==(o)
|
|
154
195
|
return true if self.equal?(o)
|
|
155
196
|
self.class == o.class &&
|
|
197
|
+
metadata == o.metadata &&
|
|
156
198
|
content_state == o.content_state &&
|
|
157
199
|
action == o.action &&
|
|
158
200
|
secondary_action == o.secondary_action &&
|
|
159
201
|
alert == o.alert &&
|
|
160
202
|
channels == o.channels &&
|
|
161
|
-
target == o.target
|
|
203
|
+
target == o.target &&
|
|
204
|
+
tags == o.tags
|
|
162
205
|
end
|
|
163
206
|
|
|
164
207
|
# @see the `==` method
|
|
@@ -170,7 +213,7 @@ module OpenapiClient
|
|
|
170
213
|
# Calculates hash code according to all attributes.
|
|
171
214
|
# @return [Integer] Hash code
|
|
172
215
|
def hash
|
|
173
|
-
[content_state, action, secondary_action, alert, channels, target].hash
|
|
216
|
+
[metadata, content_state, action, secondary_action, alert, channels, target, tags].hash
|
|
174
217
|
end
|
|
175
218
|
|
|
176
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
|
|
31
|
+
# Optional secondary action button. Supported for alert, progress, and segmented_progress 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
|
+
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.
|
|
@@ -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 HTTPS
|
|
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`.
|
|
@@ -38,9 +41,13 @@ module OpenapiClient
|
|
|
38
41
|
|
|
39
42
|
attr_accessor :target
|
|
40
43
|
|
|
44
|
+
# Optional tags to organize and filter notification history.
|
|
45
|
+
attr_accessor :tags
|
|
46
|
+
|
|
41
47
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
48
|
def self.attribute_map
|
|
43
49
|
{
|
|
50
|
+
:'metadata' => :'metadata',
|
|
44
51
|
:'title' => :'title',
|
|
45
52
|
:'message' => :'message',
|
|
46
53
|
:'subtitle' => :'subtitle',
|
|
@@ -50,7 +57,8 @@ module OpenapiClient
|
|
|
50
57
|
:'payload' => :'payload',
|
|
51
58
|
:'badge' => :'badge',
|
|
52
59
|
:'sound' => :'sound',
|
|
53
|
-
:'target' => :'target'
|
|
60
|
+
:'target' => :'target',
|
|
61
|
+
:'tags' => :'tags'
|
|
54
62
|
}
|
|
55
63
|
end
|
|
56
64
|
|
|
@@ -62,6 +70,7 @@ module OpenapiClient
|
|
|
62
70
|
# Attribute type mapping.
|
|
63
71
|
def self.openapi_types
|
|
64
72
|
{
|
|
73
|
+
:'metadata' => :'Hash<String, MetadataValue>',
|
|
65
74
|
:'title' => :'String',
|
|
66
75
|
:'message' => :'String',
|
|
67
76
|
:'subtitle' => :'String',
|
|
@@ -71,7 +80,8 @@ module OpenapiClient
|
|
|
71
80
|
:'payload' => :'Object',
|
|
72
81
|
:'badge' => :'Integer',
|
|
73
82
|
:'sound' => :'String',
|
|
74
|
-
:'target' => :'ChannelTarget'
|
|
83
|
+
:'target' => :'ChannelTarget',
|
|
84
|
+
:'tags' => :'Array<String>'
|
|
75
85
|
}
|
|
76
86
|
end
|
|
77
87
|
|
|
@@ -96,6 +106,12 @@ module OpenapiClient
|
|
|
96
106
|
h[k.to_sym] = v
|
|
97
107
|
}
|
|
98
108
|
|
|
109
|
+
if attributes.key?(:'metadata')
|
|
110
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
111
|
+
self.metadata = value
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
99
115
|
if attributes.key?(:'title')
|
|
100
116
|
self.title = attributes[:'title']
|
|
101
117
|
else
|
|
@@ -139,6 +155,12 @@ module OpenapiClient
|
|
|
139
155
|
if attributes.key?(:'target')
|
|
140
156
|
self.target = attributes[:'target']
|
|
141
157
|
end
|
|
158
|
+
|
|
159
|
+
if attributes.key?(:'tags')
|
|
160
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
161
|
+
self.tags = value
|
|
162
|
+
end
|
|
163
|
+
end
|
|
142
164
|
end
|
|
143
165
|
|
|
144
166
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -146,6 +168,10 @@ module OpenapiClient
|
|
|
146
168
|
def list_invalid_properties
|
|
147
169
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
148
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
|
+
|
|
149
175
|
if @title.nil?
|
|
150
176
|
invalid_properties.push('invalid value for "title", title cannot be nil.')
|
|
151
177
|
end
|
|
@@ -155,7 +181,11 @@ module OpenapiClient
|
|
|
155
181
|
invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
|
|
156
182
|
end
|
|
157
183
|
|
|
158
|
-
|
|
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+.-]*:/)
|
|
159
189
|
if !@redirection.nil? && @redirection !~ pattern
|
|
160
190
|
invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
|
|
161
191
|
end
|
|
@@ -171,13 +201,29 @@ module OpenapiClient
|
|
|
171
201
|
# @return true if the model is valid
|
|
172
202
|
def valid?
|
|
173
203
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
204
|
+
return false if !@metadata.nil? && @metadata.length > 50
|
|
174
205
|
return false if @title.nil?
|
|
175
206
|
return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
|
|
176
|
-
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+.-]*:/)
|
|
177
209
|
return false if !@actions.nil? && @actions.length > 4
|
|
178
210
|
true
|
|
179
211
|
end
|
|
180
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
|
+
|
|
181
227
|
# Custom attribute writer method with validation
|
|
182
228
|
# @param [Object] media Value to be assigned
|
|
183
229
|
def media=(media)
|
|
@@ -200,7 +246,11 @@ module OpenapiClient
|
|
|
200
246
|
fail ArgumentError, 'redirection cannot be nil'
|
|
201
247
|
end
|
|
202
248
|
|
|
203
|
-
|
|
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+.-]*:/)
|
|
204
254
|
if redirection !~ pattern
|
|
205
255
|
fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
|
|
206
256
|
end
|
|
@@ -227,6 +277,7 @@ module OpenapiClient
|
|
|
227
277
|
def ==(o)
|
|
228
278
|
return true if self.equal?(o)
|
|
229
279
|
self.class == o.class &&
|
|
280
|
+
metadata == o.metadata &&
|
|
230
281
|
title == o.title &&
|
|
231
282
|
message == o.message &&
|
|
232
283
|
subtitle == o.subtitle &&
|
|
@@ -236,7 +287,8 @@ module OpenapiClient
|
|
|
236
287
|
payload == o.payload &&
|
|
237
288
|
badge == o.badge &&
|
|
238
289
|
sound == o.sound &&
|
|
239
|
-
target == o.target
|
|
290
|
+
target == o.target &&
|
|
291
|
+
tags == o.tags
|
|
240
292
|
end
|
|
241
293
|
|
|
242
294
|
# @see the `==` method
|
|
@@ -248,7 +300,7 @@ module OpenapiClient
|
|
|
248
300
|
# Calculates hash code according to all attributes.
|
|
249
301
|
# @return [Integer] Hash code
|
|
250
302
|
def hash
|
|
251
|
-
[title, message, subtitle, media, redirection, actions, payload, badge, sound, target].hash
|
|
303
|
+
[metadata, title, message, subtitle, media, redirection, actions, payload, badge, sound, target, tags].hash
|
|
252
304
|
end
|
|
253
305
|
|
|
254
306
|
# Builds the object from hash
|
|
@@ -23,6 +23,9 @@ module OpenapiClient
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :effective_channel_slugs
|
|
25
25
|
|
|
26
|
+
# Optional tags to organize and filter notification history.
|
|
27
|
+
attr_accessor :tags
|
|
28
|
+
|
|
26
29
|
attr_accessor :timestamp
|
|
27
30
|
|
|
28
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -32,6 +35,7 @@ module OpenapiClient
|
|
|
32
35
|
:'devices_notified' => :'devices_notified',
|
|
33
36
|
:'users_notified' => :'users_notified',
|
|
34
37
|
:'effective_channel_slugs' => :'effective_channel_slugs',
|
|
38
|
+
:'tags' => :'tags',
|
|
35
39
|
:'timestamp' => :'timestamp'
|
|
36
40
|
}
|
|
37
41
|
end
|
|
@@ -48,6 +52,7 @@ module OpenapiClient
|
|
|
48
52
|
:'devices_notified' => :'Integer',
|
|
49
53
|
:'users_notified' => :'Integer',
|
|
50
54
|
:'effective_channel_slugs' => :'Array<String>',
|
|
55
|
+
:'tags' => :'Array<String>',
|
|
51
56
|
:'timestamp' => :'Time'
|
|
52
57
|
}
|
|
53
58
|
end
|
|
@@ -93,6 +98,12 @@ module OpenapiClient
|
|
|
93
98
|
end
|
|
94
99
|
end
|
|
95
100
|
|
|
101
|
+
if attributes.key?(:'tags')
|
|
102
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
103
|
+
self.tags = value
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
96
107
|
if attributes.key?(:'timestamp')
|
|
97
108
|
self.timestamp = attributes[:'timestamp']
|
|
98
109
|
else
|
|
@@ -134,6 +145,7 @@ module OpenapiClient
|
|
|
134
145
|
devices_notified == o.devices_notified &&
|
|
135
146
|
users_notified == o.users_notified &&
|
|
136
147
|
effective_channel_slugs == o.effective_channel_slugs &&
|
|
148
|
+
tags == o.tags &&
|
|
137
149
|
timestamp == o.timestamp
|
|
138
150
|
end
|
|
139
151
|
|
|
@@ -146,7 +158,7 @@ module OpenapiClient
|
|
|
146
158
|
# Calculates hash code according to all attributes.
|
|
147
159
|
# @return [Integer] Hash code
|
|
148
160
|
def hash
|
|
149
|
-
[success, devices_notified, users_notified, effective_channel_slugs, timestamp].hash
|
|
161
|
+
[success, devices_notified, users_notified, effective_channel_slugs, tags, timestamp].hash
|
|
150
162
|
end
|
|
151
163
|
|
|
152
164
|
# Builds the object from hash
|