diff --git a/.stats.yml b/.stats.yml index c423dd6b..417d1dea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 35 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-69265939ed1aa33d9890c86a334730210985961db56757efc28ff43696fbd1a7.yml +configured_endpoints: 37 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-f1001da4ad3c1503330eebc1e61319a1a5db5e2da9fec98bc8682cb0967894d2.yml diff --git a/api.md b/api.md index 9d5d0eca..205bad8d 100644 --- a/api.md +++ b/api.md @@ -339,3 +339,18 @@ Methods: - client.sandbox.jobs.configuration.retrieve() -> ConfigurationRetrieveResponse - client.sandbox.jobs.configuration.update(\*\*params) -> SandboxJobConfiguration + +# Payroll + +## PayGroups + +Types: + +```python +from finch.types.payroll import PayGroupRetrieveResponse, PayGroupListResponse +``` + +Methods: + +- client.payroll.pay_groups.retrieve(pay_group_id) -> PayGroupRetrieveResponse +- client.payroll.pay_groups.list(\*\*params) -> SyncSinglePage[PayGroupListResponse] diff --git a/src/finch/_client.py b/src/finch/_client.py index ecc576f3..0b38859e 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -59,6 +59,7 @@ class Finch(SyncAPIClient): request_forwarding: resources.RequestForwarding jobs: resources.Jobs sandbox: resources.Sandbox + payroll: resources.Payroll with_raw_response: FinchWithRawResponse with_streaming_response: FinchWithStreamedResponse @@ -161,6 +162,7 @@ def __init__( self.request_forwarding = resources.RequestForwarding(self) self.jobs = resources.Jobs(self) self.sandbox = resources.Sandbox(self) + self.payroll = resources.Payroll(self) self.with_raw_response = FinchWithRawResponse(self) self.with_streaming_response = FinchWithStreamedResponse(self) @@ -343,6 +345,7 @@ class AsyncFinch(AsyncAPIClient): request_forwarding: resources.AsyncRequestForwarding jobs: resources.AsyncJobs sandbox: resources.AsyncSandbox + payroll: resources.AsyncPayroll with_raw_response: AsyncFinchWithRawResponse with_streaming_response: AsyncFinchWithStreamedResponse @@ -445,6 +448,7 @@ def __init__( self.request_forwarding = resources.AsyncRequestForwarding(self) self.jobs = resources.AsyncJobs(self) self.sandbox = resources.AsyncSandbox(self) + self.payroll = resources.AsyncPayroll(self) self.with_raw_response = AsyncFinchWithRawResponse(self) self.with_streaming_response = AsyncFinchWithStreamedResponse(self) @@ -628,6 +632,7 @@ def __init__(self, client: Finch) -> None: self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding) self.jobs = resources.JobsWithRawResponse(client.jobs) self.sandbox = resources.SandboxWithRawResponse(client.sandbox) + self.payroll = resources.PayrollWithRawResponse(client.payroll) class AsyncFinchWithRawResponse: @@ -639,6 +644,7 @@ def __init__(self, client: AsyncFinch) -> None: self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding) self.jobs = resources.AsyncJobsWithRawResponse(client.jobs) self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox) + self.payroll = resources.AsyncPayrollWithRawResponse(client.payroll) class FinchWithStreamedResponse: @@ -650,6 +656,7 @@ def __init__(self, client: Finch) -> None: self.request_forwarding = resources.RequestForwardingWithStreamingResponse(client.request_forwarding) self.jobs = resources.JobsWithStreamingResponse(client.jobs) self.sandbox = resources.SandboxWithStreamingResponse(client.sandbox) + self.payroll = resources.PayrollWithStreamingResponse(client.payroll) class AsyncFinchWithStreamedResponse: @@ -661,6 +668,7 @@ def __init__(self, client: AsyncFinch) -> None: self.request_forwarding = resources.AsyncRequestForwardingWithStreamingResponse(client.request_forwarding) self.jobs = resources.AsyncJobsWithStreamingResponse(client.jobs) self.sandbox = resources.AsyncSandboxWithStreamingResponse(client.sandbox) + self.payroll = resources.AsyncPayrollWithStreamingResponse(client.payroll) Client = Finch diff --git a/src/finch/resources/__init__.py b/src/finch/resources/__init__.py index 04bef46f..ddaf8cb3 100644 --- a/src/finch/resources/__init__.py +++ b/src/finch/resources/__init__.py @@ -24,6 +24,14 @@ AccountWithStreamingResponse, AsyncAccountWithStreamingResponse, ) +from .payroll import ( + Payroll, + AsyncPayroll, + PayrollWithRawResponse, + AsyncPayrollWithRawResponse, + PayrollWithStreamingResponse, + AsyncPayrollWithStreamingResponse, +) from .sandbox import ( Sandbox, AsyncSandbox, @@ -100,4 +108,10 @@ "AsyncSandboxWithRawResponse", "SandboxWithStreamingResponse", "AsyncSandboxWithStreamingResponse", + "Payroll", + "AsyncPayroll", + "PayrollWithRawResponse", + "AsyncPayrollWithRawResponse", + "PayrollWithStreamingResponse", + "AsyncPayrollWithStreamingResponse", ] diff --git a/src/finch/resources/payroll/__init__.py b/src/finch/resources/payroll/__init__.py new file mode 100644 index 00000000..6b33267c --- /dev/null +++ b/src/finch/resources/payroll/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .payroll import ( + Payroll, + AsyncPayroll, + PayrollWithRawResponse, + AsyncPayrollWithRawResponse, + PayrollWithStreamingResponse, + AsyncPayrollWithStreamingResponse, +) +from .pay_groups import ( + PayGroups, + AsyncPayGroups, + PayGroupsWithRawResponse, + AsyncPayGroupsWithRawResponse, + PayGroupsWithStreamingResponse, + AsyncPayGroupsWithStreamingResponse, +) + +__all__ = [ + "PayGroups", + "AsyncPayGroups", + "PayGroupsWithRawResponse", + "AsyncPayGroupsWithRawResponse", + "PayGroupsWithStreamingResponse", + "AsyncPayGroupsWithStreamingResponse", + "Payroll", + "AsyncPayroll", + "PayrollWithRawResponse", + "AsyncPayrollWithRawResponse", + "PayrollWithStreamingResponse", + "AsyncPayrollWithStreamingResponse", +] diff --git a/src/finch/resources/payroll/pay_groups.py b/src/finch/resources/payroll/pay_groups.py new file mode 100644 index 00000000..e423b24a --- /dev/null +++ b/src/finch/resources/payroll/pay_groups.py @@ -0,0 +1,244 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List + +import httpx + +from ... import _legacy_response +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) +from ...types.payroll import pay_group_list_params +from ...types.payroll.pay_group_list_response import PayGroupListResponse +from ...types.payroll.pay_group_retrieve_response import PayGroupRetrieveResponse + +__all__ = ["PayGroups", "AsyncPayGroups"] + + +class PayGroups(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PayGroupsWithRawResponse: + return PayGroupsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PayGroupsWithStreamingResponse: + return PayGroupsWithStreamingResponse(self) + + def retrieve( + self, + pay_group_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, + ) -> PayGroupRetrieveResponse: + """ + Read information from a single pay group + + Args: + 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 pay_group_id: + raise ValueError(f"Expected a non-empty value for `pay_group_id` but received {pay_group_id!r}") + return self._get( + f"/employer/pay-group/{pay_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PayGroupRetrieveResponse, + ) + + def list( + self, + *, + individual_id: str | NotGiven = NOT_GIVEN, + pay_frequencies: List[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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[PayGroupListResponse]: + """ + Read company pay groups and frequencies + + Args: + 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 + """ + return self._get_api_list( + "/employer/pay-groups", + page=SyncSinglePage[PayGroupListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "individual_id": individual_id, + "pay_frequencies": pay_frequencies, + }, + pay_group_list_params.PayGroupListParams, + ), + ), + model=PayGroupListResponse, + ) + + +class AsyncPayGroups(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPayGroupsWithRawResponse: + return AsyncPayGroupsWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPayGroupsWithStreamingResponse: + return AsyncPayGroupsWithStreamingResponse(self) + + async def retrieve( + self, + pay_group_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, + ) -> PayGroupRetrieveResponse: + """ + Read information from a single pay group + + Args: + 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 pay_group_id: + raise ValueError(f"Expected a non-empty value for `pay_group_id` but received {pay_group_id!r}") + return await self._get( + f"/employer/pay-group/{pay_group_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PayGroupRetrieveResponse, + ) + + def list( + self, + *, + individual_id: str | NotGiven = NOT_GIVEN, + pay_frequencies: List[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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[PayGroupListResponse, AsyncSinglePage[PayGroupListResponse]]: + """ + Read company pay groups and frequencies + + Args: + 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 + """ + return self._get_api_list( + "/employer/pay-groups", + page=AsyncSinglePage[PayGroupListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "individual_id": individual_id, + "pay_frequencies": pay_frequencies, + }, + pay_group_list_params.PayGroupListParams, + ), + ), + model=PayGroupListResponse, + ) + + +class PayGroupsWithRawResponse: + def __init__(self, pay_groups: PayGroups) -> None: + self._pay_groups = pay_groups + + self.retrieve = _legacy_response.to_raw_response_wrapper( + pay_groups.retrieve, + ) + self.list = _legacy_response.to_raw_response_wrapper( + pay_groups.list, + ) + + +class AsyncPayGroupsWithRawResponse: + def __init__(self, pay_groups: AsyncPayGroups) -> None: + self._pay_groups = pay_groups + + self.retrieve = _legacy_response.async_to_raw_response_wrapper( + pay_groups.retrieve, + ) + self.list = _legacy_response.async_to_raw_response_wrapper( + pay_groups.list, + ) + + +class PayGroupsWithStreamingResponse: + def __init__(self, pay_groups: PayGroups) -> None: + self._pay_groups = pay_groups + + self.retrieve = to_streamed_response_wrapper( + pay_groups.retrieve, + ) + self.list = to_streamed_response_wrapper( + pay_groups.list, + ) + + +class AsyncPayGroupsWithStreamingResponse: + def __init__(self, pay_groups: AsyncPayGroups) -> None: + self._pay_groups = pay_groups + + self.retrieve = async_to_streamed_response_wrapper( + pay_groups.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + pay_groups.list, + ) diff --git a/src/finch/resources/payroll/payroll.py b/src/finch/resources/payroll/payroll.py new file mode 100644 index 00000000..01bebaa6 --- /dev/null +++ b/src/finch/resources/payroll/payroll.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ..._compat import cached_property +from .pay_groups import ( + PayGroups, + AsyncPayGroups, + PayGroupsWithRawResponse, + AsyncPayGroupsWithRawResponse, + PayGroupsWithStreamingResponse, + AsyncPayGroupsWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["Payroll", "AsyncPayroll"] + + +class Payroll(SyncAPIResource): + @cached_property + def pay_groups(self) -> PayGroups: + return PayGroups(self._client) + + @cached_property + def with_raw_response(self) -> PayrollWithRawResponse: + return PayrollWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PayrollWithStreamingResponse: + return PayrollWithStreamingResponse(self) + + +class AsyncPayroll(AsyncAPIResource): + @cached_property + def pay_groups(self) -> AsyncPayGroups: + return AsyncPayGroups(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPayrollWithRawResponse: + return AsyncPayrollWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPayrollWithStreamingResponse: + return AsyncPayrollWithStreamingResponse(self) + + +class PayrollWithRawResponse: + def __init__(self, payroll: Payroll) -> None: + self._payroll = payroll + + @cached_property + def pay_groups(self) -> PayGroupsWithRawResponse: + return PayGroupsWithRawResponse(self._payroll.pay_groups) + + +class AsyncPayrollWithRawResponse: + def __init__(self, payroll: AsyncPayroll) -> None: + self._payroll = payroll + + @cached_property + def pay_groups(self) -> AsyncPayGroupsWithRawResponse: + return AsyncPayGroupsWithRawResponse(self._payroll.pay_groups) + + +class PayrollWithStreamingResponse: + def __init__(self, payroll: Payroll) -> None: + self._payroll = payroll + + @cached_property + def pay_groups(self) -> PayGroupsWithStreamingResponse: + return PayGroupsWithStreamingResponse(self._payroll.pay_groups) + + +class AsyncPayrollWithStreamingResponse: + def __init__(self, payroll: AsyncPayroll) -> None: + self._payroll = payroll + + @cached_property + def pay_groups(self) -> AsyncPayGroupsWithStreamingResponse: + return AsyncPayGroupsWithStreamingResponse(self._payroll.pay_groups) diff --git a/src/finch/types/payroll/__init__.py b/src/finch/types/payroll/__init__.py new file mode 100644 index 00000000..f98e6098 --- /dev/null +++ b/src/finch/types/payroll/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .pay_group_list_params import PayGroupListParams as PayGroupListParams +from .pay_group_list_response import PayGroupListResponse as PayGroupListResponse +from .pay_group_retrieve_response import PayGroupRetrieveResponse as PayGroupRetrieveResponse diff --git a/src/finch/types/payroll/pay_group_list_params.py b/src/finch/types/payroll/pay_group_list_params.py new file mode 100644 index 00000000..1e33abf4 --- /dev/null +++ b/src/finch/types/payroll/pay_group_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import TypedDict + +__all__ = ["PayGroupListParams"] + + +class PayGroupListParams(TypedDict, total=False): + individual_id: str + + pay_frequencies: List[str] diff --git a/src/finch/types/payroll/pay_group_list_response.py b/src/finch/types/payroll/pay_group_list_response.py new file mode 100644 index 00000000..cd25dfcc --- /dev/null +++ b/src/finch/types/payroll/pay_group_list_response.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PayGroupListResponse"] + + +class PayGroupListResponse(BaseModel): + id: Optional[str] = None + """Finch id (uuidv4) for the pay group""" + + name: Optional[str] = None + """Name of the pay group""" + + pay_frequencies: Optional[ + List[ + Literal[ + "annually", + "semi_annually", + "quarterly", + "monthly", + "semi_monthly", + "bi_weekly", + "weekly", + "daily", + "other", + ] + ] + ] = None + """List of pay frequencies associated with this pay group""" diff --git a/src/finch/types/payroll/pay_group_retrieve_response.py b/src/finch/types/payroll/pay_group_retrieve_response.py new file mode 100644 index 00000000..b07ec41c --- /dev/null +++ b/src/finch/types/payroll/pay_group_retrieve_response.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["PayGroupRetrieveResponse"] + + +class PayGroupRetrieveResponse(BaseModel): + id: str + """Finch id (uuidv4) for the pay group""" + + individual_ids: List[str] + + name: str + """Name of the pay group""" + + pay_frequencies: List[ + Literal[ + "annually", "semi_annually", "quarterly", "monthly", "semi_monthly", "bi_weekly", "weekly", "daily", "other" + ] + ] + """List of pay frequencies associated with this pay group""" diff --git a/tests/api_resources/payroll/__init__.py b/tests/api_resources/payroll/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/payroll/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/payroll/test_pay_groups.py b/tests/api_resources/payroll/test_pay_groups.py new file mode 100644 index 00000000..1eeaf7f9 --- /dev/null +++ b/tests/api_resources/payroll/test_pay_groups.py @@ -0,0 +1,165 @@ +# 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 finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch.pagination import SyncSinglePage, AsyncSinglePage +from finch.types.payroll import PayGroupListResponse, PayGroupRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPayGroups: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Finch) -> None: + pay_group = client.payroll.pay_groups.retrieve( + "string", + ) + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Finch) -> None: + response = client.payroll.pay_groups.with_raw_response.retrieve( + "string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_group = response.parse() + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Finch) -> None: + with client.payroll.pay_groups.with_streaming_response.retrieve( + "string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_group = response.parse() + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Finch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pay_group_id` but received ''"): + client.payroll.pay_groups.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Finch) -> None: + pay_group = client.payroll.pay_groups.list() + assert_matches_type(SyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Finch) -> None: + pay_group = client.payroll.pay_groups.list( + individual_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + pay_frequencies=["string", "string", "string"], + ) + assert_matches_type(SyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Finch) -> None: + response = client.payroll.pay_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_group = response.parse() + assert_matches_type(SyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Finch) -> None: + with client.payroll.pay_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_group = response.parse() + assert_matches_type(SyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPayGroups: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncFinch) -> None: + pay_group = await async_client.payroll.pay_groups.retrieve( + "string", + ) + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: + response = await async_client.payroll.pay_groups.with_raw_response.retrieve( + "string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_group = response.parse() + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> None: + async with async_client.payroll.pay_groups.with_streaming_response.retrieve( + "string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_group = await response.parse() + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `pay_group_id` but received ''"): + await async_client.payroll.pay_groups.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncFinch) -> None: + pay_group = await async_client.payroll.pay_groups.list() + assert_matches_type(AsyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: + pay_group = await async_client.payroll.pay_groups.list( + individual_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + pay_frequencies=["string", "string", "string"], + ) + assert_matches_type(AsyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncFinch) -> None: + response = await async_client.payroll.pay_groups.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_group = response.parse() + assert_matches_type(AsyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: + async with async_client.payroll.pay_groups.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_group = await response.parse() + assert_matches_type(AsyncSinglePage[PayGroupListResponse], pay_group, path=["response"]) + + assert cast(Any, response.is_closed) is True