From eadb8a2c837699f36e6661b9f1f8c2d1d9228dcb Mon Sep 17 00:00:00 2001 From: Zeke Mostov Date: Thu, 21 Mar 2024 19:56:46 -0400 Subject: [PATCH] sync 2024.3.16 --- turnkey_client/.swagger-codegen/VERSION | 2 +- turnkey_client/lib/turnkey_client.rb | 6 + .../lib/turnkey_client/api/policies_api.rb | 58 ++++ .../lib/turnkey_client/api/signing_api.rb | 58 ++++ .../turnkey_client/models/activity_type.rb | 2 + .../models/create_policies_intent.rb | 213 +++++++++++++ .../models/create_policies_request.rb | 288 ++++++++++++++++++ .../models/create_policies_result.rb | 213 +++++++++++++ .../models/email_customization_params.rb | 2 +- .../lib/turnkey_client/models/intent.rb | 26 +- .../lib/turnkey_client/models/result.rb | 26 +- .../models/sign_raw_payloads_intent.rb | 256 ++++++++++++++++ .../models/sign_raw_payloads_request.rb | 288 ++++++++++++++++++ .../models/sign_raw_payloads_result.rb | 207 +++++++++++++ .../turnkey_client/models/wallet_account.rb | 23 +- turnkey_client_inputs/config.json | 2 +- turnkey_client_inputs/public_api.swagger.json | 183 ++++++++++- 17 files changed, 1815 insertions(+), 38 deletions(-) create mode 100644 turnkey_client/lib/turnkey_client/models/create_policies_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_policies_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_policies_result.rb create mode 100644 turnkey_client/lib/turnkey_client/models/sign_raw_payloads_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/sign_raw_payloads_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/sign_raw_payloads_result.rb diff --git a/turnkey_client/.swagger-codegen/VERSION b/turnkey_client/.swagger-codegen/VERSION index 4ffdd56..248908e 100644 --- a/turnkey_client/.swagger-codegen/VERSION +++ b/turnkey_client/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.53 \ No newline at end of file +3.0.54 \ No newline at end of file diff --git a/turnkey_client/lib/turnkey_client.rb b/turnkey_client/lib/turnkey_client.rb index 54331f2..b592513 100644 --- a/turnkey_client/lib/turnkey_client.rb +++ b/turnkey_client/lib/turnkey_client.rb @@ -53,6 +53,9 @@ require 'turnkey_client/models/create_organization_intent' require 'turnkey_client/models/create_organization_intent_v2' require 'turnkey_client/models/create_organization_result' +require 'turnkey_client/models/create_policies_intent' +require 'turnkey_client/models/create_policies_request' +require 'turnkey_client/models/create_policies_result' require 'turnkey_client/models/create_policy_intent' require 'turnkey_client/models/create_policy_intent_v2' require 'turnkey_client/models/create_policy_intent_v3' @@ -223,6 +226,9 @@ require 'turnkey_client/models/sign_raw_payload_intent_v2' require 'turnkey_client/models/sign_raw_payload_request' require 'turnkey_client/models/sign_raw_payload_result' +require 'turnkey_client/models/sign_raw_payloads_intent' +require 'turnkey_client/models/sign_raw_payloads_request' +require 'turnkey_client/models/sign_raw_payloads_result' require 'turnkey_client/models/sign_transaction_intent' require 'turnkey_client/models/sign_transaction_intent_v2' require 'turnkey_client/models/sign_transaction_request' diff --git a/turnkey_client/lib/turnkey_client/api/policies_api.rb b/turnkey_client/lib/turnkey_client/api/policies_api.rb index 4afcde8..33104dd 100644 --- a/turnkey_client/lib/turnkey_client/api/policies_api.rb +++ b/turnkey_client/lib/turnkey_client/api/policies_api.rb @@ -15,6 +15,64 @@ class PoliciesApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create Policies + # Create new Policies + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def create_policies(body, opts = {}) + data, _status_code, _headers = create_policies_with_http_info(body, opts) + data + end + + # Create Policies + # Create new Policies + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def create_policies_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PoliciesApi.create_policies ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling PoliciesApi.create_policies" + end + # resource path + local_var_path = '/public/v1/submit/create_policies' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(body) + + return_type = opts[:return_type] || 'ActivityResponse' + + auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth'] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type) + + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PoliciesApi#create_policies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Create Policy # Create a new Policy # @param body diff --git a/turnkey_client/lib/turnkey_client/api/signing_api.rb b/turnkey_client/lib/turnkey_client/api/signing_api.rb index 37ed1f4..a700054 100644 --- a/turnkey_client/lib/turnkey_client/api/signing_api.rb +++ b/turnkey_client/lib/turnkey_client/api/signing_api.rb @@ -73,6 +73,64 @@ def sign_raw_payload_with_http_info(body, opts = {}) end return data, status_code, headers end + # Sign Raw Payloads + # Sign multiple raw payloads with the same signing parameters + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def sign_raw_payloads(body, opts = {}) + data, _status_code, _headers = sign_raw_payloads_with_http_info(body, opts) + data + end + + # Sign Raw Payloads + # Sign multiple raw payloads with the same signing parameters + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def sign_raw_payloads_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SigningApi.sign_raw_payloads ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling SigningApi.sign_raw_payloads" + end + # resource path + local_var_path = '/public/v1/submit/sign_raw_payloads' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(body) + + return_type = opts[:return_type] || 'ActivityResponse' + + auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth'] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type) + + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SigningApi#sign_raw_payloads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Sign Transaction # Sign a transaction # @param body diff --git a/turnkey_client/lib/turnkey_client/models/activity_type.rb b/turnkey_client/lib/turnkey_client/models/activity_type.rb index 9eacdc3..1c68606 100644 --- a/turnkey_client/lib/turnkey_client/models/activity_type.rb +++ b/turnkey_client/lib/turnkey_client/models/activity_type.rb @@ -73,6 +73,8 @@ class ActivityType IMPORT_WALLET = 'ACTIVITY_TYPE_IMPORT_WALLET'.freeze INIT_IMPORT_PRIVATE_KEY = 'ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY'.freeze IMPORT_PRIVATE_KEY = 'ACTIVITY_TYPE_IMPORT_PRIVATE_KEY'.freeze + CREATE_POLICIES = 'ACTIVITY_TYPE_CREATE_POLICIES'.freeze + SIGN_RAW_PAYLOADS = 'ACTIVITY_TYPE_SIGN_RAW_PAYLOADS'.freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/turnkey_client/lib/turnkey_client/models/create_policies_intent.rb b/turnkey_client/lib/turnkey_client/models/create_policies_intent.rb new file mode 100644 index 0000000..d55a09c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_policies_intent.rb @@ -0,0 +1,213 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class CreatePoliciesIntent + # An array of policy intents to be created. + attr_accessor :policies + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'policies' => :'policies' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'policies' => :'Object' + } + 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 `TurnkeyClient::CreatePoliciesIntent` 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 `TurnkeyClient::CreatePoliciesIntent`. 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?(:'policies') + if (value = attributes[:'policies']).is_a?(Array) + self.policies = value + end + 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 + invalid_properties = Array.new + if @policies.nil? + invalid_properties.push('invalid value for "policies", policies 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? + return false if @policies.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 && + policies == o.policies + 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 + [policies].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/create_policies_request.rb b/turnkey_client/lib/turnkey_client/models/create_policies_request.rb new file mode 100644 index 0000000..8ff41e0 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_policies_request.rb @@ -0,0 +1,288 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class CreatePoliciesRequest + attr_accessor :type + + # Timestamp (in milliseconds) of the request, used to verify liveness of user requests. + attr_accessor :timestamp_ms + + # Unique identifier for a given Organization. + attr_accessor :organization_id + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'timestamp_ms' => :'timestampMs', + :'organization_id' => :'organizationId', + :'parameters' => :'parameters' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'Object', + :'timestamp_ms' => :'Object', + :'organization_id' => :'Object', + :'parameters' => :'Object' + } + 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 `TurnkeyClient::CreatePoliciesRequest` 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 `TurnkeyClient::CreatePoliciesRequest`. 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'timestamp_ms') + self.timestamp_ms = attributes[:'timestamp_ms'] + end + + if attributes.key?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + 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 + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @timestamp_ms.nil? + invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.') + end + + if @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.') + end + + if @parameters.nil? + invalid_properties.push('invalid value for "parameters", parameters 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? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_POLICIES']) + return false unless type_validator.valid?(@type) + return false if @timestamp_ms.nil? + return false if @organization_id.nil? + return false if @parameters.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_POLICIES']) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + 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 && + type == o.type && + timestamp_ms == o.timestamp_ms && + organization_id == o.organization_id && + parameters == o.parameters + 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 + [type, timestamp_ms, organization_id, parameters].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/create_policies_result.rb b/turnkey_client/lib/turnkey_client/models/create_policies_result.rb new file mode 100644 index 0000000..d634d0d --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_policies_result.rb @@ -0,0 +1,213 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class CreatePoliciesResult + # A list of unique identifiers for the created policies. + attr_accessor :policy_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'policy_ids' => :'policyIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'policy_ids' => :'Object' + } + 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 `TurnkeyClient::CreatePoliciesResult` 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 `TurnkeyClient::CreatePoliciesResult`. 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?(:'policy_ids') + if (value = attributes[:'policy_ids']).is_a?(Array) + self.policy_ids = value + end + 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 + invalid_properties = Array.new + if @policy_ids.nil? + invalid_properties.push('invalid value for "policy_ids", policy_ids 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? + return false if @policy_ids.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 && + policy_ids == o.policy_ids + 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 + [policy_ids].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/email_customization_params.rb b/turnkey_client/lib/turnkey_client/models/email_customization_params.rb index f08ebcd..d533542 100644 --- a/turnkey_client/lib/turnkey_client/models/email_customization_params.rb +++ b/turnkey_client/lib/turnkey_client/models/email_customization_params.rb @@ -15,7 +15,7 @@ class EmailCustomizationParams # The name of the application. attr_accessor :app_name - # A URL pointing to a logo. Note this logo will be resized to fit into 340px x 124px. + # A URL pointing to a logo in PNG format. Note this logo will be resized to fit into 340px x 124px. attr_accessor :logo_url # A template for the URL to be used in a magic link button, e.g. `https://dapp.xyz/%s`. The auth bundle will be interpolated into the `%s`. diff --git a/turnkey_client/lib/turnkey_client/models/intent.rb b/turnkey_client/lib/turnkey_client/models/intent.rb index b98e009..5354a8e 100644 --- a/turnkey_client/lib/turnkey_client/models/intent.rb +++ b/turnkey_client/lib/turnkey_client/models/intent.rb @@ -134,6 +134,10 @@ class Intent attr_accessor :import_private_key_intent + attr_accessor :create_policies_intent + + attr_accessor :sign_raw_payloads_intent + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -197,7 +201,9 @@ def self.attribute_map :'init_import_wallet_intent' => :'initImportWalletIntent', :'import_wallet_intent' => :'importWalletIntent', :'init_import_private_key_intent' => :'initImportPrivateKeyIntent', - :'import_private_key_intent' => :'importPrivateKeyIntent' + :'import_private_key_intent' => :'importPrivateKeyIntent', + :'create_policies_intent' => :'createPoliciesIntent', + :'sign_raw_payloads_intent' => :'signRawPayloadsIntent' } end @@ -264,7 +270,9 @@ def self.openapi_types :'init_import_wallet_intent' => :'Object', :'import_wallet_intent' => :'Object', :'init_import_private_key_intent' => :'Object', - :'import_private_key_intent' => :'Object' + :'import_private_key_intent' => :'Object', + :'create_policies_intent' => :'Object', + :'sign_raw_payloads_intent' => :'Object' } end @@ -532,6 +540,14 @@ def initialize(attributes = {}) if attributes.key?(:'import_private_key_intent') self.import_private_key_intent = attributes[:'import_private_key_intent'] end + + if attributes.key?(:'create_policies_intent') + self.create_policies_intent = attributes[:'create_policies_intent'] + end + + if attributes.key?(:'sign_raw_payloads_intent') + self.sign_raw_payloads_intent = attributes[:'sign_raw_payloads_intent'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -617,7 +633,9 @@ def ==(o) init_import_wallet_intent == o.init_import_wallet_intent && import_wallet_intent == o.import_wallet_intent && init_import_private_key_intent == o.init_import_private_key_intent && - import_private_key_intent == o.import_private_key_intent + import_private_key_intent == o.import_private_key_intent && + create_policies_intent == o.create_policies_intent && + sign_raw_payloads_intent == o.sign_raw_payloads_intent end # @see the `==` method @@ -629,7 +647,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent].hash + [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent, create_policies_intent, sign_raw_payloads_intent].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/result.rb b/turnkey_client/lib/turnkey_client/models/result.rb index d49021b..bcd3305 100644 --- a/turnkey_client/lib/turnkey_client/models/result.rb +++ b/turnkey_client/lib/turnkey_client/models/result.rb @@ -110,6 +110,10 @@ class Result attr_accessor :import_private_key_result + attr_accessor :create_policies_result + + attr_accessor :sign_raw_payloads_result + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -161,7 +165,9 @@ def self.attribute_map :'init_import_wallet_result' => :'initImportWalletResult', :'import_wallet_result' => :'importWalletResult', :'init_import_private_key_result' => :'initImportPrivateKeyResult', - :'import_private_key_result' => :'importPrivateKeyResult' + :'import_private_key_result' => :'importPrivateKeyResult', + :'create_policies_result' => :'createPoliciesResult', + :'sign_raw_payloads_result' => :'signRawPayloadsResult' } end @@ -216,7 +222,9 @@ def self.openapi_types :'init_import_wallet_result' => :'Object', :'import_wallet_result' => :'Object', :'init_import_private_key_result' => :'Object', - :'import_private_key_result' => :'Object' + :'import_private_key_result' => :'Object', + :'create_policies_result' => :'Object', + :'sign_raw_payloads_result' => :'Object' } end @@ -436,6 +444,14 @@ def initialize(attributes = {}) if attributes.key?(:'import_private_key_result') self.import_private_key_result = attributes[:'import_private_key_result'] end + + if attributes.key?(:'create_policies_result') + self.create_policies_result = attributes[:'create_policies_result'] + end + + if attributes.key?(:'sign_raw_payloads_result') + self.sign_raw_payloads_result = attributes[:'sign_raw_payloads_result'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -504,7 +520,9 @@ def ==(o) init_import_wallet_result == o.init_import_wallet_result && import_wallet_result == o.import_wallet_result && init_import_private_key_result == o.init_import_private_key_result && - import_private_key_result == o.import_private_key_result + import_private_key_result == o.import_private_key_result && + create_policies_result == o.create_policies_result && + sign_raw_payloads_result == o.sign_raw_payloads_result end # @see the `==` method @@ -516,7 +534,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [create_organization_result, create_authenticators_result, create_users_result, create_private_keys_result, create_invitations_result, accept_invitation_result, sign_raw_payload_result, create_policy_result, disable_private_key_result, delete_users_result, delete_authenticators_result, delete_invitation_result, delete_organization_result, delete_policy_result, create_user_tag_result, delete_user_tags_result, sign_transaction_result, delete_api_keys_result, create_api_keys_result, create_private_key_tag_result, delete_private_key_tags_result, set_payment_method_result, activate_billing_tier_result, delete_payment_method_result, create_api_only_users_result, update_root_quorum_result, update_user_tag_result, update_private_key_tag_result, create_sub_organization_result, update_allowed_origins_result, create_private_keys_result_v2, update_user_result, update_policy_result, create_sub_organization_result_v3, create_wallet_result, create_wallet_accounts_result, init_user_email_recovery_result, recover_user_result, set_organization_feature_result, remove_organization_feature_result, export_private_key_result, export_wallet_result, create_sub_organization_result_v4, email_auth_result, export_wallet_account_result, init_import_wallet_result, import_wallet_result, init_import_private_key_result, import_private_key_result].hash + [create_organization_result, create_authenticators_result, create_users_result, create_private_keys_result, create_invitations_result, accept_invitation_result, sign_raw_payload_result, create_policy_result, disable_private_key_result, delete_users_result, delete_authenticators_result, delete_invitation_result, delete_organization_result, delete_policy_result, create_user_tag_result, delete_user_tags_result, sign_transaction_result, delete_api_keys_result, create_api_keys_result, create_private_key_tag_result, delete_private_key_tags_result, set_payment_method_result, activate_billing_tier_result, delete_payment_method_result, create_api_only_users_result, update_root_quorum_result, update_user_tag_result, update_private_key_tag_result, create_sub_organization_result, update_allowed_origins_result, create_private_keys_result_v2, update_user_result, update_policy_result, create_sub_organization_result_v3, create_wallet_result, create_wallet_accounts_result, init_user_email_recovery_result, recover_user_result, set_organization_feature_result, remove_organization_feature_result, export_private_key_result, export_wallet_result, create_sub_organization_result_v4, email_auth_result, export_wallet_account_result, init_import_wallet_result, import_wallet_result, init_import_private_key_result, import_private_key_result, create_policies_result, sign_raw_payloads_result].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_intent.rb b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_intent.rb new file mode 100644 index 0000000..e8a8212 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_intent.rb @@ -0,0 +1,256 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class SignRawPayloadsIntent + # A Wallet account address, Private Key address, or Private Key identifier. + attr_accessor :sign_with + + # An array of raw unsigned payloads to be signed. + attr_accessor :payloads + + attr_accessor :encoding + + attr_accessor :hash_function + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sign_with' => :'signWith', + :'payloads' => :'payloads', + :'encoding' => :'encoding', + :'hash_function' => :'hashFunction' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sign_with' => :'Object', + :'payloads' => :'Object', + :'encoding' => :'Object', + :'hash_function' => :'Object' + } + 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 `TurnkeyClient::SignRawPayloadsIntent` 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 `TurnkeyClient::SignRawPayloadsIntent`. 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?(:'sign_with') + self.sign_with = attributes[:'sign_with'] + end + + if attributes.key?(:'payloads') + if (value = attributes[:'payloads']).is_a?(Array) + self.payloads = value + end + end + + if attributes.key?(:'encoding') + self.encoding = attributes[:'encoding'] + end + + if attributes.key?(:'hash_function') + self.hash_function = attributes[:'hash_function'] + 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 + invalid_properties = Array.new + if @sign_with.nil? + invalid_properties.push('invalid value for "sign_with", sign_with cannot be nil.') + end + + if @payloads.nil? + invalid_properties.push('invalid value for "payloads", payloads cannot be nil.') + end + + if @encoding.nil? + invalid_properties.push('invalid value for "encoding", encoding cannot be nil.') + end + + if @hash_function.nil? + invalid_properties.push('invalid value for "hash_function", hash_function 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? + return false if @sign_with.nil? + return false if @payloads.nil? + return false if @encoding.nil? + return false if @hash_function.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 && + sign_with == o.sign_with && + payloads == o.payloads && + encoding == o.encoding && + hash_function == o.hash_function + 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 + [sign_with, payloads, encoding, hash_function].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_request.rb b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_request.rb new file mode 100644 index 0000000..f82c8f9 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_request.rb @@ -0,0 +1,288 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class SignRawPayloadsRequest + attr_accessor :type + + # Timestamp (in milliseconds) of the request, used to verify liveness of user requests. + attr_accessor :timestamp_ms + + # Unique identifier for a given Organization. + attr_accessor :organization_id + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'timestamp_ms' => :'timestampMs', + :'organization_id' => :'organizationId', + :'parameters' => :'parameters' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'Object', + :'timestamp_ms' => :'Object', + :'organization_id' => :'Object', + :'parameters' => :'Object' + } + 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 `TurnkeyClient::SignRawPayloadsRequest` 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 `TurnkeyClient::SignRawPayloadsRequest`. 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'timestamp_ms') + self.timestamp_ms = attributes[:'timestamp_ms'] + end + + if attributes.key?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + 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 + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @timestamp_ms.nil? + invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.') + end + + if @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.') + end + + if @parameters.nil? + invalid_properties.push('invalid value for "parameters", parameters 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? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_SIGN_RAW_PAYLOADS']) + return false unless type_validator.valid?(@type) + return false if @timestamp_ms.nil? + return false if @organization_id.nil? + return false if @parameters.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_SIGN_RAW_PAYLOADS']) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + 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 && + type == o.type && + timestamp_ms == o.timestamp_ms && + organization_id == o.organization_id && + parameters == o.parameters + 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 + [type, timestamp_ms, organization_id, parameters].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_result.rb b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_result.rb new file mode 100644 index 0000000..aa78057 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/sign_raw_payloads_result.rb @@ -0,0 +1,207 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class SignRawPayloadsResult + attr_accessor :signatures + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'signatures' => :'signatures' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'signatures' => :'Object' + } + 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 `TurnkeyClient::SignRawPayloadsResult` 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 `TurnkeyClient::SignRawPayloadsResult`. 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?(:'signatures') + if (value = attributes[:'signatures']).is_a?(Array) + self.signatures = value + end + 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 + invalid_properties = Array.new + 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? + 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 && + signatures == o.signatures + 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 + [signatures].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) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if 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[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.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 + TurnkeyClient.const_get(type).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/turnkey_client/lib/turnkey_client/models/wallet_account.rb b/turnkey_client/lib/turnkey_client/models/wallet_account.rb index 643b3ee..c74bbed 100644 --- a/turnkey_client/lib/turnkey_client/models/wallet_account.rb +++ b/turnkey_client/lib/turnkey_client/models/wallet_account.rb @@ -34,9 +34,6 @@ class WalletAccount attr_accessor :updated_at - # True when a given Account is exported, false otherwise. - attr_accessor :exported - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -48,8 +45,7 @@ def self.attribute_map :'address_format' => :'addressFormat', :'address' => :'address', :'created_at' => :'createdAt', - :'updated_at' => :'updatedAt', - :'exported' => :'exported' + :'updated_at' => :'updatedAt' } end @@ -64,8 +60,7 @@ def self.openapi_types :'address_format' => :'Object', :'address' => :'Object', :'created_at' => :'Object', - :'updated_at' => :'Object', - :'exported' => :'Object' + :'updated_at' => :'Object' } end @@ -125,10 +120,6 @@ def initialize(attributes = {}) if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end - - if attributes.key?(:'exported') - self.exported = attributes[:'exported'] - end end # Show invalid properties with the reasons. Usually used together with valid? @@ -171,10 +162,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.') end - if @exported.nil? - invalid_properties.push('invalid value for "exported", exported cannot be nil.') - end - invalid_properties end @@ -190,7 +177,6 @@ def valid? return false if @address.nil? return false if @created_at.nil? return false if @updated_at.nil? - return false if @exported.nil? true end @@ -207,8 +193,7 @@ def ==(o) address_format == o.address_format && address == o.address && created_at == o.created_at && - updated_at == o.updated_at && - exported == o.exported + updated_at == o.updated_at end # @see the `==` method @@ -220,7 +205,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [organization_id, wallet_id, curve, path_format, path, address_format, address, created_at, updated_at, exported].hash + [organization_id, wallet_id, curve, path_format, path, address_format, address, created_at, updated_at].hash end # Builds the object from hash diff --git a/turnkey_client_inputs/config.json b/turnkey_client_inputs/config.json index 9b48f8a..6a97f2d 100644 --- a/turnkey_client_inputs/config.json +++ b/turnkey_client_inputs/config.json @@ -6,5 +6,5 @@ "gemAuthor": "Turnkey Engineering", "gemAuthorEmail": "hello@turnkey.com", "moduleName": "TurnkeyClient", - "gemVersion": "0.0.4" + "gemVersion": "0.0.5" } diff --git a/turnkey_client_inputs/public_api.swagger.json b/turnkey_client_inputs/public_api.swagger.json index 89ea8d7..b4438a4 100644 --- a/turnkey_client_inputs/public_api.swagger.json +++ b/turnkey_client_inputs/public_api.swagger.json @@ -663,6 +663,32 @@ "tags": ["Invitations"] } }, + "/public/v1/submit/create_policies": { + "post": { + "summary": "Create Policies", + "description": "Create new Policies", + "operationId": "CreatePolicies", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ActivityResponse" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePoliciesRequest" + } + } + ], + "tags": ["Policies"] + } + }, "/public/v1/submit/create_policy": { "post": { "summary": "Create Policy", @@ -1417,6 +1443,32 @@ "tags": ["Signing"] } }, + "/public/v1/submit/sign_raw_payloads": { + "post": { + "summary": "Sign Raw Payloads", + "description": "Sign multiple raw payloads with the same signing parameters", + "operationId": "SignRawPayloads", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ActivityResponse" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SignRawPayloadsRequest" + } + } + ], + "tags": ["Signing"] + } + }, "/public/v1/submit/sign_transaction": { "post": { "summary": "Sign Transaction", @@ -1800,7 +1852,9 @@ "ACTIVITY_TYPE_INIT_IMPORT_WALLET", "ACTIVITY_TYPE_IMPORT_WALLET", "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY", - "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY" + "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY", + "ACTIVITY_TYPE_CREATE_POLICIES", + "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS" ] }, "AddressFormat": { @@ -2337,6 +2391,54 @@ }, "required": ["organizationId"] }, + "CreatePoliciesIntent": { + "type": "object", + "properties": { + "policies": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/CreatePolicyIntentV3" + }, + "description": "An array of policy intents to be created." + } + }, + "required": ["policies"] + }, + "CreatePoliciesRequest": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ACTIVITY_TYPE_CREATE_POLICIES"] + }, + "timestampMs": { + "type": "string", + "description": "Timestamp (in milliseconds) of the request, used to verify liveness of user requests." + }, + "organizationId": { + "type": "string", + "description": "Unique identifier for a given Organization." + }, + "parameters": { + "$ref": "#/definitions/CreatePoliciesIntent" + } + }, + "required": ["type", "timestampMs", "organizationId", "parameters"] + }, + "CreatePoliciesResult": { + "type": "object", + "properties": { + "policyIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A list of unique identifiers for the created policies." + } + }, + "required": ["policyIds"] + }, "CreatePolicyIntent": { "type": "object", "properties": { @@ -3483,7 +3585,7 @@ }, "logoUrl": { "type": "string", - "description": "A URL pointing to a logo. Note this logo will be resized to fit into 340px x 124px." + "description": "A URL pointing to a logo in PNG format. Note this logo will be resized to fit into 340px x 124px." }, "magicLinkTemplate": { "type": "string", @@ -4589,6 +4691,12 @@ }, "importPrivateKeyIntent": { "$ref": "#/definitions/ImportPrivateKeyIntent" + }, + "createPoliciesIntent": { + "$ref": "#/definitions/CreatePoliciesIntent" + }, + "signRawPayloadsIntent": { + "$ref": "#/definitions/SignRawPayloadsIntent" } }, "required": ["createOrganizationIntent"] @@ -5186,6 +5294,12 @@ }, "importPrivateKeyResult": { "$ref": "#/definitions/ImportPrivateKeyResult" + }, + "createPoliciesResult": { + "$ref": "#/definitions/CreatePoliciesResult" + }, + "signRawPayloadsResult": { + "$ref": "#/definitions/SignRawPayloadsResult" } } }, @@ -5455,6 +5569,64 @@ }, "required": ["r", "s", "v"] }, + "SignRawPayloadsIntent": { + "type": "object", + "properties": { + "signWith": { + "type": "string", + "description": "A Wallet account address, Private Key address, or Private Key identifier." + }, + "payloads": { + "type": "array", + "items": { + "type": "string" + }, + "description": "An array of raw unsigned payloads to be signed." + }, + "encoding": { + "$ref": "#/definitions/PayloadEncoding", + "description": "Encoding of the `payload` string. Turnkey uses this information to convert `payload` into bytes with the correct decoder (e.g. hex, utf8)." + }, + "hashFunction": { + "$ref": "#/definitions/HashFunction", + "description": "Hash function to apply to payload bytes before signing. This field must be set to HASH_FUNCTION_NOT_APPLICABLE for EdDSA/ed25519 signature requests; configurable payload hashing is not supported by RFC 8032." + } + }, + "required": ["signWith", "payloads", "encoding", "hashFunction"] + }, + "SignRawPayloadsRequest": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ACTIVITY_TYPE_SIGN_RAW_PAYLOADS"] + }, + "timestampMs": { + "type": "string", + "description": "Timestamp (in milliseconds) of the request, used to verify liveness of user requests." + }, + "organizationId": { + "type": "string", + "description": "Unique identifier for a given Organization." + }, + "parameters": { + "$ref": "#/definitions/SignRawPayloadsIntent" + } + }, + "required": ["type", "timestampMs", "organizationId", "parameters"] + }, + "SignRawPayloadsResult": { + "type": "object", + "properties": { + "signatures": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/SignRawPayloadResult" + } + } + } + }, "SignTransactionIntent": { "type": "object", "properties": { @@ -6100,10 +6272,6 @@ }, "updatedAt": { "$ref": "#/definitions/external.data.v1.Timestamp" - }, - "exported": { - "type": "boolean", - "description": "True when a given Account is exported, false otherwise." } }, "required": [ @@ -6115,8 +6283,7 @@ "addressFormat", "address", "createdAt", - "updatedAt", - "exported" + "updatedAt" ] }, "WalletAccountParams": {