Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion generated/.regen-branch.txt

This file was deleted.

97 changes: 86 additions & 11 deletions generated/activitysmith_openapi/models/content_state_end.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,34 @@
require 'time'

module OpenapiClient
# End payload. Required fields are title and current_step. number_of_steps is optional.
# 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.
class ContentStateEnd
attr_accessor :title

attr_accessor :subtitle

# Total number of steps. Use for type=segmented_progress.
attr_accessor :number_of_steps

# Current step. Use for type=segmented_progress.
attr_accessor :current_step

# Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
attr_accessor :percentage

# Current progress value. Use with upper_limit for type=progress.
attr_accessor :value

# Maximum progress value. Use with value for type=progress.
attr_accessor :upper_limit

# Optional. When omitted, the API uses the existing Live Activity type.
attr_accessor :type

# Optional. Accent color for the Live Activity. Defaults to blue.
attr_accessor :color

# Optional. Overrides color for the current step.
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
attr_accessor :step_color

# 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.
Expand Down Expand Up @@ -62,6 +76,10 @@ def self.attribute_map
:'subtitle' => :'subtitle',
:'number_of_steps' => :'number_of_steps',
:'current_step' => :'current_step',
:'percentage' => :'percentage',
:'value' => :'value',
:'upper_limit' => :'upper_limit',
:'type' => :'type',
:'color' => :'color',
:'step_color' => :'step_color',
:'auto_dismiss_minutes' => :'auto_dismiss_minutes'
Expand All @@ -80,6 +98,10 @@ def self.openapi_types
:'subtitle' => :'String',
:'number_of_steps' => :'Integer',
:'current_step' => :'Integer',
:'percentage' => :'Float',
:'value' => :'Float',
:'upper_limit' => :'Float',
:'type' => :'String',
:'color' => :'String',
:'step_color' => :'String',
:'auto_dismiss_minutes' => :'Integer'
Expand Down Expand Up @@ -123,8 +145,22 @@ def initialize(attributes = {})

if attributes.key?(:'current_step')
self.current_step = attributes[:'current_step']
else
self.current_step = nil
end

if attributes.key?(:'percentage')
self.percentage = attributes[:'percentage']
end

if attributes.key?(:'value')
self.value = attributes[:'value']
end

if attributes.key?(:'upper_limit')
self.upper_limit = attributes[:'upper_limit']
end

if attributes.key?(:'type')
self.type = attributes[:'type']
end

if attributes.key?(:'color')
Expand Down Expand Up @@ -157,12 +193,16 @@ def list_invalid_properties
invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
end

if @current_step.nil?
invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
if !@current_step.nil? && @current_step < 1
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
end

if @current_step < 1
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
if !@percentage.nil? && @percentage > 100
invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
end

if !@percentage.nil? && @percentage < 0
invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
end

if !@auto_dismiss_minutes.nil? && @auto_dismiss_minutes < 0
Expand All @@ -178,8 +218,11 @@ def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
return false if @title.nil?
return false if !@number_of_steps.nil? && @number_of_steps < 1
return false if @current_step.nil?
return false if @current_step < 1
return false if !@current_step.nil? && @current_step < 1
return false if !@percentage.nil? && @percentage > 100
return false if !@percentage.nil? && @percentage < 0
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
return false unless type_validator.valid?(@type)
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
return false unless color_validator.valid?(@color)
step_color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
Expand Down Expand Up @@ -216,6 +259,34 @@ def current_step=(current_step)
@current_step = current_step
end

# Custom attribute writer method with validation
# @param [Object] percentage Value to be assigned
def percentage=(percentage)
if percentage.nil?
fail ArgumentError, 'percentage cannot be nil'
end

if percentage > 100
fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
end

if percentage < 0
fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
end

@percentage = percentage
end

# Custom attribute writer method checking allowed values (enum).
# @param [Object] type Object to be assigned
def type=(type)
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
unless validator.valid?(type)
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
end
@type = type
end

# Custom attribute writer method checking allowed values (enum).
# @param [Object] color Object to be assigned
def color=(color)
Expand Down Expand Up @@ -259,6 +330,10 @@ def ==(o)
subtitle == o.subtitle &&
number_of_steps == o.number_of_steps &&
current_step == o.current_step &&
percentage == o.percentage &&
value == o.value &&
upper_limit == o.upper_limit &&
type == o.type &&
color == o.color &&
step_color == o.step_color &&
auto_dismiss_minutes == o.auto_dismiss_minutes
Expand All @@ -273,7 +348,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[title, subtitle, number_of_steps, current_step, color, step_color, auto_dismiss_minutes].hash
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color, auto_dismiss_minutes].hash
end

# Builds the object from hash
Expand Down
88 changes: 67 additions & 21 deletions generated/activitysmith_openapi/models/content_state_start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,33 @@
require 'time'

module OpenapiClient
# Start payload requires title, number_of_steps, current_step, and type.
# 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.
class ContentStateStart
attr_accessor :title

attr_accessor :subtitle

# Total number of steps. Use for type=segmented_progress.
attr_accessor :number_of_steps

# Current step. Use for type=segmented_progress.
attr_accessor :current_step

