diff --git a/src/finch/_client.py b/src/finch/_client.py index f49ef73e..5b7be7f9 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -305,7 +305,7 @@ def get_access_token( self, code: str, *, - redirect_uri: str, + redirect_uri: str | None = None, ) -> str: """Returns an access token for the Finch API given an authorization code. @@ -657,7 +657,7 @@ async def get_access_token( self, code: str, *, - redirect_uri: str, + redirect_uri: str | None = None, ) -> str: """Returns an access token for the Finch API given an authorization code. diff --git a/src/finch/resources/access_tokens.py b/src/finch/resources/access_tokens.py index 6c1f7f82..8ab710c1 100644 --- a/src/finch/resources/access_tokens.py +++ b/src/finch/resources/access_tokens.py @@ -31,9 +31,9 @@ def create( self, *, code: str, - redirect_uri: 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. extra_headers: Headers | None = None, @@ -98,9 +98,9 @@ async def create( self, *, code: str, - redirect_uri: 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. extra_headers: Headers | None = None, diff --git a/src/finch/types/access_token_create_params.py b/src/finch/types/access_token_create_params.py index 57412ee2..5935703f 100644 --- a/src/finch/types/access_token_create_params.py +++ b/src/finch/types/access_token_create_params.py @@ -10,8 +10,8 @@ class AccessTokenCreateParams(TypedDict, total=False): code: Required[str] - redirect_uri: Required[str] - client_id: str client_secret: str + + redirect_uri: str diff --git a/tests/api_resources/test_access_tokens.py b/tests/api_resources/test_access_tokens.py index 3abe3e65..e909b979 100644 --- a/tests/api_resources/test_access_tokens.py +++ b/tests/api_resources/test_access_tokens.py @@ -21,7 +21,6 @@ class TestAccessTokens: def test_method_create(self, client: Finch) -> None: access_token = client.access_tokens.create( code="", - redirect_uri="https://example.com", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @@ -29,9 +28,9 @@ def test_method_create(self, client: Finch) -> None: def test_method_create_with_all_params(self, client: Finch) -> None: access_token = client.access_tokens.create( code="", - redirect_uri="https://example.com", client_id="", client_secret="", + redirect_uri="https://example.com", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @@ -39,7 +38,6 @@ def test_method_create_with_all_params(self, client: Finch) -> None: def test_raw_response_create(self, client: Finch) -> None: response = client.access_tokens.with_raw_response.create( code="", - redirect_uri="https://example.com", ) assert response.is_closed is True @@ -51,7 +49,6 @@ def test_raw_response_create(self, client: Finch) -> None: def test_streaming_response_create(self, client: Finch) -> None: with client.access_tokens.with_streaming_response.create( code="", - redirect_uri="https://example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,7 +66,6 @@ class TestAsyncAccessTokens: async def test_method_create(self, async_client: AsyncFinch) -> None: access_token = await async_client.access_tokens.create( code="", - redirect_uri="https://example.com", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @@ -77,9 +73,9 @@ async def test_method_create(self, async_client: AsyncFinch) -> None: async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> None: access_token = await async_client.access_tokens.create( code="", - redirect_uri="https://example.com", client_id="", client_secret="", + redirect_uri="https://example.com", ) assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) @@ -87,7 +83,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> async def test_raw_response_create(self, async_client: AsyncFinch) -> None: response = await async_client.access_tokens.with_raw_response.create( code="", - redirect_uri="https://example.com", ) assert response.is_closed is True @@ -99,7 +94,6 @@ async def test_raw_response_create(self, async_client: AsyncFinch) -> None: async def test_streaming_response_create(self, async_client: AsyncFinch) -> None: async with async_client.access_tokens.with_streaming_response.create( code="", - redirect_uri="https://example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python"