diff --git a/.stats.yml b/.stats.yml index 950c125e..de2b9cc9 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-8c83f0eae70d2a02ed3e2059fc251affdccd2f848f45445e4fed64dfd9ca5985.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-bf858f37d7ab420841ddc6329dad8c46377308b6a5c8e935908011d0f9845e22.yml openapi_spec_hash: 2523952a32436e3c7fd3b55508c2e7ee -config_hash: ce10384813f68ba3fed61c7b601b396b +config_hash: 4a8def48077df6382ed9fe00588baecf diff --git a/api.md b/api.md index d3fc74bc..30c1697a 100644 --- a/api.md +++ b/api.md @@ -182,8 +182,8 @@ Types: ```python from finch.types.hris.benefits import ( + EnrolledIndividualBenifit, IndividualBenefit, - IndividualEnrollManyResponse, IndividualEnrolledIDsResponse, IndividualUnenrollManyResponse, ) @@ -191,10 +191,10 @@ from finch.types.hris.benefits import ( Methods: -- client.hris.benefits.individuals.enroll_many(benefit_id, \*\*params) -> IndividualEnrollManyResponse +- client.hris.benefits.individuals.enroll_many(benefit_id, \*\*params) -> EnrolledIndividualBenifit - client.hris.benefits.individuals.enrolled_ids(benefit_id) -> IndividualEnrolledIDsResponse - client.hris.benefits.individuals.retrieve_many_benefits(benefit_id, \*\*params) -> SyncSinglePage[IndividualBenefit] -- client.hris.benefits.individuals.unenroll_many(benefit_id, \*\*params) -> SyncSinglePage[object] +- client.hris.benefits.individuals.unenroll_many(benefit_id, \*\*params) -> IndividualUnenrollManyResponse # Providers diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index a017e491..3e06189d 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -23,8 +23,9 @@ individual_retrieve_many_benefits_params, ) from ....types.hris.benefits.individual_benefit import IndividualBenefit -from ....types.hris.benefits.individual_enroll_many_response import IndividualEnrollManyResponse +from ....types.hris.benefits.enrolled_individual_benifit import EnrolledIndividualBenifit from ....types.hris.benefits.individual_enrolled_ids_response import IndividualEnrolledIDsResponse +from ....types.hris.benefits.individual_unenroll_many_response import IndividualUnenrollManyResponse __all__ = ["Individuals", "AsyncIndividuals"] @@ -60,7 +61,7 @@ def enroll_many( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndividualEnrollManyResponse: + ) -> EnrolledIndividualBenifit: """Enroll an individual into a deduction or contribution. This is an overwrite @@ -87,7 +88,7 @@ def enroll_many( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=IndividualEnrollManyResponse, + cast_to=EnrolledIndividualBenifit, ) def enrolled_ids( @@ -179,7 +180,7 @@ def unenroll_many( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[object]: + ) -> IndividualUnenrollManyResponse: """ Unenroll individuals from a deduction or contribution @@ -196,17 +197,15 @@ def unenroll_many( """ if not benefit_id: raise ValueError(f"Expected a non-empty value for `benefit_id` but received {benefit_id!r}") - return self._get_api_list( + return self._delete( f"/employer/benefits/{benefit_id}/individuals", - page=SyncSinglePage[object], body=maybe_transform( {"individual_ids": individual_ids}, individual_unenroll_many_params.IndividualUnenrollManyParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=object, - method="delete", + cast_to=IndividualUnenrollManyResponse, ) @@ -241,7 +240,7 @@ async def enroll_many( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndividualEnrollManyResponse: + ) -> EnrolledIndividualBenifit: """Enroll an individual into a deduction or contribution. This is an overwrite @@ -268,7 +267,7 @@ async def enroll_many( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=IndividualEnrollManyResponse, + cast_to=EnrolledIndividualBenifit, ) async def enrolled_ids( @@ -349,7 +348,7 @@ def retrieve_many_benefits( model=IndividualBenefit, ) - def unenroll_many( + async def unenroll_many( self, benefit_id: str, *, @@ -360,7 +359,7 @@ def unenroll_many( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[object, AsyncSinglePage[object]]: + ) -> IndividualUnenrollManyResponse: """ Unenroll individuals from a deduction or contribution @@ -377,17 +376,15 @@ def unenroll_many( """ if not benefit_id: raise ValueError(f"Expected a non-empty value for `benefit_id` but received {benefit_id!r}") - return self._get_api_list( + return await self._delete( f"/employer/benefits/{benefit_id}/individuals", - page=AsyncSinglePage[object], - body=maybe_transform( + body=await async_maybe_transform( {"individual_ids": individual_ids}, individual_unenroll_many_params.IndividualUnenrollManyParams ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=object, - method="delete", + cast_to=IndividualUnenrollManyResponse, ) diff --git a/src/finch/types/hris/benefits/__init__.py b/src/finch/types/hris/benefits/__init__.py index 34a2f325..99dae977 100644 --- a/src/finch/types/hris/benefits/__init__.py +++ b/src/finch/types/hris/benefits/__init__.py @@ -3,10 +3,11 @@ from __future__ import annotations from .individual_benefit import IndividualBenefit as IndividualBenefit +from .enrolled_individual_benifit import EnrolledIndividualBenifit as EnrolledIndividualBenifit from .individual_enroll_many_params import IndividualEnrollManyParams as IndividualEnrollManyParams -from .individual_enroll_many_response import IndividualEnrollManyResponse as IndividualEnrollManyResponse from .individual_unenroll_many_params import IndividualUnenrollManyParams as IndividualUnenrollManyParams from .individual_enrolled_ids_response import IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse +from .individual_unenroll_many_response import IndividualUnenrollManyResponse as IndividualUnenrollManyResponse from .individual_retrieve_many_benefits_params import ( IndividualRetrieveManyBenefitsParams as IndividualRetrieveManyBenefitsParams, ) diff --git a/src/finch/types/hris/benefits/individual_enroll_many_response.py b/src/finch/types/hris/benefits/enrolled_individual_benifit.py similarity index 61% rename from src/finch/types/hris/benefits/individual_enroll_many_response.py rename to src/finch/types/hris/benefits/enrolled_individual_benifit.py index e205eec5..6f1354e5 100644 --- a/src/finch/types/hris/benefits/individual_enroll_many_response.py +++ b/src/finch/types/hris/benefits/enrolled_individual_benifit.py @@ -3,8 +3,8 @@ from ...._models import BaseModel -__all__ = ["IndividualEnrollManyResponse"] +__all__ = ["EnrolledIndividualBenifit"] -class IndividualEnrollManyResponse(BaseModel): +class EnrolledIndividualBenifit(BaseModel): job_id: str diff --git a/src/finch/types/hris/benefits/individual_unenroll_many_response.py b/src/finch/types/hris/benefits/individual_unenroll_many_response.py new file mode 100644 index 00000000..03b9ecfa --- /dev/null +++ b/src/finch/types/hris/benefits/individual_unenroll_many_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ...._models import BaseModel + +__all__ = ["IndividualUnenrollManyResponse"] + + +class IndividualUnenrollManyResponse(BaseModel): + job_id: str diff --git a/tests/api_resources/hris/benefits/test_individuals.py b/tests/api_resources/hris/benefits/test_individuals.py index 62af21a9..8c49ddd5 100644 --- a/tests/api_resources/hris/benefits/test_individuals.py +++ b/tests/api_resources/hris/benefits/test_individuals.py @@ -13,8 +13,9 @@ from finch.pagination import SyncSinglePage, AsyncSinglePage from finch.types.hris.benefits import ( IndividualBenefit, - IndividualEnrollManyResponse, + EnrolledIndividualBenifit, IndividualEnrolledIDsResponse, + IndividualUnenrollManyResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +29,7 @@ def test_method_enroll_many(self, client: Finch) -> None: individual = client.hris.benefits.individuals.enroll_many( benefit_id="benefit_id", ) - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize def test_method_enroll_many_with_all_params(self, client: Finch) -> None: @@ -54,7 +55,7 @@ def test_method_enroll_many_with_all_params(self, client: Finch) -> None: } ], ) - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize def test_raw_response_enroll_many(self, client: Finch) -> None: @@ -65,7 +66,7 @@ def test_raw_response_enroll_many(self, client: Finch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize def test_streaming_response_enroll_many(self, client: Finch) -> None: @@ -76,7 +77,7 @@ def test_streaming_response_enroll_many(self, client: Finch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) assert cast(Any, response.is_closed) is True @@ -176,7 +177,7 @@ def test_method_unenroll_many(self, client: Finch) -> None: individual = client.hris.benefits.individuals.unenroll_many( benefit_id="benefit_id", ) - assert_matches_type(SyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize def test_method_unenroll_many_with_all_params(self, client: Finch) -> None: @@ -184,7 +185,7 @@ def test_method_unenroll_many_with_all_params(self, client: Finch) -> None: benefit_id="benefit_id", individual_ids=["string"], ) - assert_matches_type(SyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize def test_raw_response_unenroll_many(self, client: Finch) -> None: @@ -195,7 +196,7 @@ def test_raw_response_unenroll_many(self, client: Finch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(SyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize def test_streaming_response_unenroll_many(self, client: Finch) -> None: @@ -206,7 +207,7 @@ def test_streaming_response_unenroll_many(self, client: Finch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(SyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) assert cast(Any, response.is_closed) is True @@ -226,7 +227,7 @@ async def test_method_enroll_many(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.enroll_many( benefit_id="benefit_id", ) - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize async def test_method_enroll_many_with_all_params(self, async_client: AsyncFinch) -> None: @@ -252,7 +253,7 @@ async def test_method_enroll_many_with_all_params(self, async_client: AsyncFinch } ], ) - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize async def test_raw_response_enroll_many(self, async_client: AsyncFinch) -> None: @@ -263,7 +264,7 @@ async def test_raw_response_enroll_many(self, async_client: AsyncFinch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) @parametrize async def test_streaming_response_enroll_many(self, async_client: AsyncFinch) -> None: @@ -274,7 +275,7 @@ async def test_streaming_response_enroll_many(self, async_client: AsyncFinch) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = await response.parse() - assert_matches_type(IndividualEnrollManyResponse, individual, path=["response"]) + assert_matches_type(EnrolledIndividualBenifit, individual, path=["response"]) assert cast(Any, response.is_closed) is True @@ -374,7 +375,7 @@ async def test_method_unenroll_many(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.unenroll_many( benefit_id="benefit_id", ) - assert_matches_type(AsyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize async def test_method_unenroll_many_with_all_params(self, async_client: AsyncFinch) -> None: @@ -382,7 +383,7 @@ async def test_method_unenroll_many_with_all_params(self, async_client: AsyncFin benefit_id="benefit_id", individual_ids=["string"], ) - assert_matches_type(AsyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize async def test_raw_response_unenroll_many(self, async_client: AsyncFinch) -> None: @@ -393,7 +394,7 @@ async def test_raw_response_unenroll_many(self, async_client: AsyncFinch) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = response.parse() - assert_matches_type(AsyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) @parametrize async def test_streaming_response_unenroll_many(self, async_client: AsyncFinch) -> None: @@ -404,7 +405,7 @@ async def test_streaming_response_unenroll_many(self, async_client: AsyncFinch) assert response.http_request.headers.get("X-Stainless-Lang") == "python" individual = await response.parse() - assert_matches_type(AsyncSinglePage[object], individual, path=["response"]) + assert_matches_type(IndividualUnenrollManyResponse, individual, path=["response"]) assert cast(Any, response.is_closed) is True