Skip to content

Commit

Permalink
Merge pull-request #6
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkmin committed May 22, 2024
2 parents 9af8c80 + dd72efb commit e7172ac
Show file tree
Hide file tree
Showing 15 changed files with 1,430 additions and 23 deletions.
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.54
3.0.56
5 changes: 5 additions & 0 deletions turnkey_client/lib/turnkey_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require 'turnkey_client/models/activity_type'
require 'turnkey_client/models/activity_v1_address'
require 'turnkey_client/models/address_format'
require 'turnkey_client/models/any'
require 'turnkey_client/models/api_key'
require 'turnkey_client/models/api_key_params'
require 'turnkey_client/models/api_only_user_params'
Expand Down Expand Up @@ -69,6 +70,9 @@
require 'turnkey_client/models/create_private_keys_request'
require 'turnkey_client/models/create_private_keys_result'
require 'turnkey_client/models/create_private_keys_result_v2'
require 'turnkey_client/models/create_read_only_session_intent'
require 'turnkey_client/models/create_read_only_session_request'
require 'turnkey_client/models/create_read_only_session_result'
require 'turnkey_client/models/create_sub_organization_intent'
require 'turnkey_client/models/create_sub_organization_intent_v2'
require 'turnkey_client/models/create_sub_organization_intent_v3'
Expand Down Expand Up @@ -234,6 +238,7 @@
require 'turnkey_client/models/sign_transaction_request'
require 'turnkey_client/models/sign_transaction_result'
require 'turnkey_client/models/simple_client_extension_results'
require 'turnkey_client/models/status'
require 'turnkey_client/models/tag_type'
require 'turnkey_client/models/transaction_type'
require 'turnkey_client/models/update_allowed_origins_intent'
Expand Down
58 changes: 58 additions & 0 deletions turnkey_client/lib/turnkey_client/api/sessions_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,64 @@ class SessionsApi
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Create Read Only Session
# Create a read only session for a user (valid for 1 hour)
# @param body
# @param [Hash] opts the optional parameters
# @return [ActivityResponse]
def create_read_only_session(body, opts = {})
data, _status_code, _headers = create_read_only_session_with_http_info(body, opts)
data
end

# Create Read Only Session
# Create a read only session for a user (valid for 1 hour)
# @param body
# @param [Hash] opts the optional parameters
# @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers
def create_read_only_session_with_http_info(body, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SessionsApi.create_read_only_session ...'
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 SessionsApi.create_read_only_session"
end
# resource path
local_var_path = '/public/v1/submit/create_read_only_session'

# 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: SessionsApi#create_read_only_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Who am I?
# Get basic information about your current API or WebAuthN user and their organization. Affords Sub-Organization look ups via Parent Organization for WebAuthN or API key users.
# @param body
Expand Down
17 changes: 13 additions & 4 deletions turnkey_client/lib/turnkey_client/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Activity

attr_accessor :updated_at

attr_accessor :failure

# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
Expand All @@ -54,7 +56,8 @@ def self.attribute_map
:'can_approve' => :'canApprove',
:'can_reject' => :'canReject',
:'created_at' => :'createdAt',
:'updated_at' => :'updatedAt'
:'updated_at' => :'updatedAt',
:'failure' => :'failure'
}
end

Expand All @@ -72,7 +75,8 @@ def self.openapi_types
:'can_approve' => :'Object',
:'can_reject' => :'Object',
:'created_at' => :'Object',
:'updated_at' => :'Object'
:'updated_at' => :'Object',
:'failure' => :'Object'
}
end

Expand Down Expand Up @@ -146,6 +150,10 @@ def initialize(attributes = {})
if attributes.key?(:'updated_at')
self.updated_at = attributes[:'updated_at']
end

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

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -237,7 +245,8 @@ def ==(o)
can_approve == o.can_approve &&
can_reject == o.can_reject &&
created_at == o.created_at &&
updated_at == o.updated_at
updated_at == o.updated_at &&
failure == o.failure
end

# @see the `==` method
Expand All @@ -249,7 +258,7 @@ def eql?(o)
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
def hash
[id, organization_id, status, type, intent, result, votes, fingerprint, can_approve, can_reject, created_at, updated_at].hash
[id, organization_id, status, type, intent, result, votes, fingerprint, can_approve, can_reject, created_at, updated_at, failure].hash
end

# Builds the object from hash
Expand Down
1 change: 1 addition & 0 deletions turnkey_client/lib/turnkey_client/models/activity_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ActivityType
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
CREATE_READ_ONLY_SESSION = 'ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION'.freeze

# Builds the enum from string
# @param [String] The enum value in the form of the string
Expand Down
200 changes: 200 additions & 0 deletions turnkey_client/lib/turnkey_client/models/any.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
=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 Any
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
}
end

# Attribute type mapping.
def self.openapi_types
{
}
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::Any` 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::Any`. 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
}

# call parent's initialize
super(attributes)
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 = super
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 && super(o)
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
[].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)
super(attributes)
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 = super
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

0 comments on commit e7172ac

Please sign in to comment.