From b2ea2494edc92682ae39b6a6a2211907a4097ddb Mon Sep 17 00:00:00 2001 From: Andrew Min Date: Thu, 15 Aug 2024 16:16:21 -0700 Subject: [PATCH] client changes --- turnkey_client/.swagger-codegen/VERSION | 2 +- turnkey_client/lib/turnkey_client.rb | 30 ++ .../turnkey_client/api/organizations_api.rb | 58 ++++ .../lib/turnkey_client/api/sessions_api.rb | 58 ++++ .../lib/turnkey_client/api/users_api.rb | 232 ++++++++++++++ .../turnkey_client/models/activity_type.rb | 8 + .../turnkey_client/models/api_key_curve.rb | 28 ++ .../models/api_key_params_v2.rb | 250 +++++++++++++++ .../lib/turnkey_client/models/config.rb | 216 +++++++++++++ .../models/create_api_keys_intent_v2.rb | 228 +++++++++++++ .../models/create_api_keys_request.rb | 4 +- .../models/create_oauth_providers_intent.rb | 228 +++++++++++++ .../models/create_oauth_providers_request.rb | 288 +++++++++++++++++ .../models/create_oauth_providers_result.rb | 213 +++++++++++++ .../create_read_write_session_intent.rb | 246 ++++++++++++++ .../create_read_write_session_request.rb | 288 +++++++++++++++++ .../create_read_write_session_result.rb | 286 +++++++++++++++++ .../create_sub_organization_intent_v5.rb | 272 ++++++++++++++++ .../create_sub_organization_intent_v6.rb | 272 ++++++++++++++++ .../models/create_sub_organization_request.rb | 4 +- .../create_sub_organization_result_v5.rb | 230 ++++++++++++++ .../create_sub_organization_result_v6.rb | 230 ++++++++++++++ .../turnkey_client/models/credential_type.rb | 3 + .../models/delete_oauth_providers_intent.rb | 228 +++++++++++++ .../models/delete_oauth_providers_request.rb | 288 +++++++++++++++++ .../models/delete_oauth_providers_result.rb | 213 +++++++++++++ .../models/email_auth_intent.rb | 18 +- .../models/email_auth_intent_v2.rb | 265 ++++++++++++++++ .../models/email_auth_request.rb | 4 +- .../models/external_data_v1_quorum.rb | 228 +++++++++++++ .../models/get_oauth_providers_request.rb | 221 +++++++++++++ .../models/get_oauth_providers_response.rb | 213 +++++++++++++ .../get_organization_configs_request.rb | 211 ++++++++++++ .../get_organization_configs_response.rb | 210 ++++++++++++ .../models/get_sub_org_ids_request.rb | 2 +- .../lib/turnkey_client/models/intent.rb | 80 ++++- .../lib/turnkey_client/models/oauth_intent.rb | 246 ++++++++++++++ .../turnkey_client/models/oauth_provider.rb | 299 ++++++++++++++++++ .../models/oauth_provider_params.rb | 226 +++++++++++++ .../turnkey_client/models/oauth_request.rb | 288 +++++++++++++++++ .../lib/turnkey_client/models/oauth_result.rb | 241 ++++++++++++++ .../lib/turnkey_client/models/result.rb | 62 +++- .../models/root_user_params_v2.rb | 272 ++++++++++++++++ .../models/root_user_params_v3.rb | 272 ++++++++++++++++ .../lib/turnkey_client/models/user.rb | 19 +- 45 files changed, 7759 insertions(+), 21 deletions(-) create mode 100644 turnkey_client/lib/turnkey_client/models/api_key_curve.rb create mode 100644 turnkey_client/lib/turnkey_client/models/api_key_params_v2.rb create mode 100644 turnkey_client/lib/turnkey_client/models/config.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_api_keys_intent_v2.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_oauth_providers_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_oauth_providers_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_oauth_providers_result.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_read_write_session_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_read_write_session_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_read_write_session_result.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v5.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v6.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v5.rb create mode 100644 turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v6.rb create mode 100644 turnkey_client/lib/turnkey_client/models/delete_oauth_providers_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/delete_oauth_providers_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/delete_oauth_providers_result.rb create mode 100644 turnkey_client/lib/turnkey_client/models/email_auth_intent_v2.rb create mode 100644 turnkey_client/lib/turnkey_client/models/external_data_v1_quorum.rb create mode 100644 turnkey_client/lib/turnkey_client/models/get_oauth_providers_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/get_oauth_providers_response.rb create mode 100644 turnkey_client/lib/turnkey_client/models/get_organization_configs_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/get_organization_configs_response.rb create mode 100644 turnkey_client/lib/turnkey_client/models/oauth_intent.rb create mode 100644 turnkey_client/lib/turnkey_client/models/oauth_provider.rb create mode 100644 turnkey_client/lib/turnkey_client/models/oauth_provider_params.rb create mode 100644 turnkey_client/lib/turnkey_client/models/oauth_request.rb create mode 100644 turnkey_client/lib/turnkey_client/models/oauth_result.rb create mode 100644 turnkey_client/lib/turnkey_client/models/root_user_params_v2.rb create mode 100644 turnkey_client/lib/turnkey_client/models/root_user_params_v3.rb diff --git a/turnkey_client/.swagger-codegen/VERSION b/turnkey_client/.swagger-codegen/VERSION index b1d249f..3041e12 100644 --- a/turnkey_client/.swagger-codegen/VERSION +++ b/turnkey_client/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.56 \ No newline at end of file +3.0.58 \ No newline at end of file diff --git a/turnkey_client/lib/turnkey_client.rb b/turnkey_client/lib/turnkey_client.rb index c787a1a..dea3b92 100644 --- a/turnkey_client/lib/turnkey_client.rb +++ b/turnkey_client/lib/turnkey_client.rb @@ -29,7 +29,9 @@ require 'turnkey_client/models/address_format' require 'turnkey_client/models/any' require 'turnkey_client/models/api_key' +require 'turnkey_client/models/api_key_curve' require 'turnkey_client/models/api_key_params' +require 'turnkey_client/models/api_key_params_v2' require 'turnkey_client/models/api_only_user_params' require 'turnkey_client/models/approve_activity_intent' require 'turnkey_client/models/approve_activity_request' @@ -39,7 +41,9 @@ require 'turnkey_client/models/authenticator_params' require 'turnkey_client/models/authenticator_params_v2' require 'turnkey_client/models/authenticator_transport' +require 'turnkey_client/models/config' require 'turnkey_client/models/create_api_keys_intent' +require 'turnkey_client/models/create_api_keys_intent_v2' require 'turnkey_client/models/create_api_keys_request' require 'turnkey_client/models/create_api_keys_result' require 'turnkey_client/models/create_api_only_users_intent' @@ -51,6 +55,9 @@ require 'turnkey_client/models/create_invitations_intent' require 'turnkey_client/models/create_invitations_request' require 'turnkey_client/models/create_invitations_result' +require 'turnkey_client/models/create_oauth_providers_intent' +require 'turnkey_client/models/create_oauth_providers_request' +require 'turnkey_client/models/create_oauth_providers_result' require 'turnkey_client/models/create_organization_intent' require 'turnkey_client/models/create_organization_intent_v2' require 'turnkey_client/models/create_organization_result' @@ -73,14 +80,21 @@ 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_read_write_session_intent' +require 'turnkey_client/models/create_read_write_session_request' +require 'turnkey_client/models/create_read_write_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' require 'turnkey_client/models/create_sub_organization_intent_v4' +require 'turnkey_client/models/create_sub_organization_intent_v5' +require 'turnkey_client/models/create_sub_organization_intent_v6' require 'turnkey_client/models/create_sub_organization_request' require 'turnkey_client/models/create_sub_organization_result' require 'turnkey_client/models/create_sub_organization_result_v3' require 'turnkey_client/models/create_sub_organization_result_v4' +require 'turnkey_client/models/create_sub_organization_result_v5' +require 'turnkey_client/models/create_sub_organization_result_v6' require 'turnkey_client/models/create_user_tag_intent' require 'turnkey_client/models/create_user_tag_request' require 'turnkey_client/models/create_user_tag_result' @@ -107,6 +121,9 @@ require 'turnkey_client/models/delete_invitation_intent' require 'turnkey_client/models/delete_invitation_request' require 'turnkey_client/models/delete_invitation_result' +require 'turnkey_client/models/delete_oauth_providers_intent' +require 'turnkey_client/models/delete_oauth_providers_request' +require 'turnkey_client/models/delete_oauth_providers_result' require 'turnkey_client/models/delete_organization_intent' require 'turnkey_client/models/delete_organization_result' require 'turnkey_client/models/delete_payment_method_intent' @@ -127,6 +144,7 @@ require 'turnkey_client/models/disable_private_key_result' require 'turnkey_client/models/effect' require 'turnkey_client/models/email_auth_intent' +require 'turnkey_client/models/email_auth_intent_v2' require 'turnkey_client/models/email_auth_request' require 'turnkey_client/models/email_auth_result' require 'turnkey_client/models/email_customization_params' @@ -140,6 +158,7 @@ require 'turnkey_client/models/export_wallet_request' require 'turnkey_client/models/export_wallet_result' require 'turnkey_client/models/external_data_v1_credential' +require 'turnkey_client/models/external_data_v1_quorum' require 'turnkey_client/models/external_data_v1_timestamp' require 'turnkey_client/models/feature' require 'turnkey_client/models/feature_name' @@ -154,6 +173,10 @@ require 'turnkey_client/models/get_authenticator_response' require 'turnkey_client/models/get_authenticators_request' require 'turnkey_client/models/get_authenticators_response' +require 'turnkey_client/models/get_oauth_providers_request' +require 'turnkey_client/models/get_oauth_providers_response' +require 'turnkey_client/models/get_organization_configs_request' +require 'turnkey_client/models/get_organization_configs_response' require 'turnkey_client/models/get_policies_request' require 'turnkey_client/models/get_policies_response' require 'turnkey_client/models/get_policy_request' @@ -199,6 +222,11 @@ require 'turnkey_client/models/list_user_tags_request' require 'turnkey_client/models/list_user_tags_response' require 'turnkey_client/models/mnemonic_language' +require 'turnkey_client/models/oauth_intent' +require 'turnkey_client/models/oauth_provider' +require 'turnkey_client/models/oauth_provider_params' +require 'turnkey_client/models/oauth_request' +require 'turnkey_client/models/oauth_result' require 'turnkey_client/models/operator' require 'turnkey_client/models/pagination' require 'turnkey_client/models/path_format' @@ -218,6 +246,8 @@ require 'turnkey_client/models/remove_organization_feature_result' require 'turnkey_client/models/result' require 'turnkey_client/models/root_user_params' +require 'turnkey_client/models/root_user_params_v2' +require 'turnkey_client/models/root_user_params_v3' require 'turnkey_client/models/selector' require 'turnkey_client/models/selector_v2' require 'turnkey_client/models/set_organization_feature_intent' diff --git a/turnkey_client/lib/turnkey_client/api/organizations_api.rb b/turnkey_client/lib/turnkey_client/api/organizations_api.rb index afc5619..00470b4 100644 --- a/turnkey_client/lib/turnkey_client/api/organizations_api.rb +++ b/turnkey_client/lib/turnkey_client/api/organizations_api.rb @@ -73,6 +73,64 @@ def create_sub_organization_with_http_info(body, opts = {}) end return data, status_code, headers end + # Get Configs + # Get quorum settings and features for an organization + # @param body + # @param [Hash] opts the optional parameters + # @return [GetOrganizationConfigsResponse] + def get_organization_configs(body, opts = {}) + data, _status_code, _headers = get_organization_configs_with_http_info(body, opts) + data + end + + # Get Configs + # Get quorum settings and features for an organization + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(GetOrganizationConfigsResponse, Integer, Hash)>] GetOrganizationConfigsResponse data, response status code and response headers + def get_organization_configs_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsApi.get_organization_configs ...' + 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 OrganizationsApi.get_organization_configs" + end + # resource path + local_var_path = '/public/v1/query/get_organization_configs' + + # 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] || 'GetOrganizationConfigsResponse' + + 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: OrganizationsApi#get_organization_configs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Get Suborgs # Get all suborg IDs associated given a parent org ID and an optional filter. # @param body diff --git a/turnkey_client/lib/turnkey_client/api/sessions_api.rb b/turnkey_client/lib/turnkey_client/api/sessions_api.rb index 4bad9c1..bd6473a 100644 --- a/turnkey_client/lib/turnkey_client/api/sessions_api.rb +++ b/turnkey_client/lib/turnkey_client/api/sessions_api.rb @@ -73,6 +73,64 @@ def create_read_only_session_with_http_info(body, opts = {}) end return data, status_code, headers end + # Create Read Write Session + # Create a read write session for a user + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def create_read_write_session(body, opts = {}) + data, _status_code, _headers = create_read_write_session_with_http_info(body, opts) + data + end + + # Create Read Write Session + # Create a read write session for a user + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def create_read_write_session_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SessionsApi.create_read_write_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_write_session" + end + # resource path + local_var_path = '/public/v1/submit/create_read_write_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_write_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 diff --git a/turnkey_client/lib/turnkey_client/api/users_api.rb b/turnkey_client/lib/turnkey_client/api/users_api.rb index 74ad51a..24d6f43 100644 --- a/turnkey_client/lib/turnkey_client/api/users_api.rb +++ b/turnkey_client/lib/turnkey_client/api/users_api.rb @@ -15,6 +15,64 @@ class UsersApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create Oauth Providers + # Creates Oauth providers for a specified user - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def create_oauth_providers(body, opts = {}) + data, _status_code, _headers = create_oauth_providers_with_http_info(body, opts) + data + end + + # Create Oauth Providers + # Creates Oauth providers for a specified user - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def create_oauth_providers_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.create_oauth_providers ...' + 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 UsersApi.create_oauth_providers" + end + # resource path + local_var_path = '/public/v1/submit/create_oauth_providers' + + # 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: UsersApi#create_oauth_providers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Create Users # Create Users in an existing Organization # @param body @@ -73,6 +131,64 @@ def create_users_with_http_info(body, opts = {}) end return data, status_code, headers end + # Delete Oauth Providers + # Removes Oauth providers for a specified user - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def delete_oauth_providers(body, opts = {}) + data, _status_code, _headers = delete_oauth_providers_with_http_info(body, opts) + data + end + + # Delete Oauth Providers + # Removes Oauth providers for a specified user - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def delete_oauth_providers_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.delete_oauth_providers ...' + 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 UsersApi.delete_oauth_providers" + end + # resource path + local_var_path = '/public/v1/submit/delete_oauth_providers' + + # 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: UsersApi#delete_oauth_providers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Delete Users # Delete Users within an Organization # @param body @@ -131,6 +247,64 @@ def delete_users_with_http_info(body, opts = {}) end return data, status_code, headers end + # Get Oauth providers + # Get details about Oauth providers for a user + # @param body + # @param [Hash] opts the optional parameters + # @return [GetOauthProvidersResponse] + def get_oauth_providers(body, opts = {}) + data, _status_code, _headers = get_oauth_providers_with_http_info(body, opts) + data + end + + # Get Oauth providers + # Get details about Oauth providers for a user + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(GetOauthProvidersResponse, Integer, Hash)>] GetOauthProvidersResponse data, response status code and response headers + def get_oauth_providers_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.get_oauth_providers ...' + 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 UsersApi.get_oauth_providers" + end + # resource path + local_var_path = '/public/v1/query/get_oauth_providers' + + # 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] || 'GetOauthProvidersResponse' + + 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: UsersApi#get_oauth_providers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Get User # Get details about a User # @param body @@ -247,6 +421,64 @@ def get_users_with_http_info(body, opts = {}) end return data, status_code, headers end + # Oauth + # Authenticate a user with an Oidc token (Oauth) - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def oauth(body, opts = {}) + data, _status_code, _headers = oauth_with_http_info(body, opts) + data + end + + # Oauth + # Authenticate a user with an Oidc token (Oauth) - BETA + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def oauth_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.oauth ...' + 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 UsersApi.oauth" + end + # resource path + local_var_path = '/public/v1/submit/oauth' + + # 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: UsersApi#oauth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Update User # Update a User in an existing Organization # @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 0b0a23e..10c8353 100644 --- a/turnkey_client/lib/turnkey_client/models/activity_type.rb +++ b/turnkey_client/lib/turnkey_client/models/activity_type.rb @@ -76,6 +76,14 @@ class ActivityType 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 + CREATE_OAUTH_PROVIDERS = 'ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS'.freeze + DELETE_OAUTH_PROVIDERS = 'ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS'.freeze + CREATE_SUB_ORGANIZATION_V5 = 'ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5'.freeze + OAUTH = 'ACTIVITY_TYPE_OAUTH'.freeze + CREATE_API_KEYS_V2 = 'ACTIVITY_TYPE_CREATE_API_KEYS_V2'.freeze + CREATE_READ_WRITE_SESSION = 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION'.freeze + EMAIL_AUTH_V2 = 'ACTIVITY_TYPE_EMAIL_AUTH_V2'.freeze + CREATE_SUB_ORGANIZATION_V6 = 'ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6'.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/api_key_curve.rb b/turnkey_client/lib/turnkey_client/models/api_key_curve.rb new file mode 100644 index 0000000..775fcf7 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/api_key_curve.rb @@ -0,0 +1,28 @@ +=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 ApiKeyCurve + P256 = 'API_KEY_CURVE_P256'.freeze + SECP256_K1 = 'API_KEY_CURVE_SECP256K1'.freeze + ED25519 = 'API_KEY_CURVE_ED25519'.freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + constantValues = ApiKeyCurve.constants.select { |c| ApiKeyCurve::const_get(c) == value } + raise "Invalid ENUM value #{value} for class #ApiKeyCurve" if constantValues.empty? + value + end + end +end diff --git a/turnkey_client/lib/turnkey_client/models/api_key_params_v2.rb b/turnkey_client/lib/turnkey_client/models/api_key_params_v2.rb new file mode 100644 index 0000000..b23a471 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/api_key_params_v2.rb @@ -0,0 +1,250 @@ +=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 ApiKeyParamsV2 + # Human-readable name for an API Key. + attr_accessor :api_key_name + + # The public component of a cryptographic key pair used to sign messages and transactions. + attr_accessor :public_key + + attr_accessor :curve_type + + # Optional window (in seconds) indicating how long the API Key should last. + attr_accessor :expiration_seconds + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'api_key_name' => :'apiKeyName', + :'public_key' => :'publicKey', + :'curve_type' => :'curveType', + :'expiration_seconds' => :'expirationSeconds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'api_key_name' => :'Object', + :'public_key' => :'Object', + :'curve_type' => :'Object', + :'expiration_seconds' => :'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::ApiKeyParamsV2` 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::ApiKeyParamsV2`. 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?(:'api_key_name') + self.api_key_name = attributes[:'api_key_name'] + end + + if attributes.key?(:'public_key') + self.public_key = attributes[:'public_key'] + end + + if attributes.key?(:'curve_type') + self.curve_type = attributes[:'curve_type'] + end + + if attributes.key?(:'expiration_seconds') + self.expiration_seconds = attributes[:'expiration_seconds'] + 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 @api_key_name.nil? + invalid_properties.push('invalid value for "api_key_name", api_key_name cannot be nil.') + end + + if @public_key.nil? + invalid_properties.push('invalid value for "public_key", public_key cannot be nil.') + end + + if @curve_type.nil? + invalid_properties.push('invalid value for "curve_type", curve_type 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 @api_key_name.nil? + return false if @public_key.nil? + return false if @curve_type.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 && + api_key_name == o.api_key_name && + public_key == o.public_key && + curve_type == o.curve_type && + expiration_seconds == o.expiration_seconds + 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 + [api_key_name, public_key, curve_type, expiration_seconds].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/config.rb b/turnkey_client/lib/turnkey_client/models/config.rb new file mode 100644 index 0000000..452d01e --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/config.rb @@ -0,0 +1,216 @@ +=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 Config + attr_accessor :features + + attr_accessor :quorum + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'features' => :'features', + :'quorum' => :'quorum' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'features' => :'Object', + :'quorum' => :'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::Config` 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::Config`. 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?(:'features') + if (value = attributes[:'features']).is_a?(Array) + self.features = value + end + end + + if attributes.key?(:'quorum') + self.quorum = attributes[:'quorum'] + 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 && + features == o.features && + quorum == o.quorum + 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 + [features, quorum].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_api_keys_intent_v2.rb b/turnkey_client/lib/turnkey_client/models/create_api_keys_intent_v2.rb new file mode 100644 index 0000000..ff9e8d4 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_api_keys_intent_v2.rb @@ -0,0 +1,228 @@ +=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 CreateApiKeysIntentV2 + # A list of API Keys. + attr_accessor :api_keys + + # Unique identifier for a given User. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'api_keys' => :'apiKeys', + :'user_id' => :'userId' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'api_keys' => :'Object', + :'user_id' => :'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::CreateApiKeysIntentV2` 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::CreateApiKeysIntentV2`. 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?(:'api_keys') + if (value = attributes[:'api_keys']).is_a?(Array) + self.api_keys = value + end + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + 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 @api_keys.nil? + invalid_properties.push('invalid value for "api_keys", api_keys cannot be nil.') + end + + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id 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 @api_keys.nil? + return false if @user_id.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 && + api_keys == o.api_keys && + user_id == o.user_id + 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 + [api_keys, user_id].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_api_keys_request.rb b/turnkey_client/lib/turnkey_client/models/create_api_keys_request.rb index 8aaa5a2..d0b95ef 100644 --- a/turnkey_client/lib/turnkey_client/models/create_api_keys_request.rb +++ b/turnkey_client/lib/turnkey_client/models/create_api_keys_request.rb @@ -129,7 +129,7 @@ def list_invalid_properties # @return true if the model is valid def valid? return false if @type.nil? - type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_API_KEYS']) + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_API_KEYS_V2']) return false unless type_validator.valid?(@type) return false if @timestamp_ms.nil? return false if @organization_id.nil? @@ -140,7 +140,7 @@ def valid? # 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_API_KEYS']) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_API_KEYS_V2']) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end diff --git a/turnkey_client/lib/turnkey_client/models/create_oauth_providers_intent.rb b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_intent.rb new file mode 100644 index 0000000..c8886f1 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_intent.rb @@ -0,0 +1,228 @@ +=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 CreateOauthProvidersIntent + # The ID of the User to add an Oauth provider to + attr_accessor :user_id + + # A list of Oauth providers. + attr_accessor :oauth_providers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'oauth_providers' => :'oauthProviders' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'Object', + :'oauth_providers' => :'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::CreateOauthProvidersIntent` 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::CreateOauthProvidersIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = 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 @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers 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 @user_id.nil? + return false if @oauth_providers.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + oauth_providers == o.oauth_providers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, oauth_providers].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_oauth_providers_request.rb b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_request.rb new file mode 100644 index 0000000..2b5ad2e --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_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 CreateOauthProvidersRequest + 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::CreateOauthProvidersRequest` 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::CreateOauthProvidersRequest`. 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_OAUTH_PROVIDERS']) + 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_OAUTH_PROVIDERS']) + 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_oauth_providers_result.rb b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_result.rb new file mode 100644 index 0000000..3db295e --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_oauth_providers_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 CreateOauthProvidersResult + # A list of unique identifiers for Oauth Providers + attr_accessor :provider_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'provider_ids' => :'providerIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'provider_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::CreateOauthProvidersResult` 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::CreateOauthProvidersResult`. 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?(:'provider_ids') + if (value = attributes[:'provider_ids']).is_a?(Array) + self.provider_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 @provider_ids.nil? + invalid_properties.push('invalid value for "provider_ids", provider_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 @provider_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 && + provider_ids == o.provider_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 + [provider_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/create_read_write_session_intent.rb b/turnkey_client/lib/turnkey_client/models/create_read_write_session_intent.rb new file mode 100644 index 0000000..336a5c1 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_read_write_session_intent.rb @@ -0,0 +1,246 @@ +=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 CreateReadWriteSessionIntent + # Client-side public key generated by the user, to which the read write session bundle (credentials) will be encrypted. + attr_accessor :target_public_key + + # Email of the user to create a read write session for + attr_accessor :email + + # Optional human-readable name for an API Key. If none provided, default to Read Write Session - + attr_accessor :api_key_name + + # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. + attr_accessor :expiration_seconds + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'target_public_key' => :'targetPublicKey', + :'email' => :'email', + :'api_key_name' => :'apiKeyName', + :'expiration_seconds' => :'expirationSeconds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'target_public_key' => :'Object', + :'email' => :'Object', + :'api_key_name' => :'Object', + :'expiration_seconds' => :'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::CreateReadWriteSessionIntent` 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::CreateReadWriteSessionIntent`. 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?(:'target_public_key') + self.target_public_key = attributes[:'target_public_key'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'api_key_name') + self.api_key_name = attributes[:'api_key_name'] + end + + if attributes.key?(:'expiration_seconds') + self.expiration_seconds = attributes[:'expiration_seconds'] + 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 @target_public_key.nil? + invalid_properties.push('invalid value for "target_public_key", target_public_key cannot be nil.') + end + + if @email.nil? + invalid_properties.push('invalid value for "email", email 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 @target_public_key.nil? + return false if @email.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 && + target_public_key == o.target_public_key && + email == o.email && + api_key_name == o.api_key_name && + expiration_seconds == o.expiration_seconds + 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 + [target_public_key, email, api_key_name, expiration_seconds].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_read_write_session_request.rb b/turnkey_client/lib/turnkey_client/models/create_read_write_session_request.rb new file mode 100644 index 0000000..b5ba789 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_read_write_session_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 CreateReadWriteSessionRequest + 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::CreateReadWriteSessionRequest` 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::CreateReadWriteSessionRequest`. 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_READ_WRITE_SESSION']) + 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_READ_WRITE_SESSION']) + 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_read_write_session_result.rb b/turnkey_client/lib/turnkey_client/models/create_read_write_session_result.rb new file mode 100644 index 0000000..da6e4ef --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_read_write_session_result.rb @@ -0,0 +1,286 @@ +=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 CreateReadWriteSessionResult + # Unique identifier for a given Organization. If the request is being made by a user and their Sub-Organization ID is unknown, this can be the Parent Organization ID. However, using the Sub-Organization ID is preferred due to performance reasons. + attr_accessor :organization_id + + # Human-readable name for an Organization. + attr_accessor :organization_name + + # Unique identifier for a given User. + attr_accessor :user_id + + # Human-readable name for a User. + attr_accessor :username + + # Unique identifier for the created API key. + attr_accessor :api_key_id + + # HPKE encrypted credential bundle + attr_accessor :credential_bundle + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization_id' => :'organizationId', + :'organization_name' => :'organizationName', + :'user_id' => :'userId', + :'username' => :'username', + :'api_key_id' => :'apiKeyId', + :'credential_bundle' => :'credentialBundle' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'organization_id' => :'Object', + :'organization_name' => :'Object', + :'user_id' => :'Object', + :'username' => :'Object', + :'api_key_id' => :'Object', + :'credential_bundle' => :'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::CreateReadWriteSessionResult` 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::CreateReadWriteSessionResult`. 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?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'organization_name') + self.organization_name = attributes[:'organization_name'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'username') + self.username = attributes[:'username'] + end + + if attributes.key?(:'api_key_id') + self.api_key_id = attributes[:'api_key_id'] + end + + if attributes.key?(:'credential_bundle') + self.credential_bundle = attributes[:'credential_bundle'] + 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 @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.') + end + + if @organization_name.nil? + invalid_properties.push('invalid value for "organization_name", organization_name cannot be nil.') + end + + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @username.nil? + invalid_properties.push('invalid value for "username", username cannot be nil.') + end + + if @api_key_id.nil? + invalid_properties.push('invalid value for "api_key_id", api_key_id cannot be nil.') + end + + if @credential_bundle.nil? + invalid_properties.push('invalid value for "credential_bundle", credential_bundle 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 @organization_id.nil? + return false if @organization_name.nil? + return false if @user_id.nil? + return false if @username.nil? + return false if @api_key_id.nil? + return false if @credential_bundle.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 && + organization_id == o.organization_id && + organization_name == o.organization_name && + user_id == o.user_id && + username == o.username && + api_key_id == o.api_key_id && + credential_bundle == o.credential_bundle + 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 + [organization_id, organization_name, user_id, username, api_key_id, credential_bundle].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_sub_organization_intent_v5.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v5.rb new file mode 100644 index 0000000..e7ac97c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v5.rb @@ -0,0 +1,272 @@ +=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 CreateSubOrganizationIntentV5 + # Name for this sub-organization + attr_accessor :sub_organization_name + + # Root users to create within this sub-organization + attr_accessor :root_users + + # The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users + attr_accessor :root_quorum_threshold + + attr_accessor :wallet + + # Disable email recovery for the sub-organization + attr_accessor :disable_email_recovery + + # Disable email auth for the sub-organization + attr_accessor :disable_email_auth + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_name' => :'subOrganizationName', + :'root_users' => :'rootUsers', + :'root_quorum_threshold' => :'rootQuorumThreshold', + :'wallet' => :'wallet', + :'disable_email_recovery' => :'disableEmailRecovery', + :'disable_email_auth' => :'disableEmailAuth' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_name' => :'Object', + :'root_users' => :'Object', + :'root_quorum_threshold' => :'Object', + :'wallet' => :'Object', + :'disable_email_recovery' => :'Object', + :'disable_email_auth' => :'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::CreateSubOrganizationIntentV5` 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::CreateSubOrganizationIntentV5`. 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?(:'sub_organization_name') + self.sub_organization_name = attributes[:'sub_organization_name'] + end + + if attributes.key?(:'root_users') + if (value = attributes[:'root_users']).is_a?(Array) + self.root_users = value + end + end + + if attributes.key?(:'root_quorum_threshold') + self.root_quorum_threshold = attributes[:'root_quorum_threshold'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'disable_email_recovery') + self.disable_email_recovery = attributes[:'disable_email_recovery'] + end + + if attributes.key?(:'disable_email_auth') + self.disable_email_auth = attributes[:'disable_email_auth'] + 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 @sub_organization_name.nil? + invalid_properties.push('invalid value for "sub_organization_name", sub_organization_name cannot be nil.') + end + + if @root_users.nil? + invalid_properties.push('invalid value for "root_users", root_users cannot be nil.') + end + + if @root_quorum_threshold.nil? + invalid_properties.push('invalid value for "root_quorum_threshold", root_quorum_threshold 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 @sub_organization_name.nil? + return false if @root_users.nil? + return false if @root_quorum_threshold.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 && + sub_organization_name == o.sub_organization_name && + root_users == o.root_users && + root_quorum_threshold == o.root_quorum_threshold && + wallet == o.wallet && + disable_email_recovery == o.disable_email_recovery && + disable_email_auth == o.disable_email_auth + 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 + [sub_organization_name, root_users, root_quorum_threshold, wallet, disable_email_recovery, disable_email_auth].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_sub_organization_intent_v6.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v6.rb new file mode 100644 index 0000000..6094701 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v6.rb @@ -0,0 +1,272 @@ +=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 CreateSubOrganizationIntentV6 + # Name for this sub-organization + attr_accessor :sub_organization_name + + # Root users to create within this sub-organization + attr_accessor :root_users + + # The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users + attr_accessor :root_quorum_threshold + + attr_accessor :wallet + + # Disable email recovery for the sub-organization + attr_accessor :disable_email_recovery + + # Disable email auth for the sub-organization + attr_accessor :disable_email_auth + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_name' => :'subOrganizationName', + :'root_users' => :'rootUsers', + :'root_quorum_threshold' => :'rootQuorumThreshold', + :'wallet' => :'wallet', + :'disable_email_recovery' => :'disableEmailRecovery', + :'disable_email_auth' => :'disableEmailAuth' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_name' => :'Object', + :'root_users' => :'Object', + :'root_quorum_threshold' => :'Object', + :'wallet' => :'Object', + :'disable_email_recovery' => :'Object', + :'disable_email_auth' => :'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::CreateSubOrganizationIntentV6` 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::CreateSubOrganizationIntentV6`. 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?(:'sub_organization_name') + self.sub_organization_name = attributes[:'sub_organization_name'] + end + + if attributes.key?(:'root_users') + if (value = attributes[:'root_users']).is_a?(Array) + self.root_users = value + end + end + + if attributes.key?(:'root_quorum_threshold') + self.root_quorum_threshold = attributes[:'root_quorum_threshold'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'disable_email_recovery') + self.disable_email_recovery = attributes[:'disable_email_recovery'] + end + + if attributes.key?(:'disable_email_auth') + self.disable_email_auth = attributes[:'disable_email_auth'] + 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 @sub_organization_name.nil? + invalid_properties.push('invalid value for "sub_organization_name", sub_organization_name cannot be nil.') + end + + if @root_users.nil? + invalid_properties.push('invalid value for "root_users", root_users cannot be nil.') + end + + if @root_quorum_threshold.nil? + invalid_properties.push('invalid value for "root_quorum_threshold", root_quorum_threshold 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 @sub_organization_name.nil? + return false if @root_users.nil? + return false if @root_quorum_threshold.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 && + sub_organization_name == o.sub_organization_name && + root_users == o.root_users && + root_quorum_threshold == o.root_quorum_threshold && + wallet == o.wallet && + disable_email_recovery == o.disable_email_recovery && + disable_email_auth == o.disable_email_auth + 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 + [sub_organization_name, root_users, root_quorum_threshold, wallet, disable_email_recovery, disable_email_auth].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_sub_organization_request.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb index ace46f0..30d1dcb 100644 --- a/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb @@ -129,7 +129,7 @@ def list_invalid_properties # @return true if the model is valid def valid? return false if @type.nil? - type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4']) + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6']) return false unless type_validator.valid?(@type) return false if @timestamp_ms.nil? return false if @organization_id.nil? @@ -140,7 +140,7 @@ def valid? # 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_SUB_ORGANIZATION_V4']) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6']) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end diff --git a/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v5.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v5.rb new file mode 100644 index 0000000..dc33d67 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v5.rb @@ -0,0 +1,230 @@ +=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 CreateSubOrganizationResultV5 + attr_accessor :sub_organization_id + + attr_accessor :wallet + + attr_accessor :root_user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_id' => :'subOrganizationId', + :'wallet' => :'wallet', + :'root_user_ids' => :'rootUserIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_id' => :'Object', + :'wallet' => :'Object', + :'root_user_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::CreateSubOrganizationResultV5` 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::CreateSubOrganizationResultV5`. 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?(:'sub_organization_id') + self.sub_organization_id = attributes[:'sub_organization_id'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'root_user_ids') + if (value = attributes[:'root_user_ids']).is_a?(Array) + self.root_user_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 @sub_organization_id.nil? + invalid_properties.push('invalid value for "sub_organization_id", sub_organization_id 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 @sub_organization_id.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 && + sub_organization_id == o.sub_organization_id && + wallet == o.wallet && + root_user_ids == o.root_user_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 + [sub_organization_id, wallet, root_user_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/create_sub_organization_result_v6.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v6.rb new file mode 100644 index 0000000..974f882 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v6.rb @@ -0,0 +1,230 @@ +=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 CreateSubOrganizationResultV6 + attr_accessor :sub_organization_id + + attr_accessor :wallet + + attr_accessor :root_user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_id' => :'subOrganizationId', + :'wallet' => :'wallet', + :'root_user_ids' => :'rootUserIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_id' => :'Object', + :'wallet' => :'Object', + :'root_user_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::CreateSubOrganizationResultV6` 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::CreateSubOrganizationResultV6`. 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?(:'sub_organization_id') + self.sub_organization_id = attributes[:'sub_organization_id'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'root_user_ids') + if (value = attributes[:'root_user_ids']).is_a?(Array) + self.root_user_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 @sub_organization_id.nil? + invalid_properties.push('invalid value for "sub_organization_id", sub_organization_id 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 @sub_organization_id.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 && + sub_organization_id == o.sub_organization_id && + wallet == o.wallet && + root_user_ids == o.root_user_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 + [sub_organization_id, wallet, root_user_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/credential_type.rb b/turnkey_client/lib/turnkey_client/models/credential_type.rb index fc47256..6c49053 100644 --- a/turnkey_client/lib/turnkey_client/models/credential_type.rb +++ b/turnkey_client/lib/turnkey_client/models/credential_type.rb @@ -15,6 +15,9 @@ class CredentialType WEBAUTHN_AUTHENTICATOR = 'CREDENTIAL_TYPE_WEBAUTHN_AUTHENTICATOR'.freeze API_KEY_P256 = 'CREDENTIAL_TYPE_API_KEY_P256'.freeze RECOVER_USER_KEY_P256 = 'CREDENTIAL_TYPE_RECOVER_USER_KEY_P256'.freeze + API_KEY_SECP256_K1 = 'CREDENTIAL_TYPE_API_KEY_SECP256K1'.freeze + EMAIL_AUTH_KEY_P256 = 'CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256'.freeze + API_KEY_ED25519 = 'CREDENTIAL_TYPE_API_KEY_ED25519'.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/delete_oauth_providers_intent.rb b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_intent.rb new file mode 100644 index 0000000..dd39d8c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_intent.rb @@ -0,0 +1,228 @@ +=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 DeleteOauthProvidersIntent + # The ID of the User to remove an Oauth provider from + attr_accessor :user_id + + # Unique identifier for a given Provider. + attr_accessor :provider_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'provider_ids' => :'providerIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'Object', + :'provider_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::DeleteOauthProvidersIntent` 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::DeleteOauthProvidersIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'provider_ids') + if (value = attributes[:'provider_ids']).is_a?(Array) + self.provider_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 @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @provider_ids.nil? + invalid_properties.push('invalid value for "provider_ids", provider_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 @user_id.nil? + return false if @provider_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 && + user_id == o.user_id && + provider_ids == o.provider_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 + [user_id, provider_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/delete_oauth_providers_request.rb b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_request.rb new file mode 100644 index 0000000..ddd43d3 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_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 DeleteOauthProvidersRequest + 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::DeleteOauthProvidersRequest` 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::DeleteOauthProvidersRequest`. 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_DELETE_OAUTH_PROVIDERS']) + 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_DELETE_OAUTH_PROVIDERS']) + 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/delete_oauth_providers_result.rb b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_result.rb new file mode 100644 index 0000000..70719f5 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/delete_oauth_providers_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 DeleteOauthProvidersResult + # A list of unique identifiers for Oauth Providers + attr_accessor :provider_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'provider_ids' => :'providerIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'provider_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::DeleteOauthProvidersResult` 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::DeleteOauthProvidersResult`. 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?(:'provider_ids') + if (value = attributes[:'provider_ids']).is_a?(Array) + self.provider_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 @provider_ids.nil? + invalid_properties.push('invalid value for "provider_ids", provider_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 @provider_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 && + provider_ids == o.provider_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 + [provider_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_auth_intent.rb b/turnkey_client/lib/turnkey_client/models/email_auth_intent.rb index ddff3a5..dd8612e 100644 --- a/turnkey_client/lib/turnkey_client/models/email_auth_intent.rb +++ b/turnkey_client/lib/turnkey_client/models/email_auth_intent.rb @@ -26,6 +26,9 @@ class EmailAuthIntent attr_accessor :email_customization + # Invalidate all other previously generated Email Auth API keys + attr_accessor :invalidate_existing + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -33,7 +36,8 @@ def self.attribute_map :'target_public_key' => :'targetPublicKey', :'api_key_name' => :'apiKeyName', :'expiration_seconds' => :'expirationSeconds', - :'email_customization' => :'emailCustomization' + :'email_customization' => :'emailCustomization', + :'invalidate_existing' => :'invalidateExisting' } end @@ -44,7 +48,8 @@ def self.openapi_types :'target_public_key' => :'Object', :'api_key_name' => :'Object', :'expiration_seconds' => :'Object', - :'email_customization' => :'Object' + :'email_customization' => :'Object', + :'invalidate_existing' => :'Object' } end @@ -88,6 +93,10 @@ def initialize(attributes = {}) if attributes.key?(:'email_customization') self.email_customization = attributes[:'email_customization'] end + + if attributes.key?(:'invalidate_existing') + self.invalidate_existing = attributes[:'invalidate_existing'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -122,7 +131,8 @@ def ==(o) target_public_key == o.target_public_key && api_key_name == o.api_key_name && expiration_seconds == o.expiration_seconds && - email_customization == o.email_customization + email_customization == o.email_customization && + invalidate_existing == o.invalidate_existing end # @see the `==` method @@ -134,7 +144,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [email, target_public_key, api_key_name, expiration_seconds, email_customization].hash + [email, target_public_key, api_key_name, expiration_seconds, email_customization, invalidate_existing].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/email_auth_intent_v2.rb b/turnkey_client/lib/turnkey_client/models/email_auth_intent_v2.rb new file mode 100644 index 0000000..e03d08c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/email_auth_intent_v2.rb @@ -0,0 +1,265 @@ +=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 EmailAuthIntentV2 + # Email of the authenticating user. + attr_accessor :email + + # Client-side public key generated by the user, to which the email auth bundle (credentials) will be encrypted. + attr_accessor :target_public_key + + # Optional human-readable name for an API Key. If none provided, default to Email Auth - + attr_accessor :api_key_name + + # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. + attr_accessor :expiration_seconds + + attr_accessor :email_customization + + # Invalidate all other previously generated Email Auth API keys + attr_accessor :invalidate_existing + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'target_public_key' => :'targetPublicKey', + :'api_key_name' => :'apiKeyName', + :'expiration_seconds' => :'expirationSeconds', + :'email_customization' => :'emailCustomization', + :'invalidate_existing' => :'invalidateExisting' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'Object', + :'target_public_key' => :'Object', + :'api_key_name' => :'Object', + :'expiration_seconds' => :'Object', + :'email_customization' => :'Object', + :'invalidate_existing' => :'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::EmailAuthIntentV2` 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::EmailAuthIntentV2`. 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?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'target_public_key') + self.target_public_key = attributes[:'target_public_key'] + end + + if attributes.key?(:'api_key_name') + self.api_key_name = attributes[:'api_key_name'] + end + + if attributes.key?(:'expiration_seconds') + self.expiration_seconds = attributes[:'expiration_seconds'] + end + + if attributes.key?(:'email_customization') + self.email_customization = attributes[:'email_customization'] + end + + if attributes.key?(:'invalidate_existing') + self.invalidate_existing = attributes[:'invalidate_existing'] + 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 @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @target_public_key.nil? + invalid_properties.push('invalid value for "target_public_key", target_public_key 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 @email.nil? + return false if @target_public_key.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 && + email == o.email && + target_public_key == o.target_public_key && + api_key_name == o.api_key_name && + expiration_seconds == o.expiration_seconds && + email_customization == o.email_customization && + invalidate_existing == o.invalidate_existing + 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 + [email, target_public_key, api_key_name, expiration_seconds, email_customization, invalidate_existing].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_auth_request.rb b/turnkey_client/lib/turnkey_client/models/email_auth_request.rb index 5d8a5cd..4b89f59 100644 --- a/turnkey_client/lib/turnkey_client/models/email_auth_request.rb +++ b/turnkey_client/lib/turnkey_client/models/email_auth_request.rb @@ -129,7 +129,7 @@ def list_invalid_properties # @return true if the model is valid def valid? return false if @type.nil? - type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH']) + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH_V2']) return false unless type_validator.valid?(@type) return false if @timestamp_ms.nil? return false if @organization_id.nil? @@ -140,7 +140,7 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) - validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH']) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH_V2']) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end diff --git a/turnkey_client/lib/turnkey_client/models/external_data_v1_quorum.rb b/turnkey_client/lib/turnkey_client/models/external_data_v1_quorum.rb new file mode 100644 index 0000000..0fd1d9b --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/external_data_v1_quorum.rb @@ -0,0 +1,228 @@ +=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 ExternalDataV1Quorum + # Count of unique approvals required to meet quorum. + attr_accessor :threshold + + # Unique identifiers of quorum set members. + attr_accessor :user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'threshold' => :'threshold', + :'user_ids' => :'userIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'threshold' => :'Object', + :'user_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::ExternalDataV1Quorum` 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::ExternalDataV1Quorum`. 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?(:'threshold') + self.threshold = attributes[:'threshold'] + end + + if attributes.key?(:'user_ids') + if (value = attributes[:'user_ids']).is_a?(Array) + self.user_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 @threshold.nil? + invalid_properties.push('invalid value for "threshold", threshold cannot be nil.') + end + + if @user_ids.nil? + invalid_properties.push('invalid value for "user_ids", user_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 @threshold.nil? + return false if @user_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 && + threshold == o.threshold && + user_ids == o.user_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 + [threshold, user_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/get_oauth_providers_request.rb b/turnkey_client/lib/turnkey_client/models/get_oauth_providers_request.rb new file mode 100644 index 0000000..27eafaa --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/get_oauth_providers_request.rb @@ -0,0 +1,221 @@ +=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 GetOauthProvidersRequest + # Unique identifier for a given Organization. + attr_accessor :organization_id + + # Unique identifier for a given User. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization_id' => :'organizationId', + :'user_id' => :'userId' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'organization_id' => :'Object', + :'user_id' => :'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::GetOauthProvidersRequest` 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::GetOauthProvidersRequest`. 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?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + 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 @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id 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 @organization_id.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 && + organization_id == o.organization_id && + user_id == o.user_id + 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 + [organization_id, user_id].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/get_oauth_providers_response.rb b/turnkey_client/lib/turnkey_client/models/get_oauth_providers_response.rb new file mode 100644 index 0000000..563bbb6 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/get_oauth_providers_response.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 GetOauthProvidersResponse + # A list of Oauth Providers + attr_accessor :oauth_providers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'oauth_providers' => :'oauthProviders' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'oauth_providers' => :'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::GetOauthProvidersResponse` 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::GetOauthProvidersResponse`. 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?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = 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 @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers 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 @oauth_providers.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 && + oauth_providers == o.oauth_providers + 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 + [oauth_providers].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/get_organization_configs_request.rb b/turnkey_client/lib/turnkey_client/models/get_organization_configs_request.rb new file mode 100644 index 0000000..4a2c925 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/get_organization_configs_request.rb @@ -0,0 +1,211 @@ +=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 GetOrganizationConfigsRequest + # Unique identifier for a given Organization. + attr_accessor :organization_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization_id' => :'organizationId' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'organization_id' => :'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::GetOrganizationConfigsRequest` 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::GetOrganizationConfigsRequest`. 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?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + 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 @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id 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 @organization_id.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 && + organization_id == o.organization_id + 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 + [organization_id].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/get_organization_configs_response.rb b/turnkey_client/lib/turnkey_client/models/get_organization_configs_response.rb new file mode 100644 index 0000000..d260a8c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/get_organization_configs_response.rb @@ -0,0 +1,210 @@ +=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 GetOrganizationConfigsResponse + attr_accessor :configs + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'configs' => :'configs' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'configs' => :'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::GetOrganizationConfigsResponse` 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::GetOrganizationConfigsResponse`. 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?(:'configs') + self.configs = attributes[:'configs'] + 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 @configs.nil? + invalid_properties.push('invalid value for "configs", configs 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 @configs.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 && + configs == o.configs + 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 + [configs].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/get_sub_org_ids_request.rb b/turnkey_client/lib/turnkey_client/models/get_sub_org_ids_request.rb index 32426fa..9bc5ee9 100644 --- a/turnkey_client/lib/turnkey_client/models/get_sub_org_ids_request.rb +++ b/turnkey_client/lib/turnkey_client/models/get_sub_org_ids_request.rb @@ -15,7 +15,7 @@ class GetSubOrgIdsRequest # Unique identifier for the parent Organization. This is used to find sub-organizations within it. attr_accessor :organization_id - # Specifies the type of filter to apply, i.e 'CREDENTIAL_ID', 'NAME', 'USERNAME', 'EMAIL' or 'PUBLIC_KEY' + # Specifies the type of filter to apply, i.e 'CREDENTIAL_ID', 'NAME', 'USERNAME', 'EMAIL', 'OIDC_TOKEN' or 'PUBLIC_KEY' attr_accessor :filter_type # The value of the filter to apply for the specified type. For example, a specific email or name string. diff --git a/turnkey_client/lib/turnkey_client/models/intent.rb b/turnkey_client/lib/turnkey_client/models/intent.rb index 48452d9..a2cba3f 100644 --- a/turnkey_client/lib/turnkey_client/models/intent.rb +++ b/turnkey_client/lib/turnkey_client/models/intent.rb @@ -140,6 +140,22 @@ class Intent attr_accessor :create_read_only_session_intent + attr_accessor :create_oauth_providers_intent + + attr_accessor :delete_oauth_providers_intent + + attr_accessor :create_sub_organization_intent_v5 + + attr_accessor :oauth_intent + + attr_accessor :create_api_keys_intent_v2 + + attr_accessor :create_read_write_session_intent + + attr_accessor :email_auth_intent_v2 + + attr_accessor :create_sub_organization_intent_v6 + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -206,7 +222,15 @@ def self.attribute_map :'import_private_key_intent' => :'importPrivateKeyIntent', :'create_policies_intent' => :'createPoliciesIntent', :'sign_raw_payloads_intent' => :'signRawPayloadsIntent', - :'create_read_only_session_intent' => :'createReadOnlySessionIntent' + :'create_read_only_session_intent' => :'createReadOnlySessionIntent', + :'create_oauth_providers_intent' => :'createOauthProvidersIntent', + :'delete_oauth_providers_intent' => :'deleteOauthProvidersIntent', + :'create_sub_organization_intent_v5' => :'createSubOrganizationIntentV5', + :'oauth_intent' => :'oauthIntent', + :'create_api_keys_intent_v2' => :'createApiKeysIntentV2', + :'create_read_write_session_intent' => :'createReadWriteSessionIntent', + :'email_auth_intent_v2' => :'emailAuthIntentV2', + :'create_sub_organization_intent_v6' => :'createSubOrganizationIntentV6' } end @@ -276,7 +300,15 @@ def self.openapi_types :'import_private_key_intent' => :'Object', :'create_policies_intent' => :'Object', :'sign_raw_payloads_intent' => :'Object', - :'create_read_only_session_intent' => :'Object' + :'create_read_only_session_intent' => :'Object', + :'create_oauth_providers_intent' => :'Object', + :'delete_oauth_providers_intent' => :'Object', + :'create_sub_organization_intent_v5' => :'Object', + :'oauth_intent' => :'Object', + :'create_api_keys_intent_v2' => :'Object', + :'create_read_write_session_intent' => :'Object', + :'email_auth_intent_v2' => :'Object', + :'create_sub_organization_intent_v6' => :'Object' } end @@ -556,6 +588,38 @@ def initialize(attributes = {}) if attributes.key?(:'create_read_only_session_intent') self.create_read_only_session_intent = attributes[:'create_read_only_session_intent'] end + + if attributes.key?(:'create_oauth_providers_intent') + self.create_oauth_providers_intent = attributes[:'create_oauth_providers_intent'] + end + + if attributes.key?(:'delete_oauth_providers_intent') + self.delete_oauth_providers_intent = attributes[:'delete_oauth_providers_intent'] + end + + if attributes.key?(:'create_sub_organization_intent_v5') + self.create_sub_organization_intent_v5 = attributes[:'create_sub_organization_intent_v5'] + end + + if attributes.key?(:'oauth_intent') + self.oauth_intent = attributes[:'oauth_intent'] + end + + if attributes.key?(:'create_api_keys_intent_v2') + self.create_api_keys_intent_v2 = attributes[:'create_api_keys_intent_v2'] + end + + if attributes.key?(:'create_read_write_session_intent') + self.create_read_write_session_intent = attributes[:'create_read_write_session_intent'] + end + + if attributes.key?(:'email_auth_intent_v2') + self.email_auth_intent_v2 = attributes[:'email_auth_intent_v2'] + end + + if attributes.key?(:'create_sub_organization_intent_v6') + self.create_sub_organization_intent_v6 = attributes[:'create_sub_organization_intent_v6'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -639,7 +703,15 @@ def ==(o) 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 && - create_read_only_session_intent == o.create_read_only_session_intent + create_read_only_session_intent == o.create_read_only_session_intent && + create_oauth_providers_intent == o.create_oauth_providers_intent && + delete_oauth_providers_intent == o.delete_oauth_providers_intent && + create_sub_organization_intent_v5 == o.create_sub_organization_intent_v5 && + oauth_intent == o.oauth_intent && + create_api_keys_intent_v2 == o.create_api_keys_intent_v2 && + create_read_write_session_intent == o.create_read_write_session_intent && + email_auth_intent_v2 == o.email_auth_intent_v2 && + create_sub_organization_intent_v6 == o.create_sub_organization_intent_v6 end # @see the `==` method @@ -651,7 +723,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, create_policies_intent, sign_raw_payloads_intent, create_read_only_session_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, create_read_only_session_intent, create_oauth_providers_intent, delete_oauth_providers_intent, create_sub_organization_intent_v5, oauth_intent, create_api_keys_intent_v2, create_read_write_session_intent, email_auth_intent_v2, create_sub_organization_intent_v6].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/oauth_intent.rb b/turnkey_client/lib/turnkey_client/models/oauth_intent.rb new file mode 100644 index 0000000..146e1e5 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/oauth_intent.rb @@ -0,0 +1,246 @@ +=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 OauthIntent + # Base64 encoded OIDC token + attr_accessor :oidc_token + + # Client-side public key generated by the user, to which the oauth bundle (credentials) will be encrypted. + attr_accessor :target_public_key + + # Optional human-readable name for an API Key. If none provided, default to Oauth - + attr_accessor :api_key_name + + # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. + attr_accessor :expiration_seconds + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'oidc_token' => :'oidcToken', + :'target_public_key' => :'targetPublicKey', + :'api_key_name' => :'apiKeyName', + :'expiration_seconds' => :'expirationSeconds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'oidc_token' => :'Object', + :'target_public_key' => :'Object', + :'api_key_name' => :'Object', + :'expiration_seconds' => :'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::OauthIntent` 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::OauthIntent`. 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?(:'oidc_token') + self.oidc_token = attributes[:'oidc_token'] + end + + if attributes.key?(:'target_public_key') + self.target_public_key = attributes[:'target_public_key'] + end + + if attributes.key?(:'api_key_name') + self.api_key_name = attributes[:'api_key_name'] + end + + if attributes.key?(:'expiration_seconds') + self.expiration_seconds = attributes[:'expiration_seconds'] + 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 @oidc_token.nil? + invalid_properties.push('invalid value for "oidc_token", oidc_token cannot be nil.') + end + + if @target_public_key.nil? + invalid_properties.push('invalid value for "target_public_key", target_public_key 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 @oidc_token.nil? + return false if @target_public_key.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 && + oidc_token == o.oidc_token && + target_public_key == o.target_public_key && + api_key_name == o.api_key_name && + expiration_seconds == o.expiration_seconds + 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 + [oidc_token, target_public_key, api_key_name, expiration_seconds].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/oauth_provider.rb b/turnkey_client/lib/turnkey_client/models/oauth_provider.rb new file mode 100644 index 0000000..b88dc6d --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/oauth_provider.rb @@ -0,0 +1,299 @@ +=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 OauthProvider + # Unique identifier for an OAuth Provider + attr_accessor :provider_id + + # Human-readable name to identify a Provider. + attr_accessor :provider_name + + # The issuer of the token, typically a URL indicating the authentication server, e.g https://accounts.google.com + attr_accessor :issuer + + # Expected audience ('aud' attribute of the signed token) which represents the app ID + attr_accessor :audience + + # Expected subject ('sub' attribute of the signed token) which represents the user ID + attr_accessor :subject + + attr_accessor :created_at + + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'provider_id' => :'providerId', + :'provider_name' => :'providerName', + :'issuer' => :'issuer', + :'audience' => :'audience', + :'subject' => :'subject', + :'created_at' => :'createdAt', + :'updated_at' => :'updatedAt' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'provider_id' => :'Object', + :'provider_name' => :'Object', + :'issuer' => :'Object', + :'audience' => :'Object', + :'subject' => :'Object', + :'created_at' => :'Object', + :'updated_at' => :'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::OauthProvider` 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::OauthProvider`. 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?(:'provider_id') + self.provider_id = attributes[:'provider_id'] + end + + if attributes.key?(:'provider_name') + self.provider_name = attributes[:'provider_name'] + end + + if attributes.key?(:'issuer') + self.issuer = attributes[:'issuer'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'subject') + self.subject = attributes[:'subject'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + 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 @provider_id.nil? + invalid_properties.push('invalid value for "provider_id", provider_id cannot be nil.') + end + + if @provider_name.nil? + invalid_properties.push('invalid value for "provider_name", provider_name cannot be nil.') + end + + if @issuer.nil? + invalid_properties.push('invalid value for "issuer", issuer cannot be nil.') + end + + if @audience.nil? + invalid_properties.push('invalid value for "audience", audience cannot be nil.') + end + + if @subject.nil? + invalid_properties.push('invalid value for "subject", subject cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @updated_at.nil? + invalid_properties.push('invalid value for "updated_at", updated_at 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 @provider_id.nil? + return false if @provider_name.nil? + return false if @issuer.nil? + return false if @audience.nil? + return false if @subject.nil? + return false if @created_at.nil? + return false if @updated_at.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 && + provider_id == o.provider_id && + provider_name == o.provider_name && + issuer == o.issuer && + audience == o.audience && + subject == o.subject && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [provider_id, provider_name, issuer, audience, subject, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + 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/oauth_provider_params.rb b/turnkey_client/lib/turnkey_client/models/oauth_provider_params.rb new file mode 100644 index 0000000..26c60b3 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/oauth_provider_params.rb @@ -0,0 +1,226 @@ +=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 OauthProviderParams + # Human-readable name to identify a Provider. + attr_accessor :provider_name + + # Base64 encoded OIDC token + attr_accessor :oidc_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'provider_name' => :'providerName', + :'oidc_token' => :'oidcToken' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'provider_name' => :'Object', + :'oidc_token' => :'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::OauthProviderParams` 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::OauthProviderParams`. 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?(:'provider_name') + self.provider_name = attributes[:'provider_name'] + end + + if attributes.key?(:'oidc_token') + self.oidc_token = attributes[:'oidc_token'] + 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 @provider_name.nil? + invalid_properties.push('invalid value for "provider_name", provider_name cannot be nil.') + end + + if @oidc_token.nil? + invalid_properties.push('invalid value for "oidc_token", oidc_token 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 @provider_name.nil? + return false if @oidc_token.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 && + provider_name == o.provider_name && + oidc_token == o.oidc_token + 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 + [provider_name, oidc_token].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/oauth_request.rb b/turnkey_client/lib/turnkey_client/models/oauth_request.rb new file mode 100644 index 0000000..ab9bbad --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/oauth_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 OauthRequest + 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::OauthRequest` 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::OauthRequest`. 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_OAUTH']) + 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_OAUTH']) + 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/oauth_result.rb b/turnkey_client/lib/turnkey_client/models/oauth_result.rb new file mode 100644 index 0000000..e9a1597 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/oauth_result.rb @@ -0,0 +1,241 @@ +=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 OauthResult + # Unique identifier for the authenticating User. + attr_accessor :user_id + + # Unique identifier for the created API key. + attr_accessor :api_key_id + + # HPKE encrypted credential bundle + attr_accessor :credential_bundle + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'api_key_id' => :'apiKeyId', + :'credential_bundle' => :'credentialBundle' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'Object', + :'api_key_id' => :'Object', + :'credential_bundle' => :'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::OauthResult` 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::OauthResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'api_key_id') + self.api_key_id = attributes[:'api_key_id'] + end + + if attributes.key?(:'credential_bundle') + self.credential_bundle = attributes[:'credential_bundle'] + 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 @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @api_key_id.nil? + invalid_properties.push('invalid value for "api_key_id", api_key_id cannot be nil.') + end + + if @credential_bundle.nil? + invalid_properties.push('invalid value for "credential_bundle", credential_bundle 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 @user_id.nil? + return false if @api_key_id.nil? + return false if @credential_bundle.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + api_key_id == o.api_key_id && + credential_bundle == o.credential_bundle + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, api_key_id, credential_bundle].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/result.rb b/turnkey_client/lib/turnkey_client/models/result.rb index e2faaa9..bd57732 100644 --- a/turnkey_client/lib/turnkey_client/models/result.rb +++ b/turnkey_client/lib/turnkey_client/models/result.rb @@ -116,6 +116,18 @@ class Result attr_accessor :create_read_only_session_result + attr_accessor :create_oauth_providers_result + + attr_accessor :delete_oauth_providers_result + + attr_accessor :create_sub_organization_result_v5 + + attr_accessor :oauth_result + + attr_accessor :create_read_write_session_result + + attr_accessor :create_sub_organization_result_v6 + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -170,7 +182,13 @@ def self.attribute_map :'import_private_key_result' => :'importPrivateKeyResult', :'create_policies_result' => :'createPoliciesResult', :'sign_raw_payloads_result' => :'signRawPayloadsResult', - :'create_read_only_session_result' => :'createReadOnlySessionResult' + :'create_read_only_session_result' => :'createReadOnlySessionResult', + :'create_oauth_providers_result' => :'createOauthProvidersResult', + :'delete_oauth_providers_result' => :'deleteOauthProvidersResult', + :'create_sub_organization_result_v5' => :'createSubOrganizationResultV5', + :'oauth_result' => :'oauthResult', + :'create_read_write_session_result' => :'createReadWriteSessionResult', + :'create_sub_organization_result_v6' => :'createSubOrganizationResultV6' } end @@ -228,7 +246,13 @@ def self.openapi_types :'import_private_key_result' => :'Object', :'create_policies_result' => :'Object', :'sign_raw_payloads_result' => :'Object', - :'create_read_only_session_result' => :'Object' + :'create_read_only_session_result' => :'Object', + :'create_oauth_providers_result' => :'Object', + :'delete_oauth_providers_result' => :'Object', + :'create_sub_organization_result_v5' => :'Object', + :'oauth_result' => :'Object', + :'create_read_write_session_result' => :'Object', + :'create_sub_organization_result_v6' => :'Object' } end @@ -460,6 +484,30 @@ def initialize(attributes = {}) if attributes.key?(:'create_read_only_session_result') self.create_read_only_session_result = attributes[:'create_read_only_session_result'] end + + if attributes.key?(:'create_oauth_providers_result') + self.create_oauth_providers_result = attributes[:'create_oauth_providers_result'] + end + + if attributes.key?(:'delete_oauth_providers_result') + self.delete_oauth_providers_result = attributes[:'delete_oauth_providers_result'] + end + + if attributes.key?(:'create_sub_organization_result_v5') + self.create_sub_organization_result_v5 = attributes[:'create_sub_organization_result_v5'] + end + + if attributes.key?(:'oauth_result') + self.oauth_result = attributes[:'oauth_result'] + end + + if attributes.key?(:'create_read_write_session_result') + self.create_read_write_session_result = attributes[:'create_read_write_session_result'] + end + + if attributes.key?(:'create_sub_organization_result_v6') + self.create_sub_organization_result_v6 = attributes[:'create_sub_organization_result_v6'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -531,7 +579,13 @@ def ==(o) 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 && - create_read_only_session_result == o.create_read_only_session_result + create_read_only_session_result == o.create_read_only_session_result && + create_oauth_providers_result == o.create_oauth_providers_result && + delete_oauth_providers_result == o.delete_oauth_providers_result && + create_sub_organization_result_v5 == o.create_sub_organization_result_v5 && + oauth_result == o.oauth_result && + create_read_write_session_result == o.create_read_write_session_result && + create_sub_organization_result_v6 == o.create_sub_organization_result_v6 end # @see the `==` method @@ -543,7 +597,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, create_policies_result, sign_raw_payloads_result, create_read_only_session_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, create_read_only_session_result, create_oauth_providers_result, delete_oauth_providers_result, create_sub_organization_result_v5, oauth_result, create_read_write_session_result, create_sub_organization_result_v6].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/root_user_params_v2.rb b/turnkey_client/lib/turnkey_client/models/root_user_params_v2.rb new file mode 100644 index 0000000..0e9c819 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/root_user_params_v2.rb @@ -0,0 +1,272 @@ +=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 RootUserParamsV2 + # Human-readable name for a User. + attr_accessor :user_name + + # The user's email address. + attr_accessor :user_email + + # A list of API Key parameters. + attr_accessor :api_keys + + # A list of Authenticator parameters. + attr_accessor :authenticators + + # A list of Oauth providers. + attr_accessor :oauth_providers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_name' => :'userName', + :'user_email' => :'userEmail', + :'api_keys' => :'apiKeys', + :'authenticators' => :'authenticators', + :'oauth_providers' => :'oauthProviders' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_name' => :'Object', + :'user_email' => :'Object', + :'api_keys' => :'Object', + :'authenticators' => :'Object', + :'oauth_providers' => :'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::RootUserParamsV2` 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::RootUserParamsV2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_name') + self.user_name = attributes[:'user_name'] + end + + if attributes.key?(:'user_email') + self.user_email = attributes[:'user_email'] + end + + if attributes.key?(:'api_keys') + if (value = attributes[:'api_keys']).is_a?(Array) + self.api_keys = value + end + end + + if attributes.key?(:'authenticators') + if (value = attributes[:'authenticators']).is_a?(Array) + self.authenticators = value + end + end + + if attributes.key?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = 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 @user_name.nil? + invalid_properties.push('invalid value for "user_name", user_name cannot be nil.') + end + + if @api_keys.nil? + invalid_properties.push('invalid value for "api_keys", api_keys cannot be nil.') + end + + if @authenticators.nil? + invalid_properties.push('invalid value for "authenticators", authenticators cannot be nil.') + end + + if @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers 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 @user_name.nil? + return false if @api_keys.nil? + return false if @authenticators.nil? + return false if @oauth_providers.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_name == o.user_name && + user_email == o.user_email && + api_keys == o.api_keys && + authenticators == o.authenticators && + oauth_providers == o.oauth_providers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_name, user_email, api_keys, authenticators, oauth_providers].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/root_user_params_v3.rb b/turnkey_client/lib/turnkey_client/models/root_user_params_v3.rb new file mode 100644 index 0000000..f5fbf47 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/root_user_params_v3.rb @@ -0,0 +1,272 @@ +=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 RootUserParamsV3 + # Human-readable name for a User. + attr_accessor :user_name + + # The user's email address. + attr_accessor :user_email + + # A list of API Key parameters. + attr_accessor :api_keys + + # A list of Authenticator parameters. + attr_accessor :authenticators + + # A list of Oauth providers. + attr_accessor :oauth_providers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_name' => :'userName', + :'user_email' => :'userEmail', + :'api_keys' => :'apiKeys', + :'authenticators' => :'authenticators', + :'oauth_providers' => :'oauthProviders' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_name' => :'Object', + :'user_email' => :'Object', + :'api_keys' => :'Object', + :'authenticators' => :'Object', + :'oauth_providers' => :'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::RootUserParamsV3` 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::RootUserParamsV3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_name') + self.user_name = attributes[:'user_name'] + end + + if attributes.key?(:'user_email') + self.user_email = attributes[:'user_email'] + end + + if attributes.key?(:'api_keys') + if (value = attributes[:'api_keys']).is_a?(Array) + self.api_keys = value + end + end + + if attributes.key?(:'authenticators') + if (value = attributes[:'authenticators']).is_a?(Array) + self.authenticators = value + end + end + + if attributes.key?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = 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 @user_name.nil? + invalid_properties.push('invalid value for "user_name", user_name cannot be nil.') + end + + if @api_keys.nil? + invalid_properties.push('invalid value for "api_keys", api_keys cannot be nil.') + end + + if @authenticators.nil? + invalid_properties.push('invalid value for "authenticators", authenticators cannot be nil.') + end + + if @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers 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 @user_name.nil? + return false if @api_keys.nil? + return false if @authenticators.nil? + return false if @oauth_providers.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_name == o.user_name && + user_email == o.user_email && + api_keys == o.api_keys && + authenticators == o.authenticators && + oauth_providers == o.oauth_providers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_name, user_email, api_keys, authenticators, oauth_providers].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/user.rb b/turnkey_client/lib/turnkey_client/models/user.rb index f902e4c..b322f7a 100644 --- a/turnkey_client/lib/turnkey_client/models/user.rb +++ b/turnkey_client/lib/turnkey_client/models/user.rb @@ -30,6 +30,9 @@ class User # A list of User Tag IDs. attr_accessor :user_tags + # A list of Oauth Providers. + attr_accessor :oauth_providers + attr_accessor :created_at attr_accessor :updated_at @@ -43,6 +46,7 @@ def self.attribute_map :'authenticators' => :'authenticators', :'api_keys' => :'apiKeys', :'user_tags' => :'userTags', + :'oauth_providers' => :'oauthProviders', :'created_at' => :'createdAt', :'updated_at' => :'updatedAt' } @@ -57,6 +61,7 @@ def self.openapi_types :'authenticators' => :'Object', :'api_keys' => :'Object', :'user_tags' => :'Object', + :'oauth_providers' => :'Object', :'created_at' => :'Object', :'updated_at' => :'Object' } @@ -113,6 +118,12 @@ def initialize(attributes = {}) end end + if attributes.key?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = value + end + end + if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end @@ -146,6 +157,10 @@ def list_invalid_properties invalid_properties.push('invalid value for "user_tags", user_tags cannot be nil.') end + if @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers cannot be nil.') + end + if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end @@ -165,6 +180,7 @@ def valid? return false if @authenticators.nil? return false if @api_keys.nil? return false if @user_tags.nil? + return false if @oauth_providers.nil? return false if @created_at.nil? return false if @updated_at.nil? true @@ -181,6 +197,7 @@ def ==(o) authenticators == o.authenticators && api_keys == o.api_keys && user_tags == o.user_tags && + oauth_providers == o.oauth_providers && created_at == o.created_at && updated_at == o.updated_at end @@ -194,7 +211,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [user_id, user_name, user_email, authenticators, api_keys, user_tags, created_at, updated_at].hash + [user_id, user_name, user_email, authenticators, api_keys, user_tags, oauth_providers, created_at, updated_at].hash end # Builds the object from hash