diff --git a/generated/activitysmith_openapi.rb b/generated/activitysmith_openapi.rb index 664f7d0..0e8307b 100644 --- a/generated/activitysmith_openapi.rb +++ b/generated/activitysmith_openapi.rb @@ -56,7 +56,6 @@ require 'activitysmith_openapi/models/send_push_notification429_response' require 'activitysmith_openapi/models/stream_content_state' require 'activitysmith_openapi/models/widget_metric' -require 'activitysmith_openapi/models/widget_metric_latest_value' # APIs require 'activitysmith_openapi/api/live_activities_api' diff --git a/generated/activitysmith_openapi/api/metrics_api.rb b/generated/activitysmith_openapi/api/metrics_api.rb index 0814897..e625768 100644 --- a/generated/activitysmith_openapi/api/metrics_api.rb +++ b/generated/activitysmith_openapi/api/metrics_api.rb @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Update a widget metric value - # Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters. + # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. # @param metric_value_update_request [MetricValueUpdateRequest] # @param [Hash] opts the optional parameters @@ -31,7 +31,7 @@ def update_metric_value(key, metric_value_update_request, opts = {}) end # Update a widget metric value - # Updates the latest value for a metric configured in ActivitySmith widgets. Create the metric in the web app first, then write values using its key. Numeric metric formats accept finite numbers. String metrics accept non-empty text up to 64 characters. + # Updates the latest value for a metric displayed in ActivitySmith widgets. Create the metric in the web app first, then update its value using the key. # @param key [String] Metric key configured in the web app. Lowercase letters, numbers, dots, underscores, and dashes are allowed. # @param metric_value_update_request [MetricValueUpdateRequest] # @param [Hash] opts the optional parameters diff --git a/generated/activitysmith_openapi/models/metric_value_update_response.rb b/generated/activitysmith_openapi/models/metric_value_update_response.rb index 1a400d2..daab4cd 100644 --- a/generated/activitysmith_openapi/models/metric_value_update_response.rb +++ b/generated/activitysmith_openapi/models/metric_value_update_response.rb @@ -15,12 +15,12 @@ module OpenapiClient class MetricValueUpdateResponse - attr_accessor :metric + attr_accessor :success # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'metric' => :'metric' + :'success' => :'success' } end @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'metric' => :'WidgetMetric' + :'success' => :'Boolean' } end @@ -57,10 +57,10 @@ def initialize(attributes = {}) h[k.to_sym] = v } - if attributes.key?(:'metric') - self.metric = attributes[:'metric'] + if attributes.key?(:'success') + self.success = attributes[:'success'] else - self.metric = nil + self.success = nil end end @@ -69,8 +69,8 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - if @metric.nil? - invalid_properties.push('invalid value for "metric", metric cannot be nil.') + if @success.nil? + invalid_properties.push('invalid value for "success", success cannot be nil.') end invalid_properties @@ -80,7 +80,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - return false if @metric.nil? + return false if @success.nil? true end @@ -89,7 +89,7 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - metric == o.metric + success == o.success end # @see the `==` method @@ -101,7 +101,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [metric].hash + [success].hash end # Builds the object from hash diff --git a/generated/activitysmith_openapi/models/widget_metric.rb b/generated/activitysmith_openapi/models/widget_metric.rb index 0826b04..8bc12d6 100644 --- a/generated/activitysmith_openapi/models/widget_metric.rb +++ b/generated/activitysmith_openapi/models/widget_metric.rb @@ -32,6 +32,7 @@ class WidgetMetric attr_accessor :format + # Latest metric value. Numeric formats return a number. String metrics return text. attr_accessor :latest_value attr_accessor :latest_value_at @@ -94,7 +95,7 @@ def self.openapi_types :'unit' => :'String', :'unit_spacing' => :'MetricUnitSpacing', :'format' => :'MetricFormat', - :'latest_value' => :'WidgetMetricLatestValue', + :'latest_value' => :'Float', :'latest_value_at' => :'Time', :'created_at' => :'Time', :'updated_at' => :'Time' @@ -104,10 +105,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'currency_code', - :'unit', - :'latest_value', - :'latest_value_at', ]) end @@ -231,6 +228,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.') end + if @currency_code.nil? + invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.') + end + if @currency_code.to_s.length > 3 invalid_properties.push('invalid value for "currency_code", the character length must be smaller than or equal to 3.') end @@ -244,6 +245,10 @@ def list_invalid_properties invalid_properties.push("invalid value for \"currency_code\", must conform to the pattern #{pattern}.") end + if @unit.nil? + invalid_properties.push('invalid value for "unit", unit cannot be nil.') + end + if @unit.to_s.length > 16 invalid_properties.push('invalid value for "unit", the character length must be smaller than or equal to 16.') end @@ -256,6 +261,14 @@ def list_invalid_properties invalid_properties.push('invalid value for "format", format cannot be nil.') end + if @latest_value.nil? + invalid_properties.push('invalid value for "latest_value", latest_value cannot be nil.') + end + + if @latest_value_at.nil? + invalid_properties.push('invalid value for "latest_value_at", latest_value_at cannot be nil.') + end + if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end @@ -279,12 +292,16 @@ def valid? return false if @label.nil? return false if @label.to_s.length > 80 return false if @label.to_s.length < 1 + return false if @currency_code.nil? return false if @currency_code.to_s.length > 3 return false if @currency_code.to_s.length < 3 return false if @currency_code !~ Regexp.new(/^[A-Z]{3}$/) + return false if @unit.nil? return false if @unit.to_s.length > 16 return false if @unit_spacing.nil? return false if @format.nil? + return false if @latest_value.nil? + return false if @latest_value_at.nil? return false if @created_at.nil? return false if @updated_at.nil? true @@ -334,16 +351,20 @@ def label=(label) # Custom attribute writer method with validation # @param [Object] currency_code Value to be assigned def currency_code=(currency_code) - if !currency_code.nil? && currency_code.to_s.length > 3 + if currency_code.nil? + fail ArgumentError, 'currency_code cannot be nil' + end + + if currency_code.to_s.length > 3 fail ArgumentError, 'invalid value for "currency_code", the character length must be smaller than or equal to 3.' end - if !currency_code.nil? && currency_code.to_s.length < 3 + if currency_code.to_s.length < 3 fail ArgumentError, 'invalid value for "currency_code", the character length must be great than or equal to 3.' end pattern = Regexp.new(/^[A-Z]{3}$/) - if !currency_code.nil? && currency_code !~ pattern + if currency_code !~ pattern fail ArgumentError, "invalid value for \"currency_code\", must conform to the pattern #{pattern}." end @@ -353,7 +374,11 @@ def currency_code=(currency_code) # Custom attribute writer method with validation # @param [Object] unit Value to be assigned def unit=(unit) - if !unit.nil? && unit.to_s.length > 16 + if unit.nil? + fail ArgumentError, 'unit cannot be nil' + end + + if unit.to_s.length > 16 fail ArgumentError, 'invalid value for "unit", the character length must be smaller than or equal to 16.' end diff --git a/generated/activitysmith_openapi/models/widget_metric_latest_value.rb b/generated/activitysmith_openapi/models/widget_metric_latest_value.rb deleted file mode 100644 index 3d8b002..0000000 --- a/generated/activitysmith_openapi/models/widget_metric_latest_value.rb +++ /dev/null @@ -1,105 +0,0 @@ -=begin -#ActivitySmith API - -#Send push notifications and Live Activities to your own devices via a single API key. - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -Generator version: 7.7.0 - -=end - -require 'date' -require 'time' - -module OpenapiClient - # Latest metric value. Numeric formats return a number. String metrics return text. - module WidgetMetricLatestValue - class << self - # List of class defined in anyOf (OpenAPI v3) - def openapi_any_of - [ - :'Float', - :'String' - ] - end - - # Builds the object - # @param [Mixed] Data to be matched against the list of anyOf items - # @return [Object] Returns the model or the data itself - def build(data) - # Go through the list of anyOf items and attempt to identify the appropriate one. - # Note: - # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) - # due to the way the deserialization is made in the base_object template (it just casts without verifying). - # - TODO: scalar values are de facto behaving as if they were nullable. - # - TODO: logging when debugging is set. - openapi_any_of.each do |klass| - begin - next if klass == :AnyType # "nullable: true" - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue # rescue all errors so we keep iterating even if the current item lookup raises - end - end - - openapi_any_of.include?(:AnyType) ? data : nil - end - - private - - SchemaMismatchError = Class.new(StandardError) - - # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. - def find_and_cast_into_type(klass, data) - return if data.nil? - - case klass.to_s - when 'Boolean' - return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) - when 'Float' - return data if data.instance_of?(Float) - when 'Integer' - return data if data.instance_of?(Integer) - when 'Time' - return Time.parse(data) - when 'Date' - return Date.parse(data) - when 'String' - return data if data.instance_of?(String) - when 'Object' # "type: object" - return data if data.instance_of?(Hash) - when /\AArray<(?.+)>\z/ # "type: array" - if data.instance_of?(Array) - sub_type = Regexp.last_match[:sub_type] - return data.map { |item| find_and_cast_into_type(sub_type, item) } - end - when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" - if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } - sub_type = Regexp.last_match[:sub_type] - return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } - end - else # model - const = OpenapiClient.const_get(klass) - if const - if const.respond_to?(:openapi_any_of) # nested anyOf model - model = const.build(data) - return model if model - else - # raise if data contains keys that are not known to the model - raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty? - model = const.build_from_hash(data) - return model if model - end - end - end - - raise # if no match by now, raise - rescue - raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" - end - end - end - -end diff --git a/generated/activitysmith_openapi/version.rb b/generated/activitysmith_openapi/version.rb index 39d83db..6522a57 100644 --- a/generated/activitysmith_openapi/version.rb +++ b/generated/activitysmith_openapi/version.rb @@ -11,5 +11,5 @@ =end module OpenapiClient - VERSION = '1.1.0' + VERSION = '1.2.0' end