diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de44c40d..69eb19a7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.19.0" + ".": "1.20.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 66cac5a2..05cd9fbf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-3224f142ed1542ed2535c155e8eb23b7ea10470c12448d60c3ce584126073a93.yml -openapi_spec_hash: 6c4b213ed5e4f7d1b369e04e4bfb5164 -config_hash: 8303e755d3e16cf28542d5f0aec83851 +configured_endpoints: 46 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-14d375aab89e6b212fe459805a42d6ea7d7da8eae2037ae710a187d06911be1d.yml +openapi_spec_hash: 08b86ecbec3323717d48e4aaee48ed54 +config_hash: 2bca9e6b32f742acb077cf8822ec9e23 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bcf769d..87585870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 1.20.0 (2025-04-04) + +Full Changelog: [v1.19.0...v1.20.0](https://github.com/Finch-API/finch-api-python/compare/v1.19.0...v1.20.0) + +### Features + +* **api:** add new endpoints for pay statement items ([#638](https://github.com/Finch-API/finch-api-python/issues/638)) ([f7ec780](https://github.com/Finch-API/finch-api-python/commit/f7ec780012d94be05afb1b65cbbbcc1930be2c55)) +* **api:** api update ([#633](https://github.com/Finch-API/finch-api-python/issues/633)) ([cb0dc56](https://github.com/Finch-API/finch-api-python/commit/cb0dc5609828467bfc647badf208f7b3ca05b763)) +* **api:** api update ([#635](https://github.com/Finch-API/finch-api-python/issues/635)) ([9accf06](https://github.com/Finch-API/finch-api-python/commit/9accf06c45b602cc333ba1b47ad615b159c23080)) +* **api:** api update ([#636](https://github.com/Finch-API/finch-api-python/issues/636)) ([4b822a0](https://github.com/Finch-API/finch-api-python/commit/4b822a0d837333d0a6e4ac0c5b20a4226b64097b)) +* **api:** manual updates ([#639](https://github.com/Finch-API/finch-api-python/issues/639)) ([fd1f40b](https://github.com/Finch-API/finch-api-python/commit/fd1f40b4103d43758bb682c4e1178e73c123b713)) + + +### Chores + +* **internal:** remove trailing character ([#637](https://github.com/Finch-API/finch-api-python/issues/637)) ([0334e6e](https://github.com/Finch-API/finch-api-python/commit/0334e6ec5e2051ff57a862135399ab2ea1ff2496)) + ## 1.19.0 (2025-03-31) Full Changelog: [v1.18.0...v1.19.0](https://github.com/Finch-API/finch-api-python/compare/v1.18.0...v1.19.0) diff --git a/api.md b/api.md index 15b5ef12..13b455d8 100644 --- a/api.md +++ b/api.md @@ -41,7 +41,39 @@ from finch.types.hris import Company Methods: -- client.hris.company.retrieve() -> Company +- client.hris.company.retrieve() -> Company + +### PayStatementItem + +Types: + +```python +from finch.types.hris.company import PayStatementItemListResponse +``` + +Methods: + +- client.hris.company.pay_statement_item.list(\*\*params) -> SyncResponsesPage[PayStatementItemListResponse] + +#### Rules + +Types: + +```python +from finch.types.hris.company.pay_statement_item import ( + RuleCreateResponse, + RuleUpdateResponse, + RuleListResponse, + RuleDeleteResponse, +) +``` + +Methods: + +- client.hris.company.pay_statement_item.rules.create(\*\*params) -> RuleCreateResponse +- client.hris.company.pay_statement_item.rules.update(rule_id, \*\*params) -> RuleUpdateResponse +- client.hris.company.pay_statement_item.rules.list() -> SyncResponsesPage[RuleListResponse] +- client.hris.company.pay_statement_item.rules.delete(rule_id) -> RuleDeleteResponse ## Directory diff --git a/pyproject.toml b/pyproject.toml index 7c5b1b16..e2f0bd79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.19.0" +version = "1.20.0" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index 46ee3670..c1c10a09 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "finch" -__version__ = "1.19.0" # x-release-please-version +__version__ = "1.20.0" # x-release-please-version diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index 724d9439..cc24e7e1 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -83,6 +83,8 @@ def create( limiting this to <30 characters due to limitations in specific providers (e.g. Justworks). + frequency: The frequency of the benefit deduction/contribution. + type: Type of benefit. extra_headers: Send extra headers @@ -267,6 +269,8 @@ async def create( limiting this to <30 characters due to limitations in specific providers (e.g. Justworks). + frequency: The frequency of the benefit deduction/contribution. + type: Type of benefit. extra_headers: Send extra headers diff --git a/src/finch/resources/hris/company/__init__.py b/src/finch/resources/hris/company/__init__.py new file mode 100644 index 00000000..1a335c71 --- /dev/null +++ b/src/finch/resources/hris/company/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .company import ( + CompanyResource, + AsyncCompanyResource, + CompanyResourceWithRawResponse, + AsyncCompanyResourceWithRawResponse, + CompanyResourceWithStreamingResponse, + AsyncCompanyResourceWithStreamingResponse, +) +from .pay_statement_item import ( + PayStatementItem, + AsyncPayStatementItem, + PayStatementItemWithRawResponse, + AsyncPayStatementItemWithRawResponse, + PayStatementItemWithStreamingResponse, + AsyncPayStatementItemWithStreamingResponse, +) + +__all__ = [ + "PayStatementItem", + "AsyncPayStatementItem", + "PayStatementItemWithRawResponse", + "AsyncPayStatementItemWithRawResponse", + "PayStatementItemWithStreamingResponse", + "AsyncPayStatementItemWithStreamingResponse", + "CompanyResource", + "AsyncCompanyResource", + "CompanyResourceWithRawResponse", + "AsyncCompanyResourceWithRawResponse", + "CompanyResourceWithStreamingResponse", + "AsyncCompanyResourceWithStreamingResponse", +] diff --git a/src/finch/resources/hris/company.py b/src/finch/resources/hris/company/company.py similarity index 73% rename from src/finch/resources/hris/company.py rename to src/finch/resources/hris/company/company.py index e98ddb52..c4b39f5b 100644 --- a/src/finch/resources/hris/company.py +++ b/src/finch/resources/hris/company/company.py @@ -4,18 +4,30 @@ import httpx -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import make_request_options -from ...types.hris.company import Company +from .... import _legacy_response +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper +from ...._base_client import make_request_options +from ....types.hris.company.company import Company +from .pay_statement_item.pay_statement_item import ( + PayStatementItem, + AsyncPayStatementItem, + PayStatementItemWithRawResponse, + AsyncPayStatementItemWithRawResponse, + PayStatementItemWithStreamingResponse, + AsyncPayStatementItemWithStreamingResponse, +) __all__ = ["CompanyResource", "AsyncCompanyResource"] class CompanyResource(SyncAPIResource): + @cached_property + def pay_statement_item(self) -> PayStatementItem: + return PayStatementItem(self._client) + @cached_property def with_raw_response(self) -> CompanyResourceWithRawResponse: """ @@ -56,6 +68,10 @@ def retrieve( class AsyncCompanyResource(AsyncAPIResource): + @cached_property + def pay_statement_item(self) -> AsyncPayStatementItem: + return AsyncPayStatementItem(self._client) + @cached_property def with_raw_response(self) -> AsyncCompanyResourceWithRawResponse: """ @@ -103,6 +119,10 @@ def __init__(self, company: CompanyResource) -> None: company.retrieve, ) + @cached_property + def pay_statement_item(self) -> PayStatementItemWithRawResponse: + return PayStatementItemWithRawResponse(self._company.pay_statement_item) + class AsyncCompanyResourceWithRawResponse: def __init__(self, company: AsyncCompanyResource) -> None: @@ -112,6 +132,10 @@ def __init__(self, company: AsyncCompanyResource) -> None: company.retrieve, ) + @cached_property + def pay_statement_item(self) -> AsyncPayStatementItemWithRawResponse: + return AsyncPayStatementItemWithRawResponse(self._company.pay_statement_item) + class CompanyResourceWithStreamingResponse: def __init__(self, company: CompanyResource) -> None: @@ -121,6 +145,10 @@ def __init__(self, company: CompanyResource) -> None: company.retrieve, ) + @cached_property + def pay_statement_item(self) -> PayStatementItemWithStreamingResponse: + return PayStatementItemWithStreamingResponse(self._company.pay_statement_item) + class AsyncCompanyResourceWithStreamingResponse: def __init__(self, company: AsyncCompanyResource) -> None: @@ -129,3 +157,7 @@ def __init__(self, company: AsyncCompanyResource) -> None: self.retrieve = async_to_streamed_response_wrapper( company.retrieve, ) + + @cached_property + def pay_statement_item(self) -> AsyncPayStatementItemWithStreamingResponse: + return AsyncPayStatementItemWithStreamingResponse(self._company.pay_statement_item) diff --git a/src/finch/resources/hris/company/pay_statement_item/__init__.py b/src/finch/resources/hris/company/pay_statement_item/__init__.py new file mode 100644 index 00000000..6a01c352 --- /dev/null +++ b/src/finch/resources/hris/company/pay_statement_item/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .rules import ( + Rules, + AsyncRules, + RulesWithRawResponse, + AsyncRulesWithRawResponse, + RulesWithStreamingResponse, + AsyncRulesWithStreamingResponse, +) +from .pay_statement_item import ( + PayStatementItem, + AsyncPayStatementItem, + PayStatementItemWithRawResponse, + AsyncPayStatementItemWithRawResponse, + PayStatementItemWithStreamingResponse, + AsyncPayStatementItemWithStreamingResponse, +) + +__all__ = [ + "Rules", + "AsyncRules", + "RulesWithRawResponse", + "AsyncRulesWithRawResponse", + "RulesWithStreamingResponse", + "AsyncRulesWithStreamingResponse", + "PayStatementItem", + "AsyncPayStatementItem", + "PayStatementItemWithRawResponse", + "AsyncPayStatementItemWithRawResponse", + "PayStatementItemWithStreamingResponse", + "AsyncPayStatementItemWithStreamingResponse", +] diff --git a/src/finch/resources/hris/company/pay_statement_item/pay_statement_item.py b/src/finch/resources/hris/company/pay_statement_item/pay_statement_item.py new file mode 100644 index 00000000..5ddda1bc --- /dev/null +++ b/src/finch/resources/hris/company/pay_statement_item/pay_statement_item.py @@ -0,0 +1,262 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import date +from typing_extensions import Literal + +import httpx + +from ..... import _legacy_response +from .rules import ( + Rules, + AsyncRules, + RulesWithRawResponse, + AsyncRulesWithRawResponse, + RulesWithStreamingResponse, + AsyncRulesWithStreamingResponse, +) +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 SyncResponsesPage, AsyncResponsesPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.hris.company import pay_statement_item_list_params +from .....types.hris.company.pay_statement_item_list_response import PayStatementItemListResponse + +__all__ = ["PayStatementItem", "AsyncPayStatementItem"] + + +class PayStatementItem(SyncAPIResource): + @cached_property + def rules(self) -> Rules: + return Rules(self._client) + + @cached_property + def with_raw_response(self) -> PayStatementItemWithRawResponse: + """ + 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/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers + """ + return PayStatementItemWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PayStatementItemWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response + """ + return PayStatementItemWithStreamingResponse(self) + + def list( + self, + *, + categories: List[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] + | NotGiven = NOT_GIVEN, + end_date: Union[str, date] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + start_date: Union[str, date] | NotGiven = NOT_GIVEN, + type: 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, + ) -> SyncResponsesPage[PayStatementItemListResponse]: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Retrieve a list of detailed pay statement + items for the access token's connection account. + + Args: + categories: Comma-delimited list of pay statement item categories to filter on. If empty, + defaults to all categories. + + end_date: The end date to retrieve pay statement items by via their last seen pay date in + `YYYY-MM-DD` format. + + name: Case-insensitive partial match search by pay statement item name. + + start_date: The start date to retrieve pay statement items by via their last seen pay date + (inclusive) in `YYYY-MM-DD` format. + + type: String search by pay statement item type. + + 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-statement-item", + page=SyncResponsesPage[PayStatementItemListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "categories": categories, + "end_date": end_date, + "name": name, + "start_date": start_date, + "type": type, + }, + pay_statement_item_list_params.PayStatementItemListParams, + ), + ), + model=PayStatementItemListResponse, + ) + + +class AsyncPayStatementItem(AsyncAPIResource): + @cached_property + def rules(self) -> AsyncRules: + return AsyncRules(self._client) + + @cached_property + def with_raw_response(self) -> AsyncPayStatementItemWithRawResponse: + """ + 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/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncPayStatementItemWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPayStatementItemWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response + """ + return AsyncPayStatementItemWithStreamingResponse(self) + + def list( + self, + *, + categories: List[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] + | NotGiven = NOT_GIVEN, + end_date: Union[str, date] | NotGiven = NOT_GIVEN, + name: str | NotGiven = NOT_GIVEN, + start_date: Union[str, date] | NotGiven = NOT_GIVEN, + type: 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[PayStatementItemListResponse, AsyncResponsesPage[PayStatementItemListResponse]]: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Retrieve a list of detailed pay statement + items for the access token's connection account. + + Args: + categories: Comma-delimited list of pay statement item categories to filter on. If empty, + defaults to all categories. + + end_date: The end date to retrieve pay statement items by via their last seen pay date in + `YYYY-MM-DD` format. + + name: Case-insensitive partial match search by pay statement item name. + + start_date: The start date to retrieve pay statement items by via their last seen pay date + (inclusive) in `YYYY-MM-DD` format. + + type: String search by pay statement item type. + + 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-statement-item", + page=AsyncResponsesPage[PayStatementItemListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "categories": categories, + "end_date": end_date, + "name": name, + "start_date": start_date, + "type": type, + }, + pay_statement_item_list_params.PayStatementItemListParams, + ), + ), + model=PayStatementItemListResponse, + ) + + +class PayStatementItemWithRawResponse: + def __init__(self, pay_statement_item: PayStatementItem) -> None: + self._pay_statement_item = pay_statement_item + + self.list = _legacy_response.to_raw_response_wrapper( + pay_statement_item.list, + ) + + @cached_property + def rules(self) -> RulesWithRawResponse: + return RulesWithRawResponse(self._pay_statement_item.rules) + + +class AsyncPayStatementItemWithRawResponse: + def __init__(self, pay_statement_item: AsyncPayStatementItem) -> None: + self._pay_statement_item = pay_statement_item + + self.list = _legacy_response.async_to_raw_response_wrapper( + pay_statement_item.list, + ) + + @cached_property + def rules(self) -> AsyncRulesWithRawResponse: + return AsyncRulesWithRawResponse(self._pay_statement_item.rules) + + +class PayStatementItemWithStreamingResponse: + def __init__(self, pay_statement_item: PayStatementItem) -> None: + self._pay_statement_item = pay_statement_item + + self.list = to_streamed_response_wrapper( + pay_statement_item.list, + ) + + @cached_property + def rules(self) -> RulesWithStreamingResponse: + return RulesWithStreamingResponse(self._pay_statement_item.rules) + + +class AsyncPayStatementItemWithStreamingResponse: + def __init__(self, pay_statement_item: AsyncPayStatementItem) -> None: + self._pay_statement_item = pay_statement_item + + self.list = async_to_streamed_response_wrapper( + pay_statement_item.list, + ) + + @cached_property + def rules(self) -> AsyncRulesWithStreamingResponse: + return AsyncRulesWithStreamingResponse(self._pay_statement_item.rules) diff --git a/src/finch/resources/hris/company/pay_statement_item/rules.py b/src/finch/resources/hris/company/pay_statement_item/rules.py new file mode 100644 index 00000000..15bc2d25 --- /dev/null +++ b/src/finch/resources/hris/company/pay_statement_item/rules.py @@ -0,0 +1,445 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Literal + +import httpx + +from ..... import _legacy_response +from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._utils import ( + maybe_transform, + async_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 SyncResponsesPage, AsyncResponsesPage +from ....._base_client import AsyncPaginator, make_request_options +from .....types.hris.company.pay_statement_item import rule_create_params, rule_update_params +from .....types.hris.company.pay_statement_item.rule_list_response import RuleListResponse +from .....types.hris.company.pay_statement_item.rule_create_response import RuleCreateResponse +from .....types.hris.company.pay_statement_item.rule_delete_response import RuleDeleteResponse +from .....types.hris.company.pay_statement_item.rule_update_response import RuleUpdateResponse + +__all__ = ["Rules", "AsyncRules"] + + +class Rules(SyncAPIResource): + @cached_property + def with_raw_response(self) -> RulesWithRawResponse: + """ + 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/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers + """ + return RulesWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> RulesWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response + """ + return RulesWithStreamingResponse(self) + + def create( + self, + *, + attributes: rule_create_params.Attributes | NotGiven = NOT_GIVEN, + conditions: Iterable[rule_create_params.Condition] | NotGiven = NOT_GIVEN, + effective_end_date: Optional[str] | NotGiven = NOT_GIVEN, + effective_start_date: Optional[str] | NotGiven = NOT_GIVEN, + entity_type: Literal["pay_statement_item"] | 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, + ) -> RuleCreateResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Custom rules can be created to associate + specific attributes to pay statement items depending on the use case. For + example, pay statement items that meet certain conditions can be labeled as a + pre-tax 401k. This metadata can be retrieved where pay statement item + information is available. + + Args: + attributes: Specifies the fields to be applied when the condition is met. + + effective_end_date: Specifies when the rules should stop applying rules based on the date. + + effective_start_date: Specifies when the rule should begin applying based on the date. + + entity_type: The entity type to which the rule is applied. + + 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._post( + "/employer/pay-statement-item/rule", + body=maybe_transform( + { + "attributes": attributes, + "conditions": conditions, + "effective_end_date": effective_end_date, + "effective_start_date": effective_start_date, + "entity_type": entity_type, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleCreateResponse, + ) + + def update( + self, + rule_id: str, + *, + optional_property: object | 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, + ) -> RuleUpdateResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Update a rule for a pay statement item. + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._put( + f"/employer/pay-statement-item/rule/{rule_id}", + body=maybe_transform({"optional_property": optional_property}, rule_update_params.RuleUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleUpdateResponse, + ) + + def list( + self, + *, + # 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, + ) -> SyncResponsesPage[RuleListResponse]: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon List all rules of a connection account. + """ + return self._get_api_list( + "/employer/pay-statement-item/rule", + page=SyncResponsesPage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + def delete( + self, + rule_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, + ) -> RuleDeleteResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Delete a rule for a pay statement item. + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return self._delete( + f"/employer/pay-statement-item/rule/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleDeleteResponse, + ) + + +class AsyncRules(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRulesWithRawResponse: + """ + 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/Finch-API/finch-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncRulesWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Finch-API/finch-api-python#with_streaming_response + """ + return AsyncRulesWithStreamingResponse(self) + + async def create( + self, + *, + attributes: rule_create_params.Attributes | NotGiven = NOT_GIVEN, + conditions: Iterable[rule_create_params.Condition] | NotGiven = NOT_GIVEN, + effective_end_date: Optional[str] | NotGiven = NOT_GIVEN, + effective_start_date: Optional[str] | NotGiven = NOT_GIVEN, + entity_type: Literal["pay_statement_item"] | 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, + ) -> RuleCreateResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Custom rules can be created to associate + specific attributes to pay statement items depending on the use case. For + example, pay statement items that meet certain conditions can be labeled as a + pre-tax 401k. This metadata can be retrieved where pay statement item + information is available. + + Args: + attributes: Specifies the fields to be applied when the condition is met. + + effective_end_date: Specifies when the rules should stop applying rules based on the date. + + effective_start_date: Specifies when the rule should begin applying based on the date. + + entity_type: The entity type to which the rule is applied. + + 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 await self._post( + "/employer/pay-statement-item/rule", + body=await async_maybe_transform( + { + "attributes": attributes, + "conditions": conditions, + "effective_end_date": effective_end_date, + "effective_start_date": effective_start_date, + "entity_type": entity_type, + }, + rule_create_params.RuleCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleCreateResponse, + ) + + async def update( + self, + rule_id: str, + *, + optional_property: object | 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, + ) -> RuleUpdateResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Update a rule for a pay statement item. + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._put( + f"/employer/pay-statement-item/rule/{rule_id}", + body=await async_maybe_transform( + {"optional_property": optional_property}, rule_update_params.RuleUpdateParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleUpdateResponse, + ) + + def list( + self, + *, + # 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[RuleListResponse, AsyncResponsesPage[RuleListResponse]]: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon List all rules of a connection account. + """ + return self._get_api_list( + "/employer/pay-statement-item/rule", + page=AsyncResponsesPage[RuleListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=RuleListResponse, + ) + + async def delete( + self, + rule_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, + ) -> RuleDeleteResponse: + """ + **Beta:** this endpoint currently serves employers onboarded after March 4th and + historical support will be added soon Delete a rule for a pay statement item. + + 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 rule_id: + raise ValueError(f"Expected a non-empty value for `rule_id` but received {rule_id!r}") + return await self._delete( + f"/employer/pay-statement-item/rule/{rule_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RuleDeleteResponse, + ) + + +class RulesWithRawResponse: + def __init__(self, rules: Rules) -> None: + self._rules = rules + + self.create = _legacy_response.to_raw_response_wrapper( + rules.create, + ) + self.update = _legacy_response.to_raw_response_wrapper( + rules.update, + ) + self.list = _legacy_response.to_raw_response_wrapper( + rules.list, + ) + self.delete = _legacy_response.to_raw_response_wrapper( + rules.delete, + ) + + +class AsyncRulesWithRawResponse: + def __init__(self, rules: AsyncRules) -> None: + self._rules = rules + + self.create = _legacy_response.async_to_raw_response_wrapper( + rules.create, + ) + self.update = _legacy_response.async_to_raw_response_wrapper( + rules.update, + ) + self.list = _legacy_response.async_to_raw_response_wrapper( + rules.list, + ) + self.delete = _legacy_response.async_to_raw_response_wrapper( + rules.delete, + ) + + +class RulesWithStreamingResponse: + def __init__(self, rules: Rules) -> None: + self._rules = rules + + self.create = to_streamed_response_wrapper( + rules.create, + ) + self.update = to_streamed_response_wrapper( + rules.update, + ) + self.list = to_streamed_response_wrapper( + rules.list, + ) + self.delete = to_streamed_response_wrapper( + rules.delete, + ) + + +class AsyncRulesWithStreamingResponse: + def __init__(self, rules: AsyncRules) -> None: + self._rules = rules + + self.create = async_to_streamed_response_wrapper( + rules.create, + ) + self.update = async_to_streamed_response_wrapper( + rules.update, + ) + self.list = async_to_streamed_response_wrapper( + rules.list, + ) + self.delete = async_to_streamed_response_wrapper( + rules.delete, + ) diff --git a/src/finch/resources/hris/hris.py b/src/finch/resources/hris/hris.py index 79d9eee4..ca781316 100644 --- a/src/finch/resources/hris/hris.py +++ b/src/finch/resources/hris/hris.py @@ -2,14 +2,6 @@ from __future__ import annotations -from .company import ( - CompanyResource, - AsyncCompanyResource, - CompanyResourceWithRawResponse, - AsyncCompanyResourceWithRawResponse, - CompanyResourceWithStreamingResponse, - AsyncCompanyResourceWithStreamingResponse, -) from .payments import ( Payments, AsyncPayments, @@ -60,6 +52,14 @@ PayStatementsWithStreamingResponse, AsyncPayStatementsWithStreamingResponse, ) +from .company.company import ( + CompanyResource, + AsyncCompanyResource, + CompanyResourceWithRawResponse, + AsyncCompanyResourceWithRawResponse, + CompanyResourceWithStreamingResponse, + AsyncCompanyResourceWithStreamingResponse, +) from .benefits.benefits import ( Benefits, AsyncBenefits, diff --git a/src/finch/types/hris/benefit_create_params.py b/src/finch/types/hris/benefit_create_params.py index 00537cc6..34e62b09 100644 --- a/src/finch/types/hris/benefit_create_params.py +++ b/src/finch/types/hris/benefit_create_params.py @@ -20,6 +20,7 @@ class BenefitCreateParams(TypedDict, total=False): """ frequency: Optional[BenefitFrequency] + """The frequency of the benefit deduction/contribution.""" type: Optional[BenefitType] """Type of benefit.""" diff --git a/src/finch/types/hris/benefits/enrolled_individual.py b/src/finch/types/hris/benefits/enrolled_individual.py index 5efb196b..c8d6f912 100644 --- a/src/finch/types/hris/benefits/enrolled_individual.py +++ b/src/finch/types/hris/benefits/enrolled_individual.py @@ -10,7 +10,7 @@ class Body(BaseModel): finch_code: Optional[str] = None - """A descriptive identifier for the response""" + """A descriptive identifier for the response.""" message: Optional[str] = None """Short description in English that provides more information about the response.""" diff --git a/src/finch/types/hris/benefits/individual_enroll_many_params.py b/src/finch/types/hris/benefits/individual_enroll_many_params.py index b5358caf..d0ea3f43 100644 --- a/src/finch/types/hris/benefits/individual_enroll_many_params.py +++ b/src/finch/types/hris/benefits/individual_enroll_many_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Iterable, Optional -from typing_extensions import Literal, TypedDict +from typing import Union, Iterable, Optional +from datetime import date +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = [ "IndividualEnrollManyParams", @@ -54,6 +57,9 @@ class IndividualConfiguration(TypedDict, total=False): company_contribution: IndividualConfigurationCompanyContribution + effective_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The date the enrollment will take effect""" + employee_deduction: IndividualConfigurationEmployeeDeduction diff --git a/src/finch/types/hris/benefits/individual_enrolled_ids_response.py b/src/finch/types/hris/benefits/individual_enrolled_ids_response.py index c2c74002..bb78ff6f 100644 --- a/src/finch/types/hris/benefits/individual_enrolled_ids_response.py +++ b/src/finch/types/hris/benefits/individual_enrolled_ids_response.py @@ -9,5 +9,6 @@ class IndividualEnrolledIDsResponse(BaseModel): benefit_id: str + """The id of the benefit.""" individual_ids: List[str] diff --git a/src/finch/types/hris/company/__init__.py b/src/finch/types/hris/company/__init__.py new file mode 100644 index 00000000..d1e4e798 --- /dev/null +++ b/src/finch/types/hris/company/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .company import Company as Company +from .pay_statement_item_list_params import PayStatementItemListParams as PayStatementItemListParams +from .pay_statement_item_list_response import PayStatementItemListResponse as PayStatementItemListResponse diff --git a/src/finch/types/hris/company.py b/src/finch/types/hris/company/company.py similarity index 97% rename from src/finch/types/hris/company.py rename to src/finch/types/hris/company/company.py index 3300ad0f..0b4a14ae 100644 --- a/src/finch/types/hris/company.py +++ b/src/finch/types/hris/company/company.py @@ -3,8 +3,8 @@ from typing import List, Optional from typing_extensions import Literal -from ..._models import BaseModel -from ..location import Location +from ...._models import BaseModel +from ...location import Location __all__ = ["Company", "Account", "Department", "DepartmentParent", "Entity"] diff --git a/src/finch/types/hris/company/pay_statement_item/__init__.py b/src/finch/types/hris/company/pay_statement_item/__init__.py new file mode 100644 index 00000000..15e0b3ff --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/__init__.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_list_response import RuleListResponse as RuleListResponse +from .rule_update_params import RuleUpdateParams as RuleUpdateParams +from .rule_create_response import RuleCreateResponse as RuleCreateResponse +from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse +from .rule_update_response import RuleUpdateResponse as RuleUpdateResponse diff --git a/src/finch/types/hris/company/pay_statement_item/rule_create_params.py b/src/finch/types/hris/company/pay_statement_item/rule_create_params.py new file mode 100644 index 00000000..8154426b --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_create_params.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Iterable, Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["RuleCreateParams", "Attributes", "Condition"] + + +class RuleCreateParams(TypedDict, total=False): + attributes: Attributes + """Specifies the fields to be applied when the condition is met.""" + + conditions: Iterable[Condition] + + effective_end_date: Optional[str] + """Specifies when the rules should stop applying rules based on the date.""" + + effective_start_date: Optional[str] + """Specifies when the rule should begin applying based on the date.""" + + entity_type: Literal["pay_statement_item"] + """The entity type to which the rule is applied.""" + + +class Attributes(TypedDict, total=False): + metadata: Dict[str, object] + """The metadata to be attached in the entity. + + It is a key-value pairs where the values can be of any type (string, number, + boolean, object, array, etc.). + """ + + +class Condition(TypedDict, total=False): + field: str + """The field to be checked in the rule.""" + + operator: Literal["equals"] + """The operator to be used in the rule.""" + + value: str + """The value of the field to be checked in the rule.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_create_response.py b/src/finch/types/hris/company/pay_statement_item/rule_create_response.py new file mode 100644 index 00000000..65d440f1 --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_create_response.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleCreateResponse", "Attributes", "Condition"] + + +class Attributes(BaseModel): + metadata: Optional[Dict[str, object]] = None + """The metadata to be attached in the entity. + + It is a key-value pairs where the values can be of any type (string, number, + boolean, object, array, etc.). + """ + + +class Condition(BaseModel): + field: Optional[str] = None + """The field to be checked in the rule.""" + + operator: Optional[Literal["equals"]] = None + """The operator to be used in the rule.""" + + value: Optional[str] = None + """The value of the field to be checked in the rule.""" + + +class RuleCreateResponse(BaseModel): + id: Optional[str] = None + """Finch id (uuidv4) for the rule.""" + + attributes: Optional[Attributes] = None + """Specifies the fields to be applied when the condition is met.""" + + conditions: Optional[List[Condition]] = None + + created_at: Optional[datetime] = None + """The datetime when the rule was created.""" + + effective_end_date: Optional[str] = None + """Specifies when the rules should stop applying rules based on the date.""" + + effective_start_date: Optional[str] = None + """Specifies when the rule should begin applying based on the date.""" + + entity_type: Optional[Literal["pay_statement_item"]] = None + """The entity type to which the rule is applied.""" + + priority: Optional[int] = None + """The priority of the rule.""" + + updated_at: Optional[datetime] = None + """The datetime when the rule was last updated.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_delete_response.py b/src/finch/types/hris/company/pay_statement_item/rule_delete_response.py new file mode 100644 index 00000000..31e439bd --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_delete_response.py @@ -0,0 +1,60 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleDeleteResponse", "Attributes", "Condition"] + + +class Attributes(BaseModel): + metadata: Optional[Dict[str, object]] = None + """The metadata to be attached in the entity. + + It is a key-value pairs where the values can be of any type (string, number, + boolean, object, array, etc.). + """ + + +class Condition(BaseModel): + field: Optional[str] = None + """The field to be checked in the rule.""" + + operator: Optional[Literal["equals"]] = None + """The operator to be used in the rule.""" + + value: Optional[str] = None + """The value of the field to be checked in the rule.""" + + +class RuleDeleteResponse(BaseModel): + id: Optional[str] = None + """Finch id (uuidv4) for the rule.""" + + attributes: Optional[Attributes] = None + """Specifies the fields to be applied when the condition is met.""" + + conditions: Optional[List[Condition]] = None + + created_at: Optional[datetime] = None + """The datetime when the rule was created.""" + + deleted_at: Optional[datetime] = None + """The datetime when the rule was deleted.""" + + effective_end_date: Optional[str] = None + """Specifies when the rules should stop applying rules based on the date.""" + + effective_start_date: Optional[str] = None + """Specifies when the rule should begin applying based on the date.""" + + entity_type: Optional[Literal["pay_statement_item"]] = None + """The entity type to which the rule is applied.""" + + priority: Optional[int] = None + """The priority of the rule.""" + + updated_at: Optional[datetime] = None + """The datetime when the rule was last updated.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_list_response.py b/src/finch/types/hris/company/pay_statement_item/rule_list_response.py new file mode 100644 index 00000000..1ee27b67 --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_list_response.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleListResponse", "Attributes", "Condition"] + + +class Attributes(BaseModel): + metadata: Optional[Dict[str, object]] = None + """The metadata to be attached in the entity. + + It is a key-value pairs where the values can be of any type (string, number, + boolean, object, array, etc.). + """ + + +class Condition(BaseModel): + field: Optional[str] = None + """The field to be checked in the rule.""" + + operator: Optional[Literal["equals"]] = None + """The operator to be used in the rule.""" + + value: Optional[str] = None + """The value of the field to be checked in the rule.""" + + +class RuleListResponse(BaseModel): + id: Optional[str] = None + """Finch id (uuidv4) for the rule.""" + + attributes: Optional[Attributes] = None + """Specifies the fields to be applied when the condition is met.""" + + conditions: Optional[List[Condition]] = None + + created_at: Optional[datetime] = None + """The datetime when the rule was created.""" + + effective_end_date: Optional[str] = None + """Specifies when the rules should stop applying rules based on the date.""" + + effective_start_date: Optional[str] = None + """Specifies when the rule should begin applying based on the date.""" + + entity_type: Optional[Literal["pay_statement_item"]] = None + """The entity type to which the rule is applied.""" + + priority: Optional[int] = None + """The priority of the rule.""" + + updated_at: Optional[datetime] = None + """The datetime when the rule was last updated.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_update_params.py b/src/finch/types/hris/company/pay_statement_item/rule_update_params.py new file mode 100644 index 00000000..e0f18618 --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from ....._utils import PropertyInfo + +__all__ = ["RuleUpdateParams"] + + +class RuleUpdateParams(TypedDict, total=False): + optional_property: Annotated[object, PropertyInfo(alias="optionalProperty")] diff --git a/src/finch/types/hris/company/pay_statement_item/rule_update_response.py b/src/finch/types/hris/company/pay_statement_item/rule_update_response.py new file mode 100644 index 00000000..39253e9e --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_update_response.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from ....._models import BaseModel + +__all__ = ["RuleUpdateResponse", "Attributes", "Condition"] + + +class Attributes(BaseModel): + metadata: Optional[Dict[str, object]] = None + """The metadata to be attached in the entity. + + It is a key-value pairs where the values can be of any type (string, number, + boolean, object, array, etc.). + """ + + +class Condition(BaseModel): + field: Optional[str] = None + """The field to be checked in the rule.""" + + operator: Optional[Literal["equals"]] = None + """The operator to be used in the rule.""" + + value: Optional[str] = None + """The value of the field to be checked in the rule.""" + + +class RuleUpdateResponse(BaseModel): + id: Optional[str] = None + """Finch id (uuidv4) for the rule.""" + + attributes: Optional[Attributes] = None + """Specifies the fields to be applied when the condition is met.""" + + conditions: Optional[List[Condition]] = None + + created_at: Optional[datetime] = None + """The datetime when the rule was created.""" + + effective_end_date: Optional[str] = None + """Specifies when the rules should stop applying rules based on the date.""" + + effective_start_date: Optional[str] = None + """Specifies when the rule should begin applying based on the date.""" + + entity_type: Optional[Literal["pay_statement_item"]] = None + """The entity type to which the rule is applied.""" + + priority: Optional[int] = None + """The priority of the rule.""" + + updated_at: Optional[datetime] = None + """The datetime when the rule was last updated.""" diff --git a/src/finch/types/hris/company/pay_statement_item_list_params.py b/src/finch/types/hris/company/pay_statement_item_list_params.py new file mode 100644 index 00000000..9d4dabf6 --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item_list_params.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import date +from typing_extensions import Literal, Annotated, TypedDict + +from ...._utils import PropertyInfo + +__all__ = ["PayStatementItemListParams"] + + +class PayStatementItemListParams(TypedDict, total=False): + categories: List[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] + """Comma-delimited list of pay statement item categories to filter on. + + If empty, defaults to all categories. + """ + + end_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + The end date to retrieve pay statement items by via their last seen pay date in + `YYYY-MM-DD` format. + """ + + name: str + """Case-insensitive partial match search by pay statement item name.""" + + start_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """ + The start date to retrieve pay statement items by via their last seen pay date + (inclusive) in `YYYY-MM-DD` format. + """ + + type: str + """String search by pay statement item type.""" diff --git a/src/finch/types/hris/company/pay_statement_item_list_response.py b/src/finch/types/hris/company/pay_statement_item_list_response.py new file mode 100644 index 00000000..48a0cb0f --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item_list_response.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["PayStatementItemListResponse", "Attributes"] + + +class Attributes(BaseModel): + employer: Optional[bool] = None + """`true` if the amount is paid by the employers. + + This field is only available for taxes. + """ + + metadata: Optional[object] = None + """The metadata of the pay statement item derived by the rules engine if available. + + Each attribute will be a key-value pair defined by a rule. + """ + + pre_tax: Optional[bool] = None + """`true` if the pay statement item is pre-tax. + + This field is only available for employee deductions. + """ + + type: Optional[str] = None + """The type of the pay statement item.""" + + +class PayStatementItemListResponse(BaseModel): + attributes: Optional[Attributes] = None + """The attributes of the pay statement item.""" + + category: Optional[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] = None + """The category of the pay statement item.""" + + name: Optional[str] = None + """The name of the pay statement item.""" diff --git a/src/finch/types/hris/company_benefit.py b/src/finch/types/hris/company_benefit.py index a3eaeb9c..6b01e3fa 100644 --- a/src/finch/types/hris/company_benefit.py +++ b/src/finch/types/hris/company_benefit.py @@ -11,10 +11,12 @@ class CompanyBenefit(BaseModel): benefit_id: str + """The id of the benefit.""" description: Optional[str] = None frequency: Optional[BenefitFrequency] = None + """The frequency of the benefit deduction/contribution.""" type: Optional[BenefitType] = None """Type of benefit.""" diff --git a/src/finch/types/hris/create_company_benefits_response.py b/src/finch/types/hris/create_company_benefits_response.py index 176c024d..e96088af 100644 --- a/src/finch/types/hris/create_company_benefits_response.py +++ b/src/finch/types/hris/create_company_benefits_response.py @@ -8,3 +8,4 @@ class CreateCompanyBenefitsResponse(BaseModel): benefit_id: str + """The id of the benefit.""" diff --git a/src/finch/types/hris/employment_data.py b/src/finch/types/hris/employment_data.py index cc18ecc2..d05d7c18 100644 --- a/src/finch/types/hris/employment_data.py +++ b/src/finch/types/hris/employment_data.py @@ -40,7 +40,7 @@ class Manager(BaseModel): class EmploymentData(BaseModel): id: Optional[str] = None - """string A stable Finch `id` (UUID v4) for an individual in the company.""" + """A stable Finch `id` (UUID v4) for an individual in the company.""" class_code: Optional[str] = None """Worker's compensation classification code for this employee""" diff --git a/src/finch/types/hris/employment_data_response.py b/src/finch/types/hris/employment_data_response.py index 605e4473..54f62a6d 100644 --- a/src/finch/types/hris/employment_data_response.py +++ b/src/finch/types/hris/employment_data_response.py @@ -14,3 +14,4 @@ class EmploymentDataResponse(BaseModel): code: Optional[int] = None individual_id: Optional[str] = None + """A stable Finch `id` (UUID v4) for an individual in the company.""" diff --git a/src/finch/types/hris/individual_in_directory.py b/src/finch/types/hris/individual_in_directory.py index c29f34e1..6918c744 100644 --- a/src/finch/types/hris/individual_in_directory.py +++ b/src/finch/types/hris/individual_in_directory.py @@ -19,7 +19,7 @@ class Manager(BaseModel): class IndividualInDirectory(BaseModel): id: Optional[str] = None - """A stable Finch id (UUID v4) for an individual in the company.""" + """A stable Finch `id` (UUID v4) for an individual in the company.""" department: Optional[Department] = None """The department object.""" diff --git a/src/finch/types/hris/update_company_benefit_response.py b/src/finch/types/hris/update_company_benefit_response.py index de9f25b0..865b10d6 100644 --- a/src/finch/types/hris/update_company_benefit_response.py +++ b/src/finch/types/hris/update_company_benefit_response.py @@ -8,3 +8,4 @@ class UpdateCompanyBenefitResponse(BaseModel): benefit_id: str + """The id of the benefit.""" diff --git a/tests/api_resources/hris/benefits/test_individuals.py b/tests/api_resources/hris/benefits/test_individuals.py index 6fe22b42..afc8a2e3 100644 --- a/tests/api_resources/hris/benefits/test_individuals.py +++ b/tests/api_resources/hris/benefits/test_individuals.py @@ -9,6 +9,7 @@ from finch import Finch, AsyncFinch from tests.utils import assert_matches_type +from finch._utils import parse_date from finch.pagination import SyncSinglePage, AsyncSinglePage from finch.types.hris.benefits import ( IndividualBenefit, @@ -44,6 +45,7 @@ def test_method_enroll_many_with_all_params(self, client: Finch) -> None: "amount": 400, "type": "fixed", }, + "effective_date": parse_date("2025-01-01"), "employee_deduction": { "amount": 1000, "type": "fixed", @@ -241,6 +243,7 @@ async def test_method_enroll_many_with_all_params(self, async_client: AsyncFinch "amount": 400, "type": "fixed", }, + "effective_date": parse_date("2025-01-01"), "employee_deduction": { "amount": 1000, "type": "fixed", diff --git a/tests/api_resources/hris/company/__init__.py b/tests/api_resources/hris/company/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/hris/company/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/hris/company/pay_statement_item/__init__.py b/tests/api_resources/hris/company/pay_statement_item/__init__.py new file mode 100644 index 00000000..fd8019a9 --- /dev/null +++ b/tests/api_resources/hris/company/pay_statement_item/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/hris/company/pay_statement_item/test_rules.py b/tests/api_resources/hris/company/pay_statement_item/test_rules.py new file mode 100644 index 00000000..5cf919d9 --- /dev/null +++ b/tests/api_resources/hris/company/pay_statement_item/test_rules.py @@ -0,0 +1,330 @@ +# 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 SyncResponsesPage, AsyncResponsesPage +from finch.types.hris.company.pay_statement_item import ( + RuleListResponse, + RuleCreateResponse, + RuleDeleteResponse, + RuleUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestRules: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.create() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.create( + attributes={"metadata": {"foo": "bar"}}, + conditions=[ + { + "field": "field", + "operator": "equals", + "value": "value", + } + ], + effective_end_date="effective_end_date", + effective_start_date="effective_start_date", + entity_type="pay_statement_item", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.hris.company.pay_statement_item.rules.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Finch) -> None: + with client.hris.company.pay_statement_item.rules.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_update(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.update( + rule_id="rule_id", + ) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.update( + rule_id="rule_id", + optional_property={}, + ) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.hris.company.pay_statement_item.rules.with_raw_response.update( + rule_id="rule_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Finch) -> None: + with client.hris.company.pay_statement_item.rules.with_streaming_response.update( + rule_id="rule_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Finch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.hris.company.pay_statement_item.rules.with_raw_response.update( + rule_id="", + ) + + @parametrize + def test_method_list(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.list() + assert_matches_type(SyncResponsesPage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Finch) -> None: + response = client.hris.company.pay_statement_item.rules.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(SyncResponsesPage[RuleListResponse], rule, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Finch) -> None: + with client.hris.company.pay_statement_item.rules.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(SyncResponsesPage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_delete(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.delete( + "rule_id", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: Finch) -> None: + response = client.hris.company.pay_statement_item.rules.with_raw_response.delete( + "rule_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: Finch) -> None: + with client.hris.company.pay_statement_item.rules.with_streaming_response.delete( + "rule_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Finch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + client.hris.company.pay_statement_item.rules.with_raw_response.delete( + "", + ) + + +class TestAsyncRules: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.create() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.create( + attributes={"metadata": {"foo": "bar"}}, + conditions=[ + { + "field": "field", + "operator": "equals", + "value": "value", + } + ], + effective_end_date="effective_end_date", + effective_start_date="effective_start_date", + entity_type="pay_statement_item", + ) + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncFinch) -> None: + response = await async_client.hris.company.pay_statement_item.rules.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncFinch) -> None: + async with async_client.hris.company.pay_statement_item.rules.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleCreateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_update(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.update( + rule_id="rule_id", + ) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.update( + rule_id="rule_id", + optional_property={}, + ) + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncFinch) -> None: + response = await async_client.hris.company.pay_statement_item.rules.with_raw_response.update( + rule_id="rule_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncFinch) -> None: + async with async_client.hris.company.pay_statement_item.rules.with_streaming_response.update( + rule_id="rule_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleUpdateResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncFinch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.hris.company.pay_statement_item.rules.with_raw_response.update( + rule_id="", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.list() + assert_matches_type(AsyncResponsesPage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncFinch) -> None: + response = await async_client.hris.company.pay_statement_item.rules.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(AsyncResponsesPage[RuleListResponse], rule, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: + async with async_client.hris.company.pay_statement_item.rules.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(AsyncResponsesPage[RuleListResponse], rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_delete(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.delete( + "rule_id", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncFinch) -> None: + response = await async_client.hris.company.pay_statement_item.rules.with_raw_response.delete( + "rule_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + rule = response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncFinch) -> None: + async with async_client.hris.company.pay_statement_item.rules.with_streaming_response.delete( + "rule_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + rule = await response.parse() + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncFinch) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `rule_id` but received ''"): + await async_client.hris.company.pay_statement_item.rules.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/hris/company/test_pay_statement_item.py b/tests/api_resources/hris/company/test_pay_statement_item.py new file mode 100644 index 00000000..35f0aa08 --- /dev/null +++ b/tests/api_resources/hris/company/test_pay_statement_item.py @@ -0,0 +1,96 @@ +# 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._utils import parse_date +from finch.pagination import SyncResponsesPage, AsyncResponsesPage +from finch.types.hris.company import PayStatementItemListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPayStatementItem: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: Finch) -> None: + pay_statement_item = client.hris.company.pay_statement_item.list() + assert_matches_type(SyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Finch) -> None: + pay_statement_item = client.hris.company.pay_statement_item.list( + categories=["earnings"], + end_date=parse_date("2024-07-01"), + name="name", + start_date=parse_date("2024-01-01"), + type="base_compensation", + ) + assert_matches_type(SyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Finch) -> None: + response = client.hris.company.pay_statement_item.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_statement_item = response.parse() + assert_matches_type(SyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Finch) -> None: + with client.hris.company.pay_statement_item.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_statement_item = response.parse() + assert_matches_type(SyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncPayStatementItem: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncFinch) -> None: + pay_statement_item = await async_client.hris.company.pay_statement_item.list() + assert_matches_type(AsyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: + pay_statement_item = await async_client.hris.company.pay_statement_item.list( + categories=["earnings"], + end_date=parse_date("2024-07-01"), + name="name", + start_date=parse_date("2024-01-01"), + type="base_compensation", + ) + assert_matches_type(AsyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncFinch) -> None: + response = await async_client.hris.company.pay_statement_item.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pay_statement_item = response.parse() + assert_matches_type(AsyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: + async with async_client.hris.company.pay_statement_item.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pay_statement_item = await response.parse() + assert_matches_type(AsyncResponsesPage[PayStatementItemListResponse], pay_statement_item, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/hris/test_company.py b/tests/api_resources/hris/test_company.py index ea4052f9..8ea9dba0 100644 --- a/tests/api_resources/hris/test_company.py +++ b/tests/api_resources/hris/test_company.py @@ -9,7 +9,7 @@ from finch import Finch, AsyncFinch from tests.utils import assert_matches_type -from finch.types.hris import Company +from finch.types.hris.company import Company base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/hris/test_pay_statements.py b/tests/api_resources/hris/test_pay_statements.py index b52cc2b7..961bdba3 100644 --- a/tests/api_resources/hris/test_pay_statements.py +++ b/tests/api_resources/hris/test_pay_statements.py @@ -21,14 +21,14 @@ class TestPayStatements: @parametrize def test_method_retrieve_many(self, client: Finch) -> None: pay_statement = client.hris.pay_statements.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) assert_matches_type(SyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) @parametrize def test_raw_response_retrieve_many(self, client: Finch) -> None: response = client.hris.pay_statements.with_raw_response.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_retrieve_many(self, client: Finch) -> None: @parametrize def test_streaming_response_retrieve_many(self, client: Finch) -> None: with client.hris.pay_statements.with_streaming_response.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,14 +56,14 @@ class TestAsyncPayStatements: @parametrize async def test_method_retrieve_many(self, async_client: AsyncFinch) -> None: pay_statement = await async_client.hris.pay_statements.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) assert_matches_type(AsyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) @parametrize async def test_raw_response_retrieve_many(self, async_client: AsyncFinch) -> None: response = await async_client.hris.pay_statements.with_raw_response.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) assert response.is_closed is True @@ -74,7 +74,7 @@ async def test_raw_response_retrieve_many(self, async_client: AsyncFinch) -> Non @parametrize async def test_streaming_response_retrieve_many(self, async_client: AsyncFinch) -> None: async with async_client.hris.pay_statements.with_streaming_response.retrieve_many( - requests=[{"payment_id": "string"}], + requests=[{"payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/sandbox/test_directory.py b/tests/api_resources/sandbox/test_directory.py index 104e1a24..c7adaf51 100644 --- a/tests/api_resources/sandbox/test_directory.py +++ b/tests/api_resources/sandbox/test_directory.py @@ -79,7 +79,7 @@ def test_method_create_with_all_params(self, client: Finch) -> None: "source_id": "source_id", "state": "state", }, - "manager": {"id": "id"}, + "manager": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, "middle_name": "middle_name", "phone_numbers": [ { @@ -193,7 +193,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> "source_id": "source_id", "state": "state", }, - "manager": {"id": "id"}, + "manager": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, "middle_name": "middle_name", "phone_numbers": [ { diff --git a/tests/api_resources/sandbox/test_employment.py b/tests/api_resources/sandbox/test_employment.py index 368ae958..0dc28f1e 100644 --- a/tests/api_resources/sandbox/test_employment.py +++ b/tests/api_resources/sandbox/test_employment.py @@ -70,7 +70,7 @@ def test_method_update_with_all_params(self, client: Finch) -> None: "source_id": "source_id", "state": "state", }, - manager={"id": "id"}, + manager={"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, middle_name="middle_name", source_id="source_id", start_date="start_date", @@ -166,7 +166,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncFinch) -> "source_id": "source_id", "state": "state", }, - manager={"id": "id"}, + manager={"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}, middle_name="middle_name", source_id="source_id", start_date="start_date", diff --git a/tests/test_client.py b/tests/test_client.py index a52f63d4..309fcbac 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1640,7 +1640,7 @@ def test_get_platform(self) -> None: import threading from finch._utils import asyncify - from finch._base_client import get_platform + from finch._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)()