From e615899d0e9c1243db7fa677f08411ef4c291bbd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 20:38:33 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../models/access_token_create_params.rb | 34 +- .../models/create_access_token_response.rb | 84 +-- lib/finch_api/models/introspection.rb | 317 +++++----- lib/finch_api/resources/access_tokens.rb | 14 +- .../models/access_token_create_params.rbi | 32 +- .../models/create_access_token_response.rbi | 105 ++-- rbi/finch_api/models/introspection.rbi | 545 ++++++++++-------- rbi/finch_api/resources/access_tokens.rbi | 10 +- .../models/access_token_create_params.rbs | 18 +- .../models/create_access_token_response.rbs | 48 +- sig/finch_api/models/introspection.rbs | 256 ++++---- sig/finch_api/resources/access_tokens.rbs | 4 +- .../finch_api/resources/access_tokens_test.rb | 15 +- test/finch_api/resources/account_test.rb | 16 +- 15 files changed, 832 insertions(+), 670 deletions(-) diff --git a/.stats.yml b/.stats.yml index 79b6214f..9d73576a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 46 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-e8b684dbd61d1724b5e516a573a952bb6906d63840e27ebda7731a2f71061aff.yml -openapi_spec_hash: 8baff9577d4e721d0494ff315da267ca +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-6d0c6a1feba5ccb895a6779cd98c2a0ae87d6394f5e98a9da51f17258c4eb297.yml +openapi_spec_hash: ac3be0c8a992103e5f467fe1bcb20a81 config_hash: 5146b12344dae76238940989dac1e8a0 diff --git a/lib/finch_api/models/access_token_create_params.rb b/lib/finch_api/models/access_token_create_params.rb index 6224b617..2dd62859 100644 --- a/lib/finch_api/models/access_token_create_params.rb +++ b/lib/finch_api/models/access_token_create_params.rb @@ -7,31 +7,39 @@ class AccessTokenCreateParams < FinchAPI::Internal::Type::BaseModel extend FinchAPI::Internal::Type::RequestParameters::Converter include FinchAPI::Internal::Type::RequestParameters - # @!attribute code + # @!attribute client_id + # The client ID for your application # # @return [String] - required :code, String + required :client_id, String - # @!attribute client_id + # @!attribute client_secret + # The client secret for your application # - # @return [String, nil] - optional :client_id, String + # @return [String] + required :client_secret, String - # @!attribute client_secret + # @!attribute code + # The authorization code received from the authorization server # - # @return [String, nil] - optional :client_secret, String + # @return [String] + required :code, String # @!attribute redirect_uri + # The redirect URI used in the authorization request (optional) # # @return [String, nil] optional :redirect_uri, String - # @!method initialize(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {}) - # @param code [String] - # @param client_id [String] - # @param client_secret [String] - # @param redirect_uri [String] + # @!method initialize(client_id:, client_secret:, code:, redirect_uri: nil, request_options: {}) + # @param client_id [String] The client ID for your application + # + # @param client_secret [String] The client secret for your application + # + # @param code [String] The authorization code received from the authorization server + # + # @param redirect_uri [String] The redirect URI used in the authorization request (optional) + # # @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/finch_api/models/create_access_token_response.rb b/lib/finch_api/models/create_access_token_response.rb index 6e2093a7..fb3e791d 100644 --- a/lib/finch_api/models/create_access_token_response.rb +++ b/lib/finch_api/models/create_access_token_response.rb @@ -5,37 +5,19 @@ module Models # @see FinchAPI::Resources::AccessTokens#create class CreateAccessTokenResponse < FinchAPI::Internal::Type::BaseModel # @!attribute access_token - # The access token for the connection. + # The access token for the connection # # @return [String] required :access_token, String - # @!attribute account_id - # @deprecated - # - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # account ID. - # - # @return [String] - required :account_id, String - # @!attribute client_type # The type of application associated with a token. # # @return [Symbol, FinchAPI::Models::CreateAccessTokenResponse::ClientType] required :client_type, enum: -> { FinchAPI::CreateAccessTokenResponse::ClientType } - # @!attribute company_id - # @deprecated - # - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # company ID. - # - # @return [String] - required :company_id, String - # @!attribute connection_id - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` # # @return [String] required :connection_id, String @@ -50,53 +32,71 @@ class CreateAccessTokenResponse < FinchAPI::Internal::Type::BaseModel required :connection_type, enum: -> { FinchAPI::CreateAccessTokenResponse::ConnectionType } # @!attribute products - # An array of the authorized products associated with the `access_token`. + # An array of the authorized products associated with the `access_token` # # @return [Array] required :products, FinchAPI::Internal::Type::ArrayOf[String] # @!attribute provider_id - # The ID of the provider associated with the `access_token`. + # The ID of the provider associated with the `access_token` # # @return [String] required :provider_id, String - # @!attribute customer_id - # The ID of your customer you provided to Finch when a connect session was created - # for this connection. + # @!attribute token_type + # The RFC 8693 token type (Finch uses `bearer` tokens) + # + # @return [String] + required :token_type, String + + # @!attribute account_id + # @deprecated + # + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # account ID # # @return [String, nil] - optional :customer_id, String, nil?: true + optional :account_id, String - # @!attribute token_type - # The RFC 8693 token type (Finch uses `bearer` tokens) + # @!attribute company_id + # @deprecated + # + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # company ID + # + # @return [String, nil] + optional :company_id, String + + # @!attribute customer_id + # The ID of your customer you provided to Finch when a connect session was created + # for this connection # # @return [String, nil] - optional :token_type, String + optional :customer_id, String, nil?: true - # @!method initialize(access_token:, account_id:, client_type:, company_id:, connection_id:, connection_type:, products:, provider_id:, customer_id: nil, token_type: nil) + # @!method initialize(access_token:, client_type:, connection_id:, connection_type:, products:, provider_id:, token_type:, account_id: nil, company_id: nil, customer_id: nil) # Some parameter documentations has been truncated, see # {FinchAPI::Models::CreateAccessTokenResponse} for more details. # - # @param access_token [String] The access token for the connection. - # - # @param account_id [String] [DEPRECATED] Use `connection_id` to identify the connection instead of this acco + # @param access_token [String] The access token for the connection # # @param client_type [Symbol, FinchAPI::Models::CreateAccessTokenResponse::ClientType] The type of application associated with a token. # - # @param company_id [String] [DEPRECATED] Use `connection_id` to identify the connection instead of this comp - # - # @param connection_id [String] The Finch UUID of the connection associated with the `access_token`. + # @param connection_id [String] The Finch UUID of the connection associated with the `access_token` # # @param connection_type [Symbol, FinchAPI::Models::CreateAccessTokenResponse::ConnectionType] The type of the connection associated with the token. # - # @param products [Array] An array of the authorized products associated with the `access_token`. - # - # @param provider_id [String] The ID of the provider associated with the `access_token`. + # @param products [Array] An array of the authorized products associated with the `access_token` # - # @param customer_id [String, nil] The ID of your customer you provided to Finch when a connect session was created + # @param provider_id [String] The ID of the provider associated with the `access_token` # # @param token_type [String] The RFC 8693 token type (Finch uses `bearer` tokens) + # + # @param account_id [String] [DEPRECATED] Use `connection_id` to identify the connection instead of this acco + # + # @param company_id [String] [DEPRECATED] Use `connection_id` to identify the connection instead of this comp + # + # @param customer_id [String, nil] The ID of your customer you provided to Finch when a connect session was created # The type of application associated with a token. # @@ -104,8 +104,8 @@ class CreateAccessTokenResponse < FinchAPI::Internal::Type::BaseModel module ClientType extend FinchAPI::Internal::Type::Enum - PRODUCTION = :production DEVELOPMENT = :development + PRODUCTION = :production SANDBOX = :sandbox # @!method self.values @@ -121,8 +121,8 @@ module ClientType module ConnectionType extend FinchAPI::Internal::Type::Enum - PROVIDER = :provider FINCH = :finch + PROVIDER = :provider # @!method self.values # @return [Array] diff --git a/lib/finch_api/models/introspection.rb b/lib/finch_api/models/introspection.rb index bd71e471..0733d8ce 100644 --- a/lib/finch_api/models/introspection.rb +++ b/lib/finch_api/models/introspection.rb @@ -5,28 +5,13 @@ module Models # @see FinchAPI::Resources::Account#introspect class Introspection < FinchAPI::Internal::Type::BaseModel # @!attribute id - # The Finch UUID of the token being introspected. + # The Finch UUID of the token being introspected # # @return [String] required :id, String - # @!attribute account_id - # @deprecated - # - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this account ID. - # - # @return [String] - required :account_id, String - - # @!attribute authentication_methods - # - # @return [Array] - required :authentication_methods, - -> { FinchAPI::Internal::Type::ArrayOf[FinchAPI::Introspection::AuthenticationMethod] } - # @!attribute client_id - # The client ID of the application associated with the `access_token`. + # The client ID of the application associated with the `access_token` # # @return [String] required :client_id, String @@ -37,17 +22,8 @@ class Introspection < FinchAPI::Internal::Type::BaseModel # @return [Symbol, FinchAPI::Models::Introspection::ClientType] required :client_type, enum: -> { FinchAPI::Introspection::ClientType } - # @!attribute company_id - # @deprecated - # - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this company ID. - # - # @return [String] - required :company_id, String - # @!attribute connection_id - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` # # @return [String] required :connection_id, String @@ -66,34 +42,70 @@ class Introspection < FinchAPI::Internal::Type::BaseModel # @return [Symbol, FinchAPI::Models::Introspection::ConnectionType] required :connection_type, enum: -> { FinchAPI::Introspection::ConnectionType } + # @!attribute products + # An array of the authorized products associated with the `access_token`. + # + # @return [Array] + required :products, FinchAPI::Internal::Type::ArrayOf[String] + + # @!attribute provider_id + # The ID of the provider associated with the `access_token`. + # + # @return [String] + required :provider_id, String + + # @!attribute account_id + # @deprecated + # + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this account ID + # + # @return [String, nil] + optional :account_id, String + + # @!attribute authentication_methods + # + # @return [Array, nil] + optional :authentication_methods, + -> { FinchAPI::Internal::Type::ArrayOf[FinchAPI::Introspection::AuthenticationMethod] } + + # @!attribute company_id + # @deprecated + # + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this company ID + # + # @return [String, nil] + optional :company_id, String + # @!attribute customer_email # The email of your customer you provided to Finch when a connect session was - # created for this connection. + # created for this connection # # @return [String, nil] - required :customer_email, String, nil?: true + optional :customer_email, String, nil?: true # @!attribute customer_id # The ID of your customer you provided to Finch when a connect session was created - # for this connection. + # for this connection # # @return [String, nil] - required :customer_id, String, nil?: true + optional :customer_id, String, nil?: true # @!attribute customer_name # The name of your customer you provided to Finch when a connect session was - # created for this connection. + # created for this connection # # @return [String, nil] - required :customer_name, String, nil?: true + optional :customer_name, String, nil?: true # @!attribute manual # Whether the connection associated with the `access_token` uses the Assisted # Connect Flow. (`true` if using Assisted Connect, `false` if connection is # automated) # - # @return [Boolean] - required :manual, FinchAPI::Internal::Type::Boolean + # @return [Boolean, nil] + optional :manual, FinchAPI::Internal::Type::Boolean # @!attribute payroll_provider_id # @deprecated @@ -101,49 +113,41 @@ class Introspection < FinchAPI::Internal::Type::BaseModel # [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll # provider ID. # - # @return [String] - required :payroll_provider_id, String - - # @!attribute products - # An array of the authorized products associated with the `access_token`. - # - # @return [Array] - required :products, FinchAPI::Internal::Type::ArrayOf[String] - - # @!attribute provider_id - # The ID of the provider associated with the `access_token`. - # - # @return [String] - required :provider_id, String + # @return [String, nil] + optional :payroll_provider_id, String # @!attribute username # The account username used for login associated with the `access_token`. # - # @return [String] - required :username, String + # @return [String, nil] + optional :username, String, nil?: true - # @!method initialize(id:, account_id:, authentication_methods:, client_id:, client_type:, company_id:, connection_id:, connection_status:, connection_type:, customer_email:, customer_id:, customer_name:, manual:, payroll_provider_id:, products:, provider_id:, username:) + # @!method initialize(id:, client_id:, client_type:, connection_id:, connection_status:, connection_type:, products:, provider_id:, account_id: nil, authentication_methods: nil, company_id: nil, customer_email: nil, customer_id: nil, customer_name: nil, manual: nil, payroll_provider_id: nil, username: nil) # Some parameter documentations has been truncated, see # {FinchAPI::Models::Introspection} for more details. # - # @param id [String] The Finch UUID of the token being introspected. - # - # @param account_id [String] [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection ins - # - # @param authentication_methods [Array] + # @param id [String] The Finch UUID of the token being introspected # - # @param client_id [String] The client ID of the application associated with the `access_token`. + # @param client_id [String] The client ID of the application associated with the `access_token` # # @param client_type [Symbol, FinchAPI::Models::Introspection::ClientType] The type of application associated with a token. # - # @param company_id [String] [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection ins - # - # @param connection_id [String] The Finch UUID of the connection associated with the `access_token`. + # @param connection_id [String] The Finch UUID of the connection associated with the `access_token` # # @param connection_status [FinchAPI::Models::Introspection::ConnectionStatus] # # @param connection_type [Symbol, FinchAPI::Models::Introspection::ConnectionType] The type of the connection associated with the token. # + # @param products [Array] An array of the authorized products associated with the `access_token`. + # + # @param provider_id [String] The ID of the provider associated with the `access_token`. + # + # @param account_id [String] [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection ins + # + # @param authentication_methods [Array] + # + # @param company_id [String] [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection ins + # # @param customer_email [String, nil] The email of your customer you provided to Finch when a connect session was crea # # @param customer_id [String, nil] The ID of your customer you provided to Finch when a connect session was created @@ -154,70 +158,7 @@ class Introspection < FinchAPI::Internal::Type::BaseModel # # @param payroll_provider_id [String] [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll # - # @param products [Array] An array of the authorized products associated with the `access_token`. - # - # @param provider_id [String] The ID of the provider associated with the `access_token`. - # - # @param username [String] The account username used for login associated with the `access_token`. - - class AuthenticationMethod < FinchAPI::Internal::Type::BaseModel - # @!attribute connection_status - # - # @return [FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus, nil] - optional :connection_status, -> { FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus } - - # @!attribute products - # An array of the authorized products associated with the `access_token`. - # - # @return [Array, nil] - optional :products, FinchAPI::Internal::Type::ArrayOf[String] - - # @!attribute type - # The type of authentication method. - # - # @return [Symbol, FinchAPI::Models::Introspection::AuthenticationMethod::Type, nil] - optional :type, enum: -> { FinchAPI::Introspection::AuthenticationMethod::Type } - - # @!method initialize(connection_status: nil, products: nil, type: nil) - # @param connection_status [FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus] - # - # @param products [Array] An array of the authorized products associated with the `access_token`. - # - # @param type [Symbol, FinchAPI::Models::Introspection::AuthenticationMethod::Type] The type of authentication method. - - # @see FinchAPI::Models::Introspection::AuthenticationMethod#connection_status - class ConnectionStatus < FinchAPI::Internal::Type::BaseModel - # @!attribute message - # - # @return [String, nil] - optional :message, String - - # @!attribute status - # - # @return [Symbol, FinchAPI::Models::ConnectionStatusType, nil] - optional :status, enum: -> { FinchAPI::ConnectionStatusType } - - # @!method initialize(message: nil, status: nil) - # @param message [String] - # @param status [Symbol, FinchAPI::Models::ConnectionStatusType] - end - - # The type of authentication method. - # - # @see FinchAPI::Models::Introspection::AuthenticationMethod#type - module Type - extend FinchAPI::Internal::Type::Enum - - ASSISTED = :assisted - CREDENTIAL = :credential - API_TOKEN = :api_token - API_CREDENTIAL = :api_credential - OAUTH = :oauth - - # @!method self.values - # @return [Array] - end - end + # @param username [String, nil] The account username used for login associated with the `access_token`. # The type of application associated with a token. # @@ -225,8 +166,8 @@ module Type module ClientType extend FinchAPI::Internal::Type::Enum - PRODUCTION = :production DEVELOPMENT = :development + PRODUCTION = :production SANDBOX = :sandbox # @!method self.values @@ -235,28 +176,44 @@ module ClientType # @see FinchAPI::Models::Introspection#connection_status class ConnectionStatus < FinchAPI::Internal::Type::BaseModel + # @!attribute status + # + # @return [Symbol, FinchAPI::Models::ConnectionStatusType] + required :status, enum: -> { FinchAPI::ConnectionStatusType } + # @!attribute last_successful_sync - # The datetime when the connection was last successfully synced. + # The datetime when the connection was last successfully synced # - # @return [Time, nil] - optional :last_successful_sync, Time + # @return [Time, String, nil] + optional :last_successful_sync, + union: -> { FinchAPI::Introspection::ConnectionStatus::LastSuccessfulSync }, + nil?: true # @!attribute message # # @return [String, nil] optional :message, String - # @!attribute status + # @!method initialize(status:, last_successful_sync: nil, message: nil) + # @param status [Symbol, FinchAPI::Models::ConnectionStatusType] # - # @return [Symbol, FinchAPI::Models::ConnectionStatusType, nil] - optional :status, enum: -> { FinchAPI::ConnectionStatusType } - - # @!method initialize(last_successful_sync: nil, message: nil, status: nil) - # @param last_successful_sync [Time] The datetime when the connection was last successfully synced. + # @param last_successful_sync [Time, String, nil] The datetime when the connection was last successfully synced # # @param message [String] + + # The datetime when the connection was last successfully synced # - # @param status [Symbol, FinchAPI::Models::ConnectionStatusType] + # @see FinchAPI::Models::Introspection::ConnectionStatus#last_successful_sync + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union + + variant Time + + variant String + + # @!method self.variants + # @return [Array(Time, String)] + end end # The type of the connection associated with the token. @@ -268,12 +225,98 @@ class ConnectionStatus < FinchAPI::Internal::Type::BaseModel module ConnectionType extend FinchAPI::Internal::Type::Enum - PROVIDER = :provider FINCH = :finch + PROVIDER = :provider # @!method self.values # @return [Array] end + + class AuthenticationMethod < FinchAPI::Internal::Type::BaseModel + # @!attribute type + # The type of authentication method + # + # @return [Symbol, FinchAPI::Models::Introspection::AuthenticationMethod::Type] + required :type, enum: -> { FinchAPI::Introspection::AuthenticationMethod::Type } + + # @!attribute connection_status + # + # @return [FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus, nil] + optional :connection_status, -> { FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus } + + # @!attribute products + # An array of the authorized products associated with the `access_token` + # + # @return [Array, nil] + optional :products, FinchAPI::Internal::Type::ArrayOf[String] + + # @!method initialize(type:, connection_status: nil, products: nil) + # @param type [Symbol, FinchAPI::Models::Introspection::AuthenticationMethod::Type] The type of authentication method + # + # @param connection_status [FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus] + # + # @param products [Array] An array of the authorized products associated with the `access_token` + + # The type of authentication method + # + # @see FinchAPI::Models::Introspection::AuthenticationMethod#type + module Type + extend FinchAPI::Internal::Type::Enum + + ASSISTED = :assisted + CREDENTIAL = :credential + API_TOKEN = :api_token + API_CREDENTIAL = :api_credential + OAUTH = :oauth + + # @!method self.values + # @return [Array] + end + + # @see FinchAPI::Models::Introspection::AuthenticationMethod#connection_status + class ConnectionStatus < FinchAPI::Internal::Type::BaseModel + # @!attribute status + # + # @return [Symbol, FinchAPI::Models::ConnectionStatusType] + required :status, enum: -> { FinchAPI::ConnectionStatusType } + + # @!attribute last_successful_sync + # The datetime when the connection was last successfully synced + # + # @return [Time, String, nil] + optional :last_successful_sync, + union: -> { + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::LastSuccessfulSync + }, + nil?: true + + # @!attribute message + # + # @return [String, nil] + optional :message, String + + # @!method initialize(status:, last_successful_sync: nil, message: nil) + # @param status [Symbol, FinchAPI::Models::ConnectionStatusType] + # + # @param last_successful_sync [Time, String, nil] The datetime when the connection was last successfully synced + # + # @param message [String] + + # The datetime when the connection was last successfully synced + # + # @see FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus#last_successful_sync + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union + + variant Time + + variant String + + # @!method self.variants + # @return [Array(Time, String)] + end + end + end end end end diff --git a/lib/finch_api/resources/access_tokens.rb b/lib/finch_api/resources/access_tokens.rb index d1d4731c..38a3cf89 100644 --- a/lib/finch_api/resources/access_tokens.rb +++ b/lib/finch_api/resources/access_tokens.rb @@ -5,12 +5,16 @@ module Resources class AccessTokens # Exchange the authorization code for an access token # - # @overload create(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {}) + # @overload create(client_id:, client_secret:, code:, redirect_uri: nil, request_options: {}) + # + # @param client_id [String] The client ID for your application + # + # @param client_secret [String] The client secret for your application + # + # @param code [String] The authorization code received from the authorization server + # + # @param redirect_uri [String] The redirect URI used in the authorization request (optional) # - # @param code [String] - # @param client_id [String] - # @param client_secret [String] - # @param redirect_uri [String] # @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [FinchAPI::Models::CreateAccessTokenResponse] diff --git a/rbi/finch_api/models/access_token_create_params.rbi b/rbi/finch_api/models/access_token_create_params.rbi index 51f5fb30..b674a4c9 100644 --- a/rbi/finch_api/models/access_token_create_params.rbi +++ b/rbi/finch_api/models/access_token_create_params.rbi @@ -11,21 +11,19 @@ module FinchAPI T.any(FinchAPI::AccessTokenCreateParams, FinchAPI::Internal::AnyHash) end + # The client ID for your application sig { returns(String) } - attr_accessor :code - - sig { returns(T.nilable(String)) } - attr_reader :client_id + attr_accessor :client_id - sig { params(client_id: String).void } - attr_writer :client_id - - sig { returns(T.nilable(String)) } - attr_reader :client_secret + # The client secret for your application + sig { returns(String) } + attr_accessor :client_secret - sig { params(client_secret: String).void } - attr_writer :client_secret + # The authorization code received from the authorization server + sig { returns(String) } + attr_accessor :code + # The redirect URI used in the authorization request (optional) sig { returns(T.nilable(String)) } attr_reader :redirect_uri @@ -34,17 +32,21 @@ module FinchAPI sig do params( - code: String, client_id: String, client_secret: String, + code: String, redirect_uri: String, request_options: FinchAPI::RequestOptions::OrHash ).returns(T.attached_class) end def self.new( + # The client ID for your application + client_id:, + # The client secret for your application + client_secret:, + # The authorization code received from the authorization server code:, - client_id: nil, - client_secret: nil, + # The redirect URI used in the authorization request (optional) redirect_uri: nil, request_options: {} ) @@ -53,9 +55,9 @@ module FinchAPI sig do override.returns( { - code: String, client_id: String, client_secret: String, + code: String, redirect_uri: String, request_options: FinchAPI::RequestOptions } diff --git a/rbi/finch_api/models/create_access_token_response.rbi b/rbi/finch_api/models/create_access_token_response.rbi index a50b7fd1..2d124a0a 100644 --- a/rbi/finch_api/models/create_access_token_response.rbi +++ b/rbi/finch_api/models/create_access_token_response.rbi @@ -11,27 +11,17 @@ module FinchAPI ) end - # The access token for the connection. + # The access token for the connection sig { returns(String) } attr_accessor :access_token - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # account ID. - sig { returns(String) } - attr_accessor :account_id - # The type of application associated with a token. sig do returns(FinchAPI::CreateAccessTokenResponse::ClientType::TaggedSymbol) end attr_accessor :client_type - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # company ID. - sig { returns(String) } - attr_accessor :company_id - - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` sig { returns(String) } attr_accessor :connection_id @@ -46,69 +36,82 @@ module FinchAPI end attr_accessor :connection_type - # An array of the authorized products associated with the `access_token`. + # An array of the authorized products associated with the `access_token` sig { returns(T::Array[String]) } attr_accessor :products - # The ID of the provider associated with the `access_token`. + # The ID of the provider associated with the `access_token` sig { returns(String) } attr_accessor :provider_id - # The ID of your customer you provided to Finch when a connect session was created - # for this connection. + # The RFC 8693 token type (Finch uses `bearer` tokens) + sig { returns(String) } + attr_accessor :token_type + + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # account ID sig { returns(T.nilable(String)) } - attr_accessor :customer_id + attr_reader :account_id - # The RFC 8693 token type (Finch uses `bearer` tokens) + sig { params(account_id: String).void } + attr_writer :account_id + + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # company ID sig { returns(T.nilable(String)) } - attr_reader :token_type + attr_reader :company_id + + sig { params(company_id: String).void } + attr_writer :company_id - sig { params(token_type: String).void } - attr_writer :token_type + # The ID of your customer you provided to Finch when a connect session was created + # for this connection + sig { returns(T.nilable(String)) } + attr_accessor :customer_id sig do params( access_token: String, - account_id: String, client_type: FinchAPI::CreateAccessTokenResponse::ClientType::OrSymbol, - company_id: String, connection_id: String, connection_type: FinchAPI::CreateAccessTokenResponse::ConnectionType::OrSymbol, products: T::Array[String], provider_id: String, - customer_id: T.nilable(String), - token_type: String + token_type: String, + account_id: String, + company_id: String, + customer_id: T.nilable(String) ).returns(T.attached_class) end def self.new( - # The access token for the connection. + # The access token for the connection access_token:, - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # account ID. - account_id:, # The type of application associated with a token. client_type:, - # [DEPRECATED] Use `connection_id` to identify the connection instead of this - # company ID. - company_id:, - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` connection_id:, # The type of the connection associated with the token. # # - `provider` - connection to an external provider # - `finch` - finch-generated data. connection_type:, - # An array of the authorized products associated with the `access_token`. + # An array of the authorized products associated with the `access_token` products:, - # The ID of the provider associated with the `access_token`. + # The ID of the provider associated with the `access_token` provider_id:, - # The ID of your customer you provided to Finch when a connect session was created - # for this connection. - customer_id: nil, # The RFC 8693 token type (Finch uses `bearer` tokens) - token_type: nil + token_type:, + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # account ID + account_id: nil, + # [DEPRECATED] Use `connection_id` to identify the connection instead of this + # company ID + company_id: nil, + # The ID of your customer you provided to Finch when a connect session was created + # for this connection + customer_id: nil ) end @@ -116,17 +119,17 @@ module FinchAPI override.returns( { access_token: String, - account_id: String, client_type: FinchAPI::CreateAccessTokenResponse::ClientType::TaggedSymbol, - company_id: String, connection_id: String, connection_type: FinchAPI::CreateAccessTokenResponse::ConnectionType::TaggedSymbol, products: T::Array[String], provider_id: String, - customer_id: T.nilable(String), - token_type: String + token_type: String, + account_id: String, + company_id: String, + customer_id: T.nilable(String) } ) end @@ -143,14 +146,14 @@ module FinchAPI end OrSymbol = T.type_alias { T.any(Symbol, String) } - PRODUCTION = + DEVELOPMENT = T.let( - :production, + :development, FinchAPI::CreateAccessTokenResponse::ClientType::TaggedSymbol ) - DEVELOPMENT = + PRODUCTION = T.let( - :development, + :production, FinchAPI::CreateAccessTokenResponse::ClientType::TaggedSymbol ) SANDBOX = @@ -183,14 +186,14 @@ module FinchAPI end OrSymbol = T.type_alias { T.any(Symbol, String) } - PROVIDER = + FINCH = T.let( - :provider, + :finch, FinchAPI::CreateAccessTokenResponse::ConnectionType::TaggedSymbol ) - FINCH = + PROVIDER = T.let( - :finch, + :provider, FinchAPI::CreateAccessTokenResponse::ConnectionType::TaggedSymbol ) diff --git a/rbi/finch_api/models/introspection.rbi b/rbi/finch_api/models/introspection.rbi index 2249bd9d..336784b3 100644 --- a/rbi/finch_api/models/introspection.rbi +++ b/rbi/finch_api/models/introspection.rbi @@ -8,19 +8,11 @@ module FinchAPI T.any(FinchAPI::Introspection, FinchAPI::Internal::AnyHash) end - # The Finch UUID of the token being introspected. + # The Finch UUID of the token being introspected sig { returns(String) } attr_accessor :id - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this account ID. - sig { returns(String) } - attr_accessor :account_id - - sig { returns(T::Array[FinchAPI::Introspection::AuthenticationMethod]) } - attr_accessor :authentication_methods - - # The client ID of the application associated with the `access_token`. + # The client ID of the application associated with the `access_token` sig { returns(String) } attr_accessor :client_id @@ -28,12 +20,7 @@ module FinchAPI sig { returns(FinchAPI::Introspection::ClientType::TaggedSymbol) } attr_accessor :client_type - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this company ID. - sig { returns(String) } - attr_accessor :company_id - - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` sig { returns(String) } attr_accessor :connection_id @@ -54,81 +41,111 @@ module FinchAPI sig { returns(FinchAPI::Introspection::ConnectionType::TaggedSymbol) } attr_accessor :connection_type + # An array of the authorized products associated with the `access_token`. + sig { returns(T::Array[String]) } + attr_accessor :products + + # The ID of the provider associated with the `access_token`. + sig { returns(String) } + attr_accessor :provider_id + + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this account ID + sig { returns(T.nilable(String)) } + attr_reader :account_id + + sig { params(account_id: String).void } + attr_writer :account_id + + sig do + returns( + T.nilable(T::Array[FinchAPI::Introspection::AuthenticationMethod]) + ) + end + attr_reader :authentication_methods + + sig do + params( + authentication_methods: + T::Array[FinchAPI::Introspection::AuthenticationMethod::OrHash] + ).void + end + attr_writer :authentication_methods + + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this company ID + sig { returns(T.nilable(String)) } + attr_reader :company_id + + sig { params(company_id: String).void } + attr_writer :company_id + # The email of your customer you provided to Finch when a connect session was - # created for this connection. + # created for this connection sig { returns(T.nilable(String)) } attr_accessor :customer_email # The ID of your customer you provided to Finch when a connect session was created - # for this connection. + # for this connection sig { returns(T.nilable(String)) } attr_accessor :customer_id # The name of your customer you provided to Finch when a connect session was - # created for this connection. + # created for this connection sig { returns(T.nilable(String)) } attr_accessor :customer_name # Whether the connection associated with the `access_token` uses the Assisted # Connect Flow. (`true` if using Assisted Connect, `false` if connection is # automated) - sig { returns(T::Boolean) } - attr_accessor :manual + sig { returns(T.nilable(T::Boolean)) } + attr_reader :manual + + sig { params(manual: T::Boolean).void } + attr_writer :manual # [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll # provider ID. - sig { returns(String) } - attr_accessor :payroll_provider_id + sig { returns(T.nilable(String)) } + attr_reader :payroll_provider_id - # An array of the authorized products associated with the `access_token`. - sig { returns(T::Array[String]) } - attr_accessor :products - - # The ID of the provider associated with the `access_token`. - sig { returns(String) } - attr_accessor :provider_id + sig { params(payroll_provider_id: String).void } + attr_writer :payroll_provider_id # The account username used for login associated with the `access_token`. - sig { returns(String) } + sig { returns(T.nilable(String)) } attr_accessor :username sig do params( id: String, - account_id: String, - authentication_methods: - T::Array[FinchAPI::Introspection::AuthenticationMethod::OrHash], client_id: String, client_type: FinchAPI::Introspection::ClientType::OrSymbol, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus::OrHash, connection_type: FinchAPI::Introspection::ConnectionType::OrSymbol, + products: T::Array[String], + provider_id: String, + account_id: String, + authentication_methods: + T::Array[FinchAPI::Introspection::AuthenticationMethod::OrHash], + company_id: String, customer_email: T.nilable(String), customer_id: T.nilable(String), customer_name: T.nilable(String), manual: T::Boolean, payroll_provider_id: String, - products: T::Array[String], - provider_id: String, - username: String + username: T.nilable(String) ).returns(T.attached_class) end def self.new( - # The Finch UUID of the token being introspected. + # The Finch UUID of the token being introspected id:, - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this account ID. - account_id:, - authentication_methods:, - # The client ID of the application associated with the `access_token`. + # The client ID of the application associated with the `access_token` client_id:, # The type of application associated with a token. client_type:, - # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - # instead of this company ID. - company_id:, - # The Finch UUID of the connection associated with the `access_token`. + # The Finch UUID of the connection associated with the `access_token` connection_id:, connection_status:, # The type of the connection associated with the token. @@ -136,28 +153,35 @@ module FinchAPI # - `provider` - connection to an external provider # - `finch` - finch-generated data. connection_type:, + # An array of the authorized products associated with the `access_token`. + products:, + # The ID of the provider associated with the `access_token`. + provider_id:, + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this account ID + account_id: nil, + authentication_methods: nil, + # [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + # instead of this company ID + company_id: nil, # The email of your customer you provided to Finch when a connect session was - # created for this connection. - customer_email:, + # created for this connection + customer_email: nil, # The ID of your customer you provided to Finch when a connect session was created - # for this connection. - customer_id:, + # for this connection + customer_id: nil, # The name of your customer you provided to Finch when a connect session was - # created for this connection. - customer_name:, + # created for this connection + customer_name: nil, # Whether the connection associated with the `access_token` uses the Assisted # Connect Flow. (`true` if using Assisted Connect, `false` if connection is # automated) - manual:, + manual: nil, # [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll # provider ID. - payroll_provider_id:, - # An array of the authorized products associated with the `access_token`. - products:, - # The ID of the provider associated with the `access_token`. - provider_id:, + payroll_provider_id: nil, # The account username used for login associated with the `access_token`. - username: + username: nil ) end @@ -165,156 +189,236 @@ module FinchAPI override.returns( { id: String, - account_id: String, - authentication_methods: - T::Array[FinchAPI::Introspection::AuthenticationMethod], client_id: String, client_type: FinchAPI::Introspection::ClientType::TaggedSymbol, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus, connection_type: FinchAPI::Introspection::ConnectionType::TaggedSymbol, + products: T::Array[String], + provider_id: String, + account_id: String, + authentication_methods: + T::Array[FinchAPI::Introspection::AuthenticationMethod], + company_id: String, customer_email: T.nilable(String), customer_id: T.nilable(String), customer_name: T.nilable(String), manual: T::Boolean, payroll_provider_id: String, - products: T::Array[String], - provider_id: String, - username: String + username: T.nilable(String) } ) end def to_hash end - class AuthenticationMethod < FinchAPI::Internal::Type::BaseModel + # The type of application associated with a token. + module ClientType + extend FinchAPI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, FinchAPI::Introspection::ClientType) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DEVELOPMENT = + T.let(:development, FinchAPI::Introspection::ClientType::TaggedSymbol) + PRODUCTION = + T.let(:production, FinchAPI::Introspection::ClientType::TaggedSymbol) + SANDBOX = + T.let(:sandbox, FinchAPI::Introspection::ClientType::TaggedSymbol) + + sig do + override.returns( + T::Array[FinchAPI::Introspection::ClientType::TaggedSymbol] + ) + end + def self.values + end + end + + class ConnectionStatus < FinchAPI::Internal::Type::BaseModel OrHash = T.type_alias do T.any( - FinchAPI::Introspection::AuthenticationMethod, + FinchAPI::Introspection::ConnectionStatus, FinchAPI::Internal::AnyHash ) end + sig { returns(FinchAPI::ConnectionStatusType::TaggedSymbol) } + attr_accessor :status + + # The datetime when the connection was last successfully synced sig do returns( T.nilable( - FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus + FinchAPI::Introspection::ConnectionStatus::LastSuccessfulSync::Variants ) ) end - attr_reader :connection_status + attr_accessor :last_successful_sync + + sig { returns(T.nilable(String)) } + attr_reader :message + + sig { params(message: String).void } + attr_writer :message sig do params( - connection_status: - FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::OrHash - ).void + status: FinchAPI::ConnectionStatusType::OrSymbol, + last_successful_sync: + T.nilable( + FinchAPI::Introspection::ConnectionStatus::LastSuccessfulSync::Variants + ), + message: String + ).returns(T.attached_class) + end + def self.new( + status:, + # The datetime when the connection was last successfully synced + last_successful_sync: nil, + message: nil + ) end - attr_writer :connection_status - # An array of the authorized products associated with the `access_token`. - sig { returns(T.nilable(T::Array[String])) } - attr_reader :products + sig do + override.returns( + { + status: FinchAPI::ConnectionStatusType::TaggedSymbol, + last_successful_sync: + T.nilable( + FinchAPI::Introspection::ConnectionStatus::LastSuccessfulSync::Variants + ), + message: String + } + ) + end + def to_hash + end - sig { params(products: T::Array[String]).void } - attr_writer :products + # The datetime when the connection was last successfully synced + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union + + Variants = T.type_alias { T.any(Time, String) } + + sig do + override.returns( + T::Array[ + FinchAPI::Introspection::ConnectionStatus::LastSuccessfulSync::Variants + ] + ) + end + def self.variants + end + end + end + + # The type of the connection associated with the token. + # + # - `provider` - connection to an external provider + # - `finch` - finch-generated data. + module ConnectionType + extend FinchAPI::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, FinchAPI::Introspection::ConnectionType) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FINCH = + T.let(:finch, FinchAPI::Introspection::ConnectionType::TaggedSymbol) + PROVIDER = + T.let( + :provider, + FinchAPI::Introspection::ConnectionType::TaggedSymbol + ) + + sig do + override.returns( + T::Array[FinchAPI::Introspection::ConnectionType::TaggedSymbol] + ) + end + def self.values + end + end + + class AuthenticationMethod < FinchAPI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + FinchAPI::Introspection::AuthenticationMethod, + FinchAPI::Internal::AnyHash + ) + end + + # The type of authentication method + sig do + returns( + FinchAPI::Introspection::AuthenticationMethod::Type::TaggedSymbol + ) + end + attr_accessor :type - # The type of authentication method. sig do returns( T.nilable( - FinchAPI::Introspection::AuthenticationMethod::Type::TaggedSymbol + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus ) ) end - attr_reader :type + attr_reader :connection_status sig do params( - type: FinchAPI::Introspection::AuthenticationMethod::Type::OrSymbol + connection_status: + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::OrHash ).void end - attr_writer :type + attr_writer :connection_status + + # An array of the authorized products associated with the `access_token` + sig { returns(T.nilable(T::Array[String])) } + attr_reader :products + + sig { params(products: T::Array[String]).void } + attr_writer :products sig do params( + type: FinchAPI::Introspection::AuthenticationMethod::Type::OrSymbol, connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::OrHash, - products: T::Array[String], - type: FinchAPI::Introspection::AuthenticationMethod::Type::OrSymbol + products: T::Array[String] ).returns(T.attached_class) end def self.new( + # The type of authentication method + type:, connection_status: nil, - # An array of the authorized products associated with the `access_token`. - products: nil, - # The type of authentication method. - type: nil + # An array of the authorized products associated with the `access_token` + products: nil ) end sig do override.returns( { + type: + FinchAPI::Introspection::AuthenticationMethod::Type::TaggedSymbol, connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, - products: T::Array[String], - type: - FinchAPI::Introspection::AuthenticationMethod::Type::TaggedSymbol + products: T::Array[String] } ) end def to_hash end - class ConnectionStatus < FinchAPI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, - FinchAPI::Internal::AnyHash - ) - end - - sig { returns(T.nilable(String)) } - attr_reader :message - - sig { params(message: String).void } - attr_writer :message - - sig do - returns(T.nilable(FinchAPI::ConnectionStatusType::TaggedSymbol)) - end - attr_reader :status - - sig { params(status: FinchAPI::ConnectionStatusType::OrSymbol).void } - attr_writer :status - - sig do - params( - message: String, - status: FinchAPI::ConnectionStatusType::OrSymbol - ).returns(T.attached_class) - end - def self.new(message: nil, status: nil) - end - - sig do - override.returns( - { - message: String, - status: FinchAPI::ConnectionStatusType::TaggedSymbol - } - ) - end - def to_hash - end - end - - # The type of authentication method. + # The type of authentication method module Type extend FinchAPI::Internal::Type::Enum @@ -360,115 +464,84 @@ module FinchAPI def self.values end end - end - - # The type of application associated with a token. - module ClientType - extend FinchAPI::Internal::Type::Enum - TaggedSymbol = - T.type_alias { T.all(Symbol, FinchAPI::Introspection::ClientType) } - OrSymbol = T.type_alias { T.any(Symbol, String) } - - PRODUCTION = - T.let(:production, FinchAPI::Introspection::ClientType::TaggedSymbol) - DEVELOPMENT = - T.let(:development, FinchAPI::Introspection::ClientType::TaggedSymbol) - SANDBOX = - T.let(:sandbox, FinchAPI::Introspection::ClientType::TaggedSymbol) + class ConnectionStatus < FinchAPI::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, + FinchAPI::Internal::AnyHash + ) + end - sig do - override.returns( - T::Array[FinchAPI::Introspection::ClientType::TaggedSymbol] - ) - end - def self.values - end - end + sig { returns(FinchAPI::ConnectionStatusType::TaggedSymbol) } + attr_accessor :status - class ConnectionStatus < FinchAPI::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - FinchAPI::Introspection::ConnectionStatus, - FinchAPI::Internal::AnyHash + # The datetime when the connection was last successfully synced + sig do + returns( + T.nilable( + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::LastSuccessfulSync::Variants + ) ) end + attr_accessor :last_successful_sync - # The datetime when the connection was last successfully synced. - sig { returns(T.nilable(Time)) } - attr_reader :last_successful_sync - - sig { params(last_successful_sync: Time).void } - attr_writer :last_successful_sync - - sig { returns(T.nilable(String)) } - attr_reader :message - - sig { params(message: String).void } - attr_writer :message - - sig { returns(T.nilable(FinchAPI::ConnectionStatusType::TaggedSymbol)) } - attr_reader :status - - sig { params(status: FinchAPI::ConnectionStatusType::OrSymbol).void } - attr_writer :status + sig { returns(T.nilable(String)) } + attr_reader :message - sig do - params( - last_successful_sync: Time, - message: String, - status: FinchAPI::ConnectionStatusType::OrSymbol - ).returns(T.attached_class) - end - def self.new( - # The datetime when the connection was last successfully synced. - last_successful_sync: nil, - message: nil, - status: nil - ) - end + sig { params(message: String).void } + attr_writer :message - sig do - override.returns( - { - last_successful_sync: Time, - message: String, - status: FinchAPI::ConnectionStatusType::TaggedSymbol - } + sig do + params( + status: FinchAPI::ConnectionStatusType::OrSymbol, + last_successful_sync: + T.nilable( + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::LastSuccessfulSync::Variants + ), + message: String + ).returns(T.attached_class) + end + def self.new( + status:, + # The datetime when the connection was last successfully synced + last_successful_sync: nil, + message: nil ) - end - def to_hash - end - end - - # The type of the connection associated with the token. - # - # - `provider` - connection to an external provider - # - `finch` - finch-generated data. - module ConnectionType - extend FinchAPI::Internal::Type::Enum + end - TaggedSymbol = - T.type_alias do - T.all(Symbol, FinchAPI::Introspection::ConnectionType) + sig do + override.returns( + { + status: FinchAPI::ConnectionStatusType::TaggedSymbol, + last_successful_sync: + T.nilable( + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::LastSuccessfulSync::Variants + ), + message: String + } + ) + end + def to_hash end - OrSymbol = T.type_alias { T.any(Symbol, String) } - PROVIDER = - T.let( - :provider, - FinchAPI::Introspection::ConnectionType::TaggedSymbol - ) - FINCH = - T.let(:finch, FinchAPI::Introspection::ConnectionType::TaggedSymbol) + # The datetime when the connection was last successfully synced + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union - sig do - override.returns( - T::Array[FinchAPI::Introspection::ConnectionType::TaggedSymbol] - ) - end - def self.values + Variants = T.type_alias { T.any(Time, String) } + + sig do + override.returns( + T::Array[ + FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus::LastSuccessfulSync::Variants + ] + ) + end + def self.variants + end + end end end end diff --git a/rbi/finch_api/resources/access_tokens.rbi b/rbi/finch_api/resources/access_tokens.rbi index db1349d5..c04ba687 100644 --- a/rbi/finch_api/resources/access_tokens.rbi +++ b/rbi/finch_api/resources/access_tokens.rbi @@ -6,17 +6,21 @@ module FinchAPI # Exchange the authorization code for an access token sig do params( - code: String, client_id: String, client_secret: String, + code: String, redirect_uri: String, request_options: FinchAPI::RequestOptions::OrHash ).returns(FinchAPI::CreateAccessTokenResponse) end def create( + # The client ID for your application + client_id:, + # The client secret for your application + client_secret:, + # The authorization code received from the authorization server code:, - client_id: nil, - client_secret: nil, + # The redirect URI used in the authorization request (optional) redirect_uri: nil, request_options: {} ) diff --git a/sig/finch_api/models/access_token_create_params.rbs b/sig/finch_api/models/access_token_create_params.rbs index 017785ab..7bf905b7 100644 --- a/sig/finch_api/models/access_token_create_params.rbs +++ b/sig/finch_api/models/access_token_create_params.rbs @@ -2,9 +2,9 @@ module FinchAPI module Models type access_token_create_params = { - code: String, client_id: String, client_secret: String, + code: String, redirect_uri: String } & FinchAPI::Internal::Type::request_parameters @@ -13,32 +13,28 @@ module FinchAPI extend FinchAPI::Internal::Type::RequestParameters::Converter include FinchAPI::Internal::Type::RequestParameters - attr_accessor code: String - - attr_reader client_id: String? - - def client_id=: (String) -> String + attr_accessor client_id: String - attr_reader client_secret: String? + attr_accessor client_secret: String - def client_secret=: (String) -> String + attr_accessor code: String attr_reader redirect_uri: String? def redirect_uri=: (String) -> String def initialize: ( + client_id: String, + client_secret: String, code: String, - ?client_id: String, - ?client_secret: String, ?redirect_uri: String, ?request_options: FinchAPI::request_opts ) -> void def to_hash: -> { - code: String, client_id: String, client_secret: String, + code: String, redirect_uri: String, request_options: FinchAPI::RequestOptions } diff --git a/sig/finch_api/models/create_access_token_response.rbs b/sig/finch_api/models/create_access_token_response.rbs index 7722fa76..ce890088 100644 --- a/sig/finch_api/models/create_access_token_response.rbs +++ b/sig/finch_api/models/create_access_token_response.rbs @@ -3,26 +3,22 @@ module FinchAPI type create_access_token_response = { access_token: String, - account_id: String, client_type: FinchAPI::Models::CreateAccessTokenResponse::client_type, - company_id: String, connection_id: String, connection_type: FinchAPI::Models::CreateAccessTokenResponse::connection_type, products: ::Array[String], provider_id: String, - customer_id: String?, - token_type: String + token_type: String, + account_id: String, + company_id: String, + customer_id: String? } class CreateAccessTokenResponse < FinchAPI::Internal::Type::BaseModel attr_accessor access_token: String - attr_accessor account_id: String - attr_accessor client_type: FinchAPI::Models::CreateAccessTokenResponse::client_type - attr_accessor company_id: String - attr_accessor connection_id: String attr_accessor connection_type: FinchAPI::Models::CreateAccessTokenResponse::connection_type @@ -31,57 +27,63 @@ module FinchAPI attr_accessor provider_id: String - attr_accessor customer_id: String? + attr_accessor token_type: String + + attr_reader account_id: String? + + def account_id=: (String) -> String - attr_reader token_type: String? + attr_reader company_id: String? - def token_type=: (String) -> String + def company_id=: (String) -> String + + attr_accessor customer_id: String? def initialize: ( access_token: String, - account_id: String, client_type: FinchAPI::Models::CreateAccessTokenResponse::client_type, - company_id: String, connection_id: String, connection_type: FinchAPI::Models::CreateAccessTokenResponse::connection_type, products: ::Array[String], provider_id: String, - ?customer_id: String?, - ?token_type: String + token_type: String, + ?account_id: String, + ?company_id: String, + ?customer_id: String? ) -> void def to_hash: -> { access_token: String, - account_id: String, client_type: FinchAPI::Models::CreateAccessTokenResponse::client_type, - company_id: String, connection_id: String, connection_type: FinchAPI::Models::CreateAccessTokenResponse::connection_type, products: ::Array[String], provider_id: String, - customer_id: String?, - token_type: String + token_type: String, + account_id: String, + company_id: String, + customer_id: String? } - type client_type = :production | :development | :sandbox + type client_type = :development | :production | :sandbox module ClientType extend FinchAPI::Internal::Type::Enum - PRODUCTION: :production DEVELOPMENT: :development + PRODUCTION: :production SANDBOX: :sandbox def self?.values: -> ::Array[FinchAPI::Models::CreateAccessTokenResponse::client_type] end - type connection_type = :provider | :finch + type connection_type = :finch | :provider module ConnectionType extend FinchAPI::Internal::Type::Enum - PROVIDER: :provider FINCH: :finch + PROVIDER: :provider def self?.values: -> ::Array[FinchAPI::Models::CreateAccessTokenResponse::connection_type] end diff --git a/sig/finch_api/models/introspection.rbs b/sig/finch_api/models/introspection.rbs index 7085f3c2..61a6680a 100644 --- a/sig/finch_api/models/introspection.rbs +++ b/sig/finch_api/models/introspection.rbs @@ -3,107 +3,181 @@ module FinchAPI type introspection = { id: String, - account_id: String, - authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], client_id: String, client_type: FinchAPI::Models::Introspection::client_type, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus, connection_type: FinchAPI::Models::Introspection::connection_type, + products: ::Array[String], + provider_id: String, + account_id: String, + authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], + company_id: String, customer_email: String?, customer_id: String?, customer_name: String?, manual: bool, payroll_provider_id: String, - products: ::Array[String], - provider_id: String, - username: String + username: String? } class Introspection < FinchAPI::Internal::Type::BaseModel attr_accessor id: String - attr_accessor account_id: String - - attr_accessor authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod] - attr_accessor client_id: String attr_accessor client_type: FinchAPI::Models::Introspection::client_type - attr_accessor company_id: String - attr_accessor connection_id: String attr_accessor connection_status: FinchAPI::Introspection::ConnectionStatus attr_accessor connection_type: FinchAPI::Models::Introspection::connection_type + attr_accessor products: ::Array[String] + + attr_accessor provider_id: String + + attr_reader account_id: String? + + def account_id=: (String) -> String + + attr_reader authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod]? + + def authentication_methods=: ( + ::Array[FinchAPI::Introspection::AuthenticationMethod] + ) -> ::Array[FinchAPI::Introspection::AuthenticationMethod] + + attr_reader company_id: String? + + def company_id=: (String) -> String + attr_accessor customer_email: String? attr_accessor customer_id: String? attr_accessor customer_name: String? - attr_accessor manual: bool + attr_reader manual: bool? - attr_accessor payroll_provider_id: String + def manual=: (bool) -> bool - attr_accessor products: ::Array[String] + attr_reader payroll_provider_id: String? - attr_accessor provider_id: String + def payroll_provider_id=: (String) -> String - attr_accessor username: String + attr_accessor username: String? def initialize: ( id: String, - account_id: String, - authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], client_id: String, client_type: FinchAPI::Models::Introspection::client_type, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus, connection_type: FinchAPI::Models::Introspection::connection_type, - customer_email: String?, - customer_id: String?, - customer_name: String?, - manual: bool, - payroll_provider_id: String, products: ::Array[String], provider_id: String, - username: String + ?account_id: String, + ?authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], + ?company_id: String, + ?customer_email: String?, + ?customer_id: String?, + ?customer_name: String?, + ?manual: bool, + ?payroll_provider_id: String, + ?username: String? ) -> void def to_hash: -> { id: String, - account_id: String, - authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], client_id: String, client_type: FinchAPI::Models::Introspection::client_type, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus, connection_type: FinchAPI::Models::Introspection::connection_type, + products: ::Array[String], + provider_id: String, + account_id: String, + authentication_methods: ::Array[FinchAPI::Introspection::AuthenticationMethod], + company_id: String, customer_email: String?, customer_id: String?, customer_name: String?, manual: bool, payroll_provider_id: String, - products: ::Array[String], - provider_id: String, - username: String + username: String? } + type client_type = :development | :production | :sandbox + + module ClientType + extend FinchAPI::Internal::Type::Enum + + DEVELOPMENT: :development + PRODUCTION: :production + SANDBOX: :sandbox + + def self?.values: -> ::Array[FinchAPI::Models::Introspection::client_type] + end + + type connection_status = + { + status: FinchAPI::Models::connection_status_type, + last_successful_sync: FinchAPI::Models::Introspection::ConnectionStatus::last_successful_sync?, + message: String + } + + class ConnectionStatus < FinchAPI::Internal::Type::BaseModel + attr_accessor status: FinchAPI::Models::connection_status_type + + attr_accessor last_successful_sync: FinchAPI::Models::Introspection::ConnectionStatus::last_successful_sync? + + attr_reader message: String? + + def message=: (String) -> String + + def initialize: ( + status: FinchAPI::Models::connection_status_type, + ?last_successful_sync: FinchAPI::Models::Introspection::ConnectionStatus::last_successful_sync?, + ?message: String + ) -> void + + def to_hash: -> { + status: FinchAPI::Models::connection_status_type, + last_successful_sync: FinchAPI::Models::Introspection::ConnectionStatus::last_successful_sync?, + message: String + } + + type last_successful_sync = Time | String + + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union + + def self?.variants: -> ::Array[FinchAPI::Models::Introspection::ConnectionStatus::last_successful_sync] + end + end + + type connection_type = :finch | :provider + + module ConnectionType + extend FinchAPI::Internal::Type::Enum + + FINCH: :finch + PROVIDER: :provider + + def self?.values: -> ::Array[FinchAPI::Models::Introspection::connection_type] + end + type authentication_method = { + type: FinchAPI::Models::Introspection::AuthenticationMethod::type_, connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, - products: ::Array[String], - type: FinchAPI::Models::Introspection::AuthenticationMethod::type_ + products: ::Array[String] } class AuthenticationMethod < FinchAPI::Internal::Type::BaseModel + attr_accessor type: FinchAPI::Models::Introspection::AuthenticationMethod::type_ + attr_reader connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus? def connection_status=: ( @@ -114,49 +188,18 @@ module FinchAPI def products=: (::Array[String]) -> ::Array[String] - attr_reader type: FinchAPI::Models::Introspection::AuthenticationMethod::type_? - - def type=: ( - FinchAPI::Models::Introspection::AuthenticationMethod::type_ - ) -> FinchAPI::Models::Introspection::AuthenticationMethod::type_ - def initialize: ( + type: FinchAPI::Models::Introspection::AuthenticationMethod::type_, ?connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, - ?products: ::Array[String], - ?type: FinchAPI::Models::Introspection::AuthenticationMethod::type_ + ?products: ::Array[String] ) -> void def to_hash: -> { + type: FinchAPI::Models::Introspection::AuthenticationMethod::type_, connection_status: FinchAPI::Introspection::AuthenticationMethod::ConnectionStatus, - products: ::Array[String], - type: FinchAPI::Models::Introspection::AuthenticationMethod::type_ + products: ::Array[String] } - type connection_status = - { message: String, status: FinchAPI::Models::connection_status_type } - - class ConnectionStatus < FinchAPI::Internal::Type::BaseModel - attr_reader message: String? - - def message=: (String) -> String - - attr_reader status: FinchAPI::Models::connection_status_type? - - def status=: ( - FinchAPI::Models::connection_status_type - ) -> FinchAPI::Models::connection_status_type - - def initialize: ( - ?message: String, - ?status: FinchAPI::Models::connection_status_type - ) -> void - - def to_hash: -> { - message: String, - status: FinchAPI::Models::connection_status_type - } - end - type type_ = :assisted | :credential | :api_token | :api_credential | :oauth @@ -171,64 +214,43 @@ module FinchAPI def self?.values: -> ::Array[FinchAPI::Models::Introspection::AuthenticationMethod::type_] end - end - - type client_type = :production | :development | :sandbox - - module ClientType - extend FinchAPI::Internal::Type::Enum - PRODUCTION: :production - DEVELOPMENT: :development - SANDBOX: :sandbox - - def self?.values: -> ::Array[FinchAPI::Models::Introspection::client_type] - end - - type connection_status = - { - last_successful_sync: Time, - message: String, - status: FinchAPI::Models::connection_status_type - } - - class ConnectionStatus < FinchAPI::Internal::Type::BaseModel - attr_reader last_successful_sync: Time? - - def last_successful_sync=: (Time) -> Time - - attr_reader message: String? + type connection_status = + { + status: FinchAPI::Models::connection_status_type, + last_successful_sync: FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus::last_successful_sync?, + message: String + } - def message=: (String) -> String + class ConnectionStatus < FinchAPI::Internal::Type::BaseModel + attr_accessor status: FinchAPI::Models::connection_status_type - attr_reader status: FinchAPI::Models::connection_status_type? + attr_accessor last_successful_sync: FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus::last_successful_sync? - def status=: ( - FinchAPI::Models::connection_status_type - ) -> FinchAPI::Models::connection_status_type + attr_reader message: String? - def initialize: ( - ?last_successful_sync: Time, - ?message: String, - ?status: FinchAPI::Models::connection_status_type - ) -> void + def message=: (String) -> String - def to_hash: -> { - last_successful_sync: Time, - message: String, - status: FinchAPI::Models::connection_status_type - } - end + def initialize: ( + status: FinchAPI::Models::connection_status_type, + ?last_successful_sync: FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus::last_successful_sync?, + ?message: String + ) -> void - type connection_type = :provider | :finch + def to_hash: -> { + status: FinchAPI::Models::connection_status_type, + last_successful_sync: FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus::last_successful_sync?, + message: String + } - module ConnectionType - extend FinchAPI::Internal::Type::Enum + type last_successful_sync = Time | String - PROVIDER: :provider - FINCH: :finch + module LastSuccessfulSync + extend FinchAPI::Internal::Type::Union - def self?.values: -> ::Array[FinchAPI::Models::Introspection::connection_type] + def self?.variants: -> ::Array[FinchAPI::Models::Introspection::AuthenticationMethod::ConnectionStatus::last_successful_sync] + end + end end end end diff --git a/sig/finch_api/resources/access_tokens.rbs b/sig/finch_api/resources/access_tokens.rbs index a5c143c4..028f71d9 100644 --- a/sig/finch_api/resources/access_tokens.rbs +++ b/sig/finch_api/resources/access_tokens.rbs @@ -2,9 +2,9 @@ module FinchAPI module Resources class AccessTokens def create: ( + client_id: String, + client_secret: String, code: String, - ?client_id: String, - ?client_secret: String, ?redirect_uri: String, ?request_options: FinchAPI::request_opts ) -> FinchAPI::CreateAccessTokenResponse diff --git a/test/finch_api/resources/access_tokens_test.rb b/test/finch_api/resources/access_tokens_test.rb index 2f4f39e1..6507a773 100644 --- a/test/finch_api/resources/access_tokens_test.rb +++ b/test/finch_api/resources/access_tokens_test.rb @@ -4,7 +4,12 @@ class FinchAPI::Test::Resources::AccessTokensTest < FinchAPI::Test::ResourceTest def test_create_required_params - response = @finch.access_tokens.create(code: "") + response = + @finch.access_tokens.create( + client_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret: "client_secret", + code: "code" + ) assert_pattern do response => FinchAPI::CreateAccessTokenResponse @@ -13,15 +18,15 @@ def test_create_required_params assert_pattern do response => { access_token: String, - account_id: String, client_type: FinchAPI::CreateAccessTokenResponse::ClientType, - company_id: String, connection_id: String, connection_type: FinchAPI::CreateAccessTokenResponse::ConnectionType, products: ^(FinchAPI::Internal::Type::ArrayOf[String]), provider_id: String, - customer_id: String | nil, - token_type: String | nil + token_type: String, + account_id: String | nil, + company_id: String | nil, + customer_id: String | nil } end end diff --git a/test/finch_api/resources/account_test.rb b/test/finch_api/resources/account_test.rb index f3a15591..93bc1933 100644 --- a/test/finch_api/resources/account_test.rb +++ b/test/finch_api/resources/account_test.rb @@ -27,22 +27,22 @@ def test_introspect assert_pattern do response => { id: String, - account_id: String, - authentication_methods: ^(FinchAPI::Internal::Type::ArrayOf[FinchAPI::Introspection::AuthenticationMethod]), client_id: String, client_type: FinchAPI::Introspection::ClientType, - company_id: String, connection_id: String, connection_status: FinchAPI::Introspection::ConnectionStatus, connection_type: FinchAPI::Introspection::ConnectionType, + products: ^(FinchAPI::Internal::Type::ArrayOf[String]), + provider_id: String, + account_id: String | nil, + authentication_methods: ^(FinchAPI::Internal::Type::ArrayOf[FinchAPI::Introspection::AuthenticationMethod]) | nil, + company_id: String | nil, customer_email: String | nil, customer_id: String | nil, customer_name: String | nil, - manual: FinchAPI::Internal::Type::Boolean, - payroll_provider_id: String, - products: ^(FinchAPI::Internal::Type::ArrayOf[String]), - provider_id: String, - username: String + manual: FinchAPI::Internal::Type::Boolean | nil, + payroll_provider_id: String | nil, + username: String | nil } end end From 7ac79b4617d050a027b7ee692e7876d513cd766a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 20:38:55 +0000 Subject: [PATCH 2/2] release: 0.1.0-alpha.28 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/finch_api/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7657c56b..f4710698 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.27" + ".": "0.1.0-alpha.28" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7435d6ad..dff095a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.28 (2025-08-20) + +Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.27...v0.1.0-alpha.28) + +### Features + +* **api:** api update ([e615899](https://github.com/Finch-API/finch-api-ruby/commit/e615899d0e9c1243db7fa677f08411ef4c291bbd)) + ## 0.1.0-alpha.27 (2025-08-19) Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.26...v0.1.0-alpha.27) diff --git a/Gemfile.lock b/Gemfile.lock index 61c1461c..5f845b77 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - finch-api (0.1.0.pre.alpha.27) + finch-api (0.1.0.pre.alpha.28) connection_pool GEM diff --git a/README.md b/README.md index 26ffb3ae..f17517c7 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "finch-api", "~> 0.1.0.pre.alpha.27" +gem "finch-api", "~> 0.1.0.pre.alpha.28" ``` diff --git a/lib/finch_api/version.rb b/lib/finch_api/version.rb index 0ef8fdc4..9be2c98d 100644 --- a/lib/finch_api/version.rb +++ b/lib/finch_api/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module FinchAPI - VERSION = "0.1.0.pre.alpha.27" + VERSION = "0.1.0.pre.alpha.28" end