activitysmith 1.3.1 → 1.6.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 +103 -1
- data/generated/activitysmith_openapi/api/live_activities_api.rb +6 -6
- data/generated/activitysmith_openapi/models/activity_metric.rb +2 -2
- data/generated/activitysmith_openapi/models/content_state_end.rb +64 -17
- data/generated/activitysmith_openapi/models/content_state_start.rb +64 -17
- data/generated/activitysmith_openapi/models/content_state_update.rb +64 -17
- data/generated/activitysmith_openapi/models/live_activity_action.rb +19 -43
- data/generated/activitysmith_openapi/models/live_activity_alert_badge.rb +273 -0
- data/generated/activitysmith_openapi/models/live_activity_alert_icon.rb +274 -0
- data/generated/activitysmith_openapi/models/live_activity_color.rb +48 -0
- data/generated/activitysmith_openapi/models/push_notification_action.rb +19 -43
- data/generated/activitysmith_openapi/models/push_notification_request.rb +4 -4
- data/generated/activitysmith_openapi/models/stream_content_state.rb +64 -17
- data/generated/activitysmith_openapi/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +3 -0
- data/lib/activitysmith/live_activities.rb +57 -10
- data/lib/activitysmith/version.rb +1 -1
- metadata +5 -2
|
@@ -0,0 +1,274 @@
|
|
|
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
|
+
# Optional SF Symbol icon for Live Activities.
|
|
18
|
+
class LiveActivityAlertIcon
|
|
19
|
+
# Apple SF Symbol name.
|
|
20
|
+
attr_accessor :symbol
|
|
21
|
+
|
|
22
|
+
# Optional icon color.
|
|
23
|
+
attr_accessor :color
|
|
24
|
+
|
|
25
|
+
class EnumAttributeValidator
|
|
26
|
+
attr_reader :datatype
|
|
27
|
+
attr_reader :allowable_values
|
|
28
|
+
|
|
29
|
+
def initialize(datatype, allowable_values)
|
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
|
31
|
+
case datatype.to_s
|
|
32
|
+
when /Integer/i
|
|
33
|
+
value.to_i
|
|
34
|
+
when /Float/i
|
|
35
|
+
value.to_f
|
|
36
|
+
else
|
|
37
|
+
value
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def valid?(value)
|
|
43
|
+
!value || allowable_values.include?(value)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
48
|
+
def self.attribute_map
|
|
49
|
+
{
|
|
50
|
+
:'symbol' => :'symbol',
|
|
51
|
+
:'color' => :'color'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns all the JSON keys this model knows about
|
|
56
|
+
def self.acceptable_attributes
|
|
57
|
+
attribute_map.values
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute type mapping.
|
|
61
|
+
def self.openapi_types
|
|
62
|
+
{
|
|
63
|
+
:'symbol' => :'String',
|
|
64
|
+
:'color' => :'LiveActivityColor'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# List of attributes with nullable: true
|
|
69
|
+
def self.openapi_nullable
|
|
70
|
+
Set.new([
|
|
71
|
+
])
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Initializes the object
|
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
76
|
+
def initialize(attributes = {})
|
|
77
|
+
if (!attributes.is_a?(Hash))
|
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::LiveActivityAlertIcon` initialize method"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
83
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::LiveActivityAlertIcon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
85
|
+
end
|
|
86
|
+
h[k.to_sym] = v
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'symbol')
|
|
90
|
+
self.symbol = attributes[:'symbol']
|
|
91
|
+
else
|
|
92
|
+
self.symbol = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'color')
|
|
96
|
+
self.color = attributes[:'color']
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
101
|
+
# @return Array for valid properties with the reasons
|
|
102
|
+
def list_invalid_properties
|
|
103
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
104
|
+
invalid_properties = Array.new
|
|
105
|
+
if @symbol.nil?
|
|
106
|
+
invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if @symbol.to_s.length < 1
|
|
110
|
+
invalid_properties.push('invalid value for "symbol", the character length must be great than or equal to 1.')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
invalid_properties
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Check to see if the all the properties in the model are valid
|
|
117
|
+
# @return true if the model is valid
|
|
118
|
+
def valid?
|
|
119
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
120
|
+
return false if @symbol.nil?
|
|
121
|
+
return false if @symbol.to_s.length < 1
|
|
122
|
+
true
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Custom attribute writer method with validation
|
|
126
|
+
# @param [Object] symbol Value to be assigned
|
|
127
|
+
def symbol=(symbol)
|
|
128
|
+
if symbol.nil?
|
|
129
|
+
fail ArgumentError, 'symbol cannot be nil'
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if symbol.to_s.length < 1
|
|
133
|
+
fail ArgumentError, 'invalid value for "symbol", the character length must be great than or equal to 1.'
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
@symbol = symbol
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Checks equality by comparing each attribute.
|
|
140
|
+
# @param [Object] Object to be compared
|
|
141
|
+
def ==(o)
|
|
142
|
+
return true if self.equal?(o)
|
|
143
|
+
self.class == o.class &&
|
|
144
|
+
symbol == o.symbol &&
|
|
145
|
+
color == o.color
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# @see the `==` method
|
|
149
|
+
# @param [Object] Object to be compared
|
|
150
|
+
def eql?(o)
|
|
151
|
+
self == o
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Calculates hash code according to all attributes.
|
|
155
|
+
# @return [Integer] Hash code
|
|
156
|
+
def hash
|
|
157
|
+
[symbol, color].hash
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Builds the object from hash
|
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
162
|
+
# @return [Object] Returns the model itself
|
|
163
|
+
def self.build_from_hash(attributes)
|
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
|
165
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
166
|
+
transformed_hash = {}
|
|
167
|
+
openapi_types.each_pair do |key, type|
|
|
168
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
169
|
+
transformed_hash["#{key}"] = nil
|
|
170
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
171
|
+
# check to ensure the input is an array given that the attribute
|
|
172
|
+
# is documented as an array but the input is not
|
|
173
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
174
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
175
|
+
end
|
|
176
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
177
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
new(transformed_hash)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Deserializes the data based on type
|
|
184
|
+
# @param string type Data type
|
|
185
|
+
# @param string value Value to be deserialized
|
|
186
|
+
# @return [Object] Deserialized data
|
|
187
|
+
def self._deserialize(type, value)
|
|
188
|
+
case type.to_sym
|
|
189
|
+
when :Time
|
|
190
|
+
Time.parse(value)
|
|
191
|
+
when :Date
|
|
192
|
+
Date.parse(value)
|
|
193
|
+
when :String
|
|
194
|
+
value.to_s
|
|
195
|
+
when :Integer
|
|
196
|
+
value.to_i
|
|
197
|
+
when :Float
|
|
198
|
+
value.to_f
|
|
199
|
+
when :Boolean
|
|
200
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
201
|
+
true
|
|
202
|
+
else
|
|
203
|
+
false
|
|
204
|
+
end
|
|
205
|
+
when :Object
|
|
206
|
+
# generic object (usually a Hash), return directly
|
|
207
|
+
value
|
|
208
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
209
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
210
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
211
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
212
|
+
k_type = Regexp.last_match[:k_type]
|
|
213
|
+
v_type = Regexp.last_match[:v_type]
|
|
214
|
+
{}.tap do |hash|
|
|
215
|
+
value.each do |k, v|
|
|
216
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
else # model
|
|
220
|
+
# models (e.g. Pet) or oneOf
|
|
221
|
+
klass = OpenapiClient.const_get(type)
|
|
222
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Returns the string representation of the object
|
|
227
|
+
# @return [String] String presentation of the object
|
|
228
|
+
def to_s
|
|
229
|
+
to_hash.to_s
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
|
234
|
+
def to_body
|
|
235
|
+
to_hash
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Returns the object in the form of hash
|
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
|
240
|
+
def to_hash
|
|
241
|
+
hash = {}
|
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
243
|
+
value = self.send(attr)
|
|
244
|
+
if value.nil?
|
|
245
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
246
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
hash[param] = _to_hash(value)
|
|
250
|
+
end
|
|
251
|
+
hash
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Outputs non-array value in the form of hash
|
|
255
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
256
|
+
# @param [Object] value Any valid value
|
|
257
|
+
# @return [Hash] Returns the value in the form of hash
|
|
258
|
+
def _to_hash(value)
|
|
259
|
+
if value.is_a?(Array)
|
|
260
|
+
value.compact.map { |v| _to_hash(v) }
|
|
261
|
+
elsif value.is_a?(Hash)
|
|
262
|
+
{}.tap do |hash|
|
|
263
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
264
|
+
end
|
|
265
|
+
elsif value.respond_to? :to_hash
|
|
266
|
+
value.to_hash
|
|
267
|
+
else
|
|
268
|
+
value
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
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 LiveActivityColor
|
|
18
|
+
LIME = "lime".freeze
|
|
19
|
+
GREEN = "green".freeze
|
|
20
|
+
CYAN = "cyan".freeze
|
|
21
|
+
BLUE = "blue".freeze
|
|
22
|
+
PURPLE = "purple".freeze
|
|
23
|
+
MAGENTA = "magenta".freeze
|
|
24
|
+
RED = "red".freeze
|
|
25
|
+
ORANGE = "orange".freeze
|
|
26
|
+
YELLOW = "yellow".freeze
|
|
27
|
+
GRAY = "gray".freeze
|
|
28
|
+
|
|
29
|
+
def self.all_vars
|
|
30
|
+
@all_vars ||= [LIME, GREEN, CYAN, BLUE, PURPLE, MAGENTA, RED, ORANGE, YELLOW, GRAY].freeze
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Builds the enum from string
|
|
34
|
+
# @param [String] The enum value in the form of the string
|
|
35
|
+
# @return [String] The enum value
|
|
36
|
+
def self.build_from_hash(value)
|
|
37
|
+
new.build_from_hash(value)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Builds the enum from string
|
|
41
|
+
# @param [String] The enum value in the form of the string
|
|
42
|
+
# @return [String] The enum value
|
|
43
|
+
def build_from_hash(value)
|
|
44
|
+
return value if LiveActivityColor.all_vars.include?(value)
|
|
45
|
+
raise "Invalid ENUM value #{value} for class #LiveActivityColor"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -20,7 +20,7 @@ module OpenapiClient
|
|
|
20
20
|
|
|
21
21
|
attr_accessor :type
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# Action URL. For open_url, use an HTTPS or shortcuts:// URL. 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,28 +29,6 @@ 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
|
-
|
|
54
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
55
33
|
def self.attribute_map
|
|
56
34
|
{
|
|
@@ -116,6 +94,7 @@ module OpenapiClient
|
|
|
116
94
|
else
|
|
117
95
|
self.url = nil
|
|
118
96
|
end
|
|
97
|
+
validate_action_url!
|
|
119
98
|
|
|
120
99
|
if attributes.key?(:'method')
|
|
121
100
|
self.method = attributes[:'method']
|
|
@@ -130,6 +109,16 @@ module OpenapiClient
|
|
|
130
109
|
end
|
|
131
110
|
end
|
|
132
111
|
|
|
112
|
+
def validate_action_url!
|
|
113
|
+
return if @url.nil? || @type.nil?
|
|
114
|
+
if @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
|
|
115
|
+
fail ArgumentError, 'invalid value for "url", open_url must use https or shortcuts.'
|
|
116
|
+
end
|
|
117
|
+
if @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
|
|
118
|
+
fail ArgumentError, 'invalid value for "url", webhook must use https.'
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
133
122
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
134
123
|
# @return Array for valid properties with the reasons
|
|
135
124
|
def list_invalid_properties
|
|
@@ -146,10 +135,11 @@ module OpenapiClient
|
|
|
146
135
|
if @url.nil?
|
|
147
136
|
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
|
148
137
|
end
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
138
|
+
if !@url.nil? && @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
|
|
139
|
+
invalid_properties.push('invalid value for "url", open_url must use https or shortcuts.')
|
|
140
|
+
end
|
|
141
|
+
if !@url.nil? && @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
|
|
142
|
+
invalid_properties.push('invalid value for "url", webhook must use https.')
|
|
153
143
|
end
|
|
154
144
|
|
|
155
145
|
invalid_properties
|
|
@@ -162,25 +152,11 @@ module OpenapiClient
|
|
|
162
152
|
return false if @title.nil?
|
|
163
153
|
return false if @type.nil?
|
|
164
154
|
return false if @url.nil?
|
|
165
|
-
return false if @url !~
|
|
155
|
+
return false if !@url.nil? && @type == PushNotificationActionType::OPEN_URL && @url !~ /\A(https|shortcuts):\/\//
|
|
156
|
+
return false if !@url.nil? && @type == PushNotificationActionType::WEBHOOK && @url !~ /\Ahttps:\/\//
|
|
166
157
|
true
|
|
167
158
|
end
|
|
168
159
|
|
|
169
|
-
# Custom attribute writer method with validation
|
|
170
|
-
# @param [Object] url Value to be assigned
|
|
171
|
-
def url=(url)
|
|
172
|
-
if url.nil?
|
|
173
|
-
fail ArgumentError, 'url cannot be nil'
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
pattern = Regexp.new(/^https:\/\//)
|
|
177
|
-
if url !~ pattern
|
|
178
|
-
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
@url = url
|
|
182
|
-
end
|
|
183
|
-
|
|
184
160
|
# Checks equality by comparing each attribute.
|
|
185
161
|
# @param [Object] Object to be compared
|
|
186
162
|
def ==(o)
|
|
@@ -24,7 +24,7 @@ module OpenapiClient
|
|
|
24
24
|
# 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
25
|
attr_accessor :media
|
|
26
26
|
|
|
27
|
-
# Optional HTTPS URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
|
|
27
|
+
# Optional HTTPS or shortcuts:// URL opened when user taps the notification body. Overrides the default tap target from `media` when both are provided.
|
|
28
28
|
attr_accessor :redirection
|
|
29
29
|
|
|
30
30
|
# Optional interactive actions shown when users expand the notification. Cannot be combined with `media`.
|
|
@@ -157,7 +157,7 @@ module OpenapiClient
|
|
|
157
157
|
invalid_properties.push("invalid value for \"media\", must conform to the pattern #{pattern}.")
|
|
158
158
|
end
|
|
159
159
|
|
|
160
|
-
pattern = Regexp.new(/^https:\/\//)
|
|
160
|
+
pattern = Regexp.new(/^(https|shortcuts):\/\//)
|
|
161
161
|
if !@redirection.nil? && @redirection !~ pattern
|
|
162
162
|
invalid_properties.push("invalid value for \"redirection\", must conform to the pattern #{pattern}.")
|
|
163
163
|
end
|
|
@@ -175,7 +175,7 @@ module OpenapiClient
|
|
|
175
175
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
176
176
|
return false if @title.nil?
|
|
177
177
|
return false if !@media.nil? && @media !~ Regexp.new(/^https:\/\//)
|
|
178
|
-
return false if !@redirection.nil? && @redirection !~ Regexp.new(/^https:\/\//)
|
|
178
|
+
return false if !@redirection.nil? && @redirection !~ Regexp.new(/^(https|shortcuts):\/\//)
|
|
179
179
|
return false if !@actions.nil? && @actions.length > 4
|
|
180
180
|
true
|
|
181
181
|
end
|
|
@@ -202,7 +202,7 @@ module OpenapiClient
|
|
|
202
202
|
fail ArgumentError, 'redirection cannot be nil'
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
-
pattern = Regexp.new(/^https:\/\//)
|
|
205
|
+
pattern = Regexp.new(/^(https|shortcuts):\/\//)
|
|
206
206
|
if redirection !~ pattern
|
|
207
207
|
fail ArgumentError, "invalid value for \"redirection\", must conform to the pattern #{pattern}."
|
|
208
208
|
end
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
-
# Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, and
|
|
17
|
+
# Current state for a managed Live Activity stream. Include type on the first PUT, and whenever the stream may need to start a fresh activity. Supports segmented_progress, progress, metrics, stats, and alert types.
|
|
18
18
|
class StreamContentState
|
|
19
19
|
attr_accessor :title
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ module OpenapiClient
|
|
|
23
23
|
# Use for segmented_progress.
|
|
24
24
|
attr_accessor :number_of_steps
|
|
25
25
|
|
|
26
|
-
# Use for segmented_progress.
|
|
26
|
+
# Use for segmented_progress. Set 0 when no segment is complete yet. Must be less than or equal to number_of_steps when number_of_steps is provided.
|
|
27
27
|
attr_accessor :current_step
|
|
28
28
|
|
|
29
29
|
# Use for progress. Takes precedence over value/upper_limit if both are provided.
|
|
@@ -38,7 +38,7 @@ module OpenapiClient
|
|
|
38
38
|
# Required on the first PUT or whenever the stream cannot infer the current activity type.
|
|
39
39
|
attr_accessor :type
|
|
40
40
|
|
|
41
|
-
# Optional. Accent color for
|
|
41
|
+
# Optional. Accent color for progress, segmented_progress, and metrics Live Activities. For Alert Live Activities, this tints the action button when action is included.
|
|
42
42
|
attr_accessor :color
|
|
43
43
|
|
|
44
44
|
# Optional. Overrides color for the current step. Only applies to segmented_progress.
|
|
@@ -50,6 +50,15 @@ module OpenapiClient
|
|
|
50
50
|
# Use for metrics and stats activities.
|
|
51
51
|
attr_accessor :metrics
|
|
52
52
|
|
|
53
|
+
# Required for type=alert.
|
|
54
|
+
attr_accessor :message
|
|
55
|
+
|
|
56
|
+
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, and stats.
|
|
57
|
+
attr_accessor :icon
|
|
58
|
+
|
|
59
|
+
# Optional badge. Supported by alert, progress, and segmented_progress.
|
|
60
|
+
attr_accessor :badge
|
|
61
|
+
|
|
53
62
|
# Optional. Seconds before the ended Live Activity is dismissed.
|
|
54
63
|
attr_accessor :auto_dismiss_seconds
|
|
55
64
|
|
|
@@ -93,6 +102,9 @@ module OpenapiClient
|
|
|
93
102
|
:'step_color' => :'step_color',
|
|
94
103
|
:'step_colors' => :'step_colors',
|
|
95
104
|
:'metrics' => :'metrics',
|
|
105
|
+
:'message' => :'message',
|
|
106
|
+
:'icon' => :'icon',
|
|
107
|
+
:'badge' => :'badge',
|
|
96
108
|
:'auto_dismiss_seconds' => :'auto_dismiss_seconds',
|
|
97
109
|
:'auto_dismiss_minutes' => :'auto_dismiss_minutes'
|
|
98
110
|
}
|
|
@@ -118,6 +130,9 @@ module OpenapiClient
|
|
|
118
130
|
:'step_color' => :'String',
|
|
119
131
|
:'step_colors' => :'Array<String>',
|
|
120
132
|
:'metrics' => :'Array<ActivityMetric>',
|
|
133
|
+
:'message' => :'String',
|
|
134
|
+
:'icon' => :'LiveActivityAlertIcon',
|
|
135
|
+
:'badge' => :'LiveActivityAlertBadge',
|
|
121
136
|
:'auto_dismiss_seconds' => :'Integer',
|
|
122
137
|
:'auto_dismiss_minutes' => :'Integer'
|
|
123
138
|
}
|
|
@@ -180,8 +195,6 @@ module OpenapiClient
|
|
|
180
195
|
|
|
181
196
|
if attributes.key?(:'color')
|
|
182
197
|
self.color = attributes[:'color']
|
|
183
|
-
else
|
|
184
|
-
self.color = 'blue'
|
|
185
198
|
end
|
|
186
199
|
|
|
187
200
|
if attributes.key?(:'step_color')
|
|
@@ -200,6 +213,18 @@ module OpenapiClient
|
|
|
200
213
|
end
|
|
201
214
|
end
|
|
202
215
|
|
|
216
|
+
if attributes.key?(:'message')
|
|
217
|
+
self.message = attributes[:'message']
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if attributes.key?(:'icon')
|
|
221
|
+
self.icon = attributes[:'icon']
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
if attributes.key?(:'badge')
|
|
225
|
+
self.badge = attributes[:'badge']
|
|
226
|
+
end
|
|
227
|
+
|
|
203
228
|
if attributes.key?(:'auto_dismiss_seconds')
|
|
204
229
|
self.auto_dismiss_seconds = attributes[:'auto_dismiss_seconds']
|
|
205
230
|
end
|
|
@@ -222,8 +247,8 @@ module OpenapiClient
|
|
|
222
247
|
invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
|
|
223
248
|
end
|
|
224
249
|
|
|
225
|
-
if !@current_step.nil? && @current_step <
|
|
226
|
-
invalid_properties.push('invalid value for "current_step", must be greater than or equal to
|
|
250
|
+
if !@current_step.nil? && @current_step < 0
|
|
251
|
+
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 0.')
|
|
227
252
|
end
|
|
228
253
|
|
|
229
254
|
if !@percentage.nil? && @percentage > 100
|
|
@@ -242,6 +267,10 @@ module OpenapiClient
|
|
|
242
267
|
invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
|
|
243
268
|
end
|
|
244
269
|
|
|
270
|
+
if !@message.nil? && @message.to_s.length < 1
|
|
271
|
+
invalid_properties.push('invalid value for "message", the character length must be great than or equal to 1.')
|
|
272
|
+
end
|
|
273
|
+
|
|
245
274
|
if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
246
275
|
invalid_properties.push('invalid value for "auto_dismiss_seconds", must be greater than or equal to 0.')
|
|
247
276
|
end
|
|
@@ -259,17 +288,18 @@ module OpenapiClient
|
|
|
259
288
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
260
289
|
return false if @title.nil?
|
|
261
290
|
return false if !@number_of_steps.nil? && @number_of_steps < 1
|
|
262
|
-
return false if !@current_step.nil? && @current_step <
|
|
291
|
+
return false if !@current_step.nil? && @current_step < 0
|
|
263
292
|
return false if !@percentage.nil? && @percentage > 100
|
|
264
293
|
return false if !@percentage.nil? && @percentage < 0
|
|
265
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
|
|
294
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
|
|
266
295
|
return false unless type_validator.valid?(@type)
|
|
267
|
-
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
296
|
+
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
268
297
|
return false unless color_validator.valid?(@color)
|
|
269
|
-
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
298
|
+
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
270
299
|
return false unless step_color_validator.valid?(@step_color)
|
|
271
300
|
return false if !@metrics.nil? && @metrics.length > 8
|
|
272
301
|
return false if !@metrics.nil? && @metrics.length < 1
|
|
302
|
+
return false if !@message.nil? && @message.to_s.length < 1
|
|
273
303
|
return false if !@auto_dismiss_seconds.nil? && @auto_dismiss_seconds < 0
|
|
274
304
|
return false if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
|
|
275
305
|
true
|
|
@@ -296,8 +326,8 @@ module OpenapiClient
|
|
|
296
326
|
fail ArgumentError, 'current_step cannot be nil'
|
|
297
327
|
end
|
|
298
328
|
|
|
299
|
-
if current_step <
|
|
300
|
-
fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to
|
|
329
|
+
if current_step < 0
|
|
330
|
+
fail ArgumentError, 'invalid value for "current_step", must be greater than or equal to 0.'
|
|
301
331
|
end
|
|
302
332
|
|
|
303
333
|
@current_step = current_step
|
|
@@ -324,7 +354,7 @@ module OpenapiClient
|
|
|
324
354
|
# Custom attribute writer method checking allowed values (enum).
|
|
325
355
|
# @param [Object] type Object to be assigned
|
|
326
356
|
def type=(type)
|
|
327
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats"])
|
|
357
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert"])
|
|
328
358
|
unless validator.valid?(type)
|
|
329
359
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
330
360
|
end
|
|
@@ -334,7 +364,7 @@ module OpenapiClient
|
|
|
334
364
|
# Custom attribute writer method checking allowed values (enum).
|
|
335
365
|
# @param [Object] color Object to be assigned
|
|
336
366
|
def color=(color)
|
|
337
|
-
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
367
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
338
368
|
unless validator.valid?(color)
|
|
339
369
|
fail ArgumentError, "invalid value for \"color\", must be one of #{validator.allowable_values}."
|
|
340
370
|
end
|
|
@@ -344,7 +374,7 @@ module OpenapiClient
|
|
|
344
374
|
# Custom attribute writer method checking allowed values (enum).
|
|
345
375
|
# @param [Object] step_color Object to be assigned
|
|
346
376
|
def step_color=(step_color)
|
|
347
|
-
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
377
|
+
validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
348
378
|
unless validator.valid?(step_color)
|
|
349
379
|
fail ArgumentError, "invalid value for \"step_color\", must be one of #{validator.allowable_values}."
|
|
350
380
|
end
|
|
@@ -369,6 +399,20 @@ module OpenapiClient
|
|
|
369
399
|
@metrics = metrics
|
|
370
400
|
end
|
|
371
401
|
|
|
402
|
+
# Custom attribute writer method with validation
|
|
403
|
+
# @param [Object] message Value to be assigned
|
|
404
|
+
def message=(message)
|
|
405
|
+
if message.nil?
|
|
406
|
+
fail ArgumentError, 'message cannot be nil'
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
if message.to_s.length < 1
|
|
410
|
+
fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.'
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
@message = message
|
|
414
|
+
end
|
|
415
|
+
|
|
372
416
|
# Custom attribute writer method with validation
|
|
373
417
|
# @param [Object] auto_dismiss_seconds Value to be assigned
|
|
374
418
|
def auto_dismiss_seconds=(auto_dismiss_seconds)
|
|
@@ -414,6 +458,9 @@ module OpenapiClient
|
|
|
414
458
|
step_color == o.step_color &&
|
|
415
459
|
step_colors == o.step_colors &&
|
|
416
460
|
metrics == o.metrics &&
|
|
461
|
+
message == o.message &&
|
|
462
|
+
icon == o.icon &&
|
|
463
|
+
badge == o.badge &&
|
|
417
464
|
auto_dismiss_seconds == o.auto_dismiss_seconds &&
|
|
418
465
|
auto_dismiss_minutes == o.auto_dismiss_minutes
|
|
419
466
|
end
|
|
@@ -427,7 +474,7 @@ module OpenapiClient
|
|
|
427
474
|
# Calculates hash code according to all attributes.
|
|
428
475
|
# @return [Integer] Hash code
|
|
429
476
|
def hash
|
|
430
|
-
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, step_colors, metrics, auto_dismiss_seconds, auto_dismiss_minutes].hash
|
|
477
|
+
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, step_colors, metrics, message, icon, badge, auto_dismiss_seconds, auto_dismiss_minutes].hash
|
|
431
478
|
end
|
|
432
479
|
|
|
433
480
|
# Builds the object from hash
|