From 250dd7334ae72a1e6c6b1c2e4578e796aa9a87ff 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:08 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- src/finch/resources/access_tokens.py | 24 ++++- src/finch/types/access_token_create_params.py | 10 +- .../types/create_access_token_response.py | 44 ++++----- src/finch/types/introspection.py | 97 ++++++++++--------- tests/api_resources/test_access_tokens.py | 40 +++++--- 6 files changed, 127 insertions(+), 92 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/src/finch/resources/access_tokens.py b/src/finch/resources/access_tokens.py index 7806ed89..65b69b55 100644 --- a/src/finch/resources/access_tokens.py +++ b/src/finch/resources/access_tokens.py @@ -40,9 +40,9 @@ def with_streaming_response(self) -> AccessTokensWithStreamingResponse: def create( self, *, + client_id: str, + client_secret: str, code: str, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, redirect_uri: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -55,6 +55,14 @@ def create( Exchange the authorization code for an access token Args: + client_id: The client ID for your application + + client_secret: The client secret for your application + + code: The authorization code received from the authorization server + + redirect_uri: The redirect URI used in the authorization request (optional) + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -118,9 +126,9 @@ def with_streaming_response(self) -> AsyncAccessTokensWithStreamingResponse: async def create( self, *, + client_id: str, + client_secret: str, code: str, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, redirect_uri: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -133,6 +141,14 @@ async def create( Exchange the authorization code for an access token Args: + client_id: The client ID for your application + + client_secret: The client secret for your application + + code: The authorization code received from the authorization server + + redirect_uri: The redirect URI used in the authorization request (optional) + extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/finch/types/access_token_create_params.py b/src/finch/types/access_token_create_params.py index 85fcb158..410b46a7 100644 --- a/src/finch/types/access_token_create_params.py +++ b/src/finch/types/access_token_create_params.py @@ -8,10 +8,14 @@ class AccessTokenCreateParams(TypedDict, total=False): - code: Required[str] + client_id: Required[str] + """The client ID for your application""" - client_id: str + client_secret: Required[str] + """The client secret for your application""" - client_secret: str + code: Required[str] + """The authorization code received from the authorization server""" redirect_uri: str + """The redirect URI used in the authorization request (optional)""" diff --git a/src/finch/types/create_access_token_response.py b/src/finch/types/create_access_token_response.py index c443de74..beddef23 100644 --- a/src/finch/types/create_access_token_response.py +++ b/src/finch/types/create_access_token_response.py @@ -10,27 +10,15 @@ class CreateAccessTokenResponse(BaseModel): access_token: str - """The access token for the connection.""" + """The access token for the connection""" - account_id: str - """ - [DEPRECATED] Use `connection_id` to identify the connection instead of this - account ID. - """ - - client_type: Literal["production", "development", "sandbox"] + client_type: Literal["development", "production", "sandbox"] """The type of application associated with a token.""" - company_id: str - """ - [DEPRECATED] Use `connection_id` to identify the connection instead of this - company ID. - """ - connection_id: str - """The Finch UUID of the connection associated with the `access_token`.""" + """The Finch UUID of the connection associated with the `access_token`""" - connection_type: Literal["provider", "finch"] + connection_type: Literal["finch", "provider"] """The type of the connection associated with the token. - `provider` - connection to an external provider @@ -38,16 +26,28 @@ class CreateAccessTokenResponse(BaseModel): """ products: List[str] - """An array of the authorized products associated with the `access_token`.""" + """An array of the authorized products associated with the `access_token`""" provider_id: str - """The ID of the provider associated with the `access_token`.""" + """The ID of the provider associated with the `access_token`""" + + token_type: str + """The RFC 8693 token type (Finch uses `bearer` tokens)""" + + account_id: Optional[str] = None + """ + [DEPRECATED] Use `connection_id` to identify the connection instead of this + account ID + """ + + company_id: Optional[str] = None + """ + [DEPRECATED] Use `connection_id` to identify the connection instead of this + company ID + """ customer_id: Optional[str] = None """ The ID of your customer you provided to Finch when a connect session was created - for this connection. + for this connection """ - - token_type: Optional[str] = None - """The RFC 8693 token type (Finch uses `bearer` tokens)""" diff --git a/src/finch/types/introspection.py b/src/finch/types/introspection.py index 5121825a..30847577 100644 --- a/src/finch/types/introspection.py +++ b/src/finch/types/introspection.py @@ -1,112 +1,115 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List, Union, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel from .shared.connection_status_type import ConnectionStatusType -__all__ = ["Introspection", "AuthenticationMethod", "AuthenticationMethodConnectionStatus", "ConnectionStatus"] +__all__ = ["Introspection", "ConnectionStatus", "AuthenticationMethod", "AuthenticationMethodConnectionStatus"] -class AuthenticationMethodConnectionStatus(BaseModel): - message: Optional[str] = None +class ConnectionStatus(BaseModel): + status: ConnectionStatusType - status: Optional[ConnectionStatusType] = None + last_successful_sync: Union[datetime, str, None] = None + """The datetime when the connection was last successfully synced""" + message: Optional[str] = None -class AuthenticationMethod(BaseModel): - connection_status: Optional[AuthenticationMethodConnectionStatus] = None - products: Optional[List[str]] = None - """An array of the authorized products associated with the `access_token`.""" +class AuthenticationMethodConnectionStatus(BaseModel): + status: ConnectionStatusType - type: Optional[Literal["assisted", "credential", "api_token", "api_credential", "oauth"]] = None - """The type of authentication method.""" + last_successful_sync: Union[datetime, str, None] = None + """The datetime when the connection was last successfully synced""" + message: Optional[str] = None -class ConnectionStatus(BaseModel): - last_successful_sync: Optional[datetime] = None - """The datetime when the connection was last successfully synced.""" - message: Optional[str] = None +class AuthenticationMethod(BaseModel): + type: Literal["assisted", "credential", "api_token", "api_credential", "oauth"] + """The type of authentication method""" + + connection_status: Optional[AuthenticationMethodConnectionStatus] = None - status: Optional[ConnectionStatusType] = None + products: Optional[List[str]] = None + """An array of the authorized products associated with the `access_token`""" class Introspection(BaseModel): id: str - """The Finch UUID of the token being introspected.""" - - account_id: str - """ - [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - instead of this account ID. - """ - - authentication_methods: List[AuthenticationMethod] + """The Finch UUID of the token being introspected""" client_id: str - """The client ID of the application associated with the `access_token`.""" + """The client ID of the application associated with the `access_token`""" - client_type: Literal["production", "development", "sandbox"] + client_type: Literal["development", "production", "sandbox"] """The type of application associated with a token.""" - company_id: str - """ - [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection - instead of this company ID. - """ - connection_id: str - """The Finch UUID of the connection associated with the `access_token`.""" + """The Finch UUID of the connection associated with the `access_token`""" connection_status: ConnectionStatus - connection_type: Literal["provider", "finch"] + connection_type: Literal["finch", "provider"] """The type of the connection associated with the token. - `provider` - connection to an external provider - `finch` - finch-generated data. """ + products: List[str] + """An array of the authorized products associated with the `access_token`.""" + + provider_id: str + """The ID of the provider associated with the `access_token`.""" + + account_id: Optional[str] = None + """ + [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + instead of this account ID + """ + + authentication_methods: Optional[List[AuthenticationMethod]] = None + + company_id: Optional[str] = None + """ + [DEPRECATED] Use `connection_id` to associate tokens with a Finch connection + instead of this company ID + """ + customer_email: Optional[str] = None """ The email of your customer you provided to Finch when a connect session was - created for this connection. + created for this connection """ customer_id: Optional[str] = None """ The ID of your customer you provided to Finch when a connect session was created - for this connection. + for this connection """ customer_name: Optional[str] = None """ The name of your customer you provided to Finch when a connect session was - created for this connection. + created for this connection """ - manual: bool + manual: Optional[bool] = None """ Whether the connection associated with the `access_token` uses the Assisted Connect Flow. (`true` if using Assisted Connect, `false` if connection is automated) """ - payroll_provider_id: str + payroll_provider_id: Optional[str] = None """ [DEPRECATED] Use `provider_id` to identify the provider instead of this payroll provider ID. """ - products: List[str] - """An array of the authorized products associated with the `access_token`.""" - - provider_id: str - """The ID of the provider associated with the `access_token`.""" - - username: str + username: Optional[str] = None """The account username used for login associated with the `access_token`.""" diff --git a/tests/api_resources/test_access_tokens.py b/tests/api_resources/test_access_tokens.py index 1a4cd3fe..ae4428a4 100644 --- a/tests/api_resources/test_access_tokens.py +++ b/tests/api_resources/test_access_tokens.py @@ -49,24 +49,28 @@ class TestAccessTokens: @parametrize def test_method_create(self, client: Finch) -> None: access_token = client.access_tokens.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Finch) -> None: access_token = client.access_tokens.create( - code="", - client_id="6d28c315-5eaa-4071-8ea5-f030eb45edbc", - client_secret="", - redirect_uri="https://example.com", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", + redirect_uri="redirect_uri", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @parametrize def test_raw_response_create(self, client: Finch) -> None: response = client.access_tokens.with_raw_response.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) assert response.is_closed is True @@ -77,7 +81,9 @@ def test_raw_response_create(self, client: Finch) -> None: @parametrize def test_streaming_response_create(self, client: Finch) -> None: with client.access_tokens.with_streaming_response.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -94,24 +100,28 @@ class TestAsyncAccessTokens: @parametrize async def test_method_create(self, async_client: AsyncFinch) -> None: access_token = await async_client.access_tokens.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> None: access_token = await async_client.access_tokens.create( - code="", - client_id="6d28c315-5eaa-4071-8ea5-f030eb45edbc", - client_secret="", - redirect_uri="https://example.com", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", + redirect_uri="redirect_uri", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncFinch) -> None: response = await async_client.access_tokens.with_raw_response.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) assert response.is_closed is True @@ -122,7 +132,9 @@ async def test_raw_response_create(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncFinch) -> None: async with async_client.access_tokens.with_streaming_response.create( - code="", + client_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + client_secret="client_secret", + code="code", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From ce1eed0387b37ba5d7141784296f3482766b89a8 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:28 +0000 Subject: [PATCH 2/2] release: 1.34.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/finch/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5334cb41..257e308d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.33.0" + ".": "1.34.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 27aa2fd3..10ed1e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.34.0 (2025-08-20) + +Full Changelog: [v1.33.0...v1.34.0](https://github.com/Finch-API/finch-api-python/compare/v1.33.0...v1.34.0) + +### Features + +* **api:** api update ([250dd73](https://github.com/Finch-API/finch-api-python/commit/250dd7334ae72a1e6c6b1c2e4578e796aa9a87ff)) + ## 1.33.0 (2025-08-12) Full Changelog: [v1.32.0...v1.33.0](https://github.com/Finch-API/finch-api-python/compare/v1.32.0...v1.33.0) diff --git a/pyproject.toml b/pyproject.toml index 1693244f..81c435c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.33.0" +version = "1.34.0" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index cf3fd824..e42e8ee5 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.33.0" # x-release-please-version +__version__ = "1.34.0" # x-release-please-version