Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync 2024.3.16 #5

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion turnkey_client/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.53
3.0.54
6 changes: 6 additions & 0 deletions turnkey_client/lib/turnkey_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
58 changes: 58 additions & 0 deletions turnkey_client/lib/turnkey_client/api/policies_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 58 additions & 0 deletions turnkey_client/lib/turnkey_client/api/signing_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions turnkey_client/lib/turnkey_client/models/activity_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
213 changes: 213 additions & 0 deletions turnkey_client/lib/turnkey_client/models/create_policies_intent.rb
Original file line number Diff line number Diff line change
@@ -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<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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
Loading
Loading