activitysmith 1.0.0 → 1.1.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 +238 -32
- data/generated/activitysmith_openapi/api/live_activities_api.rb +168 -6
- data/generated/activitysmith_openapi/models/activity_metric.rb +293 -0
- data/generated/activitysmith_openapi/models/content_state_end.rb +47 -4
- data/generated/activitysmith_openapi/models/content_state_start.rb +50 -7
- data/generated/activitysmith_openapi/models/content_state_update.rb +50 -7
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +233 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_response.rb +332 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_put_response.rb +361 -0
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +280 -0
- data/generated/activitysmith_openapi/models/not_found_error.rb +237 -0
- data/generated/activitysmith_openapi/models/stream_content_state.rb +538 -0
- data/generated/activitysmith_openapi.rb +7 -0
- data/lib/activitysmith/live_activities.rb +19 -0
- data/lib/activitysmith/version.rb +1 -1
- metadata +9 -2
|
@@ -0,0 +1,293 @@
|
|
|
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 ActivityMetric
|
|
18
|
+
attr_accessor :label
|
|
19
|
+
|
|
20
|
+
attr_accessor :value
|
|
21
|
+
|
|
22
|
+
attr_accessor :unit
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'label' => :'label',
|
|
28
|
+
:'value' => :'value',
|
|
29
|
+
:'unit' => :'unit'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
|
34
|
+
def self.acceptable_attributes
|
|
35
|
+
attribute_map.values
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Attribute type mapping.
|
|
39
|
+
def self.openapi_types
|
|
40
|
+
{
|
|
41
|
+
:'label' => :'String',
|
|
42
|
+
:'value' => :'Float',
|
|
43
|
+
:'unit' => :'String'
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# List of attributes with nullable: true
|
|
48
|
+
def self.openapi_nullable
|
|
49
|
+
Set.new([
|
|
50
|
+
])
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Initializes the object
|
|
54
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
55
|
+
def initialize(attributes = {})
|
|
56
|
+
if (!attributes.is_a?(Hash))
|
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::ActivityMetric` initialize method"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
63
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::ActivityMetric`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
64
|
+
end
|
|
65
|
+
h[k.to_sym] = v
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'label')
|
|
69
|
+
self.label = attributes[:'label']
|
|
70
|
+
else
|
|
71
|
+
self.label = nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'value')
|
|
75
|
+
self.value = attributes[:'value']
|
|
76
|
+
else
|
|
77
|
+
self.value = nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'unit')
|
|
81
|
+
self.unit = attributes[:'unit']
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
86
|
+
# @return Array for valid properties with the reasons
|
|
87
|
+
def list_invalid_properties
|
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
89
|
+
invalid_properties = Array.new
|
|
90
|
+
if @label.nil?
|
|
91
|
+
invalid_properties.push('invalid value for "label", label cannot be nil.')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if @label.to_s.length < 1
|
|
95
|
+
invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if @value.nil?
|
|
99
|
+
invalid_properties.push('invalid value for "value", value cannot be nil.')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if @value > 100
|
|
103
|
+
invalid_properties.push('invalid value for "value", must be smaller than or equal to 100.')
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if @value < 0
|
|
107
|
+
invalid_properties.push('invalid value for "value", must be greater than or equal to 0.')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
invalid_properties
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Check to see if the all the properties in the model are valid
|
|
114
|
+
# @return true if the model is valid
|
|
115
|
+
def valid?
|
|
116
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
117
|
+
return false if @label.nil?
|
|
118
|
+
return false if @label.to_s.length < 1
|
|
119
|
+
return false if @value.nil?
|
|
120
|
+
return false if @value > 100
|
|
121
|
+
return false if @value < 0
|
|
122
|
+
true
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Custom attribute writer method with validation
|
|
126
|
+
# @param [Object] label Value to be assigned
|
|
127
|
+
def label=(label)
|
|
128
|
+
if label.nil?
|
|
129
|
+
fail ArgumentError, 'label cannot be nil'
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if label.to_s.length < 1
|
|
133
|
+
fail ArgumentError, 'invalid value for "label", the character length must be great than or equal to 1.'
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
@label = label
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Custom attribute writer method with validation
|
|
140
|
+
# @param [Object] value Value to be assigned
|
|
141
|
+
def value=(value)
|
|
142
|
+
if value.nil?
|
|
143
|
+
fail ArgumentError, 'value cannot be nil'
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if value > 100
|
|
147
|
+
fail ArgumentError, 'invalid value for "value", must be smaller than or equal to 100.'
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if value < 0
|
|
151
|
+
fail ArgumentError, 'invalid value for "value", must be greater than or equal to 0.'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
@value = value
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Checks equality by comparing each attribute.
|
|
158
|
+
# @param [Object] Object to be compared
|
|
159
|
+
def ==(o)
|
|
160
|
+
return true if self.equal?(o)
|
|
161
|
+
self.class == o.class &&
|
|
162
|
+
label == o.label &&
|
|
163
|
+
value == o.value &&
|
|
164
|
+
unit == o.unit
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# @see the `==` method
|
|
168
|
+
# @param [Object] Object to be compared
|
|
169
|
+
def eql?(o)
|
|
170
|
+
self == o
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Calculates hash code according to all attributes.
|
|
174
|
+
# @return [Integer] Hash code
|
|
175
|
+
def hash
|
|
176
|
+
[label, value, unit].hash
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Builds the object from hash
|
|
180
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
181
|
+
# @return [Object] Returns the model itself
|
|
182
|
+
def self.build_from_hash(attributes)
|
|
183
|
+
return nil unless attributes.is_a?(Hash)
|
|
184
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
185
|
+
transformed_hash = {}
|
|
186
|
+
openapi_types.each_pair do |key, type|
|
|
187
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
188
|
+
transformed_hash["#{key}"] = nil
|
|
189
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
190
|
+
# check to ensure the input is an array given that the attribute
|
|
191
|
+
# is documented as an array but the input is not
|
|
192
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
193
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
194
|
+
end
|
|
195
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
196
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
new(transformed_hash)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Deserializes the data based on type
|
|
203
|
+
# @param string type Data type
|
|
204
|
+
# @param string value Value to be deserialized
|
|
205
|
+
# @return [Object] Deserialized data
|
|
206
|
+
def self._deserialize(type, value)
|
|
207
|
+
case type.to_sym
|
|
208
|
+
when :Time
|
|
209
|
+
Time.parse(value)
|
|
210
|
+
when :Date
|
|
211
|
+
Date.parse(value)
|
|
212
|
+
when :String
|
|
213
|
+
value.to_s
|
|
214
|
+
when :Integer
|
|
215
|
+
value.to_i
|
|
216
|
+
when :Float
|
|
217
|
+
value.to_f
|
|
218
|
+
when :Boolean
|
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
220
|
+
true
|
|
221
|
+
else
|
|
222
|
+
false
|
|
223
|
+
end
|
|
224
|
+
when :Object
|
|
225
|
+
# generic object (usually a Hash), return directly
|
|
226
|
+
value
|
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
|
233
|
+
{}.tap do |hash|
|
|
234
|
+
value.each do |k, v|
|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
else # model
|
|
239
|
+
# models (e.g. Pet) or oneOf
|
|
240
|
+
klass = OpenapiClient.const_get(type)
|
|
241
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Returns the string representation of the object
|
|
246
|
+
# @return [String] String presentation of the object
|
|
247
|
+
def to_s
|
|
248
|
+
to_hash.to_s
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
|
253
|
+
def to_body
|
|
254
|
+
to_hash
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# Returns the object in the form of hash
|
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
|
259
|
+
def to_hash
|
|
260
|
+
hash = {}
|
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
262
|
+
value = self.send(attr)
|
|
263
|
+
if value.nil?
|
|
264
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
265
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
hash[param] = _to_hash(value)
|
|
269
|
+
end
|
|
270
|
+
hash
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Outputs non-array value in the form of hash
|
|
274
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
275
|
+
# @param [Object] value Any valid value
|
|
276
|
+
# @return [Hash] Returns the value in the form of hash
|
|
277
|
+
def _to_hash(value)
|
|
278
|
+
if value.is_a?(Array)
|
|
279
|
+
value.compact.map { |v| _to_hash(v) }
|
|
280
|
+
elsif value.is_a?(Hash)
|
|
281
|
+
{}.tap do |hash|
|
|
282
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
283
|
+
end
|
|
284
|
+
elsif value.respond_to? :to_hash
|
|
285
|
+
value.to_hash
|
|
286
|
+
else
|
|
287
|
+
value
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
end
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
-
# End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
|
|
17
|
+
# End payload requires title. For segmented_progress include current_step and optionally number_of_steps. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. Type is optional when ending an existing activity. You can send an updated number_of_steps here if the workflow changed after start.
|
|
18
18
|
class ContentStateEnd
|
|
19
19
|
attr_accessor :title
|
|
20
20
|
|
|
@@ -35,6 +35,9 @@ module OpenapiClient
|
|
|
35
35
|
# Maximum progress value. Use with value for type=progress.
|
|
36
36
|
attr_accessor :upper_limit
|
|
37
37
|
|
|
38
|
+
# Use for type=metrics.
|
|
39
|
+
attr_accessor :metrics
|
|
40
|
+
|
|
38
41
|
# Optional. When omitted, the API uses the existing Live Activity type.
|
|
39
42
|
attr_accessor :type
|
|
40
43
|
|
|
@@ -44,6 +47,9 @@ module OpenapiClient
|
|
|
44
47
|
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
|
|
45
48
|
attr_accessor :step_color
|
|
46
49
|
|
|
50
|
+
# Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
|
|
51
|
+
attr_accessor :step_colors
|
|
52
|
+
|
|
47
53
|
# Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max.
|
|
48
54
|
attr_accessor :auto_dismiss_minutes
|
|
49
55
|
|
|
@@ -79,9 +85,11 @@ module OpenapiClient
|
|
|
79
85
|
:'percentage' => :'percentage',
|
|
80
86
|
:'value' => :'value',
|
|
81
87
|
:'upper_limit' => :'upper_limit',
|
|
88
|
+
:'metrics' => :'metrics',
|
|
82
89
|
:'type' => :'type',
|
|
83
90
|
:'color' => :'color',
|
|
84
91
|
:'step_color' => :'step_color',
|
|
92
|
+
:'step_colors' => :'step_colors',
|
|
85
93
|
:'auto_dismiss_minutes' => :'auto_dismiss_minutes'
|
|
86
94
|
}
|
|
87
95
|
end
|
|
@@ -101,9 +109,11 @@ module OpenapiClient
|
|
|
101
109
|
:'percentage' => :'Float',
|
|
102
110
|
:'value' => :'Float',
|
|
103
111
|
:'upper_limit' => :'Float',
|
|
112
|
+
:'metrics' => :'Array<ActivityMetric>',
|
|
104
113
|
:'type' => :'String',
|
|
105
114
|
:'color' => :'String',
|
|
106
115
|
:'step_color' => :'String',
|
|
116
|
+
:'step_colors' => :'Array<String>',
|
|
107
117
|
:'auto_dismiss_minutes' => :'Integer'
|
|
108
118
|
}
|
|
109
119
|
end
|
|
@@ -159,6 +169,12 @@ module OpenapiClient
|
|
|
159
169
|
self.upper_limit = attributes[:'upper_limit']
|
|
160
170
|
end
|
|
161
171
|
|
|
172
|
+
if attributes.key?(:'metrics')
|
|
173
|
+
if (value = attributes[:'metrics']).is_a?(Array)
|
|
174
|
+
self.metrics = value
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
162
178
|
if attributes.key?(:'type')
|
|
163
179
|
self.type = attributes[:'type']
|
|
164
180
|
end
|
|
@@ -173,6 +189,12 @@ module OpenapiClient
|
|
|
173
189
|
self.step_color = attributes[:'step_color']
|
|
174
190
|
end
|
|
175
191
|
|
|
192
|
+
if attributes.key?(:'step_colors')
|
|
193
|
+
if (value = attributes[:'step_colors']).is_a?(Array)
|
|
194
|
+
self.step_colors = value
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
176
198
|
if attributes.key?(:'auto_dismiss_minutes')
|
|
177
199
|
self.auto_dismiss_minutes = attributes[:'auto_dismiss_minutes']
|
|
178
200
|
else
|
|
@@ -205,6 +227,10 @@ module OpenapiClient
|
|
|
205
227
|
invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
|
|
206
228
|
end
|
|
207
229
|
|
|
230
|
+
if !@metrics.nil? && @metrics.length < 1
|
|
231
|
+
invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
|
|
232
|
+
end
|
|
233
|
+
|
|
208
234
|
if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
|
|
209
235
|
invalid_properties.push('invalid value for "auto_dismiss_minutes", must be greater than or equal to 0.')
|
|
210
236
|
end
|
|
@@ -221,7 +247,8 @@ module OpenapiClient
|
|
|
221
247
|
return false if !@current_step.nil? && @current_step < 1
|
|
222
248
|
return false if !@percentage.nil? && @percentage > 100
|
|
223
249
|
return false if !@percentage.nil? && @percentage < 0
|
|
224
|
-
|
|
250
|
+
return false if !@metrics.nil? && @metrics.length < 1
|
|
251
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
225
252
|
return false unless type_validator.valid?(@type)
|
|
226
253
|
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
227
254
|
return false unless color_validator.valid?(@color)
|
|
@@ -277,10 +304,24 @@ module OpenapiClient
|
|
|
277
304
|
@percentage = percentage
|
|
278
305
|
end
|
|
279
306
|
|
|
307
|
+
# Custom attribute writer method with validation
|
|
308
|
+
# @param [Object] metrics Value to be assigned
|
|
309
|
+
def metrics=(metrics)
|
|
310
|
+
if metrics.nil?
|
|
311
|
+
fail ArgumentError, 'metrics cannot be nil'
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
if metrics.length < 1
|
|
315
|
+
fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
@metrics = metrics
|
|
319
|
+
end
|
|
320
|
+
|
|
280
321
|
# Custom attribute writer method checking allowed values (enum).
|
|
281
322
|
# @param [Object] type Object to be assigned
|
|
282
323
|
def type=(type)
|
|
283
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
|
|
324
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
284
325
|
unless validator.valid?(type)
|
|
285
326
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
286
327
|
end
|
|
@@ -333,9 +374,11 @@ module OpenapiClient
|
|
|
333
374
|
percentage == o.percentage &&
|
|
334
375
|
value == o.value &&
|
|
335
376
|
upper_limit == o.upper_limit &&
|
|
377
|
+
metrics == o.metrics &&
|
|
336
378
|
type == o.type &&
|
|
337
379
|
color == o.color &&
|
|
338
380
|
step_color == o.step_color &&
|
|
381
|
+
step_colors == o.step_colors &&
|
|
339
382
|
auto_dismiss_minutes == o.auto_dismiss_minutes
|
|
340
383
|
end
|
|
341
384
|
|
|
@@ -348,7 +391,7 @@ module OpenapiClient
|
|
|
348
391
|
# Calculates hash code according to all attributes.
|
|
349
392
|
# @return [Integer] Hash code
|
|
350
393
|
def hash
|
|
351
|
-
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, auto_dismiss_minutes].hash
|
|
394
|
+
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors, auto_dismiss_minutes].hash
|
|
352
395
|
end
|
|
353
396
|
|
|
354
397
|
# Builds the object from hash
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
-
# Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
|
|
17
|
+
# Start payload requires title and type. For segmented_progress include number_of_steps and current_step. For progress include percentage or value with upper_limit. For metrics include a non-empty metrics array. Legacy counter/timer/countdown types also use current_step and number_of_steps. For segmented_progress, number_of_steps is not locked and can be changed in later update or end calls.
|
|
18
18
|
class ContentStateStart
|
|
19
19
|
attr_accessor :title
|
|
20
20
|
|
|
@@ -35,6 +35,9 @@ module OpenapiClient
|
|
|
35
35
|
# Maximum progress value. Use with value for type=progress.
|
|
36
36
|
attr_accessor :upper_limit
|
|
37
37
|
|
|
38
|
+
# Use for type=metrics.
|
|
39
|
+
attr_accessor :metrics
|
|
40
|
+
|
|
38
41
|
attr_accessor :type
|
|
39
42
|
|
|
40
43
|
# Optional. Accent color for the Live Activity. Defaults to blue.
|
|
@@ -43,6 +46,9 @@ module OpenapiClient
|
|
|
43
46
|
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
|
|
44
47
|
attr_accessor :step_color
|
|
45
48
|
|
|
49
|
+
# Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
|
|
50
|
+
attr_accessor :step_colors
|
|
51
|
+
|
|
46
52
|
class EnumAttributeValidator
|
|
47
53
|
attr_reader :datatype
|
|
48
54
|
attr_reader :allowable_values
|
|
@@ -75,9 +81,11 @@ module OpenapiClient
|
|
|
75
81
|
:'percentage' => :'percentage',
|
|
76
82
|
:'value' => :'value',
|
|
77
83
|
:'upper_limit' => :'upper_limit',
|
|
84
|
+
:'metrics' => :'metrics',
|
|
78
85
|
:'type' => :'type',
|
|
79
86
|
:'color' => :'color',
|
|
80
|
-
:'step_color' => :'step_color'
|
|
87
|
+
:'step_color' => :'step_color',
|
|
88
|
+
:'step_colors' => :'step_colors'
|
|
81
89
|
}
|
|
82
90
|
end
|
|
83
91
|
|
|
@@ -96,9 +104,11 @@ module OpenapiClient
|
|
|
96
104
|
:'percentage' => :'Float',
|
|
97
105
|
:'value' => :'Float',
|
|
98
106
|
:'upper_limit' => :'Float',
|
|
107
|
+
:'metrics' => :'Array<ActivityMetric>',
|
|
99
108
|
:'type' => :'String',
|
|
100
109
|
:'color' => :'String',
|
|
101
|
-
:'step_color' => :'String'
|
|
110
|
+
:'step_color' => :'String',
|
|
111
|
+
:'step_colors' => :'Array<String>'
|
|
102
112
|
}
|
|
103
113
|
end
|
|
104
114
|
|
|
@@ -153,6 +163,12 @@ module OpenapiClient
|
|
|
153
163
|
self.upper_limit = attributes[:'upper_limit']
|
|
154
164
|
end
|
|
155
165
|
|
|
166
|
+
if attributes.key?(:'metrics')
|
|
167
|
+
if (value = attributes[:'metrics']).is_a?(Array)
|
|
168
|
+
self.metrics = value
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
156
172
|
if attributes.key?(:'type')
|
|
157
173
|
self.type = attributes[:'type']
|
|
158
174
|
else
|
|
@@ -168,6 +184,12 @@ module OpenapiClient
|
|
|
168
184
|
if attributes.key?(:'step_color')
|
|
169
185
|
self.step_color = attributes[:'step_color']
|
|
170
186
|
end
|
|
187
|
+
|
|
188
|
+
if attributes.key?(:'step_colors')
|
|
189
|
+
if (value = attributes[:'step_colors']).is_a?(Array)
|
|
190
|
+
self.step_colors = value
|
|
191
|
+
end
|
|
192
|
+
end
|
|
171
193
|
end
|
|
172
194
|
|
|
173
195
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -195,6 +217,10 @@ module OpenapiClient
|
|
|
195
217
|
invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
|
|
196
218
|
end
|
|
197
219
|
|
|
220
|
+
if !@metrics.nil? && @metrics.length < 1
|
|
221
|
+
invalid_properties.push('invalid value for "metrics", number of items must be greater than or equal to 1.')
|
|
222
|
+
end
|
|
223
|
+
|
|
198
224
|
if @type.nil?
|
|
199
225
|
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
200
226
|
end
|
|
@@ -211,8 +237,9 @@ module OpenapiClient
|
|
|
211
237
|
return false if !@current_step.nil? && @current_step < 1
|
|
212
238
|
return false if !@percentage.nil? && @percentage > 100
|
|
213
239
|
return false if !@percentage.nil? && @percentage < 0
|
|
240
|
+
return false if !@metrics.nil? && @metrics.length < 1
|
|
214
241
|
return false if @type.nil?
|
|
215
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
|
|
242
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
216
243
|
return false unless type_validator.valid?(@type)
|
|
217
244
|
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
|
|
218
245
|
return false unless color_validator.valid?(@color)
|
|
@@ -267,10 +294,24 @@ module OpenapiClient
|
|
|
267
294
|
@percentage = percentage
|
|
268
295
|
end
|
|
269
296
|
|
|
297
|
+
# Custom attribute writer method with validation
|
|
298
|
+
# @param [Object] metrics Value to be assigned
|
|
299
|
+
def metrics=(metrics)
|
|
300
|
+
if metrics.nil?
|
|
301
|
+
fail ArgumentError, 'metrics cannot be nil'
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
if metrics.length < 1
|
|
305
|
+
fail ArgumentError, 'invalid value for "metrics", number of items must be greater than or equal to 1.'
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
@metrics = metrics
|
|
309
|
+
end
|
|
310
|
+
|
|
270
311
|
# Custom attribute writer method checking allowed values (enum).
|
|
271
312
|
# @param [Object] type Object to be assigned
|
|
272
313
|
def type=(type)
|
|
273
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
|
|
314
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "counter", "timer", "countdown"])
|
|
274
315
|
unless validator.valid?(type)
|
|
275
316
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
276
317
|
end
|
|
@@ -309,9 +350,11 @@ module OpenapiClient
|
|
|
309
350
|
percentage == o.percentage &&
|
|
310
351
|
value == o.value &&
|
|
311
352
|
upper_limit == o.upper_limit &&
|
|
353
|
+
metrics == o.metrics &&
|
|
312
354
|
type == o.type &&
|
|
313
355
|
color == o.color &&
|
|
314
|
-
step_color == o.step_color
|
|
356
|
+
step_color == o.step_color &&
|
|
357
|
+
step_colors == o.step_colors
|
|
315
358
|
end
|
|
316
359
|
|
|
317
360
|
# @see the `==` method
|
|
@@ -323,7 +366,7 @@ module OpenapiClient
|
|
|
323
366
|
# Calculates hash code according to all attributes.
|
|
324
367
|
# @return [Integer] Hash code
|
|
325
368
|
def hash
|
|
326
|
-
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
|
|
369
|
+
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, metrics, type, color, step_color, step_colors].hash
|
|
327
370
|
end
|
|
328
371
|
|
|
329
372
|
# Builds the object from hash
|