# Progress percentage (0–100). Use for type=progress. Takes precedence over value/upper_limit if both are provided.
attr_accessor :percentage

# Current progress value. Use with upper_limit for type=progress.
attr_accessor :value

# Maximum progress value. Use with value for type=progress.
attr_accessor :upper_limit

attr_accessor :type

# Optional. Accent color for the Live Activity. Defaults to blue.
attr_accessor :color

# Optional. Overrides color for the current step.
# Optional. Overrides color for the current step. Only applies to type=segmented_progress.
attr_accessor :step_color

class EnumAttributeValidator
Expand Down Expand Up @@ -61,6 +72,9 @@ def self.attribute_map
:'subtitle' => :'subtitle',
:'number_of_steps' => :'number_of_steps',
:'current_step' => :'current_step',
:'percentage' => :'percentage',
:'value' => :'value',
:'upper_limit' => :'upper_limit',
:'type' => :'type',
:'color' => :'color',
:'step_color' => :'step_color'
Expand All @@ -79,6 +93,9 @@ def self.openapi_types
:'subtitle' => :'String',
:'number_of_steps' => :'Integer',
:'current_step' => :'Integer',
:'percentage' => :'Float',
:'value' => :'Float',
:'upper_limit' => :'Float',
:'type' => :'String',
:'color' => :'String',
:'step_color' => :'String'
Expand Down Expand Up @@ -118,14 +135,22 @@ def initialize(attributes = {})

if attributes.key?(:'number_of_steps')
self.number_of_steps = attributes[:'number_of_steps']
else
self.number_of_steps = nil
end

if attributes.key?(:'current_step')
self.current_step = attributes[:'current_step']
else
self.current_step = nil
end

if attributes.key?(:'percentage')
self.percentage = attributes[:'percentage']
end

if attributes.key?(:'value')
self.value = attributes[:'value']
end

if attributes.key?(:'upper_limit')
self.upper_limit = attributes[:'upper_limit']
end

if attributes.key?(:'type')
Expand Down Expand Up @@ -154,20 +179,20 @@ def list_invalid_properties
invalid_properties.push('invalid value for "title", title cannot be nil.')
end

if @number_of_steps.nil?
invalid_properties.push('invalid value for "number_of_steps", number_of_steps cannot be nil.')
if !@number_of_steps.nil? && @number_of_steps < 1
invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
end

if @number_of_steps < 1
invalid_properties.push('invalid value for "number_of_steps", must be greater than or equal to 1.')
if !@current_step.nil? && @current_step < 1
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
end

if @current_step.nil?
invalid_properties.push('invalid value for "current_step", current_step cannot be nil.')
if !@percentage.nil? && @percentage > 100
invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
end

if @current_step < 1
invalid_properties.push('invalid value for "current_step", must be greater than or equal to 1.')
if !@percentage.nil? && @percentage < 0
invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
end

if @type.nil?
Expand All @@ -182,12 +207,12 @@ def list_invalid_properties
def valid?
warn '[DEPRECATED] the `valid?` method is obsolete'
return false if @title.nil?
return false if @number_of_steps.nil?
return false if @number_of_steps < 1
return false if @current_step.nil?
return false if @current_step < 1
return false if !@number_of_steps.nil? && @number_of_steps < 1
return false if !@current_step.nil? && @current_step < 1
return false if !@percentage.nil? && @percentage > 100
return false if !@percentage.nil? && @percentage < 0
return false if @type.nil?
type_validator = EnumAttributeValidator.new('String', ["segmented_progress"])
type_validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
return false unless type_validator.valid?(@type)
color_validator = EnumAttributeValidator.new('String', ["lime", "green", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow"])
return false unless color_validator.valid?(@color)
Expand Down Expand Up @@ -224,10 +249,28 @@ def current_step=(current_step)
@current_step = current_step
end

# Custom attribute writer method with validation
# @param [Object] percentage Value to be assigned
def percentage=(percentage)
if percentage.nil?
fail ArgumentError, 'percentage cannot be nil'
end

if percentage > 100
fail ArgumentError, 'invalid value for "percentage", must be smaller than or equal to 100.'
end

if percentage < 0
fail ArgumentError, 'invalid value for "percentage", must be greater than or equal to 0.'
end

@percentage = percentage
end

# Custom attribute writer method checking allowed values (enum).
# @param [Object] type Object to be assigned
def type=(type)
validator = EnumAttributeValidator.new('String', ["segmented_progress"])
validator = EnumAttributeValidator.new('String', ["segmented_progress", "progress"])
unless validator.valid?(type)
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
end
Expand Down Expand Up @@ -263,6 +306,9 @@ def ==(o)
subtitle == o.subtitle &&
number_of_steps == o.number_of_steps &&
current_step == o.current_step &&
percentage == o.percentage &&
value == o.value &&
upper_limit == o.upper_limit &&
type == o.type &&
color == o.color &&
step_color == o.step_color
Expand All @@ -277,7 +323,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[title, subtitle, number_of_steps, current_step, type, color, step_color].hash
[title, subtitle, number_of_steps, current_step, percentage, value, upper_limit, type, color, step_color].hash
end

# Builds the object from hash
Expand Down
Loading