activitysmith 1.11.0 → 1.13.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 +126 -26
- 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/api/push_notifications_api.rb +2 -2
- data/generated/activitysmith_openapi/models/billing_blocked_error.rb +296 -0
- data/generated/activitysmith_openapi/models/billing_blocked_error_trial_period.rb +237 -0
- 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 +1 -1
- data/generated/activitysmith_openapi/models/live_activity_start_request.rb +1 -1
- data/generated/activitysmith_openapi/models/live_activity_stream_delete_request.rb +1 -1
- data/generated/activitysmith_openapi/models/live_activity_stream_request.rb +1 -1
- data/generated/activitysmith_openapi/models/live_activity_update_request.rb +1 -1
- data/generated/activitysmith_openapi/models/live_activity_value.rb +106 -0
- data/generated/activitysmith_openapi/models/push_interruption_level.rb +41 -0
- data/generated/activitysmith_openapi/models/push_notification_action.rb +22 -0
- data/generated/activitysmith_openapi/models/push_notification_request.rb +64 -1
- data/generated/activitysmith_openapi/models/push_notification_response.rb +3 -0
- 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/version.rb +1 -1
- data/generated/activitysmith_openapi.rb +4 -0
- data/generated/openapi-source.json +2 -2
- data/lib/activitysmith/live_activities.rb +1 -0
- data/lib/activitysmith/notifications.rb +10 -4
- data/lib/activitysmith/push_interruption_level.rb +10 -0
- data/lib/activitysmith/version.rb +1 -1
- data/lib/activitysmith.rb +1 -0
- metadata +7 -2
|
@@ -0,0 +1,237 @@
|
|
|
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 BillingBlockedErrorTrialPeriod
|
|
18
|
+
attr_accessor :started_at
|
|
19
|
+
|
|
20
|
+
attr_accessor :ends_at
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'started_at' => :'started_at',
|
|
26
|
+
:'ends_at' => :'ends_at'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
|
31
|
+
def self.acceptable_attributes
|
|
32
|
+
attribute_map.values
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'started_at' => :'Time',
|
|
39
|
+
:'ends_at' => :'Time'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new([
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the object
|
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
51
|
+
def initialize(attributes = {})
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::BillingBlockedErrorTrialPeriod` initialize method"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::BillingBlockedErrorTrialPeriod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:'started_at')
|
|
65
|
+
self.started_at = attributes[:'started_at']
|
|
66
|
+
else
|
|
67
|
+
self.started_at = nil
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'ends_at')
|
|
71
|
+
self.ends_at = attributes[:'ends_at']
|
|
72
|
+
else
|
|
73
|
+
self.ends_at = nil
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
78
|
+
# @return Array for valid properties with the reasons
|
|
79
|
+
def list_invalid_properties
|
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
81
|
+
invalid_properties = Array.new
|
|
82
|
+
if @started_at.nil?
|
|
83
|
+
invalid_properties.push('invalid value for "started_at", started_at cannot be nil.')
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if @ends_at.nil?
|
|
87
|
+
invalid_properties.push('invalid value for "ends_at", ends_at cannot be nil.')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
invalid_properties
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check to see if the all the properties in the model are valid
|
|
94
|
+
# @return true if the model is valid
|
|
95
|
+
def valid?
|
|
96
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
97
|
+
return false if @started_at.nil?
|
|
98
|
+
return false if @ends_at.nil?
|
|
99
|
+
true
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Checks equality by comparing each attribute.
|
|
103
|
+
# @param [Object] Object to be compared
|
|
104
|
+
def ==(o)
|
|
105
|
+
return true if self.equal?(o)
|
|
106
|
+
self.class == o.class &&
|
|
107
|
+
started_at == o.started_at &&
|
|
108
|
+
ends_at == o.ends_at
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# @see the `==` method
|
|
112
|
+
# @param [Object] Object to be compared
|
|
113
|
+
def eql?(o)
|
|
114
|
+
self == o
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Calculates hash code according to all attributes.
|
|
118
|
+
# @return [Integer] Hash code
|
|
119
|
+
def hash
|
|
120
|
+
[started_at, ends_at].hash
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Builds the object from hash
|
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
125
|
+
# @return [Object] Returns the model itself
|
|
126
|
+
def self.build_from_hash(attributes)
|
|
127
|
+
return nil unless attributes.is_a?(Hash)
|
|
128
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
129
|
+
transformed_hash = {}
|
|
130
|
+
openapi_types.each_pair do |key, type|
|
|
131
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
132
|
+
transformed_hash["#{key}"] = nil
|
|
133
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
134
|
+
# check to ensure the input is an array given that the attribute
|
|
135
|
+
# is documented as an array but the input is not
|
|
136
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
137
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
138
|
+
end
|
|
139
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
140
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
new(transformed_hash)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Deserializes the data based on type
|
|
147
|
+
# @param string type Data type
|
|
148
|
+
# @param string value Value to be deserialized
|
|
149
|
+
# @return [Object] Deserialized data
|
|
150
|
+
def self._deserialize(type, value)
|
|
151
|
+
case type.to_sym
|
|
152
|
+
when :Time
|
|
153
|
+
Time.parse(value)
|
|
154
|
+
when :Date
|
|
155
|
+
Date.parse(value)
|
|
156
|
+
when :String
|
|
157
|
+
value.to_s
|
|
158
|
+
when :Integer
|
|
159
|
+
value.to_i
|
|
160
|
+
when :Float
|
|
161
|
+
value.to_f
|
|
162
|
+
when :Boolean
|
|
163
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
164
|
+
true
|
|
165
|
+
else
|
|
166
|
+
false
|
|
167
|
+
end
|
|
168
|
+
when :Object
|
|
169
|
+
# generic object (usually a Hash), return directly
|
|
170
|
+
value
|
|
171
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
172
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
173
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
174
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
175
|
+
k_type = Regexp.last_match[:k_type]
|
|
176
|
+
v_type = Regexp.last_match[:v_type]
|
|
177
|
+
{}.tap do |hash|
|
|
178
|
+
value.each do |k, v|
|
|
179
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
else # model
|
|
183
|
+
# models (e.g. Pet) or oneOf
|
|
184
|
+
klass = OpenapiClient.const_get(type)
|
|
185
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the string representation of the object
|
|
190
|
+
# @return [String] String presentation of the object
|
|
191
|
+
def to_s
|
|
192
|
+
to_hash.to_s
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_body
|
|
198
|
+
to_hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Returns the object in the form of hash
|
|
202
|
+
# @return [Hash] Returns the object in the form of hash
|
|
203
|
+
def to_hash
|
|
204
|
+
hash = {}
|
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
206
|
+
value = self.send(attr)
|
|
207
|
+
if value.nil?
|
|
208
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
209
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
hash[param] = _to_hash(value)
|
|
213
|
+
end
|
|
214
|
+
hash
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Outputs non-array value in the form of hash
|
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
219
|
+
# @param [Object] value Any valid value
|
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
|
221
|
+
def _to_hash(value)
|
|
222
|
+
if value.is_a?(Array)
|
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
|
224
|
+
elsif value.is_a?(Hash)
|
|
225
|
+
{}.tap do |hash|
|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
227
|
+
end
|
|
228
|
+
elsif value.respond_to? :to_hash
|
|
229
|
+
value.to_hash
|
|
230
|
+
else
|
|
231
|
+
value
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
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. For metrics and stats include a non-empty metrics array. For alert include message. For timer, omit duration_seconds to preserve and freeze the latest timer state. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and
|
|
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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer, omit duration_seconds to preserve and freeze the latest timer state. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. 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
|
|
|
@@ -29,7 +29,7 @@ module OpenapiClient
|
|
|
29
29
|
# Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
|
|
30
30
|
attr_accessor :percentage
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit.
|
|
33
33
|
attr_accessor :value
|
|
34
34
|
|
|
35
35
|
# Maximum progress value. Use with value for type=progress.
|
|
@@ -50,16 +50,16 @@ module OpenapiClient
|
|
|
50
50
|
# Alert message. Use for type=alert.
|
|
51
51
|
attr_accessor :message
|
|
52
52
|
|
|
53
|
-
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and
|
|
53
|
+
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value.
|
|
54
54
|
attr_accessor :icon
|
|
55
55
|
|
|
56
|
-
# Optional badge. Supported by alert, progress, and
|
|
56
|
+
# Optional badge. Supported by alert, progress, segmented_progress, and value.
|
|
57
57
|
attr_accessor :badge
|
|
58
58
|
|
|
59
59
|
# Optional. When omitted, the API uses the existing Live Activity type.
|
|
60
60
|
attr_accessor :type
|
|
61
61
|
|
|
62
|
-
# Optional. Accent color for progress, segmented_progress, metrics, and
|
|
62
|
+
# Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.
|
|
63
63
|
attr_accessor :color
|
|
64
64
|
|
|
65
65
|
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
|
|
@@ -131,7 +131,7 @@ module OpenapiClient
|
|
|
131
131
|
:'number_of_steps' => :'Integer',
|
|
132
132
|
:'current_step' => :'Integer',
|
|
133
133
|
:'percentage' => :'Float',
|
|
134
|
-
:'value' => :'
|
|
134
|
+
:'value' => :'LiveActivityValue',
|
|
135
135
|
:'upper_limit' => :'Float',
|
|
136
136
|
:'duration_seconds' => :'Float',
|
|
137
137
|
:'counts_down' => :'Boolean',
|
|
@@ -314,7 +314,7 @@ module OpenapiClient
|
|
|
314
314
|
return false if !@metrics.nil? && @metrics.length > 8
|
|
315
315
|
return false if !@metrics.nil? && @metrics.length < 1
|
|
316
316
|
return false if !@message.nil? && @message.to_s.length < 1
|
|
317
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
317
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
318
318
|
return false unless type_validator.valid?(@type)
|
|
319
319
|
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
320
320
|
return false unless color_validator.valid?(@color)
|
|
@@ -405,7 +405,7 @@ module OpenapiClient
|
|
|
405
405
|
# Custom attribute writer method checking allowed values (enum).
|
|
406
406
|
# @param [Object] type Object to be assigned
|
|
407
407
|
def type=(type)
|
|
408
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
408
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
409
409
|
unless validator.valid?(type)
|
|
410
410
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
411
411
|
end
|
|
@@ -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 metrics and stats include a non-empty metrics array. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and
|
|
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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer include duration_seconds for countdowns, or set counts_down false without duration_seconds for an open-ended elapsed timer. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. 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
|
|
|
@@ -29,7 +29,7 @@ module OpenapiClient
|
|
|
29
29
|
# Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
|
|
30
30
|
attr_accessor :percentage
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit.
|
|
33
33
|
attr_accessor :value
|
|
34
34
|
|
|
35
35
|
# Maximum progress value. Use with value for type=progress.
|
|
@@ -50,15 +50,15 @@ module OpenapiClient
|
|
|
50
50
|
# Required for type=alert.
|
|
51
51
|
attr_accessor :message
|
|
52
52
|
|
|
53
|
-
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and
|
|
53
|
+
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value.
|
|
54
54
|
attr_accessor :icon
|
|
55
55
|
|
|
56
|
-
# Optional badge. Supported by alert, progress, and
|
|
56
|
+
# Optional badge. Supported by alert, progress, segmented_progress, and value.
|
|
57
57
|
attr_accessor :badge
|
|
58
58
|
|
|
59
59
|
attr_accessor :type
|
|
60
60
|
|
|
61
|
-
# Optional. Accent color for progress, segmented_progress, metrics, and
|
|
61
|
+
# Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.
|
|
62
62
|
attr_accessor :color
|
|
63
63
|
|
|
64
64
|
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
|
|
@@ -126,7 +126,7 @@ module OpenapiClient
|
|
|
126
126
|
:'number_of_steps' => :'Integer',
|
|
127
127
|
:'current_step' => :'Integer',
|
|
128
128
|
:'percentage' => :'Float',
|
|
129
|
-
:'value' => :'
|
|
129
|
+
:'value' => :'LiveActivityValue',
|
|
130
130
|
:'upper_limit' => :'Float',
|
|
131
131
|
:'duration_seconds' => :'Float',
|
|
132
132
|
:'counts_down' => :'Boolean',
|
|
@@ -305,7 +305,7 @@ module OpenapiClient
|
|
|
305
305
|
return false if !@metrics.nil? && @metrics.length < 1
|
|
306
306
|
return false if !@message.nil? && @message.to_s.length < 1
|
|
307
307
|
return false if @type.nil?
|
|
308
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
308
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
309
309
|
return false unless type_validator.valid?(@type)
|
|
310
310
|
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
311
311
|
return false unless color_validator.valid?(@color)
|
|
@@ -395,7 +395,7 @@ module OpenapiClient
|
|
|
395
395
|
# Custom attribute writer method checking allowed values (enum).
|
|
396
396
|
# @param [Object] type Object to be assigned
|
|
397
397
|
def type=(type)
|
|
398
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
398
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
399
399
|
unless validator.valid?(type)
|
|
400
400
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
401
401
|
end
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
-
# Update 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 and stats include a non-empty metrics array. For alert include message. For timer, omit duration_seconds to preserve the current timer window or send duration_seconds to reset the timer from the update request time. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, and
|
|
17
|
+
# Update 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 and stats include a non-empty metrics array. For value include a string or number in value; strings preserve currency, units, and other formatting. For alert include message. For timer, omit duration_seconds to preserve the current timer window or send duration_seconds to reset the timer from the update request time. Optional icon is supported by all Live Activity types. Optional badge is supported by alert, progress, segmented_progress, and value. Type is optional when updating an existing activity. You can increase or decrease number_of_steps during updates.
|
|
18
18
|
class ContentStateUpdate
|
|
19
19
|
attr_accessor :title
|
|
20
20
|
|
|
@@ -29,7 +29,7 @@ module OpenapiClient
|
|
|
29
29
|
# Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
|
|
30
30
|
attr_accessor :percentage
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# For type=value, the required prominent readout (string or finite number); strings preserve exact formatting. For type=progress, a numeric progress value used with upper_limit.
|
|
33
33
|
attr_accessor :value
|
|
34
34
|
|
|
35
35
|
# Maximum progress value. Use with value for type=progress.
|
|
@@ -50,16 +50,16 @@ module OpenapiClient
|
|
|
50
50
|
# Alert message. Use for type=alert.
|
|
51
51
|
attr_accessor :message
|
|
52
52
|
|
|
53
|
-
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, and
|
|
53
|
+
# Optional SF Symbol icon. Supported by alert, progress, segmented_progress, metrics, stats, timer, and value.
|
|
54
54
|
attr_accessor :icon
|
|
55
55
|
|
|
56
|
-
# Optional badge. Supported by alert, progress, and
|
|
56
|
+
# Optional badge. Supported by alert, progress, segmented_progress, and value.
|
|
57
57
|
attr_accessor :badge
|
|
58
58
|
|
|
59
59
|
# Optional. When omitted, the API uses the existing Live Activity type.
|
|
60
60
|
attr_accessor :type
|
|
61
61
|
|
|
62
|
-
# Optional. Accent color for progress, segmented_progress, metrics, and
|
|
62
|
+
# Optional. Accent color for progress, segmented_progress, metrics, timer, and value Live Activities. For Alert Live Activities, this tints action and secondary_action buttons when included.
|
|
63
63
|
attr_accessor :color
|
|
64
64
|
|
|
65
65
|
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
|
|
@@ -127,7 +127,7 @@ module OpenapiClient
|
|
|
127
127
|
:'number_of_steps' => :'Integer',
|
|
128
128
|
:'current_step' => :'Integer',
|
|
129
129
|
:'percentage' => :'Float',
|
|
130
|
-
:'value' => :'
|
|
130
|
+
:'value' => :'LiveActivityValue',
|
|
131
131
|
:'upper_limit' => :'Float',
|
|
132
132
|
:'duration_seconds' => :'Float',
|
|
133
133
|
:'counts_down' => :'Boolean',
|
|
@@ -299,7 +299,7 @@ module OpenapiClient
|
|
|
299
299
|
return false if !@metrics.nil? && @metrics.length > 8
|
|
300
300
|
return false if !@metrics.nil? && @metrics.length < 1
|
|
301
301
|
return false if !@message.nil? && @message.to_s.length < 1
|
|
302
|
-
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
302
|
+
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
303
303
|
return false unless type_validator.valid?(@type)
|
|
304
304
|
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "gray"])
|
|
305
305
|
return false unless color_validator.valid?(@color)
|
|
@@ -389,7 +389,7 @@ module OpenapiClient
|
|
|
389
389
|
# Custom attribute writer method checking allowed values (enum).
|
|
390
390
|
# @param [Object] type Object to be assigned
|
|
391
391
|
def type=(type)
|
|
392
|
-
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer"])
|
|
392
|
+
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress", "metrics", "stats", "alert", "timer", "value"])
|
|
393
393
|
unless validator.valid?(type)
|
|
394
394
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
395
395
|
end
|
|
@@ -14,7 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module OpenapiClient
|
|
17
|
-
# Optional action button shown in the Live Activity UI. Use action for the primary button, or secondary_action for a secondary button on alert, progress, and
|
|
17
|
+
# Optional action button shown in the Live Activity UI. Use action for the primary button, or secondary_action for a secondary button on alert, progress, segmented_progress, and value Live Activities.
|
|
18
18
|
class LiveActivityAction
|
|
19
19
|
# Button title displayed in the Live Activity UI.
|
|
20
20
|
attr_accessor :title
|
|
@@ -30,6 +30,28 @@ module OpenapiClient
|
|
|
30
30
|
# Optional webhook payload body. Used only when type=webhook.
|
|
31
31
|
attr_accessor :body
|
|
32
32
|
|
|
33
|
+
class EnumAttributeValidator
|
|
34
|
+
attr_reader :datatype
|
|
35
|
+
attr_reader :allowable_values
|
|
36
|
+
|
|
37
|
+
def initialize(datatype, allowable_values)
|
|
38
|
+
@allowable_values = allowable_values.map do |value|
|
|
39
|
+
case datatype.to_s
|
|
40
|
+
when /Integer/i
|
|
41
|
+
value.to_i
|
|
42
|
+
when /Float/i
|
|
43
|
+
value.to_f
|
|
44
|
+
else
|
|
45
|
+
value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def valid?(value)
|
|
51
|
+
!value || allowable_values.include?(value)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
33
55
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
56
|
def self.attribute_map
|
|
35
57
|
{
|
|
@@ -28,7 +28,7 @@ module OpenapiClient
|
|
|
28
28
|
|
|
29
29
|
attr_accessor :action
|
|
30
30
|
|
|
31
|
-
# 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.
|
|
32
32
|
attr_accessor :secondary_action
|
|
33
33
|
|
|
34
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -23,7 +23,7 @@ module OpenapiClient
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :action
|
|
25
25
|
|
|
26
|
-
# 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.
|
|
27
27
|
attr_accessor :secondary_action
|
|
28
28
|
|
|
29
29
|
attr_accessor :alert
|
|
@@ -26,7 +26,7 @@ module OpenapiClient
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :action
|
|
28
28
|
|
|
29
|
-
# Optional secondary action button. Supported for alert, progress, and
|
|
29
|
+
# 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.
|
|
30
30
|
attr_accessor :secondary_action
|
|
31
31
|
|
|
32
32
|
attr_accessor :alert
|
|
@@ -23,7 +23,7 @@ module OpenapiClient
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :action
|
|
25
25
|
|
|
26
|
-
# 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.
|
|
27
27
|
attr_accessor :secondary_action
|
|
28
28
|
|
|
29
29
|
attr_accessor :alert
|
|
@@ -28,7 +28,7 @@ module OpenapiClient
|
|
|
28
28
|
|
|
29
29
|
attr_accessor :action
|
|
30
30
|
|
|
31
|
-
# 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.
|
|
32
32
|
attr_accessor :secondary_action
|
|
33
33
|
|
|
34
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -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,41 @@
|
|
|
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 PushInterruptionLevel
|
|
18
|
+
PASSIVE = "passive".freeze
|
|
19
|
+
ACTIVE = "active".freeze
|
|
20
|
+
TIME_SENSITIVE = "time-sensitive".freeze
|
|
21
|
+
|
|
22
|
+
def self.all_vars
|
|
23
|
+
@all_vars ||= [PASSIVE, ACTIVE, TIME_SENSITIVE].freeze
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Builds the enum from string
|
|
27
|
+
# @param [String] The enum value in the form of the string
|
|
28
|
+
# @return [String] The enum value
|
|
29
|
+
def self.build_from_hash(value)
|
|
30
|
+
new.build_from_hash(value)
|
|
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 build_from_hash(value)
|
|
37
|
+
return value if PushInterruptionLevel.all_vars.include?(value)
|
|
38
|
+
raise "Invalid ENUM value #{value} for class #PushInterruptionLevel"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|