diff --git a/generated/activitysmith_openapi.rb b/generated/activitysmith_openapi.rb index 2264a0c..0c6597a 100644 --- a/generated/activitysmith_openapi.rb +++ b/generated/activitysmith_openapi.rb @@ -17,6 +17,9 @@ require 'activitysmith_openapi/configuration' # Models +require 'activitysmith_openapi/models/account_device' +require 'activitysmith_openapi/models/account_device_list_response' +require 'activitysmith_openapi/models/account_device_list_response_meta' require 'activitysmith_openapi/models/activity_metric' require 'activitysmith_openapi/models/activity_metric_value' require 'activitysmith_openapi/models/alert_payload' @@ -74,6 +77,7 @@ # APIs require 'activitysmith_openapi/api/app_icon_badges_api' +require 'activitysmith_openapi/api/devices_api' require 'activitysmith_openapi/api/live_activities_api' require 'activitysmith_openapi/api/metrics_api' require 'activitysmith_openapi/api/push_notifications_api' diff --git a/generated/activitysmith_openapi/api/devices_api.rb b/generated/activitysmith_openapi/api/devices_api.rb new file mode 100644 index 0000000..85736a3 --- /dev/null +++ b/generated/activitysmith_openapi/api/devices_api.rb @@ -0,0 +1,100 @@ +=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 'cgi' + +module OpenapiClient + class DevicesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # List paired devices + # Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Maximum devices to return, 1 to 100. Defaults to 100. (default to 100) + # @option opts [Integer] :offset Devices to skip. Use meta.next_offset from the previous page. (default to 0) + # @option opts [Boolean] :include_inactive Include devices that can no longer receive deliveries, such as unpaired phones. (default to false) + # @return [AccountDeviceListResponse] + def list_account_devices(opts = {}) + data, _status_code, _headers = list_account_devices_with_http_info(opts) + data + end + + # List paired devices + # Lists the iPhones and iPads paired to the account, active devices first. Use it to check that a device is paired before you send, or to find device IDs for Channels. An empty list means no device is paired yet: install the ActivitySmith app from the App Store and sign in. Channel-scoped API keys cannot list devices. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :limit Maximum devices to return, 1 to 100. Defaults to 100. (default to 100) + # @option opts [Integer] :offset Devices to skip. Use meta.next_offset from the previous page. (default to 0) + # @option opts [Boolean] :include_inactive Include devices that can no longer receive deliveries, such as unpaired phones. (default to false) + # @return [Array<(AccountDeviceListResponse, Integer, Hash)>] AccountDeviceListResponse data, response status code and response headers + def list_account_devices_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DevicesApi.list_account_devices ...' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DevicesApi.list_account_devices, must be smaller than or equal to 100.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DevicesApi.list_account_devices, must be greater than or equal to 1.' + end + + if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0 + fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling DevicesApi.list_account_devices, must be greater than or equal to 0.' + end + + # resource path + local_var_path = '/account/devices' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + query_params[:'include_inactive'] = opts[:'include_inactive'] if !opts[:'include_inactive'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AccountDeviceListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['apiKeyAuth'] + + new_options = opts.merge( + :operation => :"DevicesApi.list_account_devices", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DevicesApi#list_account_devices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/generated/activitysmith_openapi/api/live_activities_api.rb b/generated/activitysmith_openapi/api/live_activities_api.rb index c106b10..19a3288 100644 --- a/generated/activitysmith_openapi/api/live_activities_api.rb +++ b/generated/activitysmith_openapi/api/live_activities_api.rb @@ -20,7 +20,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # End a Live Activity (legacy manual lifecycle) - # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. + # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe. # @param live_activity_end_request [LiveActivityEndRequest] # @param [Hash] opts the optional parameters # @return [LiveActivityEndResponse] @@ -30,7 +30,7 @@ def end_live_activity(live_activity_end_request, opts = {}) end # End a Live Activity (legacy manual lifecycle) - # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. + # Legacy manual lifecycle endpoint. For new integrations, use DELETE /live-activity/stream/{stream_key} to end a managed Live Activity stream. This endpoint remains supported for existing integrations and advanced lifecycle control. Ends a Live Activity and archives its lifecycle. Supports segmented_progress, progress, metrics, stats, alert, timer, and value activity types. For segmented_progress activities, you can send the latest number_of_steps here if the workflow changed after start. Use secondary_action for a second button on alert, progress, segmented_progress, and value Live Activities. Ending a Live Activity that already ended returns 200 with ignored: true and sends nothing to devices, so retries are safe. # @param live_activity_end_request [LiveActivityEndRequest] # @param [Hash] opts the optional parameters # @return [Array<(LiveActivityEndResponse, Integer, Hash)>] LiveActivityEndResponse data, response status code and response headers diff --git a/generated/activitysmith_openapi/models/account_device.rb b/generated/activitysmith_openapi/models/account_device.rb new file mode 100644 index 0000000..53457b9 --- /dev/null +++ b/generated/activitysmith_openapi/models/account_device.rb @@ -0,0 +1,367 @@ +=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 + # An iPhone or iPad paired to the account, one entry per device and owner. + class AccountDevice + # Email of the account member who paired the device. + attr_accessor :user_email + + # Device ID. Use it to assign the device to Channels. + attr_accessor :device_id + + # Device platform, such as ios. iPhones and iPads both report ios; use system_name to tell them apart. + attr_accessor :device_type + + # True when the device can receive Push Notifications or Live Activities. + attr_accessor :is_active + + # Whether each delivery token is active, keyed by token type (push, start_live_activity). + attr_accessor :token_status + + # ActivitySmith app version on the device. + attr_accessor :app_version + + # Device name set on the device. + attr_accessor :device_name + + # Operating system name, such as iOS or iPadOS. + attr_accessor :system_name + + # Operating system version. + attr_accessor :system_version + + # When the device was first paired. + attr_accessor :created_at + + # When the device last updated its pairing. + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_email' => :'user_email', + :'device_id' => :'device_id', + :'device_type' => :'device_type', + :'is_active' => :'is_active', + :'token_status' => :'token_status', + :'app_version' => :'app_version', + :'device_name' => :'device_name', + :'system_name' => :'system_name', + :'system_version' => :'system_version', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_email' => :'String', + :'device_id' => :'String', + :'device_type' => :'String', + :'is_active' => :'Boolean', + :'token_status' => :'Hash', + :'app_version' => :'String', + :'device_name' => :'String', + :'system_name' => :'String', + :'system_version' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'device_type', + :'app_version', + :'device_name', + :'system_name', + :'system_version', + :'created_at', + :'updated_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AccountDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AccountDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_email') + self.user_email = attributes[:'user_email'] + else + self.user_email = nil + end + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + else + self.device_id = nil + end + + if attributes.key?(:'device_type') + self.device_type = attributes[:'device_type'] + else + self.device_type = nil + end + + if attributes.key?(:'is_active') + self.is_active = attributes[:'is_active'] + else + self.is_active = nil + end + + if attributes.key?(:'token_status') + if (value = attributes[:'token_status']).is_a?(Hash) + self.token_status = value + end + else + self.token_status = nil + end + + if attributes.key?(:'app_version') + self.app_version = attributes[:'app_version'] + else + self.app_version = nil + end + + if attributes.key?(:'device_name') + self.device_name = attributes[:'device_name'] + else + self.device_name = nil + end + + if attributes.key?(:'system_name') + self.system_name = attributes[:'system_name'] + else + self.system_name = nil + end + + if attributes.key?(:'system_version') + self.system_version = attributes[:'system_version'] + else + self.system_version = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + else + self.updated_at = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_email.nil? + invalid_properties.push('invalid value for "user_email", user_email cannot be nil.') + end + + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + if @is_active.nil? + invalid_properties.push('invalid value for "is_active", is_active cannot be nil.') + end + + if @token_status.nil? + invalid_properties.push('invalid value for "token_status", token_status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_email.nil? + return false if @device_id.nil? + return false if @is_active.nil? + return false if @token_status.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_email == o.user_email && + device_id == o.device_id && + device_type == o.device_type && + is_active == o.is_active && + token_status == o.token_status && + app_version == o.app_version && + device_name == o.device_name && + system_name == o.system_name && + system_version == o.system_version && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_email, device_id, device_type, is_active, token_status, app_version, device_name, system_name, system_version, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/generated/activitysmith_openapi/models/account_device_list_response.rb b/generated/activitysmith_openapi/models/account_device_list_response.rb new file mode 100644 index 0000000..d62501e --- /dev/null +++ b/generated/activitysmith_openapi/models/account_device_list_response.rb @@ -0,0 +1,239 @@ +=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 + class AccountDeviceListResponse + attr_accessor :devices + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'devices' => :'devices', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'devices' => :'Array', + :'meta' => :'AccountDeviceListResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AccountDeviceListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AccountDeviceListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'devices') + if (value = attributes[:'devices']).is_a?(Array) + self.devices = value + end + else + self.devices = nil + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + else + self.meta = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @devices.nil? + invalid_properties.push('invalid value for "devices", devices cannot be nil.') + end + + if @meta.nil? + invalid_properties.push('invalid value for "meta", meta cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @devices.nil? + return false if @meta.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + devices == o.devices && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [devices, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/generated/activitysmith_openapi/models/account_device_list_response_meta.rb b/generated/activitysmith_openapi/models/account_device_list_response_meta.rb new file mode 100644 index 0000000..205536d --- /dev/null +++ b/generated/activitysmith_openapi/models/account_device_list_response_meta.rb @@ -0,0 +1,299 @@ +=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 + class AccountDeviceListResponseMeta + # Devices matching the filter. + attr_accessor :total + + attr_accessor :limit + + attr_accessor :offset + + attr_accessor :has_more + + # Offset for the next page, or null on the last page. + attr_accessor :next_offset + + attr_accessor :include_inactive + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total', + :'limit' => :'limit', + :'offset' => :'offset', + :'has_more' => :'has_more', + :'next_offset' => :'next_offset', + :'include_inactive' => :'include_inactive' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'Integer', + :'limit' => :'Integer', + :'offset' => :'Integer', + :'has_more' => :'Boolean', + :'next_offset' => :'Integer', + :'include_inactive' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'next_offset', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::AccountDeviceListResponseMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::AccountDeviceListResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + else + self.total = nil + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + else + self.limit = nil + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + else + self.offset = nil + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + else + self.has_more = nil + end + + if attributes.key?(:'next_offset') + self.next_offset = attributes[:'next_offset'] + else + self.next_offset = nil + end + + if attributes.key?(:'include_inactive') + self.include_inactive = attributes[:'include_inactive'] + else + self.include_inactive = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total.nil? + invalid_properties.push('invalid value for "total", total cannot be nil.') + end + + if @limit.nil? + invalid_properties.push('invalid value for "limit", limit cannot be nil.') + end + + if @offset.nil? + invalid_properties.push('invalid value for "offset", offset cannot be nil.') + end + + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @include_inactive.nil? + invalid_properties.push('invalid value for "include_inactive", include_inactive cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total.nil? + return false if @limit.nil? + return false if @offset.nil? + return false if @has_more.nil? + return false if @include_inactive.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total && + limit == o.limit && + offset == o.offset && + has_more == o.has_more && + next_offset == o.next_offset && + include_inactive == o.include_inactive + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total, limit, offset, has_more, next_offset, include_inactive].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/generated/openapi-source.json b/generated/openapi-source.json index 498433c..7731deb 100644 --- a/generated/openapi-source.json +++ b/generated/openapi-source.json @@ -1,6 +1,6 @@ { "repository": "ActivitySmithHQ/activitysmith-backend", - "commit": "7bf9c3d88459fe3f122810979a45da0a1e6fd2d6", + "commit": "1f133d70555e39b9fe02e9e38e81c924422f9109", "path": "openapi.json", - "sha256": "6987f90b106e28a0ab8058f43309e7a9f045c7c54d27ce90bbdd5966c3f99f7a" + "sha256": "69315d272f2d20ef648a9cc675bae718b8fcdd9a1223268db41a176e6f89cdf9" }