diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 37458fa12..fd30b1d67 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.262.0" + ".": "0.263.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 327b8df67..18daa6ba3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 201 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-e25bdcd9c9cd987962f1507200b619dc7c32f91b940e5ca9110f24bdb294b14a.yml -openapi_spec_hash: 693a205b039e410d9a6b49a5b0ccc72c -config_hash: 97774f946585cecb19181a1817870d0b +configured_endpoints: 202 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a7e0e17a385ddfb049d0fe4e5d05785901cf40f464c51399d7c2cd1f863696c0.yml +openapi_spec_hash: b4bca6edf466e9061a72c98207f92c6d +config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b459b3e0..d339aefca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.263.0 (2025-07-09) + +Full Changelog: [v0.262.0...v0.263.0](https://github.com/Increase/increase-python/compare/v0.262.0...v0.263.0) + +### Features + +* **api:** api update ([2b55d1c](https://github.com/Increase/increase-python/commit/2b55d1cf2e50ac7462f61bbe33133df76cb94395)) + + +### Bug Fixes + +* **parsing:** correctly handle nested discriminated unions ([2c4b34f](https://github.com/Increase/increase-python/commit/2c4b34f5352fc8a3221dfd42bc5548f7f5fac84b)) + ## 0.262.0 (2025-07-08) Full Changelog: [v0.261.0...v0.262.0](https://github.com/Increase/increase-python/compare/v0.261.0...v0.262.0) diff --git a/api.md b/api.md index 2a4dab211..bc0abaf01 100644 --- a/api.md +++ b/api.md @@ -860,6 +860,12 @@ Methods: - client.simulations.inbound_wire_transfers.create(\*\*params) -> InboundWireTransfer +## WireDrawdownRequests + +Methods: + +- client.simulations.wire_drawdown_requests.refuse(wire_drawdown_request_id) -> WireDrawdownRequest + ## InboundWireDrawdownRequests Methods: diff --git a/pyproject.toml b/pyproject.toml index 5c4060bbc..867e13cf4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.262.0" +version = "0.263.0" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/increase/_models.py b/src/increase/_models.py index 4f2149805..528d56803 100644 --- a/src/increase/_models.py +++ b/src/increase/_models.py @@ -2,9 +2,10 @@ import os import inspect -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast +from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( + List, Unpack, Literal, ClassVar, @@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") - return construct_type(value=value, type_=type_) + return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) def is_basemodel(type_: type) -> bool: @@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: return cast(_T, construct_type(value=value, type_=type_)) -def construct_type(*, value: object, type_: object) -> object: +def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object: """Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned as-is. @@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object: type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(type_): - meta: tuple[Any, ...] = get_args(type_)[1:] + if metadata is not None: + meta: tuple[Any, ...] = tuple(metadata) + elif is_annotated_type(type_): + meta = get_args(type_)[1:] type_ = extract_type_arg(type_, 0) else: meta = tuple() diff --git a/src/increase/_version.py b/src/increase/_version.py index e2507b339..dbd23f52a 100644 --- a/src/increase/_version.py +++ b/src/increase/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "increase" -__version__ = "0.262.0" # x-release-please-version +__version__ = "0.263.0" # x-release-please-version diff --git a/src/increase/resources/inbound_wire_transfers.py b/src/increase/resources/inbound_wire_transfers.py index a697f2460..1bca46b3e 100644 --- a/src/increase/resources/inbound_wire_transfers.py +++ b/src/increase/resources/inbound_wire_transfers.py @@ -90,6 +90,7 @@ def list( cursor: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, status: inbound_wire_transfer_list_params.Status | NotGiven = NOT_GIVEN, + wire_drawdown_request_id: 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, @@ -110,6 +111,9 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. + wire_drawdown_request_id: Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -134,6 +138,7 @@ def list( "cursor": cursor, "limit": limit, "status": status, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_list_params.InboundWireTransferListParams, ), @@ -262,6 +267,7 @@ def list( cursor: str | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, status: inbound_wire_transfer_list_params.Status | NotGiven = NOT_GIVEN, + wire_drawdown_request_id: 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, @@ -282,6 +288,9 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. + wire_drawdown_request_id: Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -306,6 +315,7 @@ def list( "cursor": cursor, "limit": limit, "status": status, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_list_params.InboundWireTransferListParams, ), diff --git a/src/increase/resources/simulations/__init__.py b/src/increase/resources/simulations/__init__.py index f1f46f9a5..262890320 100644 --- a/src/increase/resources/simulations/__init__.py +++ b/src/increase/resources/simulations/__init__.py @@ -176,6 +176,14 @@ InboundWireTransfersResourceWithStreamingResponse, AsyncInboundWireTransfersResourceWithStreamingResponse, ) +from .wire_drawdown_requests import ( + WireDrawdownRequestsResource, + AsyncWireDrawdownRequestsResource, + WireDrawdownRequestsResourceWithRawResponse, + AsyncWireDrawdownRequestsResourceWithRawResponse, + WireDrawdownRequestsResourceWithStreamingResponse, + AsyncWireDrawdownRequestsResourceWithStreamingResponse, +) from .card_fuel_confirmations import ( CardFuelConfirmationsResource, AsyncCardFuelConfirmationsResource, @@ -328,6 +336,12 @@ "AsyncInboundWireTransfersResourceWithRawResponse", "InboundWireTransfersResourceWithStreamingResponse", "AsyncInboundWireTransfersResourceWithStreamingResponse", + "WireDrawdownRequestsResource", + "AsyncWireDrawdownRequestsResource", + "WireDrawdownRequestsResourceWithRawResponse", + "AsyncWireDrawdownRequestsResourceWithRawResponse", + "WireDrawdownRequestsResourceWithStreamingResponse", + "AsyncWireDrawdownRequestsResourceWithStreamingResponse", "InboundWireDrawdownRequestsResource", "AsyncInboundWireDrawdownRequestsResource", "InboundWireDrawdownRequestsResourceWithRawResponse", diff --git a/src/increase/resources/simulations/inbound_wire_transfers.py b/src/increase/resources/simulations/inbound_wire_transfers.py index eaae67014..1b17c95b1 100644 --- a/src/increase/resources/simulations/inbound_wire_transfers.py +++ b/src/increase/resources/simulations/inbound_wire_transfers.py @@ -61,6 +61,7 @@ def create( originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, originator_to_beneficiary_information_line4: str | NotGiven = NOT_GIVEN, sender_reference: str | NotGiven = NOT_GIVEN, + wire_drawdown_request_id: 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, @@ -122,6 +123,9 @@ def create( sender_reference: The sending bank will set sender_reference in production. You can simulate any value here. + wire_drawdown_request_id: The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -153,6 +157,7 @@ def create( "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, "sender_reference": sender_reference, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_create_params.InboundWireTransferCreateParams, ), @@ -207,6 +212,7 @@ async def create( originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, originator_to_beneficiary_information_line4: str | NotGiven = NOT_GIVEN, sender_reference: str | NotGiven = NOT_GIVEN, + wire_drawdown_request_id: 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, @@ -268,6 +274,9 @@ async def create( sender_reference: The sending bank will set sender_reference in production. You can simulate any value here. + wire_drawdown_request_id: The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -299,6 +308,7 @@ async def create( "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, "sender_reference": sender_reference, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_create_params.InboundWireTransferCreateParams, ), diff --git a/src/increase/resources/simulations/simulations.py b/src/increase/resources/simulations/simulations.py index 878a9c5ee..d91595500 100644 --- a/src/increase/resources/simulations/simulations.py +++ b/src/increase/resources/simulations/simulations.py @@ -172,6 +172,14 @@ InboundWireTransfersResourceWithStreamingResponse, AsyncInboundWireTransfersResourceWithStreamingResponse, ) +from .wire_drawdown_requests import ( + WireDrawdownRequestsResource, + AsyncWireDrawdownRequestsResource, + WireDrawdownRequestsResourceWithRawResponse, + AsyncWireDrawdownRequestsResourceWithRawResponse, + WireDrawdownRequestsResourceWithStreamingResponse, + AsyncWireDrawdownRequestsResourceWithStreamingResponse, +) from .card_fuel_confirmations import ( CardFuelConfirmationsResource, AsyncCardFuelConfirmationsResource, @@ -293,6 +301,10 @@ def wire_transfers(self) -> WireTransfersResource: def inbound_wire_transfers(self) -> InboundWireTransfersResource: return InboundWireTransfersResource(self._client) + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResource: + return WireDrawdownRequestsResource(self._client) + @cached_property def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResource: return InboundWireDrawdownRequestsResource(self._client) @@ -422,6 +434,10 @@ def wire_transfers(self) -> AsyncWireTransfersResource: def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResource: return AsyncInboundWireTransfersResource(self._client) + @cached_property + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResource: + return AsyncWireDrawdownRequestsResource(self._client) + @cached_property def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResource: return AsyncInboundWireDrawdownRequestsResource(self._client) @@ -554,6 +570,10 @@ def wire_transfers(self) -> WireTransfersResourceWithRawResponse: def inbound_wire_transfers(self) -> InboundWireTransfersResourceWithRawResponse: return InboundWireTransfersResourceWithRawResponse(self._simulations.inbound_wire_transfers) + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResourceWithRawResponse: + return WireDrawdownRequestsResourceWithRawResponse(self._simulations.wire_drawdown_requests) + @cached_property def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResourceWithRawResponse: return InboundWireDrawdownRequestsResourceWithRawResponse(self._simulations.inbound_wire_drawdown_requests) @@ -671,6 +691,10 @@ def wire_transfers(self) -> AsyncWireTransfersResourceWithRawResponse: def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResourceWithRawResponse: return AsyncInboundWireTransfersResourceWithRawResponse(self._simulations.inbound_wire_transfers) + @cached_property + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResourceWithRawResponse: + return AsyncWireDrawdownRequestsResourceWithRawResponse(self._simulations.wire_drawdown_requests) + @cached_property def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResourceWithRawResponse: return AsyncInboundWireDrawdownRequestsResourceWithRawResponse(self._simulations.inbound_wire_drawdown_requests) @@ -788,6 +812,10 @@ def wire_transfers(self) -> WireTransfersResourceWithStreamingResponse: def inbound_wire_transfers(self) -> InboundWireTransfersResourceWithStreamingResponse: return InboundWireTransfersResourceWithStreamingResponse(self._simulations.inbound_wire_transfers) + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResourceWithStreamingResponse: + return WireDrawdownRequestsResourceWithStreamingResponse(self._simulations.wire_drawdown_requests) + @cached_property def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResourceWithStreamingResponse: return InboundWireDrawdownRequestsResourceWithStreamingResponse( @@ -909,6 +937,10 @@ def wire_transfers(self) -> AsyncWireTransfersResourceWithStreamingResponse: def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResourceWithStreamingResponse: return AsyncInboundWireTransfersResourceWithStreamingResponse(self._simulations.inbound_wire_transfers) + @cached_property + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResourceWithStreamingResponse: + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self._simulations.wire_drawdown_requests) + @cached_property def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: return AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse( diff --git a/src/increase/resources/simulations/wire_drawdown_requests.py b/src/increase/resources/simulations/wire_drawdown_requests.py new file mode 100644 index 000000000..f60e766d1 --- /dev/null +++ b/src/increase/resources/simulations/wire_drawdown_requests.py @@ -0,0 +1,185 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.wire_drawdown_request import WireDrawdownRequest + +__all__ = ["WireDrawdownRequestsResource", "AsyncWireDrawdownRequestsResource"] + + +class WireDrawdownRequestsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> WireDrawdownRequestsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return WireDrawdownRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return WireDrawdownRequestsResourceWithStreamingResponse(self) + + def refuse( + self, + wire_drawdown_request_id: str, + *, + # 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being refused by the debtor. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to refuse. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return self._post( + f"/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/refuse", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + +class AsyncWireDrawdownRequestsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncWireDrawdownRequestsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncWireDrawdownRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self) + + async def refuse( + self, + wire_drawdown_request_id: str, + *, + # 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being refused by the debtor. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to refuse. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return await self._post( + f"/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/refuse", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + +class WireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = to_raw_response_wrapper( + wire_drawdown_requests.refuse, + ) + + +class AsyncWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = async_to_raw_response_wrapper( + wire_drawdown_requests.refuse, + ) + + +class WireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = to_streamed_response_wrapper( + wire_drawdown_requests.refuse, + ) + + +class AsyncWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = async_to_streamed_response_wrapper( + wire_drawdown_requests.refuse, + ) diff --git a/src/increase/types/inbound_wire_transfer_list_params.py b/src/increase/types/inbound_wire_transfer_list_params.py index 3e92f2818..6c65d52d9 100644 --- a/src/increase/types/inbound_wire_transfer_list_params.py +++ b/src/increase/types/inbound_wire_transfer_list_params.py @@ -33,6 +33,12 @@ class InboundWireTransferListParams(TypedDict, total=False): status: Status + wire_drawdown_request_id: str + """ + Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. + """ + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] diff --git a/src/increase/types/simulations/inbound_wire_transfer_create_params.py b/src/increase/types/simulations/inbound_wire_transfer_create_params.py index 6e25dc5a8..818242af7 100644 --- a/src/increase/types/simulations/inbound_wire_transfer_create_params.py +++ b/src/increase/types/simulations/inbound_wire_transfer_create_params.py @@ -103,3 +103,9 @@ class InboundWireTransferCreateParams(TypedDict, total=False): You can simulate any value here. """ + + wire_drawdown_request_id: str + """ + The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + """ diff --git a/tests/api_resources/simulations/test_inbound_wire_transfers.py b/tests/api_resources/simulations/test_inbound_wire_transfers.py index a2e63e0af..bbf5f2169 100644 --- a/tests/api_resources/simulations/test_inbound_wire_transfers.py +++ b/tests/api_resources/simulations/test_inbound_wire_transfers.py @@ -45,6 +45,7 @@ def test_method_create_with_all_params(self, client: Increase) -> None: originator_to_beneficiary_information_line3="x", originator_to_beneficiary_information_line4="x", sender_reference="x", + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) @@ -108,6 +109,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) originator_to_beneficiary_information_line3="x", originator_to_beneficiary_information_line4="x", sender_reference="x", + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) diff --git a/tests/api_resources/simulations/test_wire_drawdown_requests.py b/tests/api_resources/simulations/test_wire_drawdown_requests.py new file mode 100644 index 000000000..938fd5a3f --- /dev/null +++ b/tests/api_resources/simulations/test_wire_drawdown_requests.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import WireDrawdownRequest + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestWireDrawdownRequests: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_refuse(self, client: Increase) -> None: + wire_drawdown_request = client.simulations.wire_drawdown_requests.refuse( + "wire_drawdown_request_id", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_raw_response_refuse(self, client: Increase) -> None: + response = client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "wire_drawdown_request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_streaming_response_refuse(self, client: Increase) -> None: + with client.simulations.wire_drawdown_requests.with_streaming_response.refuse( + "wire_drawdown_request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_refuse(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "", + ) + + +class TestAsyncWireDrawdownRequests: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_refuse(self, async_client: AsyncIncrease) -> None: + wire_drawdown_request = await async_client.simulations.wire_drawdown_requests.refuse( + "wire_drawdown_request_id", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_raw_response_refuse(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "wire_drawdown_request_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_streaming_response_refuse(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.wire_drawdown_requests.with_streaming_response.refuse( + "wire_drawdown_request_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_refuse(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + await async_client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "", + ) diff --git a/tests/api_resources/test_inbound_wire_transfers.py b/tests/api_resources/test_inbound_wire_transfers.py index 707135866..984e76ab3 100644 --- a/tests/api_resources/test_inbound_wire_transfers.py +++ b/tests/api_resources/test_inbound_wire_transfers.py @@ -78,6 +78,7 @@ def test_method_list_with_all_params(self, client: Increase) -> None: cursor="cursor", limit=1, status={"in": ["pending"]}, + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(SyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) @@ -210,6 +211,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> cursor="cursor", limit=1, status={"in": ["pending"]}, + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(AsyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) diff --git a/tests/test_models.py b/tests/test_models.py index f06ebcd65..43aa0a417 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -889,3 +889,48 @@ class ModelB(BaseModel): ) assert isinstance(m, ModelB) + + +def test_nested_discriminated_union() -> None: + class InnerType1(BaseModel): + type: Literal["type_1"] + + class InnerModel(BaseModel): + inner_value: str + + class InnerType2(BaseModel): + type: Literal["type_2"] + some_inner_model: InnerModel + + class Type1(BaseModel): + base_type: Literal["base_type_1"] + value: Annotated[ + Union[ + InnerType1, + InnerType2, + ], + PropertyInfo(discriminator="type"), + ] + + class Type2(BaseModel): + base_type: Literal["base_type_2"] + + T = Annotated[ + Union[ + Type1, + Type2, + ], + PropertyInfo(discriminator="base_type"), + ] + + model = construct_type( + type_=T, + value={ + "base_type": "base_type_1", + "value": { + "type": "type_2", + }, + }, + ) + assert isinstance(model, Type1) + assert isinstance(model.value, InnerType2)