diff --git a/.stats.yml b/.stats.yml index f932550..980fdcf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 71 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-a6a18ba80810ceb90173e44a17324eb2a9fbd683627c02811c5d70eaedc142af.yml +configured_endpoints: 72 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-1eeb4013155ccc760ed7f7d33c403b74e4a1c22db9c98e09fce7a16ae2e6497d.yml diff --git a/api.md b/api.md index 9a63d64..936d3e4 100644 --- a/api.md +++ b/api.md @@ -279,9 +279,10 @@ Methods: Types: ```python -from conductor.types.qbd import CheckListResponse +from conductor.types.qbd import QbdCheck ``` Methods: -- client.qbd.checks.list(\*\*params) -> SyncCursorPage[CheckListResponse] +- client.qbd.checks.retrieve(id) -> QbdCheck +- client.qbd.checks.list(\*\*params) -> SyncCursorPage[QbdCheck] diff --git a/src/conductor/resources/qbd/checks.py b/src/conductor/resources/qbd/checks.py index 375a6f0..383046c 100644 --- a/src/conductor/resources/qbd/checks.py +++ b/src/conductor/resources/qbd/checks.py @@ -20,7 +20,7 @@ from ...types.qbd import check_list_params from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options -from ...types.qbd.check_list_response import CheckListResponse +from ...types.qbd.qbd_check import QbdCheck __all__ = ["ChecksResource", "AsyncChecksResource"] @@ -45,6 +45,46 @@ def with_streaming_response(self) -> ChecksResourceWithStreamingResponse: """ return ChecksResourceWithStreamingResponse(self) + def retrieve( + self, + id: str, + *, + conductor_end_user_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, + ) -> QbdCheck: + """ + Retrieves a check by ID. + + Args: + id: The QuickBooks-assigned unique identifier of the check to retrieve. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + 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 + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._get( + f"/quickbooks-desktop/checks/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + def list( self, *, @@ -73,7 +113,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncCursorPage[CheckListResponse]: + ) -> SyncCursorPage[QbdCheck]: """ Returns a list of checks. @@ -164,7 +204,7 @@ def list( extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} return self._get_api_list( "/quickbooks-desktop/checks", - page=SyncCursorPage[CheckListResponse], + page=SyncCursorPage[QbdCheck], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -194,7 +234,7 @@ def list( check_list_params.CheckListParams, ), ), - model=CheckListResponse, + model=QbdCheck, ) @@ -218,6 +258,46 @@ def with_streaming_response(self) -> AsyncChecksResourceWithStreamingResponse: """ return AsyncChecksResourceWithStreamingResponse(self) + async def retrieve( + self, + id: str, + *, + conductor_end_user_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, + ) -> QbdCheck: + """ + Retrieves a check by ID. + + Args: + id: The QuickBooks-assigned unique identifier of the check to retrieve. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + 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 + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return await self._get( + f"/quickbooks-desktop/checks/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdCheck, + ) + def list( self, *, @@ -246,7 +326,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[CheckListResponse, AsyncCursorPage[CheckListResponse]]: + ) -> AsyncPaginator[QbdCheck, AsyncCursorPage[QbdCheck]]: """ Returns a list of checks. @@ -337,7 +417,7 @@ def list( extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} return self._get_api_list( "/quickbooks-desktop/checks", - page=AsyncCursorPage[CheckListResponse], + page=AsyncCursorPage[QbdCheck], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -367,7 +447,7 @@ def list( check_list_params.CheckListParams, ), ), - model=CheckListResponse, + model=QbdCheck, ) @@ -375,6 +455,9 @@ class ChecksResourceWithRawResponse: def __init__(self, checks: ChecksResource) -> None: self._checks = checks + self.retrieve = to_raw_response_wrapper( + checks.retrieve, + ) self.list = to_raw_response_wrapper( checks.list, ) @@ -384,6 +467,9 @@ class AsyncChecksResourceWithRawResponse: def __init__(self, checks: AsyncChecksResource) -> None: self._checks = checks + self.retrieve = async_to_raw_response_wrapper( + checks.retrieve, + ) self.list = async_to_raw_response_wrapper( checks.list, ) @@ -393,6 +479,9 @@ class ChecksResourceWithStreamingResponse: def __init__(self, checks: ChecksResource) -> None: self._checks = checks + self.retrieve = to_streamed_response_wrapper( + checks.retrieve, + ) self.list = to_streamed_response_wrapper( checks.list, ) @@ -402,6 +491,9 @@ class AsyncChecksResourceWithStreamingResponse: def __init__(self, checks: AsyncChecksResource) -> None: self._checks = checks + self.retrieve = async_to_streamed_response_wrapper( + checks.retrieve, + ) self.list = async_to_streamed_response_wrapper( checks.list, ) diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py index a5882cb..10d809a 100644 --- a/src/conductor/types/qbd/__init__.py +++ b/src/conductor/types/qbd/__init__.py @@ -9,6 +9,7 @@ from .invoice import Invoice as Invoice from .customer import Customer as Customer from .transfer import Transfer as Transfer +from .qbd_check import QbdCheck as QbdCheck from .service_item import ServiceItem as ServiceItem from .standard_term import StandardTerm as StandardTerm from .inventory_item import InventoryItem as InventoryItem @@ -25,7 +26,6 @@ from .non_inventory_item import NonInventoryItem as NonInventoryItem from .vendor_list_params import VendorListParams as VendorListParams from .account_list_params import AccountListParams as AccountListParams -from .check_list_response import CheckListResponse as CheckListResponse from .class_create_params import ClassCreateParams as ClassCreateParams from .class_list_response import ClassListResponse as ClassListResponse from .class_update_params import ClassUpdateParams as ClassUpdateParams diff --git a/src/conductor/types/qbd/check_list_response.py b/src/conductor/types/qbd/qbd_check.py similarity index 99% rename from src/conductor/types/qbd/check_list_response.py rename to src/conductor/types/qbd/qbd_check.py index 0c03ebf..5eecea5 100644 --- a/src/conductor/types/qbd/check_list_response.py +++ b/src/conductor/types/qbd/qbd_check.py @@ -9,7 +9,7 @@ from ..._models import BaseModel __all__ = [ - "CheckListResponse", + "QbdCheck", "Account", "Address", "Currency", @@ -1172,7 +1172,7 @@ class SalesTaxCode(BaseModel): """ -class CheckListResponse(BaseModel): +class QbdCheck(BaseModel): id: str """The unique identifier assigned by QuickBooks to this check. diff --git a/tests/api_resources/qbd/test_checks.py b/tests/api_resources/qbd/test_checks.py index 8f6ac8e..cc83eeb 100644 --- a/tests/api_resources/qbd/test_checks.py +++ b/tests/api_resources/qbd/test_checks.py @@ -10,7 +10,7 @@ from conductor import Conductor, AsyncConductor from tests.utils import assert_matches_type from conductor._utils import parse_date -from conductor.types.qbd import CheckListResponse +from conductor.types.qbd import QbdCheck from conductor.pagination import SyncCursorPage, AsyncCursorPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,12 +19,54 @@ class TestChecks: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_retrieve(self, client: Conductor) -> None: + check = client.qbd.checks.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Conductor) -> None: + response = client.qbd.checks.with_raw_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Conductor) -> None: + with client.qbd.checks.with_streaming_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Conductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.qbd.checks.with_raw_response.retrieve( + id="", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize def test_method_list(self, client: Conductor) -> None: check = client.qbd.checks.list( conductor_end_user_id="end_usr_1234567abcdefg", ) - assert_matches_type(SyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(SyncCursorPage[QbdCheck], check, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Conductor) -> None: @@ -49,7 +91,7 @@ def test_method_list_with_all_params(self, client: Conductor) -> None: updated_after="updatedAfter", updated_before="updatedBefore", ) - assert_matches_type(SyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(SyncCursorPage[QbdCheck], check, path=["response"]) @parametrize def test_raw_response_list(self, client: Conductor) -> None: @@ -60,7 +102,7 @@ def test_raw_response_list(self, client: Conductor) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" check = response.parse() - assert_matches_type(SyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(SyncCursorPage[QbdCheck], check, path=["response"]) @parametrize def test_streaming_response_list(self, client: Conductor) -> None: @@ -71,7 +113,7 @@ def test_streaming_response_list(self, client: Conductor) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" check = response.parse() - assert_matches_type(SyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(SyncCursorPage[QbdCheck], check, path=["response"]) assert cast(Any, response.is_closed) is True @@ -79,12 +121,54 @@ def test_streaming_response_list(self, client: Conductor) -> None: class TestAsyncChecks: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + async def test_method_retrieve(self, async_client: AsyncConductor) -> None: + check = await async_client.qbd.checks.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.checks.with_raw_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.checks.with_streaming_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check = await response.parse() + assert_matches_type(QbdCheck, check, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncConductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.qbd.checks.with_raw_response.retrieve( + id="", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize async def test_method_list(self, async_client: AsyncConductor) -> None: check = await async_client.qbd.checks.list( conductor_end_user_id="end_usr_1234567abcdefg", ) - assert_matches_type(AsyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(AsyncCursorPage[QbdCheck], check, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncConductor) -> None: @@ -109,7 +193,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncConductor) - updated_after="updatedAfter", updated_before="updatedBefore", ) - assert_matches_type(AsyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(AsyncCursorPage[QbdCheck], check, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncConductor) -> None: @@ -120,7 +204,7 @@ async def test_raw_response_list(self, async_client: AsyncConductor) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" check = await response.parse() - assert_matches_type(AsyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(AsyncCursorPage[QbdCheck], check, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncConductor) -> None: @@ -131,6 +215,6 @@ async def test_streaming_response_list(self, async_client: AsyncConductor) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" check = await response.parse() - assert_matches_type(AsyncCursorPage[CheckListResponse], check, path=["response"]) + assert_matches_type(AsyncCursorPage[QbdCheck], check, path=["response"]) assert cast(Any, response.is_closed) is True