From 3aec47cb1aca54af98bce5733d32788b4a6e8a06 Mon Sep 17 00:00:00 2001 From: Chris Tran Date: Fri, 3 Jan 2025 13:15:18 -0600 Subject: [PATCH] build: add config to rename codegen models (#161) --- .rubocop.yml | 3 - .../AppleUserSocialConnection.md | 0 .../{generated => }/CreateMagicLinkRequest.md | 0 ...CreateUserRequest.md => CreateUserArgs.md} | 4 +- .../GithubUserSocialConnection.md | 0 .../GoogleUserSocialConnection.md | 0 docs/{generated => }/Link.md | 0 docs/{generated => }/ListDevicesResponse.md | 0 .../{generated => }/ListPaginatedUsersItem.md | 0 .../ListPaginatedUsersResponse.md | 0 docs/{generated => }/MagicLink.md | 0 docs/{generated => }/MagicLinkChannel.md | 0 docs/{generated => }/MagicLinkResponse.md | 0 docs/{generated => }/MagicLinkType.md | 0 docs/{generated => }/MagicLinksApi.md | 0 docs/{generated => }/Model400Error.md | 0 docs/{generated => }/Model401Error.md | 0 docs/{generated => }/Model403Error.md | 0 docs/{generated => }/Model404Error.md | 0 docs/{generated => }/Model500Error.md | 0 docs/{generated => }/Nonce.md | 0 docs/{generated => }/PaginatedLinks.md | 0 .../{generated/UserInfo.md => PassageUser.md} | 4 +- docs/{generated => }/README.md | 6 +- docs/{generated => }/SocialConnectionType.md | 0 docs/{generated => }/TokensApi.md | 0 ...UpdateUserRequest.md => UpdateUserArgs.md} | 4 +- docs/{generated => }/UserDevicesApi.md | 0 docs/{generated => }/UserEventAction.md | 0 docs/{generated => }/UserEventStatus.md | 0 docs/{generated => }/UserRecentEvent.md | 0 docs/{generated => }/UserResponse.md | 2 +- docs/{generated => }/UserSocialConnections.md | 0 docs/{generated => }/UserStatus.md | 0 docs/{generated => }/UsersApi.md | 24 +- docs/{generated => }/WebAuthnDevices.md | 0 docs/{generated => }/WebAuthnIcons.md | 0 docs/{generated => }/WebAuthnType.md | 0 docs/custom/AuthApi.md | 141 ------ docs/custom/ClientApi.md | 107 ----- docs/custom/UserApi.md | 419 ------------------ generate.sh | 9 +- lib/models/update_magic_link_auth_method.rb | 276 ------------ lib/models/update_otp_auth_method.rb | 276 ------------ lib/models/update_passkeys_auth_method.rb | 216 --------- lib/openapi_client.rb | 6 +- lib/openapi_client/api/users_api.rb | 36 +- ...te_user_request.rb => create_user_args.rb} | 6 +- .../models/{user_info.rb => passage_user.rb} | 6 +- ...te_user_request.rb => update_user_args.rb} | 6 +- lib/openapi_client/models/user_response.rb | 2 +- 51 files changed, 58 insertions(+), 1495 deletions(-) rename docs/{generated => }/AppleUserSocialConnection.md (100%) rename docs/{generated => }/CreateMagicLinkRequest.md (100%) rename docs/{generated/CreateUserRequest.md => CreateUserArgs.md} (86%) rename docs/{generated => }/GithubUserSocialConnection.md (100%) rename docs/{generated => }/GoogleUserSocialConnection.md (100%) rename docs/{generated => }/Link.md (100%) rename docs/{generated => }/ListDevicesResponse.md (100%) rename docs/{generated => }/ListPaginatedUsersItem.md (100%) rename docs/{generated => }/ListPaginatedUsersResponse.md (100%) rename docs/{generated => }/MagicLink.md (100%) rename docs/{generated => }/MagicLinkChannel.md (100%) rename docs/{generated => }/MagicLinkResponse.md (100%) rename docs/{generated => }/MagicLinkType.md (100%) rename docs/{generated => }/MagicLinksApi.md (100%) rename docs/{generated => }/Model400Error.md (100%) rename docs/{generated => }/Model401Error.md (100%) rename docs/{generated => }/Model403Error.md (100%) rename docs/{generated => }/Model404Error.md (100%) rename docs/{generated => }/Model500Error.md (100%) rename docs/{generated => }/Nonce.md (100%) rename docs/{generated => }/PaginatedLinks.md (100%) rename docs/{generated/UserInfo.md => PassageUser.md} (95%) rename docs/{generated => }/README.md (97%) rename docs/{generated => }/SocialConnectionType.md (100%) rename docs/{generated => }/TokensApi.md (100%) rename docs/{generated/UpdateUserRequest.md => UpdateUserArgs.md} (79%) rename docs/{generated => }/UserDevicesApi.md (100%) rename docs/{generated => }/UserEventAction.md (100%) rename docs/{generated => }/UserEventStatus.md (100%) rename docs/{generated => }/UserRecentEvent.md (100%) rename docs/{generated => }/UserResponse.md (80%) rename docs/{generated => }/UserSocialConnections.md (100%) rename docs/{generated => }/UserStatus.md (100%) rename docs/{generated => }/UsersApi.md (95%) rename docs/{generated => }/WebAuthnDevices.md (100%) rename docs/{generated => }/WebAuthnIcons.md (100%) rename docs/{generated => }/WebAuthnType.md (100%) delete mode 100644 docs/custom/AuthApi.md delete mode 100644 docs/custom/ClientApi.md delete mode 100644 docs/custom/UserApi.md delete mode 100644 lib/models/update_magic_link_auth_method.rb delete mode 100644 lib/models/update_otp_auth_method.rb delete mode 100644 lib/models/update_passkeys_auth_method.rb rename lib/openapi_client/models/{create_user_request.rb => create_user_args.rb} (96%) rename lib/openapi_client/models/{user_info.rb => passage_user.rb} (98%) rename lib/openapi_client/models/{update_user_request.rb => update_user_args.rb} (96%) diff --git a/.rubocop.yml b/.rubocop.yml index c553ccb..6c0bfb7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,9 +2,6 @@ AllCops: Exclude: - 'lib/openapi_client/**/*' - 'lib/openapi_client.rb' - - 'lib/models/update_magic_link_auth_method.rb' - - 'lib/models/update_otp_auth_method.rb' - - 'lib/models/update_passkeys_auth_method.rb' - 'docs/generated/*' Metrics/ClassLength: diff --git a/docs/generated/AppleUserSocialConnection.md b/docs/AppleUserSocialConnection.md similarity index 100% rename from docs/generated/AppleUserSocialConnection.md rename to docs/AppleUserSocialConnection.md diff --git a/docs/generated/CreateMagicLinkRequest.md b/docs/CreateMagicLinkRequest.md similarity index 100% rename from docs/generated/CreateMagicLinkRequest.md rename to docs/CreateMagicLinkRequest.md diff --git a/docs/generated/CreateUserRequest.md b/docs/CreateUserArgs.md similarity index 86% rename from docs/generated/CreateUserRequest.md rename to docs/CreateUserArgs.md index db020a0..353b191 100644 --- a/docs/generated/CreateUserRequest.md +++ b/docs/CreateUserArgs.md @@ -1,4 +1,4 @@ -# OpenapiClient::CreateUserRequest +# OpenapiClient::CreateUserArgs ## Properties @@ -13,7 +13,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::CreateUserRequest.new( +instance = OpenapiClient::CreateUserArgs.new( email: null, phone: null, user_metadata: null diff --git a/docs/generated/GithubUserSocialConnection.md b/docs/GithubUserSocialConnection.md similarity index 100% rename from docs/generated/GithubUserSocialConnection.md rename to docs/GithubUserSocialConnection.md diff --git a/docs/generated/GoogleUserSocialConnection.md b/docs/GoogleUserSocialConnection.md similarity index 100% rename from docs/generated/GoogleUserSocialConnection.md rename to docs/GoogleUserSocialConnection.md diff --git a/docs/generated/Link.md b/docs/Link.md similarity index 100% rename from docs/generated/Link.md rename to docs/Link.md diff --git a/docs/generated/ListDevicesResponse.md b/docs/ListDevicesResponse.md similarity index 100% rename from docs/generated/ListDevicesResponse.md rename to docs/ListDevicesResponse.md diff --git a/docs/generated/ListPaginatedUsersItem.md b/docs/ListPaginatedUsersItem.md similarity index 100% rename from docs/generated/ListPaginatedUsersItem.md rename to docs/ListPaginatedUsersItem.md diff --git a/docs/generated/ListPaginatedUsersResponse.md b/docs/ListPaginatedUsersResponse.md similarity index 100% rename from docs/generated/ListPaginatedUsersResponse.md rename to docs/ListPaginatedUsersResponse.md diff --git a/docs/generated/MagicLink.md b/docs/MagicLink.md similarity index 100% rename from docs/generated/MagicLink.md rename to docs/MagicLink.md diff --git a/docs/generated/MagicLinkChannel.md b/docs/MagicLinkChannel.md similarity index 100% rename from docs/generated/MagicLinkChannel.md rename to docs/MagicLinkChannel.md diff --git a/docs/generated/MagicLinkResponse.md b/docs/MagicLinkResponse.md similarity index 100% rename from docs/generated/MagicLinkResponse.md rename to docs/MagicLinkResponse.md diff --git a/docs/generated/MagicLinkType.md b/docs/MagicLinkType.md similarity index 100% rename from docs/generated/MagicLinkType.md rename to docs/MagicLinkType.md diff --git a/docs/generated/MagicLinksApi.md b/docs/MagicLinksApi.md similarity index 100% rename from docs/generated/MagicLinksApi.md rename to docs/MagicLinksApi.md diff --git a/docs/generated/Model400Error.md b/docs/Model400Error.md similarity index 100% rename from docs/generated/Model400Error.md rename to docs/Model400Error.md diff --git a/docs/generated/Model401Error.md b/docs/Model401Error.md similarity index 100% rename from docs/generated/Model401Error.md rename to docs/Model401Error.md diff --git a/docs/generated/Model403Error.md b/docs/Model403Error.md similarity index 100% rename from docs/generated/Model403Error.md rename to docs/Model403Error.md diff --git a/docs/generated/Model404Error.md b/docs/Model404Error.md similarity index 100% rename from docs/generated/Model404Error.md rename to docs/Model404Error.md diff --git a/docs/generated/Model500Error.md b/docs/Model500Error.md similarity index 100% rename from docs/generated/Model500Error.md rename to docs/Model500Error.md diff --git a/docs/generated/Nonce.md b/docs/Nonce.md similarity index 100% rename from docs/generated/Nonce.md rename to docs/Nonce.md diff --git a/docs/generated/PaginatedLinks.md b/docs/PaginatedLinks.md similarity index 100% rename from docs/generated/PaginatedLinks.md rename to docs/PaginatedLinks.md diff --git a/docs/generated/UserInfo.md b/docs/PassageUser.md similarity index 95% rename from docs/generated/UserInfo.md rename to docs/PassageUser.md index 73ee755..9d62410 100644 --- a/docs/generated/UserInfo.md +++ b/docs/PassageUser.md @@ -1,4 +1,4 @@ -# OpenapiClient::UserInfo +# OpenapiClient::PassageUser ## Properties @@ -27,7 +27,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::UserInfo.new( +instance = OpenapiClient::PassageUser.new( created_at: null, email: null, email_verified: null, diff --git a/docs/generated/README.md b/docs/README.md similarity index 97% rename from docs/generated/README.md rename to docs/README.md index 900208b..4211178 100644 --- a/docs/generated/README.md +++ b/docs/README.md @@ -105,7 +105,7 @@ Class | Method | HTTP request | Description - [OpenapiClient::AppleUserSocialConnection](docs/AppleUserSocialConnection.md) - [OpenapiClient::CreateMagicLinkRequest](docs/CreateMagicLinkRequest.md) - - [OpenapiClient::CreateUserRequest](docs/CreateUserRequest.md) + - [OpenapiClient::CreateUserArgs](docs/CreateUserArgs.md) - [OpenapiClient::GithubUserSocialConnection](docs/GithubUserSocialConnection.md) - [OpenapiClient::GoogleUserSocialConnection](docs/GoogleUserSocialConnection.md) - [OpenapiClient::Link](docs/Link.md) @@ -123,11 +123,11 @@ Class | Method | HTTP request | Description - [OpenapiClient::Model500Error](docs/Model500Error.md) - [OpenapiClient::Nonce](docs/Nonce.md) - [OpenapiClient::PaginatedLinks](docs/PaginatedLinks.md) + - [OpenapiClient::PassageUser](docs/PassageUser.md) - [OpenapiClient::SocialConnectionType](docs/SocialConnectionType.md) - - [OpenapiClient::UpdateUserRequest](docs/UpdateUserRequest.md) + - [OpenapiClient::UpdateUserArgs](docs/UpdateUserArgs.md) - [OpenapiClient::UserEventAction](docs/UserEventAction.md) - [OpenapiClient::UserEventStatus](docs/UserEventStatus.md) - - [OpenapiClient::UserInfo](docs/UserInfo.md) - [OpenapiClient::UserRecentEvent](docs/UserRecentEvent.md) - [OpenapiClient::UserResponse](docs/UserResponse.md) - [OpenapiClient::UserSocialConnections](docs/UserSocialConnections.md) diff --git a/docs/generated/SocialConnectionType.md b/docs/SocialConnectionType.md similarity index 100% rename from docs/generated/SocialConnectionType.md rename to docs/SocialConnectionType.md diff --git a/docs/generated/TokensApi.md b/docs/TokensApi.md similarity index 100% rename from docs/generated/TokensApi.md rename to docs/TokensApi.md diff --git a/docs/generated/UpdateUserRequest.md b/docs/UpdateUserArgs.md similarity index 79% rename from docs/generated/UpdateUserRequest.md rename to docs/UpdateUserArgs.md index 1b61fa9..90a34ae 100644 --- a/docs/generated/UpdateUserRequest.md +++ b/docs/UpdateUserArgs.md @@ -1,4 +1,4 @@ -# OpenapiClient::UpdateUserRequest +# OpenapiClient::UpdateUserArgs ## Properties @@ -13,7 +13,7 @@ ```ruby require 'openapi_client' -instance = OpenapiClient::UpdateUserRequest.new( +instance = OpenapiClient::UpdateUserArgs.new( email: null, phone: null, user_metadata: null diff --git a/docs/generated/UserDevicesApi.md b/docs/UserDevicesApi.md similarity index 100% rename from docs/generated/UserDevicesApi.md rename to docs/UserDevicesApi.md diff --git a/docs/generated/UserEventAction.md b/docs/UserEventAction.md similarity index 100% rename from docs/generated/UserEventAction.md rename to docs/UserEventAction.md diff --git a/docs/generated/UserEventStatus.md b/docs/UserEventStatus.md similarity index 100% rename from docs/generated/UserEventStatus.md rename to docs/UserEventStatus.md diff --git a/docs/generated/UserRecentEvent.md b/docs/UserRecentEvent.md similarity index 100% rename from docs/generated/UserRecentEvent.md rename to docs/UserRecentEvent.md diff --git a/docs/generated/UserResponse.md b/docs/UserResponse.md similarity index 80% rename from docs/generated/UserResponse.md rename to docs/UserResponse.md index 42a892b..fef8437 100644 --- a/docs/generated/UserResponse.md +++ b/docs/UserResponse.md @@ -4,7 +4,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **user** | [**UserInfo**](UserInfo.md) | | | +| **user** | [**PassageUser**](PassageUser.md) | | | ## Example diff --git a/docs/generated/UserSocialConnections.md b/docs/UserSocialConnections.md similarity index 100% rename from docs/generated/UserSocialConnections.md rename to docs/UserSocialConnections.md diff --git a/docs/generated/UserStatus.md b/docs/UserStatus.md similarity index 100% rename from docs/generated/UserStatus.md rename to docs/UserStatus.md diff --git a/docs/generated/UsersApi.md b/docs/UsersApi.md similarity index 95% rename from docs/generated/UsersApi.md rename to docs/UsersApi.md index 6527fa7..fe65648 100644 --- a/docs/generated/UsersApi.md +++ b/docs/UsersApi.md @@ -86,7 +86,7 @@ end ## create_user -> create_user(app_id, create_user_request) +> create_user(app_id, create_user_args) Create User @@ -105,11 +105,11 @@ end api_instance = OpenapiClient::UsersApi.new app_id = 'app_id_example' # String | App ID -create_user_request = OpenapiClient::CreateUserRequest.new # CreateUserRequest | email, phone, user_metadata +create_user_args = OpenapiClient::CreateUserArgs.new # CreateUserArgs | email, phone, user_metadata begin # Create User - result = api_instance.create_user(app_id, create_user_request) + result = api_instance.create_user(app_id, create_user_args) p result rescue OpenapiClient::ApiError => e puts "Error when calling UsersApi->create_user: #{e}" @@ -120,12 +120,12 @@ end This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> create_user_with_http_info(app_id, create_user_request) +> , Integer, Hash)> create_user_with_http_info(app_id, create_user_args) ```ruby begin # Create User - data, status_code, headers = api_instance.create_user_with_http_info(app_id, create_user_request) + data, status_code, headers = api_instance.create_user_with_http_info(app_id, create_user_args) p status_code # => 2xx p headers # => { ... } p data # => @@ -139,7 +139,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **app_id** | **String** | App ID | | -| **create_user_request** | [**CreateUserRequest**](CreateUserRequest.md) | email, phone, user_metadata | | +| **create_user_args** | [**CreateUserArgs**](CreateUserArgs.md) | email, phone, user_metadata | | ### Return type @@ -462,7 +462,7 @@ end ## update_user -> update_user(app_id, user_id, update_user_request) +> update_user(app_id, user_id, update_user_args) Update User @@ -482,11 +482,11 @@ end api_instance = OpenapiClient::UsersApi.new app_id = 'app_id_example' # String | App ID user_id = 'user_id_example' # String | User ID -update_user_request = OpenapiClient::UpdateUserRequest.new # UpdateUserRequest | user settings +update_user_args = OpenapiClient::UpdateUserArgs.new # UpdateUserArgs | user settings begin # Update User - result = api_instance.update_user(app_id, user_id, update_user_request) + result = api_instance.update_user(app_id, user_id, update_user_args) p result rescue OpenapiClient::ApiError => e puts "Error when calling UsersApi->update_user: #{e}" @@ -497,12 +497,12 @@ end This returns an Array which contains the response data, status code and headers. -> , Integer, Hash)> update_user_with_http_info(app_id, user_id, update_user_request) +> , Integer, Hash)> update_user_with_http_info(app_id, user_id, update_user_args) ```ruby begin # Update User - data, status_code, headers = api_instance.update_user_with_http_info(app_id, user_id, update_user_request) + data, status_code, headers = api_instance.update_user_with_http_info(app_id, user_id, update_user_args) p status_code # => 2xx p headers # => { ... } p data # => @@ -517,7 +517,7 @@ end | ---- | ---- | ----------- | ----- | | **app_id** | **String** | App ID | | | **user_id** | **String** | User ID | | -| **update_user_request** | [**UpdateUserRequest**](UpdateUserRequest.md) | user settings | | +| **update_user_args** | [**UpdateUserArgs**](UpdateUserArgs.md) | user settings | | ### Return type diff --git a/docs/generated/WebAuthnDevices.md b/docs/WebAuthnDevices.md similarity index 100% rename from docs/generated/WebAuthnDevices.md rename to docs/WebAuthnDevices.md diff --git a/docs/generated/WebAuthnIcons.md b/docs/WebAuthnIcons.md similarity index 100% rename from docs/generated/WebAuthnIcons.md rename to docs/WebAuthnIcons.md diff --git a/docs/generated/WebAuthnType.md b/docs/WebAuthnType.md similarity index 100% rename from docs/generated/WebAuthnType.md rename to docs/WebAuthnType.md diff --git a/docs/custom/AuthApi.md b/docs/custom/AuthApi.md deleted file mode 100644 index a65d9c5..0000000 --- a/docs/custom/AuthApi.md +++ /dev/null @@ -1,141 +0,0 @@ -# Passage::AuthApi - -All URIs are relative to *https://api.passage.id/v1* - -| Method | Description | -| ------ | ----------- | -| [**authenticate_request**](AuthApi.md#authenticate_request) | **Deprecated:** Revokes refresh tokens | -| [**revoke_user_refresh_tokens**](AuthApi.md#revoke_user_refresh_tokens) | Revokes user tokens | -| [**validate_jwt**](AuthApi.md#validate_jwt) | Validates jwt token - - ---- - -## authenticate_request (deprecated) - -> authenticate_request(request) - -Validates that request has the correct jwt token - - -### Examples - -```ruby -require 'passageidentity' - -class ApplicationController < ActionController::Base - PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - - def authorize! - begin - request.to_hash() - @user_id = Passage.auth.authenticate_request(request) - session[:psg_user_id] = @user_id - rescue Exception => e - # unauthorized - redirect_to "/unauthorized" - end - end -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **request** | **RequestObject** | request | | - -### Return type - -[**UserInfo**](UserInfo.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - - ---- - -## revoke_user_refresh_tokens() - -> revoke_user_refresh_tokens(user_id) - -Revokes user tokens - -### Examples - -```ruby -require 'passageidentity' - -class ApplicationController < ActionController::Base - PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - - def authorize! - begin - revoke = PassageClient.auth.revoke_user_refresh_tokens(USER_ID) - rescue Exception => e - # handle exception (user is not authorized) - # unauthorized - redirect_to "/unauthorized" - end - end -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **string** | user id | | - -### Return type - -boolean - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - - - ---- - -## validate_jwt - -> validate_jwt(token) - -Validates jwt token for a user - -### Examples - -```ruby -require 'passageidentity' - -class ApplicationController < ActionController::Base - PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - - def validate_passage_user! - begin - # tokens are revoked - revoke = PassageClient.auth.validate_jwt(token) - rescue Exception => e - # handle exception (user is not authorized) - end - end -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **token** | **String** | jwt token | | - -### Return type - -[**UserInfo**](UserInfo.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - diff --git a/docs/custom/ClientApi.md b/docs/custom/ClientApi.md deleted file mode 100644 index 2b6c580..0000000 --- a/docs/custom/ClientApi.md +++ /dev/null @@ -1,107 +0,0 @@ -# Passage::ClientApi - -All URIs are relative to *https://api.passage.id/v1* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -| [**get_app**](ClientApi.md#get_app) | **GET** /apps/{app_id} | Get App | -| [**create_magic_link**](ClientApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link | - - -## get_app - -> get_app() - -Get App - -Get app information. - -### Examples - -```ruby -PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - -begin - # Get App - result = PassageClient.get_app() - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling AppsApi->get_app: #{e}" -end -``` - - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **app_id** | **String** | App ID | | - -### Return type - -[**AppResponse**](AppResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - - -## create_magic_link - -> create_magic_link(create_magic_link_request) - -Create Embeddable Magic Link - -Create magic link for a user. - -### Examples - -```ruby -PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - -api_instance = PassageClient.create_magic_link() - -create_magic_link_request = OpenapiClient::create_magic_link({channel: OpenapiClient::MagicLinkChannel::EMAIL, email: 'email_example', magic_link_path: 'magic_link_path_example', phone: 'phone_example', redirect_url: 'redirect_url_example', _send: false, ttl: 37, user_id: 'user_id_example'}) # CreateMagicLinkRequest | magic link request - -begin - # Create Embeddable Magic Link - result = PassageClient.create_magic_link.create_magic_link(create_magic_link_request) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling MagicLinksApi->create_magic_link: #{e}" -end -``` - -#### Using the create_magic_link_with_http_info variant - -This returns an Array which contains the response data, status code and headers. - -> , Integer, Hash)> create_magic_link_with_http_info(app_id, create_magic_link_request) - - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **create_magic_link_request** | [**CreateMagicLinkRequest**](CreateMagicLinkRequest.md) | magic link request | | - -### Return type - -[**MagicLinkResponse**](MagicLinkResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - diff --git a/docs/custom/UserApi.md b/docs/custom/UserApi.md deleted file mode 100644 index f48f4dd..0000000 --- a/docs/custom/UserApi.md +++ /dev/null @@ -1,419 +0,0 @@ -# Passage::UsersApi - -All URIs are relative to *https://api.passage.id/v1* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -| [**activate**](UsersApi.md#activate) | **PATCH** /apps/{app_id}/users/{user_id}/activate | Activate User | -| [**create**](UsersApi.md#create) | **POST** /apps/{app_id}/users | Create User | -| [**deactivate**](UsersApi.md#deactivate) | **PATCH** /apps/{app_id}/users/{user_id}/deactivate | Deactivate User | -| [**delete**](UsersApi.md#delete) | **DELETE** /apps/{app_id}/users/{user_id} | Delete User | -| [**get**](UsersApi.md#get) | **GET** /apps/{app_id}/users/{user_id} | Get User | -| [**update**](UsersApi.md#update) | **PATCH** /apps/{app_id}/users/{user_id} | Update User | -| [**delete_device**](UsersApi.md#delete_device) | **DELETE** /apps/{app_id}/users/{user_id}/devices/{device_id} | Delete a device for a user | -| [**list_devices**](UsersApi.md#list_devices) | **GET** /apps/{app_id}/users/{user_id}/devices | List User Devices | -| [**signout**](UsersApi.md#signout) | DELETE /apps/{app_id}/users/{user_id}/tokens | **Deprecated:** Signout a user | - - -## activate - -> activate(user_id) - -Activate User - -Activate a user. They will now be able to login. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -user_id = 'user_id_example' # String | User ID - -begin - # Activate User - result = api_instance.user.activate(user_id) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->activate: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -[**UserResponse**](UserResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - -## create - -> create(create_user_request) - -Create User - -Create user for an application. Must provide an email of phone number identifier. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -create_user_request = OpenapiClient::CreateUserRequest.new # CreateUserRequest | email, phone, user_metadata - -begin - # Create User - result = api_instance.user.create(create_user_request) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->create: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **create_user_request** | [**CreateUserRequest**](CreateUserRequest.md) | email, phone, user_metadata | | - -### Return type - -[**UserResponse**](UserResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - ---- - -## deactivate - -> deactivate(user_id) - -Deactivate User - -Deactivate a user. Their account will still exist, but they will not be able to login. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -user_id = 'user_id_example' # String | User ID - -begin - # Deactivate User - result = api_instance.user.deactivate(user_id) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->deactivate: #{e}" -end -``` - - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -[**UserResponse**](UserResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - -## delete - -> delete(user_id) - -Delete User - -Delete a user. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -user_id = 'user_id_example' # String | User ID - -begin - # Delete User - api_instance.user.delete(user_id) -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->delete: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -nil (empty response body) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - -## get - -> get(user_id) - -Get User - -Get information about a user. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -user_id = 'user_id_example' # String | User ID - -begin - # Get User - result = api_instance.user.get(user_id) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->get: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -[**UserResponse**](UserResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - -## update - -> update(user_id, update_user_request) - -Update User - -Update a user's information. - -### Examples - -```ruby -api_instance = Passage::UsersApi.new -user_id = 'user_id_example' # String | User ID -update_user_request = OpenapiClient::UpdateUserRequest.new # UpdateUserRequest | user settings - -begin - # Update User - result = api_instance.user.update(user_id, update_user_request) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UsersApi->update: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | -| **update_user_request** | [**UpdateUserRequest**](UpdateUserRequest.md) | user settings | | - -### Return type - -[**UserResponse**](UserResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - ---- - -## delete_device - -> delete_device(user_id, device_id) - -Delete a device for a user - -Delete a device for a user. - -### Examples - -```ruby -api_instance = Passage::UserDevicesApi.new -user_id = 'user_id_example' # String | User ID -device_id = 'device_id_example' # String | Device ID - -begin - # Delete a device for a user - api_instance.user.delete_device(user_id, device_id) -rescue OpenapiClient::ApiError => e - puts "Error when calling UserDevicesApi->delete_device: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | -| **device_id** | **String** | Device ID | | - -### Return type - -nil (empty response body) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - - ---- - -## list_devices - -> list_devices(user_id) - -List User Devices - -List user devices. - -### Examples - -```ruby -api_instance = Passage::UserDevicesApi.new -user_id = 'user_id_example' # String | User ID - -begin - # List User Devices - result = api_instance.user.list_devices(user_id) - p result -rescue OpenapiClient::ApiError => e - puts "Error when calling UserDevicesApi->list_devices: #{e}" -end -``` - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -[**ListDevicesResponse**](ListDevicesResponse.md) - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - ---- - -## signout - -> signout(user_id) - -Revokes refresh tokens - -Revokes all refresh tokens for a user - -### Examples - -```ruby -require 'passageidentity' - -class ApplicationController < ActionController::Base - PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY) - - def revoke_passage_user_tokens! - begin - # tokens are revoked - revoke = PassageClient.auth.signout(USER_ID) - rescue Exception => e - # handle exception (user is not authorized) - end - end -end -``` - - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **user_id** | **String** | User ID | | - -### Return type - -bool - -### Authorization - -[bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json diff --git a/generate.sh b/generate.sh index e23be33..a309848 100755 --- a/generate.sh +++ b/generate.sh @@ -12,11 +12,12 @@ docker run --rm -v "${PWD}:/local" -u $(id -u) openapitools/openapi-generator-cl -i "/local/$file" \ -g ruby \ -o /local/generated \ - --additional-properties=modelPropertyNaming=original,library=faraday + --additional-properties=library=faraday \ + --model-name-mappings CreateUserRequest=CreateUserArgs,UpdateUserRequest=UpdateUserArgs,UserInfo=PassageUser -rm -rf ./docs/generated -mv ./generated/docs ./docs/generated -mv ./generated/README.md ./docs/generated +rm -rf ./docs +mv ./generated/docs ./docs +mv ./generated/README.md ./docs rm -rf ./lib/openapi_client mv ./generated/lib/openapi_client ./lib diff --git a/lib/models/update_magic_link_auth_method.rb b/lib/models/update_magic_link_auth_method.rb deleted file mode 100644 index bf82bc6..0000000 --- a/lib/models/update_magic_link_auth_method.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Passage Management API - -#Passage's management API to manage your Passage apps and users. - -The version of the OpenAPI document: 1 -Contact: support@passage.id -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.1.0 - -=end - -require 'date' -require 'time' - -module OpenapiClient - class UpdateMagicLinkAuthMethod - attr_accessor :enabled - - # Maximum time (IN SECONDS) for the auth to expire. - attr_accessor :ttl - - attr_accessor :ttl_display_unit - - 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 - { - :'enabled' => :'enabled', - :'ttl' => :'ttl', - :'ttl_display_unit' => :'ttl_display_unit' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'enabled' => :'Boolean', - :'ttl' => :'Integer', - :'ttl_display_unit' => :'TtlDisplayUnit' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateMagicLinkAuthMethod` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateMagicLinkAuthMethod`. 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?(:'enabled') - self.enabled = attributes[:'enabled'] - end - - if attributes.key?(:'ttl') - self.ttl = attributes[:'ttl'] - else - self.ttl = 300 - end - - if attributes.key?(:'ttl_display_unit') - self.ttl_display_unit = attributes[:'ttl_display_unit'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@ttl.nil? && @ttl < 60 - invalid_properties.push('invalid value for "ttl", must be greater than or equal to 60.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if !@ttl.nil? && @ttl < 60 - true - end - - # Custom attribute writer method with validation - # @param [Object] ttl Value to be assigned - def ttl=(ttl) - if ttl.nil? - fail ArgumentError, 'ttl cannot be nil' - end - - if ttl < 60 - fail ArgumentError, 'invalid value for "ttl", must be greater than or equal to 60.' - end - - @ttl = ttl - 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 && - enabled == o.enabled && - ttl == o.ttl && - ttl_display_unit == o.ttl_display_unit - 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 - [enabled, ttl, ttl_display_unit].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = OpenapiClient.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/models/update_otp_auth_method.rb b/lib/models/update_otp_auth_method.rb deleted file mode 100644 index 7e4e2b6..0000000 --- a/lib/models/update_otp_auth_method.rb +++ /dev/null @@ -1,276 +0,0 @@ -=begin -#Passage Management API - -#Passage's management API to manage your Passage apps and users. - -The version of the OpenAPI document: 1 -Contact: support@passage.id -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.1.0 - -=end - -require 'date' -require 'time' - -module OpenapiClient - class UpdateOtpAuthMethod - attr_accessor :enabled - - # Maximum time (IN SECONDS) for the auth to expire. - attr_accessor :ttl - - attr_accessor :ttl_display_unit - - 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 - { - :'enabled' => :'enabled', - :'ttl' => :'ttl', - :'ttl_display_unit' => :'ttl_display_unit' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'enabled' => :'Boolean', - :'ttl' => :'Integer', - :'ttl_display_unit' => :'TtlDisplayUnit' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateOtpAuthMethod` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateOtpAuthMethod`. 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?(:'enabled') - self.enabled = attributes[:'enabled'] - end - - if attributes.key?(:'ttl') - self.ttl = attributes[:'ttl'] - else - self.ttl = 300 - end - - if attributes.key?(:'ttl_display_unit') - self.ttl_display_unit = attributes[:'ttl_display_unit'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - if !@ttl.nil? && @ttl < 60 - invalid_properties.push('invalid value for "ttl", must be greater than or equal to 60.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - return false if !@ttl.nil? && @ttl < 60 - true - end - - # Custom attribute writer method with validation - # @param [Object] ttl Value to be assigned - def ttl=(ttl) - if ttl.nil? - fail ArgumentError, 'ttl cannot be nil' - end - - if ttl < 60 - fail ArgumentError, 'invalid value for "ttl", must be greater than or equal to 60.' - end - - @ttl = ttl - 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 && - enabled == o.enabled && - ttl == o.ttl && - ttl_display_unit == o.ttl_display_unit - 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 - [enabled, ttl, ttl_display_unit].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = OpenapiClient.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/models/update_passkeys_auth_method.rb b/lib/models/update_passkeys_auth_method.rb deleted file mode 100644 index 86d4fbc..0000000 --- a/lib/models/update_passkeys_auth_method.rb +++ /dev/null @@ -1,216 +0,0 @@ -=begin -#Passage Management API - -#Passage's management API to manage your Passage apps and users. - -The version of the OpenAPI document: 1 -Contact: support@passage.id -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 7.1.0 - -=end - -require 'date' -require 'time' - -module OpenapiClient - class UpdatePasskeysAuthMethod - attr_accessor :enabled - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'enabled' => :'enabled' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'enabled' => :'Boolean' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - ]) - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdatePasskeysAuthMethod` initialize method" - end - - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdatePasskeysAuthMethod`. 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?(:'enabled') - self.enabled = attributes[:'enabled'] - else - self.enabled = true - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - warn '[DEPRECATED] the `valid?` method is obsolete' - 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 && - enabled == o.enabled - 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 - [enabled].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - transformed_hash = {} - openapi_types.each_pair do |key, type| - if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = nil - elsif type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the attribute - # is documented as an array but the input is not - if attributes[attribute_map[key]].is_a?(Array) - transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } - end - elsif !attributes[attribute_map[key]].nil? - transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) - end - end - new(transformed_hash) - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = OpenapiClient.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) - end - - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - - end - -end diff --git a/lib/openapi_client.rb b/lib/openapi_client.rb index 249bc4b..80d993b 100644 --- a/lib/openapi_client.rb +++ b/lib/openapi_client.rb @@ -19,7 +19,7 @@ # Models require_relative 'openapi_client/models/apple_user_social_connection' require_relative 'openapi_client/models/create_magic_link_request' -require_relative 'openapi_client/models/create_user_request' +require_relative 'openapi_client/models/create_user_args' require_relative 'openapi_client/models/github_user_social_connection' require_relative 'openapi_client/models/google_user_social_connection' require_relative 'openapi_client/models/link' @@ -37,11 +37,11 @@ require_relative 'openapi_client/models/model500_error' require_relative 'openapi_client/models/nonce' require_relative 'openapi_client/models/paginated_links' +require_relative 'openapi_client/models/passage_user' require_relative 'openapi_client/models/social_connection_type' -require_relative 'openapi_client/models/update_user_request' +require_relative 'openapi_client/models/update_user_args' require_relative 'openapi_client/models/user_event_action' require_relative 'openapi_client/models/user_event_status' -require_relative 'openapi_client/models/user_info' require_relative 'openapi_client/models/user_recent_event' require_relative 'openapi_client/models/user_response' require_relative 'openapi_client/models/user_social_connections' diff --git a/lib/openapi_client/api/users_api.rb b/lib/openapi_client/api/users_api.rb index 4a21377..c11739f 100644 --- a/lib/openapi_client/api/users_api.rb +++ b/lib/openapi_client/api/users_api.rb @@ -91,21 +91,21 @@ def activate_user_with_http_info(app_id, user_id, opts = {}) # Create User # Create user for an application. Must provide an email of phone number identifier. # @param app_id [String] App ID - # @param create_user_request [CreateUserRequest] email, phone, user_metadata + # @param create_user_args [CreateUserArgs] email, phone, user_metadata # @param [Hash] opts the optional parameters # @return [UserResponse] - def create_user(app_id, create_user_request, opts = {}) - data, _status_code, _headers = create_user_with_http_info(app_id, create_user_request, opts) + def create_user(app_id, create_user_args, opts = {}) + data, _status_code, _headers = create_user_with_http_info(app_id, create_user_args, opts) data end # Create User # Create user for an application. Must provide an email of phone number identifier. # @param app_id [String] App ID - # @param create_user_request [CreateUserRequest] email, phone, user_metadata + # @param create_user_args [CreateUserArgs] email, phone, user_metadata # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers - def create_user_with_http_info(app_id, create_user_request, opts = {}) + def create_user_with_http_info(app_id, create_user_args, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.create_user ...' end @@ -113,9 +113,9 @@ def create_user_with_http_info(app_id, create_user_request, opts = {}) if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling UsersApi.create_user" end - # verify the required parameter 'create_user_request' is set - if @api_client.config.client_side_validation && create_user_request.nil? - fail ArgumentError, "Missing the required parameter 'create_user_request' when calling UsersApi.create_user" + # verify the required parameter 'create_user_args' is set + if @api_client.config.client_side_validation && create_user_args.nil? + fail ArgumentError, "Missing the required parameter 'create_user_args' when calling UsersApi.create_user" end # resource path local_var_path = '/apps/{app_id}/users'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) @@ -137,7 +137,7 @@ def create_user_with_http_info(app_id, create_user_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(create_user_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_user_args) # return_type return_type = opts[:debug_return_type] || 'UserResponse' @@ -469,11 +469,11 @@ def list_paginated_users_with_http_info(app_id, opts = {}) # Update a user's information. # @param app_id [String] App ID # @param user_id [String] User ID - # @param update_user_request [UpdateUserRequest] user settings + # @param update_user_args [UpdateUserArgs] user settings # @param [Hash] opts the optional parameters # @return [UserResponse] - def update_user(app_id, user_id, update_user_request, opts = {}) - data, _status_code, _headers = update_user_with_http_info(app_id, user_id, update_user_request, opts) + def update_user(app_id, user_id, update_user_args, opts = {}) + data, _status_code, _headers = update_user_with_http_info(app_id, user_id, update_user_args, opts) data end @@ -481,10 +481,10 @@ def update_user(app_id, user_id, update_user_request, opts = {}) # Update a user's information. # @param app_id [String] App ID # @param user_id [String] User ID - # @param update_user_request [UpdateUserRequest] user settings + # @param update_user_args [UpdateUserArgs] user settings # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers - def update_user_with_http_info(app_id, user_id, update_user_request, opts = {}) + def update_user_with_http_info(app_id, user_id, update_user_args, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UsersApi.update_user ...' end @@ -496,9 +496,9 @@ def update_user_with_http_info(app_id, user_id, update_user_request, opts = {}) if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.update_user" end - # verify the required parameter 'update_user_request' is set - if @api_client.config.client_side_validation && update_user_request.nil? - fail ArgumentError, "Missing the required parameter 'update_user_request' when calling UsersApi.update_user" + # verify the required parameter 'update_user_args' is set + if @api_client.config.client_side_validation && update_user_args.nil? + fail ArgumentError, "Missing the required parameter 'update_user_args' when calling UsersApi.update_user" end # resource path local_var_path = '/apps/{app_id}/users/{user_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)) @@ -520,7 +520,7 @@ def update_user_with_http_info(app_id, user_id, update_user_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(update_user_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_user_args) # return_type return_type = opts[:debug_return_type] || 'UserResponse' diff --git a/lib/openapi_client/models/create_user_request.rb b/lib/openapi_client/models/create_user_args.rb similarity index 96% rename from lib/openapi_client/models/create_user_request.rb rename to lib/openapi_client/models/create_user_args.rb index f974a1b..d9d1af6 100644 --- a/lib/openapi_client/models/create_user_request.rb +++ b/lib/openapi_client/models/create_user_args.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class CreateUserRequest + class CreateUserArgs # Email of the new user. Either this or `phone` is required; both may be provided. attr_accessor :email @@ -56,13 +56,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::CreateUserRequest` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::CreateUserArgs` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::CreateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::CreateUserArgs`. 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 } diff --git a/lib/openapi_client/models/user_info.rb b/lib/openapi_client/models/passage_user.rb similarity index 98% rename from lib/openapi_client/models/user_info.rb rename to lib/openapi_client/models/passage_user.rb index 2f47416..4013fab 100644 --- a/lib/openapi_client/models/user_info.rb +++ b/lib/openapi_client/models/passage_user.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class UserInfo + class PassageUser attr_accessor :created_at attr_accessor :email @@ -135,13 +135,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UserInfo` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::PassageUser` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UserInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::PassageUser`. 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 } diff --git a/lib/openapi_client/models/update_user_request.rb b/lib/openapi_client/models/update_user_args.rb similarity index 96% rename from lib/openapi_client/models/update_user_request.rb rename to lib/openapi_client/models/update_user_args.rb index f86edc6..1d0042c 100644 --- a/lib/openapi_client/models/update_user_request.rb +++ b/lib/openapi_client/models/update_user_args.rb @@ -14,7 +14,7 @@ require 'time' module OpenapiClient - class UpdateUserRequest + class UpdateUserArgs attr_accessor :email attr_accessor :phone @@ -54,13 +54,13 @@ def self.openapi_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateUserRequest` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::UpdateUserArgs` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::UpdateUserArgs`. 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 } diff --git a/lib/openapi_client/models/user_response.rb b/lib/openapi_client/models/user_response.rb index 47bb007..733a859 100644 --- a/lib/openapi_client/models/user_response.rb +++ b/lib/openapi_client/models/user_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'user' => :'UserInfo' + :'user' => :'PassageUser' } end