diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f29e96b8..36116e17 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.36.0" + ".": "1.37.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 496cf9a0..ee607421 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-bb50c0ae41ff5036adf72344d33057941f6de67c5fae811eba2e758bfa4ffd31.yml -openapi_spec_hash: 1b21e4bfc46daeef1613e410e5aa8f28 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-0105d239fcaf84750c886dfa6c2cfbf2b2087f89a48f8827c4cbe28479ebfb13.yml +openapi_spec_hash: 34895c3d3c137fb9f5a019ac5370afbb config_hash: 6d3585c0032e08d723d077d660fc8448 diff --git a/CHANGELOG.md b/CHANGELOG.md index be9676dc..371f8167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # Changelog +## 1.37.0 (2025-10-27) + +Full Changelog: [v1.36.0...v1.37.0](https://github.com/Finch-API/finch-api-python/compare/v1.36.0...v1.37.0) + +### Features + +* **api:** api update ([87b2d65](https://github.com/Finch-API/finch-api-python/commit/87b2d65bc501fe885839ba1d6c5942cc01d203c9)) +* **api:** api update ([831b170](https://github.com/Finch-API/finch-api-python/commit/831b170668e868574307830fc6eb419d4c281cc2)) +* **api:** api update ([93a72d4](https://github.com/Finch-API/finch-api-python/commit/93a72d479f74907ce25e4117a225e76082ef6c9e)) +* **api:** api update ([b676295](https://github.com/Finch-API/finch-api-python/commit/b676295b15b012c8388ca679ab9815e34ce457df)) +* **api:** api update ([3b99127](https://github.com/Finch-API/finch-api-python/commit/3b9912772396d97b16f2b5dec275ffd5c46fc4ea)) +* **api:** api update ([9885ba4](https://github.com/Finch-API/finch-api-python/commit/9885ba4aba34ab023117ed8cb03bf38bb8baaef2)) +* **api:** api update ([8d08d1b](https://github.com/Finch-API/finch-api-python/commit/8d08d1b5226654243854f230bb34727ec5ac430b)) +* **api:** api update ([647e7c6](https://github.com/Finch-API/finch-api-python/commit/647e7c62de07d1b7ee16e76592f3594b7bba373d)) +* **api:** api update ([e014b8b](https://github.com/Finch-API/finch-api-python/commit/e014b8be6ee16d732b597dd93bcd5f0573c87254)) + + +### Bug Fixes + +* **compat:** compat with `pydantic<2.8.0` when using additional fields ([2d12ad9](https://github.com/Finch-API/finch-api-python/commit/2d12ad9207864192d9166bdf21d61effeabc6ae9)) + + +### Chores + +* bump `httpx-aiohttp` version to 0.1.9 ([993af10](https://github.com/Finch-API/finch-api-python/commit/993af10b90d38c53229108e40f1ebb657003d9d6)) +* do not install brew dependencies in ./scripts/bootstrap by default ([d9ac7ed](https://github.com/Finch-API/finch-api-python/commit/d9ac7edae7fdda865513b488caa03bd305b29b58)) +* **internal:** detect missing future annotations with ruff ([c1e5e28](https://github.com/Finch-API/finch-api-python/commit/c1e5e2841ec38f9d290169abd6320fb0b8438f2f)) +* **internal:** update pydantic dependency ([1e72324](https://github.com/Finch-API/finch-api-python/commit/1e723242d8a86affd25c23a009318ed4da5e3374)) +* **types:** change optional parameter type from NotGiven to Omit ([ae486ab](https://github.com/Finch-API/finch-api-python/commit/ae486abd5198b2aa15615108ef70281b1194666c)) + ## 1.36.0 (2025-09-08) Full Changelog: [v1.35.0...v1.36.0](https://github.com/Finch-API/finch-api-python/compare/v1.35.0...v1.36.0) diff --git a/api.md b/api.md index 8dad5c14..54860760 100644 --- a/api.md +++ b/api.md @@ -41,7 +41,7 @@ from finch.types.hris import Company Methods: -- client.hris.company.retrieve() -> Company +- client.hris.company.retrieve(\*\*params) -> Company ### PayStatementItem @@ -72,8 +72,8 @@ 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 +- client.hris.company.pay_statement_item.rules.list(\*\*params) -> SyncResponsesPage[RuleListResponse] +- client.hris.company.pay_statement_item.rules.delete(rule_id, \*\*params) -> RuleDeleteResponse ## Directory @@ -157,7 +157,7 @@ from finch.types.hris import ( Methods: - client.hris.documents.list(\*\*params) -> DocumentListResponse -- client.hris.documents.retreive(document_id) -> DocumentRetreiveResponse +- client.hris.documents.retreive(document_id, \*\*params) -> DocumentRetreiveResponse ## Benefits @@ -182,10 +182,10 @@ from finch.types.hris import ( Methods: - client.hris.benefits.create(\*\*params) -> CreateCompanyBenefitsResponse -- client.hris.benefits.retrieve(benefit_id) -> CompanyBenefit +- client.hris.benefits.retrieve(benefit_id, \*\*params) -> CompanyBenefit - client.hris.benefits.update(benefit_id, \*\*params) -> UpdateCompanyBenefitResponse -- client.hris.benefits.list() -> SyncSinglePage[CompanyBenefit] -- client.hris.benefits.list_supported_benefits() -> SyncSinglePage[SupportedBenefit] +- client.hris.benefits.list(\*\*params) -> SyncSinglePage[CompanyBenefit] +- client.hris.benefits.list_supported_benefits(\*\*params) -> SyncSinglePage[SupportedBenefit] ### Individuals @@ -203,7 +203,7 @@ from finch.types.hris.benefits import ( Methods: - client.hris.benefits.individuals.enroll_many(benefit_id, \*\*params) -> EnrolledIndividualBenefitResponse -- client.hris.benefits.individuals.enrolled_ids(benefit_id) -> IndividualEnrolledIDsResponse +- client.hris.benefits.individuals.enrolled_ids(benefit_id, \*\*params) -> IndividualEnrolledIDsResponse - client.hris.benefits.individuals.retrieve_many_benefits(benefit_id, \*\*params) -> SyncSinglePage[IndividualBenefit] - client.hris.benefits.individuals.unenroll_many(benefit_id, \*\*params) -> UnenrolledIndividualBenefitResponse @@ -212,12 +212,12 @@ Methods: Types: ```python -from finch.types import Provider +from finch.types import Provider, ProviderListResponse ``` Methods: -- client.providers.list() -> SyncSinglePage[Provider] +- client.providers.list() -> SyncSinglePage[ProviderListResponse] # Account @@ -281,7 +281,7 @@ from finch.types.jobs import AutomatedAsyncJob, AutomatedCreateResponse, Automat Methods: - client.jobs.automated.create(\*\*params) -> AutomatedCreateResponse -- client.jobs.automated.retrieve(job_id, \*\*params) -> AutomatedAsyncJob +- client.jobs.automated.retrieve(job_id) -> AutomatedAsyncJob - client.jobs.automated.list(\*\*params) -> AutomatedListResponse ## Manual @@ -294,7 +294,7 @@ from finch.types.jobs import ManualAsyncJob Methods: -- client.jobs.manual.retrieve(job_id, \*\*params) -> ManualAsyncJob +- client.jobs.manual.retrieve(job_id) -> ManualAsyncJob # Sandbox @@ -420,7 +420,7 @@ from finch.types.payroll import PayGroupRetrieveResponse, PayGroupListResponse Methods: -- client.payroll.pay_groups.retrieve(pay_group_id) -> PayGroupRetrieveResponse +- client.payroll.pay_groups.retrieve(pay_group_id, \*\*params) -> PayGroupRetrieveResponse - client.payroll.pay_groups.list(\*\*params) -> SyncSinglePage[PayGroupListResponse] # Connect diff --git a/pyproject.toml b/pyproject.toml index d9e19a7f..1662b037 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "1.36.0" +version = "1.37.0" description = "The official Python library for the Finch API" dynamic = ["readme"] license = "Apache-2.0" @@ -39,7 +39,7 @@ Homepage = "https://github.com/Finch-API/finch-api-python" Repository = "https://github.com/Finch-API/finch-api-python" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] [tool.rye] managed = true @@ -224,6 +224,8 @@ select = [ "B", # remove unused imports "F401", + # check for missing future annotations + "FA102", # bare except statements "E722", # unused arguments @@ -246,6 +248,8 @@ unfixable = [ "T203", ] +extend-safe-fixes = ["FA102"] + [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" diff --git a/requirements-dev.lock b/requirements-dev.lock index b353a1ba..11981681 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -56,7 +56,7 @@ httpx==0.28.1 # via finch-api # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via finch-api idna==3.4 # via anyio @@ -88,9 +88,9 @@ pluggy==1.5.0 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via finch-api -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic pygments==2.18.0 # via rich @@ -126,6 +126,9 @@ typing-extensions==4.12.2 # via pydantic # via pydantic-core # via pyright + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic virtualenv==20.24.5 # via nox yarl==1.20.0 diff --git a/requirements.lock b/requirements.lock index a7f7f00c..b68ef972 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via finch-api # via httpx-aiohttp -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via finch-api idna==3.4 # via anyio @@ -55,9 +55,9 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via finch-api -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic sniffio==1.3.0 # via anyio @@ -68,5 +68,8 @@ typing-extensions==4.12.2 # via multidict # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic yarl==1.20.0 # via aiohttp diff --git a/scripts/bootstrap b/scripts/bootstrap index e84fe62c..b430fee3 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi diff --git a/src/finch/__init__.py b/src/finch/__init__.py index 41c80a92..7b799b16 100644 --- a/src/finch/__init__.py +++ b/src/finch/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import Finch, Client, Stream, Timeout, Transport, AsyncFinch, AsyncClient, AsyncStream, RequestOptions from ._models import BaseModel @@ -38,7 +38,9 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "FinchError", "APIError", "APIStatusError", diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index 4dee4d8e..072c469b 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -42,7 +42,6 @@ from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -146,9 +146,9 @@ def __init__( def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -596,7 +596,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -826,7 +826,7 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1371,7 +1371,7 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1847,8 +1847,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/finch/_client.py b/src/finch/_client.py index f08e2199..cb1cea55 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -4,7 +4,7 @@ import os import base64 -from typing import TYPE_CHECKING, Any, Union, Mapping +from typing import TYPE_CHECKING, Any, Mapping from typing_extensions import Self, override import httpx @@ -12,7 +12,6 @@ from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Headers, Timeout, @@ -20,6 +19,7 @@ Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library from ._compat import cached_property @@ -73,7 +73,7 @@ def __init__( client_secret: str | None = None, webhook_secret: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -261,9 +261,9 @@ def copy( client_secret: str | None = None, webhook_secret: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -423,7 +423,7 @@ def __init__( client_secret: str | None = None, webhook_secret: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -611,9 +611,9 @@ def copy( client_secret: str | None = None, webhook_secret: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/finch/_models.py b/src/finch/_models.py index 3a6017ef..6a3cd1d2 100644 --- a/src/finch/_models.py +++ b/src/finch/_models.py @@ -256,7 +256,7 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, @@ -264,6 +264,7 @@ def model_dump( warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, serialize_as_any: bool = False, + fallback: Callable[[Any], Any] | None = None, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -295,10 +296,12 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -313,13 +316,14 @@ def model_dump_json( indent: int | None = None, include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, + fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -348,11 +352,13 @@ def model_dump_json( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, diff --git a/src/finch/_qs.py b/src/finch/_qs.py index 274320ca..ada6fd3f 100644 --- a/src/finch/_qs.py +++ b/src/finch/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/finch/_types.py b/src/finch/_types.py index 9a4666ba..b99b2f91 100644 --- a/src/finch/_types.py +++ b/src/finch/_types.py @@ -118,18 +118,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -141,13 +144,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -157,8 +161,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -166,6 +170,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/finch/_utils/_transform.py b/src/finch/_utils/_transform.py index c19124f0..52075492 100644 --- a/src/finch/_utils/_transform.py +++ b/src/finch/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/finch/_utils/_utils.py b/src/finch/_utils/_utils.py index f0818595..50d59269 100644 --- a/src/finch/_utils/_utils.py +++ b/src/finch/_utils/_utils.py @@ -21,7 +21,7 @@ import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/finch/_version.py b/src/finch/_version.py index 02127b56..d2d9b5da 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.36.0" # x-release-please-version +__version__ = "1.37.0" # x-release-please-version diff --git a/src/finch/resources/access_tokens.py b/src/finch/resources/access_tokens.py index 7a171237..39599bc9 100644 --- a/src/finch/resources/access_tokens.py +++ b/src/finch/resources/access_tokens.py @@ -6,7 +6,7 @@ from .. import _legacy_response from ..types import access_token_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import is_given, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -41,15 +41,15 @@ def create( self, *, code: str, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - redirect_uri: str | NotGiven = NOT_GIVEN, + client_id: str | Omit = omit, + client_secret: str | Omit = omit, + redirect_uri: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateAccessTokenResponse: """ Exchange the authorization code for an access token @@ -127,15 +127,15 @@ async def create( self, *, code: str, - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - redirect_uri: str | NotGiven = NOT_GIVEN, + client_id: str | Omit = omit, + client_secret: str | Omit = omit, + redirect_uri: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateAccessTokenResponse: """ Exchange the authorization code for an access token diff --git a/src/finch/resources/account.py b/src/finch/resources/account.py index 7e5658fb..394a29e8 100644 --- a/src/finch/resources/account.py +++ b/src/finch/resources/account.py @@ -5,7 +5,7 @@ import httpx from .. import _legacy_response -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper @@ -44,7 +44,7 @@ def disconnect( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DisconnectResponse: """Disconnect one or more `access_token`s from your application.""" return self._post( @@ -63,7 +63,7 @@ def introspect( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Introspection: """Read account information associated with an `access_token`""" return self._get( @@ -103,7 +103,7 @@ async def disconnect( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DisconnectResponse: """Disconnect one or more `access_token`s from your application.""" return await self._post( @@ -122,7 +122,7 @@ async def introspect( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Introspection: """Read account information associated with an `access_token`""" return await self._get( diff --git a/src/finch/resources/connect/sessions.py b/src/finch/resources/connect/sessions.py index c88c3a67..66663aff 100644 --- a/src/finch/resources/connect/sessions.py +++ b/src/finch/resources/connect/sessions.py @@ -8,7 +8,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -44,42 +44,58 @@ def with_streaming_response(self) -> SessionsWithStreamingResponse: def new( self, *, + customer_email: Optional[str], customer_id: str, customer_name: str, + integration: Optional[session_new_params.Integration], + manual: Optional[bool], + minutes_to_expire: Optional[float], products: List[ Literal[ + "benefits", "company", + "deduction", "directory", - "individual", + "documents", "employment", + "individual", "payment", "pay_statement", - "benefits", "ssn", - "deduction", - "documents", ] ], - customer_email: Optional[str] | NotGiven = NOT_GIVEN, - integration: Optional[session_new_params.Integration] | NotGiven = NOT_GIVEN, - manual: Optional[bool] | NotGiven = NOT_GIVEN, - minutes_to_expire: Optional[float] | NotGiven = NOT_GIVEN, - redirect_uri: Optional[str] | NotGiven = NOT_GIVEN, - sandbox: Optional[Literal["finch", "provider"]] | NotGiven = NOT_GIVEN, + redirect_uri: Optional[str], + sandbox: Optional[Literal["finch", "provider"]], # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionNewResponse: """ Create a new connect session for an employer Args: + customer_email: Email address of the customer + + customer_id: Unique identifier for the customer + + customer_name: Name of the customer + + integration: Integration configuration for the connect session + + manual: Enable manual authentication mode + minutes_to_expire: The number of minutes until the session expires (defaults to 129,600, which is 90 days) + products: The Finch products to request access to + + redirect_uri: The URI to redirect to after the Connect flow is completed + + sandbox: Sandbox mode for testing + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -92,13 +108,13 @@ def new( "/connect/sessions", body=maybe_transform( { + "customer_email": customer_email, "customer_id": customer_id, "customer_name": customer_name, - "products": products, - "customer_email": customer_email, "integration": integration, "manual": manual, "minutes_to_expire": minutes_to_expire, + "products": products, "redirect_uri": redirect_uri, "sandbox": sandbox, }, @@ -114,31 +130,30 @@ def reauthenticate( self, *, connection_id: str, - minutes_to_expire: Optional[int] | NotGiven = NOT_GIVEN, + minutes_to_expire: int, products: Optional[ List[ Literal[ + "benefits", "company", + "deduction", "directory", - "individual", + "documents", "employment", + "individual", "payment", "pay_statement", - "benefits", "ssn", - "deduction", - "documents", ] ] - ] - | NotGiven = NOT_GIVEN, - redirect_uri: Optional[str] | NotGiven = NOT_GIVEN, + ], + redirect_uri: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionReauthenticateResponse: """ Create a new Connect session for reauthenticating an existing connection @@ -202,42 +217,58 @@ def with_streaming_response(self) -> AsyncSessionsWithStreamingResponse: async def new( self, *, + customer_email: Optional[str], customer_id: str, customer_name: str, + integration: Optional[session_new_params.Integration], + manual: Optional[bool], + minutes_to_expire: Optional[float], products: List[ Literal[ + "benefits", "company", + "deduction", "directory", - "individual", + "documents", "employment", + "individual", "payment", "pay_statement", - "benefits", "ssn", - "deduction", - "documents", ] ], - customer_email: Optional[str] | NotGiven = NOT_GIVEN, - integration: Optional[session_new_params.Integration] | NotGiven = NOT_GIVEN, - manual: Optional[bool] | NotGiven = NOT_GIVEN, - minutes_to_expire: Optional[float] | NotGiven = NOT_GIVEN, - redirect_uri: Optional[str] | NotGiven = NOT_GIVEN, - sandbox: Optional[Literal["finch", "provider"]] | NotGiven = NOT_GIVEN, + redirect_uri: Optional[str], + sandbox: Optional[Literal["finch", "provider"]], # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionNewResponse: """ Create a new connect session for an employer Args: + customer_email: Email address of the customer + + customer_id: Unique identifier for the customer + + customer_name: Name of the customer + + integration: Integration configuration for the connect session + + manual: Enable manual authentication mode + minutes_to_expire: The number of minutes until the session expires (defaults to 129,600, which is 90 days) + products: The Finch products to request access to + + redirect_uri: The URI to redirect to after the Connect flow is completed + + sandbox: Sandbox mode for testing + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -250,13 +281,13 @@ async def new( "/connect/sessions", body=await async_maybe_transform( { + "customer_email": customer_email, "customer_id": customer_id, "customer_name": customer_name, - "products": products, - "customer_email": customer_email, "integration": integration, "manual": manual, "minutes_to_expire": minutes_to_expire, + "products": products, "redirect_uri": redirect_uri, "sandbox": sandbox, }, @@ -272,31 +303,30 @@ async def reauthenticate( self, *, connection_id: str, - minutes_to_expire: Optional[int] | NotGiven = NOT_GIVEN, + minutes_to_expire: int, products: Optional[ List[ Literal[ + "benefits", "company", + "deduction", "directory", - "individual", + "documents", "employment", + "individual", "payment", "pay_statement", - "benefits", "ssn", - "deduction", - "documents", ] ] - ] - | NotGiven = NOT_GIVEN, - redirect_uri: Optional[str] | NotGiven = NOT_GIVEN, + ], + redirect_uri: Optional[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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionReauthenticateResponse: """ Create a new Connect session for reauthenticating an existing connection diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index eecb7b7f..9d5d0dde 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -7,7 +7,7 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .individuals import ( @@ -21,7 +21,15 @@ from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ....types.hris import BenefitType, BenefitFrequency, benefit_create_params, benefit_update_params +from ....types.hris import ( + BenefitType, + BenefitFrequency, + benefit_list_params, + benefit_create_params, + benefit_update_params, + benefit_retrieve_params, + benefit_list_supported_benefits_params, +) from ...._base_client import AsyncPaginator, make_request_options from ....types.hris.benefit_type import BenefitType from ....types.hris.company_benefit import CompanyBenefit @@ -60,16 +68,17 @@ def with_streaming_response(self) -> BenefitsWithStreamingResponse: def create( self, *, - company_contribution: Optional[benefit_create_params.CompanyContribution] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - frequency: Optional[BenefitFrequency] | NotGiven = NOT_GIVEN, - type: Optional[BenefitType] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + company_contribution: Optional[benefit_create_params.CompanyContribution] | Omit = omit, + description: str | Omit = omit, + frequency: Optional[BenefitFrequency] | Omit = omit, + type: Optional[BenefitType] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateCompanyBenefitsResponse: """Creates a new company-wide deduction or contribution. @@ -77,6 +86,8 @@ def create( `/providers` endpoint to view available types for each provider. Args: + entity_ids: The entity IDs to specify which entities' data to access. + company_contribution: The company match for this benefit. description: Name of the benefit as it appears in the provider and pay statements. Recommend @@ -107,7 +118,11 @@ def create( benefit_create_params.BenefitCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, benefit_create_params.BenefitCreateParams), ), cast_to=CreateCompanyBenefitsResponse, ) @@ -116,17 +131,20 @@ def retrieve( self, benefit_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompanyBenefit: """ Lists deductions and contributions information for a given item Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -140,7 +158,11 @@ def retrieve( return self._get( f"/employer/benefits/{benefit_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, benefit_retrieve_params.BenefitRetrieveParams), ), cast_to=CompanyBenefit, ) @@ -149,18 +171,21 @@ def update( self, benefit_id: str, *, - description: str | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + description: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UpdateCompanyBenefitResponse: """ Updates an existing company-wide deduction or contribution Args: + entity_ids: The entity IDs to specify which entities' data to access. + description: Updated name or description. extra_headers: Send extra headers @@ -177,7 +202,11 @@ def update( f"/employer/benefits/{benefit_id}", body=maybe_transform({"description": description}, benefit_update_params.BenefitUpdateParams), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, benefit_update_params.BenefitUpdateParams), ), cast_to=UpdateCompanyBenefitResponse, ) @@ -185,19 +214,37 @@ def update( def list( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[CompanyBenefit]: - """List all company-wide deductions and contributions.""" + """ + List all company-wide deductions and contributions. + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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/benefits", page=SyncSinglePage[CompanyBenefit], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, benefit_list_params.BenefitListParams), ), model=CompanyBenefit, ) @@ -205,19 +252,40 @@ def list( def list_supported_benefits( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[SupportedBenefit]: - """Get deductions metadata""" + """ + Get deductions metadata + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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/benefits/meta", page=SyncSinglePage[SupportedBenefit], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, + benefit_list_supported_benefits_params.BenefitListSupportedBenefitsParams, + ), ), model=SupportedBenefit, ) @@ -250,16 +318,17 @@ def with_streaming_response(self) -> AsyncBenefitsWithStreamingResponse: async def create( self, *, - company_contribution: Optional[benefit_create_params.CompanyContribution] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - frequency: Optional[BenefitFrequency] | NotGiven = NOT_GIVEN, - type: Optional[BenefitType] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + company_contribution: Optional[benefit_create_params.CompanyContribution] | Omit = omit, + description: str | Omit = omit, + frequency: Optional[BenefitFrequency] | Omit = omit, + type: Optional[BenefitType] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateCompanyBenefitsResponse: """Creates a new company-wide deduction or contribution. @@ -267,6 +336,8 @@ async def create( `/providers` endpoint to view available types for each provider. Args: + entity_ids: The entity IDs to specify which entities' data to access. + company_contribution: The company match for this benefit. description: Name of the benefit as it appears in the provider and pay statements. Recommend @@ -297,7 +368,13 @@ async def create( benefit_create_params.BenefitCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, benefit_create_params.BenefitCreateParams + ), ), cast_to=CreateCompanyBenefitsResponse, ) @@ -306,17 +383,20 @@ async def retrieve( self, benefit_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompanyBenefit: """ Lists deductions and contributions information for a given item Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -330,7 +410,13 @@ async def retrieve( return await self._get( f"/employer/benefits/{benefit_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, benefit_retrieve_params.BenefitRetrieveParams + ), ), cast_to=CompanyBenefit, ) @@ -339,18 +425,21 @@ async def update( self, benefit_id: str, *, - description: str | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + description: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UpdateCompanyBenefitResponse: """ Updates an existing company-wide deduction or contribution Args: + entity_ids: The entity IDs to specify which entities' data to access. + description: Updated name or description. extra_headers: Send extra headers @@ -367,7 +456,13 @@ async def update( f"/employer/benefits/{benefit_id}", body=await async_maybe_transform({"description": description}, benefit_update_params.BenefitUpdateParams), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, benefit_update_params.BenefitUpdateParams + ), ), cast_to=UpdateCompanyBenefitResponse, ) @@ -375,19 +470,37 @@ async def update( def list( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CompanyBenefit, AsyncSinglePage[CompanyBenefit]]: - """List all company-wide deductions and contributions.""" + """ + List all company-wide deductions and contributions. + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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/benefits", page=AsyncSinglePage[CompanyBenefit], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, benefit_list_params.BenefitListParams), ), model=CompanyBenefit, ) @@ -395,19 +508,40 @@ def list( def list_supported_benefits( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SupportedBenefit, AsyncSinglePage[SupportedBenefit]]: - """Get deductions metadata""" + """ + Get deductions metadata + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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/benefits/meta", page=AsyncSinglePage[SupportedBenefit], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, + benefit_list_supported_benefits_params.BenefitListSupportedBenefitsParams, + ), ), model=SupportedBenefit, ) diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index f9662196..cc8d67d3 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -7,7 +7,7 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -16,6 +16,7 @@ from ...._base_client import AsyncPaginator, make_request_options from ....types.hris.benefits import ( individual_enroll_many_params, + individual_enrolled_ids_params, individual_unenroll_many_params, individual_retrieve_many_benefits_params, ) @@ -51,13 +52,14 @@ def enroll_many( self, benefit_id: str, *, - individuals: Iterable[individual_enroll_many_params.Individual] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individuals: Iterable[individual_enroll_many_params.Individual] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EnrolledIndividualBenefitResponse: """Enroll an individual into a deduction or contribution. @@ -67,6 +69,8 @@ def enroll_many( enrollments, but will continue to set the state of the existing enrollment. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individuals: Array of the individual_id to enroll and a configuration object. extra_headers: Send extra headers @@ -83,7 +87,13 @@ def enroll_many( f"/employer/benefits/{benefit_id}/individuals", body=maybe_transform(individuals, Iterable[individual_enroll_many_params.Individual]), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, individual_enroll_many_params.IndividualEnrollManyParams + ), ), cast_to=EnrolledIndividualBenefitResponse, ) @@ -92,17 +102,20 @@ def enrolled_ids( self, benefit_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IndividualEnrolledIDsResponse: """ Lists individuals currently enrolled in a given deduction. Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -116,7 +129,13 @@ def enrolled_ids( return self._get( f"/employer/benefits/{benefit_id}/enrolled", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, individual_enrolled_ids_params.IndividualEnrolledIDsParams + ), ), cast_to=IndividualEnrolledIDsResponse, ) @@ -125,18 +144,21 @@ def retrieve_many_benefits( self, benefit_id: str, *, - individual_ids: str | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[IndividualBenefit]: """ Get enrollment information for the given individuals. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all individuals @@ -159,7 +181,10 @@ def retrieve_many_benefits( extra_body=extra_body, timeout=timeout, query=maybe_transform( - {"individual_ids": individual_ids}, + { + "entity_ids": entity_ids, + "individual_ids": individual_ids, + }, individual_retrieve_many_benefits_params.IndividualRetrieveManyBenefitsParams, ), ), @@ -170,18 +195,21 @@ def unenroll_many( self, benefit_id: str, *, - individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UnenrolledIndividualBenefitResponse: """ Unenroll individuals from a deduction or contribution Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: Array of individual_ids to unenroll. extra_headers: Send extra headers @@ -200,7 +228,13 @@ def unenroll_many( {"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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, individual_unenroll_many_params.IndividualUnenrollManyParams + ), ), cast_to=UnenrolledIndividualBenefitResponse, ) @@ -230,13 +264,14 @@ async def enroll_many( self, benefit_id: str, *, - individuals: Iterable[individual_enroll_many_params.Individual] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individuals: Iterable[individual_enroll_many_params.Individual] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EnrolledIndividualBenefitResponse: """Enroll an individual into a deduction or contribution. @@ -246,6 +281,8 @@ async def enroll_many( enrollments, but will continue to set the state of the existing enrollment. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individuals: Array of the individual_id to enroll and a configuration object. extra_headers: Send extra headers @@ -262,7 +299,13 @@ async def enroll_many( f"/employer/benefits/{benefit_id}/individuals", body=await async_maybe_transform(individuals, Iterable[individual_enroll_many_params.Individual]), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, individual_enroll_many_params.IndividualEnrollManyParams + ), ), cast_to=EnrolledIndividualBenefitResponse, ) @@ -271,17 +314,20 @@ async def enrolled_ids( self, benefit_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IndividualEnrolledIDsResponse: """ Lists individuals currently enrolled in a given deduction. Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -295,7 +341,13 @@ async def enrolled_ids( return await self._get( f"/employer/benefits/{benefit_id}/enrolled", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, individual_enrolled_ids_params.IndividualEnrolledIDsParams + ), ), cast_to=IndividualEnrolledIDsResponse, ) @@ -304,18 +356,21 @@ def retrieve_many_benefits( self, benefit_id: str, *, - individual_ids: str | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IndividualBenefit, AsyncSinglePage[IndividualBenefit]]: """ Get enrollment information for the given individuals. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all individuals @@ -338,7 +393,10 @@ def retrieve_many_benefits( extra_body=extra_body, timeout=timeout, query=maybe_transform( - {"individual_ids": individual_ids}, + { + "entity_ids": entity_ids, + "individual_ids": individual_ids, + }, individual_retrieve_many_benefits_params.IndividualRetrieveManyBenefitsParams, ), ), @@ -349,18 +407,21 @@ async def unenroll_many( self, benefit_id: str, *, - individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UnenrolledIndividualBenefitResponse: """ Unenroll individuals from a deduction or contribution Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: Array of individual_ids to unenroll. extra_headers: Send extra headers @@ -379,7 +440,13 @@ async def unenroll_many( {"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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, individual_unenroll_many_params.IndividualUnenrollManyParams + ), ), cast_to=UnenrolledIndividualBenefitResponse, ) diff --git a/src/finch/resources/hris/company/company.py b/src/finch/resources/hris/company/company.py index c4b39f5b..159b6e64 100644 --- a/src/finch/resources/hris/company/company.py +++ b/src/finch/resources/hris/company/company.py @@ -5,10 +5,12 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +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 ....types.hris import company_retrieve_params from ...._base_client import make_request_options from ....types.hris.company.company import Company from .pay_statement_item.pay_statement_item import ( @@ -50,18 +52,36 @@ def with_streaming_response(self) -> CompanyResourceWithStreamingResponse: def retrieve( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Company: - """Read basic company data""" + """ + Read basic company data + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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( "/employer/company", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, company_retrieve_params.CompanyRetrieveParams), ), cast_to=Company, ) @@ -94,18 +114,38 @@ def with_streaming_response(self) -> AsyncCompanyResourceWithStreamingResponse: async def retrieve( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Company: - """Read basic company data""" + """ + Read basic company data + + Args: + entity_ids: The entity IDs to specify which entities' data to access. + + 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._get( "/employer/company", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, company_retrieve_params.CompanyRetrieveParams + ), ), cast_to=Company, ) 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 index 5ddda1bc..8234b6df 100644 --- 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 @@ -17,7 +17,7 @@ RulesWithStreamingResponse, AsyncRulesWithStreamingResponse, ) -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ....._utils import maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource @@ -57,18 +57,18 @@ def with_streaming_response(self) -> PayStatementItemWithStreamingResponse: 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, + categories: List[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] | Omit = omit, + end_date: Union[str, date] | Omit = omit, + entity_ids: SequenceNotStr[str] | Omit = omit, + name: str | Omit = omit, + start_date: Union[str, date] | Omit = omit, + type: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncResponsesPage[PayStatementItemListResponse]: """ **Beta:** this endpoint currently serves employers onboarded after March 4th and @@ -82,6 +82,8 @@ def list( end_date: The end date to retrieve pay statement items by via their last seen pay date in `YYYY-MM-DD` format. + entity_ids: The entity IDs to specify which entities' data to access. + 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 @@ -109,6 +111,7 @@ def list( { "categories": categories, "end_date": end_date, + "entity_ids": entity_ids, "name": name, "start_date": start_date, "type": type, @@ -147,18 +150,18 @@ def with_streaming_response(self) -> AsyncPayStatementItemWithStreamingResponse: 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, + categories: List[Literal["earnings", "taxes", "employee_deductions", "employer_contributions"]] | Omit = omit, + end_date: Union[str, date] | Omit = omit, + entity_ids: SequenceNotStr[str] | Omit = omit, + name: str | Omit = omit, + start_date: Union[str, date] | Omit = omit, + type: str | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PayStatementItemListResponse, AsyncResponsesPage[PayStatementItemListResponse]]: """ **Beta:** this endpoint currently serves employers onboarded after March 4th and @@ -172,6 +175,8 @@ def list( end_date: The end date to retrieve pay statement items by via their last seen pay date in `YYYY-MM-DD` format. + entity_ids: The entity IDs to specify which entities' data to access. + 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 @@ -199,6 +204,7 @@ def list( { "categories": categories, "end_date": end_date, + "entity_ids": entity_ids, "name": name, "start_date": start_date, "type": type, diff --git a/src/finch/resources/hris/company/pay_statement_item/rules.py b/src/finch/resources/hris/company/pay_statement_item/rules.py index e85597be..13bf20d0 100644 --- a/src/finch/resources/hris/company/pay_statement_item/rules.py +++ b/src/finch/resources/hris/company/pay_statement_item/rules.py @@ -8,14 +8,19 @@ import httpx from ..... import _legacy_response -from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given 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 import ( + rule_list_params, + rule_create_params, + rule_delete_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 @@ -47,17 +52,18 @@ def with_streaming_response(self) -> RulesWithStreamingResponse: 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, + entity_ids: SequenceNotStr[str] | Omit = omit, + attributes: rule_create_params.Attributes | Omit = omit, + conditions: Iterable[rule_create_params.Condition] | Omit = omit, + effective_end_date: Optional[str] | Omit = omit, + effective_start_date: Optional[str] | Omit = omit, + entity_type: Literal["pay_statement_item"] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RuleCreateResponse: """ **Beta:** this endpoint currently serves employers onboarded after March 4th and @@ -68,6 +74,8 @@ def create( information is available. Args: + entity_ids: The entity IDs to create the rule for. + 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. @@ -97,7 +105,11 @@ def create( rule_create_params.RuleCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, rule_create_params.RuleCreateParams), ), cast_to=RuleCreateResponse, ) @@ -106,19 +118,22 @@ def update( self, rule_id: str, *, - optional_property: object | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + optional_property: object | Omit = omit, # 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, + 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: + entity_ids: The entity IDs to update the rule for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -133,7 +148,11 @@ def update( 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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, rule_update_params.RuleUpdateParams), ), cast_to=RuleUpdateResponse, ) @@ -141,22 +160,38 @@ def update( def list( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + 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. + + Args: + entity_ids: The entity IDs to retrieve rules for. + + 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/rule", page=SyncResponsesPage[RuleListResponse], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, rule_list_params.RuleListParams), ), model=RuleListResponse, ) @@ -165,18 +200,21 @@ def delete( self, rule_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + 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: + entity_ids: The entity IDs to delete the rule for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -190,7 +228,11 @@ def delete( 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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, rule_delete_params.RuleDeleteParams), ), cast_to=RuleDeleteResponse, ) @@ -219,17 +261,18 @@ def with_streaming_response(self) -> AsyncRulesWithStreamingResponse: 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, + entity_ids: SequenceNotStr[str] | Omit = omit, + attributes: rule_create_params.Attributes | Omit = omit, + conditions: Iterable[rule_create_params.Condition] | Omit = omit, + effective_end_date: Optional[str] | Omit = omit, + effective_start_date: Optional[str] | Omit = omit, + entity_type: Literal["pay_statement_item"] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RuleCreateResponse: """ **Beta:** this endpoint currently serves employers onboarded after March 4th and @@ -240,6 +283,8 @@ async def create( information is available. Args: + entity_ids: The entity IDs to create the rule for. + 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. @@ -269,7 +314,11 @@ async def create( rule_create_params.RuleCreateParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"entity_ids": entity_ids}, rule_create_params.RuleCreateParams), ), cast_to=RuleCreateResponse, ) @@ -278,19 +327,22 @@ async def update( self, rule_id: str, *, - optional_property: object | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + optional_property: object | Omit = omit, # 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, + 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: + entity_ids: The entity IDs to update the rule for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -307,7 +359,11 @@ async def update( {"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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"entity_ids": entity_ids}, rule_update_params.RuleUpdateParams), ), cast_to=RuleUpdateResponse, ) @@ -315,22 +371,38 @@ async def update( def list( self, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + 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. + + Args: + entity_ids: The entity IDs to retrieve rules for. + + 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/rule", page=AsyncResponsesPage[RuleListResponse], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, rule_list_params.RuleListParams), ), model=RuleListResponse, ) @@ -339,18 +411,21 @@ async def delete( self, rule_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + 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: + entity_ids: The entity IDs to delete the rule for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -364,7 +439,11 @@ async def delete( 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 + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"entity_ids": entity_ids}, rule_delete_params.RuleDeleteParams), ), cast_to=RuleDeleteResponse, ) diff --git a/src/finch/resources/hris/directory.py b/src/finch/resources/hris/directory.py index e4e6827e..32068b06 100644 --- a/src/finch/resources/hris/directory.py +++ b/src/finch/resources/hris/directory.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -43,19 +43,22 @@ def with_streaming_response(self) -> DirectoryWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncIndividualsPage[IndividualInDirectory]: """ Read company directory and organization structure Args: + entity_ids: The entity IDs to specify which entities' data to access. + limit: Number of employees to return (defaults to all) offset: Index to start from (defaults to 0) @@ -78,6 +81,7 @@ def list( timeout=timeout, query=maybe_transform( { + "entity_ids": entity_ids, "limit": limit, "offset": offset, }, @@ -91,19 +95,22 @@ def list( def list_individuals( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncIndividualsPage[IndividualInDirectory]: """ Read company directory and organization structure Args: + entity_ids: The entity IDs to specify which entities' data to access. + limit: Number of employees to return (defaults to all) offset: Index to start from (defaults to 0) @@ -117,6 +124,7 @@ def list_individuals( timeout: Override the client-level default timeout for this request, in seconds """ return self.list( + entity_ids=entity_ids, limit=limit, offset=offset, extra_headers=extra_headers, @@ -149,19 +157,22 @@ def with_streaming_response(self) -> AsyncDirectoryWithStreamingResponse: def list( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IndividualInDirectory, AsyncIndividualsPage[IndividualInDirectory]]: """ Read company directory and organization structure Args: + entity_ids: The entity IDs to specify which entities' data to access. + limit: Number of employees to return (defaults to all) offset: Index to start from (defaults to 0) @@ -184,6 +195,7 @@ def list( timeout=timeout, query=maybe_transform( { + "entity_ids": entity_ids, "limit": limit, "offset": offset, }, @@ -197,19 +209,22 @@ def list( def list_individuals( self, *, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IndividualInDirectory, AsyncIndividualsPage[IndividualInDirectory]]: """ Read company directory and organization structure Args: + entity_ids: The entity IDs to specify which entities' data to access. + limit: Number of employees to return (defaults to all) offset: Index to start from (defaults to 0) @@ -223,6 +238,7 @@ def list_individuals( timeout: Override the client-level default timeout for this request, in seconds """ return self.list( + entity_ids=entity_ids, limit=limit, offset=offset, extra_headers=extra_headers, diff --git a/src/finch/resources/hris/documents.py b/src/finch/resources/hris/documents.py index ce3085e8..e7dc7c73 100644 --- a/src/finch/resources/hris/documents.py +++ b/src/finch/resources/hris/documents.py @@ -8,12 +8,12 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given 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 ...types.hris import document_list_params +from ...types.hris import document_list_params, document_retreive_params from ..._base_client import make_request_options from ...types.hris.document_list_response import DocumentListResponse from ...types.hris.document_retreive_response import DocumentRetreiveResponse @@ -44,16 +44,17 @@ def with_streaming_response(self) -> DocumentsWithStreamingResponse: def list( self, *, - individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + types: List[Literal["w4_2020", "w4_2005"]] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DocumentListResponse: """**Beta:** This endpoint is in beta and may change. @@ -61,6 +62,8 @@ def list( company-wide documents. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all individuals @@ -88,6 +91,7 @@ def list( timeout=timeout, query=maybe_transform( { + "entity_ids": entity_ids, "individual_ids": individual_ids, "limit": limit, "offset": offset, @@ -103,12 +107,13 @@ def retreive( self, document_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DocumentRetreiveResponse: """**Beta:** This endpoint is in beta and may change. @@ -116,6 +121,8 @@ def retreive( specific document by its ID. Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -131,7 +138,11 @@ def retreive( self._get( f"/employer/documents/{document_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, document_retreive_params.DocumentRetreiveParams), ), cast_to=cast( Any, DocumentRetreiveResponse @@ -163,16 +174,17 @@ def with_streaming_response(self) -> AsyncDocumentsWithStreamingResponse: async def list( self, *, - individual_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, - types: List[Literal["w4_2020", "w4_2005"]] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_ids: SequenceNotStr[str] | Omit = omit, + limit: int | Omit = omit, + offset: int | Omit = omit, + types: List[Literal["w4_2020", "w4_2005"]] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DocumentListResponse: """**Beta:** This endpoint is in beta and may change. @@ -180,6 +192,8 @@ async def list( company-wide documents. Args: + entity_ids: The entity IDs to specify which entities' data to access. + individual_ids: Comma-delimited list of stable Finch uuids for each individual. If empty, defaults to all individuals @@ -207,6 +221,7 @@ async def list( timeout=timeout, query=await async_maybe_transform( { + "entity_ids": entity_ids, "individual_ids": individual_ids, "limit": limit, "offset": offset, @@ -222,12 +237,13 @@ async def retreive( self, document_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DocumentRetreiveResponse: """**Beta:** This endpoint is in beta and may change. @@ -235,6 +251,8 @@ async def retreive( specific document by its ID. Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -250,7 +268,13 @@ async def retreive( await self._get( f"/employer/documents/{document_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, document_retreive_params.DocumentRetreiveParams + ), ), cast_to=cast( Any, DocumentRetreiveResponse diff --git a/src/finch/resources/hris/employments.py b/src/finch/resources/hris/employments.py index 14bdd1ad..6374b0b7 100644 --- a/src/finch/resources/hris/employments.py +++ b/src/finch/resources/hris/employments.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -44,12 +44,13 @@ def retrieve_many( self, *, requests: Iterable[employment_retrieve_many_params.Request], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncResponsesPage[EmploymentDataResponse]: """ Read individual employment and income data @@ -57,6 +58,8 @@ def retrieve_many( Args: requests: The array of batch requests. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -70,7 +73,13 @@ def retrieve_many( page=SyncResponsesPage[EmploymentDataResponse], body=maybe_transform({"requests": requests}, employment_retrieve_many_params.EmploymentRetrieveManyParams), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, employment_retrieve_many_params.EmploymentRetrieveManyParams + ), ), model=EmploymentDataResponse, method="post", @@ -101,12 +110,13 @@ def retrieve_many( self, *, requests: Iterable[employment_retrieve_many_params.Request], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[EmploymentDataResponse, AsyncResponsesPage[EmploymentDataResponse]]: """ Read individual employment and income data @@ -114,6 +124,8 @@ def retrieve_many( Args: requests: The array of batch requests. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -127,7 +139,13 @@ def retrieve_many( page=AsyncResponsesPage[EmploymentDataResponse], body=maybe_transform({"requests": requests}, employment_retrieve_many_params.EmploymentRetrieveManyParams), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, employment_retrieve_many_params.EmploymentRetrieveManyParams + ), ), model=EmploymentDataResponse, method="post", diff --git a/src/finch/resources/hris/individuals.py b/src/finch/resources/hris/individuals.py index 1d5e4aae..b4a966c0 100644 --- a/src/finch/resources/hris/individuals.py +++ b/src/finch/resources/hris/individuals.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -43,19 +43,22 @@ def with_streaming_response(self) -> IndividualsWithStreamingResponse: def retrieve_many( self, *, - options: Optional[individual_retrieve_many_params.Options] | NotGiven = NOT_GIVEN, - requests: Iterable[individual_retrieve_many_params.Request] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + options: Optional[individual_retrieve_many_params.Options] | Omit = omit, + requests: Iterable[individual_retrieve_many_params.Request] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncResponsesPage[IndividualResponse]: """ Read individual data, excluding income and employment data Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -75,7 +78,13 @@ def retrieve_many( individual_retrieve_many_params.IndividualRetrieveManyParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, individual_retrieve_many_params.IndividualRetrieveManyParams + ), ), model=IndividualResponse, method="post", @@ -105,19 +114,22 @@ def with_streaming_response(self) -> AsyncIndividualsWithStreamingResponse: def retrieve_many( self, *, - options: Optional[individual_retrieve_many_params.Options] | NotGiven = NOT_GIVEN, - requests: Iterable[individual_retrieve_many_params.Request] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + options: Optional[individual_retrieve_many_params.Options] | Omit = omit, + requests: Iterable[individual_retrieve_many_params.Request] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IndividualResponse, AsyncResponsesPage[IndividualResponse]]: """ Read individual data, excluding income and employment data Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -137,7 +149,13 @@ def retrieve_many( individual_retrieve_many_params.IndividualRetrieveManyParams, ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, individual_retrieve_many_params.IndividualRetrieveManyParams + ), ), model=IndividualResponse, method="post", diff --git a/src/finch/resources/hris/pay_statements.py b/src/finch/resources/hris/pay_statements.py index a4d919b5..bcae95c8 100644 --- a/src/finch/resources/hris/pay_statements.py +++ b/src/finch/resources/hris/pay_statements.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -44,12 +44,13 @@ def retrieve_many( self, *, requests: Iterable[pay_statement_retrieve_many_params.Request], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncResponsesPage[PayStatementResponse]: """ Read detailed pay statements for each individual. @@ -60,6 +61,8 @@ def retrieve_many( Args: requests: The array of batch requests. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -75,7 +78,13 @@ def retrieve_many( {"requests": requests}, pay_statement_retrieve_many_params.PayStatementRetrieveManyParams ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, pay_statement_retrieve_many_params.PayStatementRetrieveManyParams + ), ), model=PayStatementResponse, method="post", @@ -106,12 +115,13 @@ def retrieve_many( self, *, requests: Iterable[pay_statement_retrieve_many_params.Request], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PayStatementResponse, AsyncResponsesPage[PayStatementResponse]]: """ Read detailed pay statements for each individual. @@ -122,6 +132,8 @@ def retrieve_many( Args: requests: The array of batch requests. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -137,7 +149,13 @@ def retrieve_many( {"requests": requests}, pay_statement_retrieve_many_params.PayStatementRetrieveManyParams ), options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"entity_ids": entity_ids}, pay_statement_retrieve_many_params.PayStatementRetrieveManyParams + ), ), model=PayStatementResponse, method="post", diff --git a/src/finch/resources/hris/payments.py b/src/finch/resources/hris/payments.py index f9e2010b..94543492 100644 --- a/src/finch/resources/hris/payments.py +++ b/src/finch/resources/hris/payments.py @@ -8,7 +8,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,12 +46,13 @@ def list( *, end_date: Union[str, date], start_date: Union[str, date], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[Payment]: """ Read payroll and contractor related payments by the company. @@ -63,6 +64,8 @@ def list( start_date: The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -83,6 +86,7 @@ def list( { "end_date": end_date, "start_date": start_date, + "entity_ids": entity_ids, }, payment_list_params.PaymentListParams, ), @@ -116,12 +120,13 @@ def list( *, end_date: Union[str, date], start_date: Union[str, date], + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Payment, AsyncSinglePage[Payment]]: """ Read payroll and contractor related payments by the company. @@ -133,6 +138,8 @@ def list( start_date: The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -153,6 +160,7 @@ def list( { "end_date": end_date, "start_date": start_date, + "entity_ids": entity_ids, }, payment_list_params.PaymentListParams, ), diff --git a/src/finch/resources/jobs/automated.py b/src/finch/resources/jobs/automated.py index eb4e7ca9..687e1389 100644 --- a/src/finch/resources/jobs/automated.py +++ b/src/finch/resources/jobs/automated.py @@ -7,12 +7,12 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import required_args, 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 ...types.jobs import automated_list_params, automated_create_params, automated_retrieve_params +from ...types.jobs import automated_list_params, automated_create_params from ..._base_client import make_request_options from ...types.jobs.automated_async_job import AutomatedAsyncJob from ...types.jobs.automated_list_response import AutomatedListResponse @@ -51,7 +51,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: """ Enqueue an automated job. @@ -93,7 +93,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: """ Enqueue an automated job. @@ -129,13 +129,13 @@ def create( self, *, type: Literal["data_sync_all"] | Literal["w4_form_employee_sync"], - params: automated_create_params.W4FormEmployeeSyncParams | NotGiven = NOT_GIVEN, + params: automated_create_params.W4FormEmployeeSyncParams | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: return self._post( "/jobs/automated", @@ -156,22 +156,17 @@ def retrieve( self, job_id: str, *, - entity_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedAsyncJob: """ Get an automated job by `job_id`. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -185,11 +180,7 @@ def retrieve( return self._get( f"/jobs/automated/{job_id}", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"entity_id": entity_id}, automated_retrieve_params.AutomatedRetrieveParams), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=AutomatedAsyncJob, ) @@ -197,15 +188,14 @@ def retrieve( def list( self, *, - entity_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedListResponse: """Get all automated jobs. @@ -214,10 +204,6 @@ def list( as data syncs, only the next scheduled job is shown. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - limit: Number of items to return offset: Index to start from (defaults to 0) @@ -239,7 +225,6 @@ def list( timeout=timeout, query=maybe_transform( { - "entity_id": entity_id, "limit": limit, "offset": offset, }, @@ -280,7 +265,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: """ Enqueue an automated job. @@ -322,7 +307,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: """ Enqueue an automated job. @@ -358,13 +343,13 @@ async def create( self, *, type: Literal["data_sync_all"] | Literal["w4_form_employee_sync"], - params: automated_create_params.W4FormEmployeeSyncParams | NotGiven = NOT_GIVEN, + params: automated_create_params.W4FormEmployeeSyncParams | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedCreateResponse: return await self._post( "/jobs/automated", @@ -385,22 +370,17 @@ async def retrieve( self, job_id: str, *, - entity_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedAsyncJob: """ Get an automated job by `job_id`. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -414,13 +394,7 @@ async def retrieve( return await self._get( f"/jobs/automated/{job_id}", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"entity_id": entity_id}, automated_retrieve_params.AutomatedRetrieveParams - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=AutomatedAsyncJob, ) @@ -428,15 +402,14 @@ async def retrieve( async def list( self, *, - entity_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - offset: int | NotGiven = NOT_GIVEN, + limit: int | Omit = omit, + offset: int | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AutomatedListResponse: """Get all automated jobs. @@ -445,10 +418,6 @@ async def list( as data syncs, only the next scheduled job is shown. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - limit: Number of items to return offset: Index to start from (defaults to 0) @@ -470,7 +439,6 @@ async def list( timeout=timeout, query=await async_maybe_transform( { - "entity_id": entity_id, "limit": limit, "offset": offset, }, diff --git a/src/finch/resources/jobs/manual.py b/src/finch/resources/jobs/manual.py index de9a8413..e2f4d6d8 100644 --- a/src/finch/resources/jobs/manual.py +++ b/src/finch/resources/jobs/manual.py @@ -5,12 +5,10 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import maybe_transform, async_maybe_transform +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ...types.jobs import manual_retrieve_params from ..._base_client import make_request_options from ...types.jobs.manual_async_job import ManualAsyncJob @@ -41,13 +39,12 @@ def retrieve( self, job_id: str, *, - entity_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ManualAsyncJob: """Get a manual job by `job_id`. @@ -55,10 +52,6 @@ def retrieve( Assisted Benefits jobs. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -72,11 +65,7 @@ def retrieve( return self._get( f"/jobs/manual/{job_id}", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"entity_id": entity_id}, manual_retrieve_params.ManualRetrieveParams), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=ManualAsyncJob, ) @@ -106,13 +95,12 @@ async def retrieve( self, job_id: str, *, - entity_id: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ManualAsyncJob: """Get a manual job by `job_id`. @@ -120,10 +108,6 @@ async def retrieve( Assisted Benefits jobs. Args: - entity_id: The entity ID to use when authenticating with a multi-account token. Required - when using a multi-account token to specify which entity's data to access. - Example: `123e4567-e89b-12d3-a456-426614174000` - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -137,13 +121,7 @@ async def retrieve( return await self._get( f"/jobs/manual/{job_id}", options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"entity_id": entity_id}, manual_retrieve_params.ManualRetrieveParams - ), + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=ManualAsyncJob, ) diff --git a/src/finch/resources/payroll/pay_groups.py b/src/finch/resources/payroll/pay_groups.py index da646900..0202884e 100644 --- a/src/finch/resources/payroll/pay_groups.py +++ b/src/finch/resources/payroll/pay_groups.py @@ -5,14 +5,14 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr -from ..._utils import maybe_transform +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +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 SyncSinglePage, AsyncSinglePage from ..._base_client import AsyncPaginator, make_request_options -from ...types.payroll import pay_group_list_params +from ...types.payroll import pay_group_list_params, pay_group_retrieve_params from ...types.payroll.pay_group_list_response import PayGroupListResponse from ...types.payroll.pay_group_retrieve_response import PayGroupRetrieveResponse @@ -43,17 +43,20 @@ def retrieve( self, pay_group_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PayGroupRetrieveResponse: """ Read information from a single pay group Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -67,7 +70,11 @@ def retrieve( return self._get( f"/employer/pay-groups/{pay_group_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"entity_ids": entity_ids}, pay_group_retrieve_params.PayGroupRetrieveParams), ), cast_to=PayGroupRetrieveResponse, ) @@ -75,19 +82,22 @@ def retrieve( def list( self, *, - individual_id: str | NotGiven = NOT_GIVEN, - pay_frequencies: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_id: str | Omit = omit, + pay_frequencies: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[PayGroupListResponse]: """ Read company pay groups and frequencies Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -106,6 +116,7 @@ def list( timeout=timeout, query=maybe_transform( { + "entity_ids": entity_ids, "individual_id": individual_id, "pay_frequencies": pay_frequencies, }, @@ -140,17 +151,20 @@ async def retrieve( self, pay_group_id: str, *, + entity_ids: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PayGroupRetrieveResponse: """ Read information from a single pay group Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -164,7 +178,13 @@ async def retrieve( return await self._get( f"/employer/pay-groups/{pay_group_id}", options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"entity_ids": entity_ids}, pay_group_retrieve_params.PayGroupRetrieveParams + ), ), cast_to=PayGroupRetrieveResponse, ) @@ -172,19 +192,22 @@ async def retrieve( def list( self, *, - individual_id: str | NotGiven = NOT_GIVEN, - pay_frequencies: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + entity_ids: SequenceNotStr[str] | Omit = omit, + individual_id: str | Omit = omit, + pay_frequencies: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PayGroupListResponse, AsyncSinglePage[PayGroupListResponse]]: """ Read company pay groups and frequencies Args: + entity_ids: The entity IDs to specify which entities' data to access. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -203,6 +226,7 @@ def list( timeout=timeout, query=maybe_transform( { + "entity_ids": entity_ids, "individual_id": individual_id, "pay_frequencies": pay_frequencies, }, diff --git a/src/finch/resources/providers.py b/src/finch/resources/providers.py index 76fc8852..9fc6fad3 100644 --- a/src/finch/resources/providers.py +++ b/src/finch/resources/providers.py @@ -5,13 +5,13 @@ import httpx from .. import _legacy_response -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import AsyncPaginator, make_request_options -from ..types.provider import Provider +from ..types.provider_list_response import ProviderListResponse __all__ = ["Providers", "AsyncProviders"] @@ -44,16 +44,16 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Provider]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncSinglePage[ProviderListResponse]: """Return details on all available payroll and HR systems.""" return self._get_api_list( "/providers", - page=SyncSinglePage[Provider], + page=SyncSinglePage[ProviderListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Provider, + model=ProviderListResponse, ) @@ -85,16 +85,16 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Provider, AsyncSinglePage[Provider]]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[ProviderListResponse, AsyncSinglePage[ProviderListResponse]]: """Return details on all available payroll and HR systems.""" return self._get_api_list( "/providers", - page=AsyncSinglePage[Provider], + page=AsyncSinglePage[ProviderListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=Provider, + model=ProviderListResponse, ) diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 619d784b..62e2a25e 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx from .. import _legacy_response from ..types import request_forwarding_forward_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -44,15 +44,15 @@ def forward( *, method: str, route: str, - data: Optional[str] | NotGiven = NOT_GIVEN, - headers: Optional[object] | NotGiven = NOT_GIVEN, - params: Optional[object] | NotGiven = NOT_GIVEN, + data: Optional[str] | Omit = omit, + headers: Optional[Dict[str, Optional[object]]] | Omit = omit, + params: Optional[Dict[str, Optional[object]]] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestForwardingForwardResponse: """The Forward API allows you to make direct requests to an employment system. @@ -131,15 +131,15 @@ async def forward( *, method: str, route: str, - data: Optional[str] | NotGiven = NOT_GIVEN, - headers: Optional[object] | NotGiven = NOT_GIVEN, - params: Optional[object] | NotGiven = NOT_GIVEN, + data: Optional[str] | Omit = omit, + headers: Optional[Dict[str, Optional[object]]] | Omit = omit, + params: Optional[Dict[str, Optional[object]]] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RequestForwardingForwardResponse: """The Forward API allows you to make direct requests to an employment system. diff --git a/src/finch/resources/sandbox/company.py b/src/finch/resources/sandbox/company.py index 9b76b1c0..45c87dc9 100644 --- a/src/finch/resources/sandbox/company.py +++ b/src/finch/resources/sandbox/company.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompanyUpdateResponse: """ Update a sandbox company's data @@ -143,7 +143,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompanyUpdateResponse: """ Update a sandbox company's data diff --git a/src/finch/resources/sandbox/connections/accounts.py b/src/finch/resources/sandbox/connections/accounts.py index 956cd971..e38e2a2d 100644 --- a/src/finch/resources/sandbox/connections/accounts.py +++ b/src/finch/resources/sandbox/connections/accounts.py @@ -7,7 +7,7 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -46,14 +46,14 @@ def create( *, company_id: str, provider_id: str, - authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, - products: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | Omit = omit, + products: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountCreateResponse: """ Create a new account for an existing connection (company/provider pair) @@ -92,13 +92,13 @@ def create( def update( self, *, - connection_status: ConnectionStatusType | NotGiven = NOT_GIVEN, + connection_status: ConnectionStatusType | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountUpdateResponse: """Update an existing sandbox account. @@ -149,14 +149,14 @@ async def create( *, company_id: str, provider_id: str, - authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, - products: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | Omit = omit, + products: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountCreateResponse: """ Create a new account for an existing connection (company/provider pair) @@ -195,13 +195,13 @@ async def create( async def update( self, *, - connection_status: ConnectionStatusType | NotGiven = NOT_GIVEN, + connection_status: ConnectionStatusType | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountUpdateResponse: """Update an existing sandbox account. diff --git a/src/finch/resources/sandbox/connections/connections.py b/src/finch/resources/sandbox/connections/connections.py index 146e6739..c4c35dc3 100644 --- a/src/finch/resources/sandbox/connections/connections.py +++ b/src/finch/resources/sandbox/connections/connections.py @@ -15,7 +15,7 @@ AccountsWithStreamingResponse, AsyncAccountsWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -55,15 +55,15 @@ def create( self, *, provider_id: str, - authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, - employee_size: int | NotGiven = NOT_GIVEN, - products: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | Omit = omit, + employee_size: int | Omit = omit, + products: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectionCreateResponse: """ Create a new connection (new company/provider pair) with a new account @@ -129,15 +129,15 @@ async def create( self, *, provider_id: str, - authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, - employee_size: int | NotGiven = NOT_GIVEN, - products: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + authentication_type: Literal["credential", "api_token", "oauth", "assisted"] | Omit = omit, + employee_size: int | Omit = omit, + products: SequenceNotStr[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConnectionCreateResponse: """ Create a new connection (new company/provider pair) with a new account diff --git a/src/finch/resources/sandbox/directory.py b/src/finch/resources/sandbox/directory.py index 4d3378ca..2afba6a5 100644 --- a/src/finch/resources/sandbox/directory.py +++ b/src/finch/resources/sandbox/directory.py @@ -7,7 +7,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -42,13 +42,13 @@ def with_streaming_response(self) -> DirectoryWithStreamingResponse: def create( self, *, - body: Iterable[directory_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[directory_create_params.Body] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryCreateResponse: """ Add new individuals to a sandbox company @@ -98,13 +98,13 @@ def with_streaming_response(self) -> AsyncDirectoryWithStreamingResponse: async def create( self, *, - body: Iterable[directory_create_params.Body] | NotGiven = NOT_GIVEN, + body: Iterable[directory_create_params.Body] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DirectoryCreateResponse: """ Add new individuals to a sandbox company diff --git a/src/finch/resources/sandbox/employment.py b/src/finch/resources/sandbox/employment.py index 56d44d15..55bd7581 100644 --- a/src/finch/resources/sandbox/employment.py +++ b/src/finch/resources/sandbox/employment.py @@ -8,7 +8,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -46,33 +46,33 @@ def update( self, individual_id: str, *, - class_code: Optional[str] | NotGiven = NOT_GIVEN, - custom_fields: Optional[Iterable[employment_update_params.CustomField]] | NotGiven = NOT_GIVEN, - department: Optional[employment_update_params.Department] | NotGiven = NOT_GIVEN, - employment: Optional[employment_update_params.Employment] | NotGiven = NOT_GIVEN, + class_code: Optional[str] | Omit = omit, + custom_fields: Optional[Iterable[employment_update_params.CustomField]] | Omit = omit, + department: Optional[employment_update_params.Department] | Omit = omit, + employment: Optional[employment_update_params.Employment] | Omit = omit, employment_status: Optional[ Literal["active", "deceased", "leave", "onboarding", "prehire", "retired", "terminated"] ] - | NotGiven = NOT_GIVEN, - end_date: Optional[str] | NotGiven = NOT_GIVEN, - first_name: Optional[str] | NotGiven = NOT_GIVEN, - income: Optional[IncomeParam] | NotGiven = NOT_GIVEN, - income_history: Optional[Iterable[Optional[IncomeParam]]] | NotGiven = NOT_GIVEN, - is_active: Optional[bool] | NotGiven = NOT_GIVEN, - last_name: Optional[str] | NotGiven = NOT_GIVEN, - latest_rehire_date: Optional[str] | NotGiven = NOT_GIVEN, - location: Optional[LocationParam] | NotGiven = NOT_GIVEN, - manager: Optional[employment_update_params.Manager] | NotGiven = NOT_GIVEN, - middle_name: Optional[str] | NotGiven = NOT_GIVEN, - source_id: Optional[str] | NotGiven = NOT_GIVEN, - start_date: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + end_date: Optional[str] | Omit = omit, + first_name: Optional[str] | Omit = omit, + income: Optional[IncomeParam] | Omit = omit, + income_history: Optional[Iterable[Optional[IncomeParam]]] | Omit = omit, + is_active: Optional[bool] | Omit = omit, + last_name: Optional[str] | Omit = omit, + latest_rehire_date: Optional[str] | Omit = omit, + location: Optional[LocationParam] | Omit = omit, + manager: Optional[employment_update_params.Manager] | Omit = omit, + middle_name: Optional[str] | Omit = omit, + source_id: Optional[str] | Omit = omit, + start_date: Optional[str] | Omit = omit, + title: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EmploymentUpdateResponse: """ Update sandbox employment @@ -179,33 +179,33 @@ async def update( self, individual_id: str, *, - class_code: Optional[str] | NotGiven = NOT_GIVEN, - custom_fields: Optional[Iterable[employment_update_params.CustomField]] | NotGiven = NOT_GIVEN, - department: Optional[employment_update_params.Department] | NotGiven = NOT_GIVEN, - employment: Optional[employment_update_params.Employment] | NotGiven = NOT_GIVEN, + class_code: Optional[str] | Omit = omit, + custom_fields: Optional[Iterable[employment_update_params.CustomField]] | Omit = omit, + department: Optional[employment_update_params.Department] | Omit = omit, + employment: Optional[employment_update_params.Employment] | Omit = omit, employment_status: Optional[ Literal["active", "deceased", "leave", "onboarding", "prehire", "retired", "terminated"] ] - | NotGiven = NOT_GIVEN, - end_date: Optional[str] | NotGiven = NOT_GIVEN, - first_name: Optional[str] | NotGiven = NOT_GIVEN, - income: Optional[IncomeParam] | NotGiven = NOT_GIVEN, - income_history: Optional[Iterable[Optional[IncomeParam]]] | NotGiven = NOT_GIVEN, - is_active: Optional[bool] | NotGiven = NOT_GIVEN, - last_name: Optional[str] | NotGiven = NOT_GIVEN, - latest_rehire_date: Optional[str] | NotGiven = NOT_GIVEN, - location: Optional[LocationParam] | NotGiven = NOT_GIVEN, - manager: Optional[employment_update_params.Manager] | NotGiven = NOT_GIVEN, - middle_name: Optional[str] | NotGiven = NOT_GIVEN, - source_id: Optional[str] | NotGiven = NOT_GIVEN, - start_date: Optional[str] | NotGiven = NOT_GIVEN, - title: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + end_date: Optional[str] | Omit = omit, + first_name: Optional[str] | Omit = omit, + income: Optional[IncomeParam] | Omit = omit, + income_history: Optional[Iterable[Optional[IncomeParam]]] | Omit = omit, + is_active: Optional[bool] | Omit = omit, + last_name: Optional[str] | Omit = omit, + latest_rehire_date: Optional[str] | Omit = omit, + location: Optional[LocationParam] | Omit = omit, + manager: Optional[employment_update_params.Manager] | Omit = omit, + middle_name: Optional[str] | Omit = omit, + source_id: Optional[str] | Omit = omit, + start_date: Optional[str] | Omit = omit, + title: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EmploymentUpdateResponse: """ Update sandbox employment diff --git a/src/finch/resources/sandbox/individual.py b/src/finch/resources/sandbox/individual.py index fdd077b8..5b9041c0 100644 --- a/src/finch/resources/sandbox/individual.py +++ b/src/finch/resources/sandbox/individual.py @@ -8,7 +8,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,9 +45,9 @@ def update( self, individual_id: str, *, - dob: Optional[str] | NotGiven = NOT_GIVEN, - emails: Optional[Iterable[individual_update_params.Email]] | NotGiven = NOT_GIVEN, - encrypted_ssn: Optional[str] | NotGiven = NOT_GIVEN, + dob: Optional[str] | Omit = omit, + emails: Optional[Iterable[individual_update_params.Email]] | Omit = omit, + encrypted_ssn: Optional[str] | Omit = omit, ethnicity: Optional[ Literal[ "asian", @@ -60,21 +60,21 @@ def update( "decline_to_specify", ] ] - | NotGiven = NOT_GIVEN, - first_name: Optional[str] | NotGiven = NOT_GIVEN, - gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] | NotGiven = NOT_GIVEN, - last_name: Optional[str] | NotGiven = NOT_GIVEN, - middle_name: Optional[str] | NotGiven = NOT_GIVEN, - phone_numbers: Optional[Iterable[Optional[individual_update_params.PhoneNumber]]] | NotGiven = NOT_GIVEN, - preferred_name: Optional[str] | NotGiven = NOT_GIVEN, - residence: Optional[LocationParam] | NotGiven = NOT_GIVEN, - ssn: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + first_name: Optional[str] | Omit = omit, + gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] | Omit = omit, + last_name: Optional[str] | Omit = omit, + middle_name: Optional[str] | Omit = omit, + phone_numbers: Optional[Iterable[Optional[individual_update_params.PhoneNumber]]] | Omit = omit, + preferred_name: Optional[str] | Omit = omit, + residence: Optional[LocationParam] | Omit = omit, + ssn: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IndividualUpdateResponse: """ Update sandbox individual @@ -163,9 +163,9 @@ async def update( self, individual_id: str, *, - dob: Optional[str] | NotGiven = NOT_GIVEN, - emails: Optional[Iterable[individual_update_params.Email]] | NotGiven = NOT_GIVEN, - encrypted_ssn: Optional[str] | NotGiven = NOT_GIVEN, + dob: Optional[str] | Omit = omit, + emails: Optional[Iterable[individual_update_params.Email]] | Omit = omit, + encrypted_ssn: Optional[str] | Omit = omit, ethnicity: Optional[ Literal[ "asian", @@ -178,21 +178,21 @@ async def update( "decline_to_specify", ] ] - | NotGiven = NOT_GIVEN, - first_name: Optional[str] | NotGiven = NOT_GIVEN, - gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] | NotGiven = NOT_GIVEN, - last_name: Optional[str] | NotGiven = NOT_GIVEN, - middle_name: Optional[str] | NotGiven = NOT_GIVEN, - phone_numbers: Optional[Iterable[Optional[individual_update_params.PhoneNumber]]] | NotGiven = NOT_GIVEN, - preferred_name: Optional[str] | NotGiven = NOT_GIVEN, - residence: Optional[LocationParam] | NotGiven = NOT_GIVEN, - ssn: Optional[str] | NotGiven = NOT_GIVEN, + | Omit = omit, + first_name: Optional[str] | Omit = omit, + gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] | Omit = omit, + last_name: Optional[str] | Omit = omit, + middle_name: Optional[str] | Omit = omit, + phone_numbers: Optional[Iterable[Optional[individual_update_params.PhoneNumber]]] | Omit = omit, + preferred_name: Optional[str] | Omit = omit, + residence: Optional[LocationParam] | Omit = omit, + ssn: Optional[str] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IndividualUpdateResponse: """ Update sandbox individual diff --git a/src/finch/resources/sandbox/jobs/configuration.py b/src/finch/resources/sandbox/jobs/configuration.py index 3fac04cf..f8839411 100644 --- a/src/finch/resources/sandbox/jobs/configuration.py +++ b/src/finch/resources/sandbox/jobs/configuration.py @@ -7,7 +7,7 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConfigurationRetrieveResponse: """Get configurations for sandbox jobs""" return self._get( @@ -69,7 +69,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SandboxJobConfiguration: """ Update configurations for sandbox jobs @@ -127,7 +127,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConfigurationRetrieveResponse: """Get configurations for sandbox jobs""" return await self._get( @@ -148,7 +148,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SandboxJobConfiguration: """ Update configurations for sandbox jobs diff --git a/src/finch/resources/sandbox/jobs/jobs.py b/src/finch/resources/sandbox/jobs/jobs.py index 38abe210..070bd293 100644 --- a/src/finch/resources/sandbox/jobs/jobs.py +++ b/src/finch/resources/sandbox/jobs/jobs.py @@ -7,7 +7,7 @@ import httpx from .... import _legacy_response -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import Body, Query, Headers, NotGiven, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -60,7 +60,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> JobCreateResponse: """Enqueue a new sandbox job @@ -120,7 +120,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> JobCreateResponse: """Enqueue a new sandbox job diff --git a/src/finch/resources/sandbox/payment.py b/src/finch/resources/sandbox/payment.py index dc2ec15e..2506f49d 100644 --- a/src/finch/resources/sandbox/payment.py +++ b/src/finch/resources/sandbox/payment.py @@ -8,7 +8,7 @@ import httpx from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -43,15 +43,15 @@ def with_streaming_response(self) -> PaymentWithStreamingResponse: def create( self, *, - end_date: Union[str, date] | NotGiven = NOT_GIVEN, - pay_statements: Iterable[payment_create_params.PayStatement] | NotGiven = NOT_GIVEN, - start_date: Union[str, date] | NotGiven = NOT_GIVEN, + end_date: Union[str, date] | Omit = omit, + pay_statements: Iterable[payment_create_params.PayStatement] | Omit = omit, + start_date: Union[str, date] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PaymentCreateResponse: """ Add a new sandbox payment @@ -107,15 +107,15 @@ def with_streaming_response(self) -> AsyncPaymentWithStreamingResponse: async def create( self, *, - end_date: Union[str, date] | NotGiven = NOT_GIVEN, - pay_statements: Iterable[payment_create_params.PayStatement] | NotGiven = NOT_GIVEN, - start_date: Union[str, date] | NotGiven = NOT_GIVEN, + end_date: Union[str, date] | Omit = omit, + pay_statements: Iterable[payment_create_params.PayStatement] | Omit = omit, + start_date: Union[str, date] | Omit = omit, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PaymentCreateResponse: """ Add a new sandbox payment diff --git a/src/finch/types/__init__.py b/src/finch/types/__init__.py index 14bf231d..4981087b 100644 --- a/src/finch/types/__init__.py +++ b/src/finch/types/__init__.py @@ -11,7 +11,6 @@ OperationSupportMatrix as OperationSupportMatrix, ) from .location import Location as Location -from .provider import Provider as Provider from .income_param import IncomeParam as IncomeParam from .company_event import CompanyEvent as CompanyEvent from .introspection import Introspection as Introspection @@ -26,6 +25,7 @@ from .pay_statement_event import PayStatementEvent as PayStatementEvent from .account_update_event import AccountUpdateEvent as AccountUpdateEvent from .job_completion_event import JobCompletionEvent as JobCompletionEvent +from .provider_list_response import ProviderListResponse as ProviderListResponse from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams from .create_access_token_response import CreateAccessTokenResponse as CreateAccessTokenResponse from .request_forwarding_forward_params import RequestForwardingForwardParams as RequestForwardingForwardParams diff --git a/src/finch/types/connect/session_new_params.py b/src/finch/types/connect/session_new_params.py index f49dc752..f62c3f1d 100644 --- a/src/finch/types/connect/session_new_params.py +++ b/src/finch/types/connect/session_new_params.py @@ -9,45 +9,55 @@ class SessionNewParams(TypedDict, total=False): + customer_email: Required[Optional[str]] + """Email address of the customer""" + customer_id: Required[str] + """Unique identifier for the customer""" customer_name: Required[str] + """Name of the customer""" + + integration: Required[Optional[Integration]] + """Integration configuration for the connect session""" + + manual: Required[Optional[bool]] + """Enable manual authentication mode""" + + minutes_to_expire: Required[Optional[float]] + """ + The number of minutes until the session expires (defaults to 129,600, which is + 90 days) + """ products: Required[ List[ Literal[ + "benefits", "company", + "deduction", "directory", - "individual", + "documents", "employment", + "individual", "payment", "pay_statement", - "benefits", "ssn", - "deduction", - "documents", ] ] ] + """The Finch products to request access to""" - customer_email: Optional[str] - - integration: Optional[Integration] - - manual: Optional[bool] - - minutes_to_expire: Optional[float] - """ - The number of minutes until the session expires (defaults to 129,600, which is - 90 days) - """ - - redirect_uri: Optional[str] + redirect_uri: Required[Optional[str]] + """The URI to redirect to after the Connect flow is completed""" - sandbox: Optional[Literal["finch", "provider"]] + sandbox: Required[Optional[Literal["finch", "provider"]]] + """Sandbox mode for testing""" class Integration(TypedDict, total=False): - auth_method: Optional[Literal["assisted", "credential", "oauth", "api_token"]] + auth_method: Required[Optional[Literal["assisted", "credential", "oauth", "api_token"]]] + """The authentication method to use""" - provider: Optional[str] + provider: Required[Optional[str]] + """The provider to integrate with""" diff --git a/src/finch/types/connect/session_reauthenticate_params.py b/src/finch/types/connect/session_reauthenticate_params.py index 124100a5..2e7023ce 100644 --- a/src/finch/types/connect/session_reauthenticate_params.py +++ b/src/finch/types/connect/session_reauthenticate_params.py @@ -12,29 +12,31 @@ class SessionReauthenticateParams(TypedDict, total=False): connection_id: Required[str] """The ID of the existing connection to reauthenticate""" - minutes_to_expire: Optional[int] + minutes_to_expire: Required[int] """ The number of minutes until the session expires (defaults to 43,200, which is 30 days) """ - products: Optional[ - List[ - Literal[ - "company", - "directory", - "individual", - "employment", - "payment", - "pay_statement", - "benefits", - "ssn", - "deduction", - "documents", + products: Required[ + Optional[ + List[ + Literal[ + "benefits", + "company", + "deduction", + "directory", + "documents", + "employment", + "individual", + "payment", + "pay_statement", + "ssn", + ] ] ] ] """The products to request access to (optional for reauthentication)""" - redirect_uri: Optional[str] + redirect_uri: Required[Optional[str]] """The URI to redirect to after the Connect flow is completed""" diff --git a/src/finch/types/create_access_token_response.py b/src/finch/types/create_access_token_response.py index beddef23..0aacdf48 100644 --- a/src/finch/types/create_access_token_response.py +++ b/src/finch/types/create_access_token_response.py @@ -25,6 +25,9 @@ class CreateAccessTokenResponse(BaseModel): - `finch` - finch-generated data. """ + entity_ids: List[str] + """An array of entity IDs that can be accessed with this access token""" + products: List[str] """An array of the authorized products associated with the `access_token`""" diff --git a/src/finch/types/hris/__init__.py b/src/finch/types/hris/__init__.py index cbb3ebd9..eb98fa99 100644 --- a/src/finch/types/hris/__init__.py +++ b/src/finch/types/hris/__init__.py @@ -15,17 +15,19 @@ from .benefit_frequency import BenefitFrequency as BenefitFrequency from .document_response import DocumentResponse as DocumentResponse from .supported_benefit import SupportedBenefit as SupportedBenefit -from .benfit_contribution import BenfitContribution as BenfitContribution +from .benefit_list_params import BenefitListParams as BenefitListParams from .individual_response import IndividualResponse as IndividualResponse from .payment_list_params import PaymentListParams as PaymentListParams -from .benefit_contribution import BenefitContribution as BenefitContribution from .document_list_params import DocumentListParams as DocumentListParams from .benefit_create_params import BenefitCreateParams as BenefitCreateParams from .benefit_update_params import BenefitUpdateParams as BenefitUpdateParams from .directory_list_params import DirectoryListParams as DirectoryListParams from .document_list_response import DocumentListResponse as DocumentListResponse from .pay_statement_response import PayStatementResponse as PayStatementResponse +from .benefit_retrieve_params import BenefitRetrieveParams as BenefitRetrieveParams +from .company_retrieve_params import CompanyRetrieveParams as CompanyRetrieveParams from .individual_in_directory import IndividualInDirectory as IndividualInDirectory +from .document_retreive_params import DocumentRetreiveParams as DocumentRetreiveParams from .employment_data_response import EmploymentDataResponse as EmploymentDataResponse from .support_per_benefit_type import SupportPerBenefitType as SupportPerBenefitType from .document_retreive_response import DocumentRetreiveResponse as DocumentRetreiveResponse @@ -38,3 +40,6 @@ from .directory_list_individuals_params import DirectoryListIndividualsParams as DirectoryListIndividualsParams from .pay_statement_retrieve_many_params import PayStatementRetrieveManyParams as PayStatementRetrieveManyParams from .pay_statement_data_sync_in_progress import PayStatementDataSyncInProgress as PayStatementDataSyncInProgress +from .benefit_list_supported_benefits_params import ( + BenefitListSupportedBenefitsParams as BenefitListSupportedBenefitsParams, +) diff --git a/src/finch/types/hris/benefit_contribution.py b/src/finch/types/hris/benefit_contribution.py deleted file mode 100644 index 66423a85..00000000 --- a/src/finch/types/hris/benefit_contribution.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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__ = ["BenefitContribution"] - - -class BenefitContribution(BaseModel): - amount: Optional[int] = None - """Contribution amount in cents (if `fixed`) or basis points (if `percent`).""" - - type: Optional[Literal["fixed", "percent"]] = None - """Contribution type.""" diff --git a/src/finch/types/hris/benefit_create_params.py b/src/finch/types/hris/benefit_create_params.py index 48b21cf3..e4a39b39 100644 --- a/src/finch/types/hris/benefit_create_params.py +++ b/src/finch/types/hris/benefit_create_params.py @@ -5,6 +5,7 @@ from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from ..._types import SequenceNotStr from .benefit_type import BenefitType from .benefit_frequency import BenefitFrequency @@ -12,6 +13,9 @@ class BenefitCreateParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + company_contribution: Optional[CompanyContribution] """The company match for this benefit.""" diff --git a/src/finch/types/hris/benefit_list_params.py b/src/finch/types/hris/benefit_list_params.py new file mode 100644 index 00000000..4dcc7014 --- /dev/null +++ b/src/finch/types/hris/benefit_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["BenefitListParams"] + + +class BenefitListParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/benefit_list_supported_benefits_params.py b/src/finch/types/hris/benefit_list_supported_benefits_params.py new file mode 100644 index 00000000..81ef1435 --- /dev/null +++ b/src/finch/types/hris/benefit_list_supported_benefits_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["BenefitListSupportedBenefitsParams"] + + +class BenefitListSupportedBenefitsParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/benefit_retrieve_params.py b/src/finch/types/hris/benefit_retrieve_params.py new file mode 100644 index 00000000..2a7c870a --- /dev/null +++ b/src/finch/types/hris/benefit_retrieve_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["BenefitRetrieveParams"] + + +class BenefitRetrieveParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/benefit_update_params.py b/src/finch/types/hris/benefit_update_params.py index 33ddfff2..1fe5a338 100644 --- a/src/finch/types/hris/benefit_update_params.py +++ b/src/finch/types/hris/benefit_update_params.py @@ -4,9 +4,14 @@ from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["BenefitUpdateParams"] class BenefitUpdateParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + description: str """Updated name or description.""" diff --git a/src/finch/types/hris/benefits/__init__.py b/src/finch/types/hris/benefits/__init__.py index 90057bb2..47052d79 100644 --- a/src/finch/types/hris/benefits/__init__.py +++ b/src/finch/types/hris/benefits/__init__.py @@ -4,6 +4,7 @@ from .individual_benefit import IndividualBenefit as IndividualBenefit from .individual_enroll_many_params import IndividualEnrollManyParams as IndividualEnrollManyParams +from .individual_enrolled_ids_params import IndividualEnrolledIDsParams as IndividualEnrolledIDsParams from .individual_unenroll_many_params import IndividualUnenrollManyParams as IndividualUnenrollManyParams from .individual_enrolled_ids_response import IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse from .enrolled_individual_benefit_response import EnrolledIndividualBenefitResponse as EnrolledIndividualBenefitResponse diff --git a/src/finch/types/hris/benefits/individual_benefit.py b/src/finch/types/hris/benefits/individual_benefit.py index f550fdc2..c230f16f 100644 --- a/src/finch/types/hris/benefits/individual_benefit.py +++ b/src/finch/types/hris/benefits/individual_benefit.py @@ -1,12 +1,86 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import List, Union, Optional from typing_extensions import Literal, TypeAlias from ...._models import BaseModel -from ..benefit_contribution import BenefitContribution -__all__ = ["IndividualBenefit", "Body", "BodyUnionMember0", "BodyBatchError"] +__all__ = [ + "IndividualBenefit", + "Body", + "BodyUnionMember0", + "BodyUnionMember0CompanyContribution", + "BodyUnionMember0CompanyContributionUnionMember0", + "BodyUnionMember0CompanyContributionUnionMember1", + "BodyUnionMember0CompanyContributionUnionMember2", + "BodyUnionMember0CompanyContributionUnionMember2Tier", + "BodyUnionMember0EmployeeDeduction", + "BodyUnionMember0EmployeeDeductionUnionMember0", + "BodyUnionMember0EmployeeDeductionUnionMember1", + "BodyBatchError", +] + + +class BodyUnionMember0CompanyContributionUnionMember0(BaseModel): + amount: int + """Contribution amount in cents.""" + + type: Literal["fixed"] + """Fixed contribution type.""" + + +class BodyUnionMember0CompanyContributionUnionMember1(BaseModel): + amount: int + """Contribution amount in basis points (1/100th of a percent).""" + + type: Literal["percent"] + """Percentage contribution type.""" + + +class BodyUnionMember0CompanyContributionUnionMember2Tier(BaseModel): + match: int + + threshold: int + + +class BodyUnionMember0CompanyContributionUnionMember2(BaseModel): + tiers: List[BodyUnionMember0CompanyContributionUnionMember2Tier] + """ + Array of tier objects defining employer match tiers based on employee + contribution thresholds. + """ + + type: Literal["tiered"] + """Tiered contribution type (only valid for company_contribution).""" + + +BodyUnionMember0CompanyContribution: TypeAlias = Union[ + BodyUnionMember0CompanyContributionUnionMember0, + BodyUnionMember0CompanyContributionUnionMember1, + BodyUnionMember0CompanyContributionUnionMember2, + None, +] + + +class BodyUnionMember0EmployeeDeductionUnionMember0(BaseModel): + amount: int + """Contribution amount in cents.""" + + type: Literal["fixed"] + """Fixed contribution type.""" + + +class BodyUnionMember0EmployeeDeductionUnionMember1(BaseModel): + amount: int + """Contribution amount in basis points (1/100th of a percent).""" + + type: Literal["percent"] + """Percentage contribution type.""" + + +BodyUnionMember0EmployeeDeduction: TypeAlias = Union[ + BodyUnionMember0EmployeeDeductionUnionMember0, BodyUnionMember0EmployeeDeductionUnionMember1, None +] class BodyUnionMember0(BaseModel): @@ -21,9 +95,9 @@ class BodyUnionMember0(BaseModel): for this individual. """ - company_contribution: Optional[BenefitContribution] = None + company_contribution: Optional[BodyUnionMember0CompanyContribution] = None - employee_deduction: Optional[BenefitContribution] = None + employee_deduction: Optional[BodyUnionMember0EmployeeDeduction] = None hsa_contribution_limit: Optional[Literal["individual", "family"]] = None """Type for HSA contribution limit if the benefit is a HSA.""" 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 d0ea3f43..1988387c 100644 --- a/src/finch/types/hris/benefits/individual_enroll_many_params.py +++ b/src/finch/types/hris/benefits/individual_enroll_many_params.py @@ -4,8 +4,9 @@ from typing import Union, Iterable, Optional from datetime import date -from typing_extensions import Literal, Annotated, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict +from ...._types import SequenceNotStr from ...._utils import PropertyInfo __all__ = [ @@ -13,15 +14,27 @@ "Individual", "IndividualConfiguration", "IndividualConfigurationCompanyContribution", + "IndividualConfigurationCompanyContributionTier", "IndividualConfigurationEmployeeDeduction", ] class IndividualEnrollManyParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + individuals: Iterable[Individual] """Array of the individual_id to enroll and a configuration object.""" +class IndividualConfigurationCompanyContributionTier(TypedDict, total=False): + match: Required[int] + """The employer match percentage in basis points (0-10000 = 0-100%)""" + + threshold: Required[int] + """The employee contribution threshold in basis points (0-10000 = 0-100%)""" + + class IndividualConfigurationCompanyContribution(TypedDict, total=False): amount: int """ @@ -29,7 +42,13 @@ class IndividualConfigurationCompanyContribution(TypedDict, total=False): percent type """ - type: Literal["fixed", "percent"] + tiers: Iterable[IndividualConfigurationCompanyContributionTier] + """ + Array of tier objects for tiered contribution matching (required when type is + tiered) + """ + + type: Literal["fixed", "percent", "tiered"] class IndividualConfigurationEmployeeDeduction(TypedDict, total=False): diff --git a/src/finch/types/hris/benefits/individual_enrolled_ids_params.py b/src/finch/types/hris/benefits/individual_enrolled_ids_params.py new file mode 100644 index 00000000..405cd23c --- /dev/null +++ b/src/finch/types/hris/benefits/individual_enrolled_ids_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ...._types import SequenceNotStr + +__all__ = ["IndividualEnrolledIDsParams"] + + +class IndividualEnrolledIDsParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/benefits/individual_retrieve_many_benefits_params.py b/src/finch/types/hris/benefits/individual_retrieve_many_benefits_params.py index dab473e1..f56bc521 100644 --- a/src/finch/types/hris/benefits/individual_retrieve_many_benefits_params.py +++ b/src/finch/types/hris/benefits/individual_retrieve_many_benefits_params.py @@ -4,10 +4,15 @@ from typing_extensions import TypedDict +from ...._types import SequenceNotStr + __all__ = ["IndividualRetrieveManyBenefitsParams"] class IndividualRetrieveManyBenefitsParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + individual_ids: str """comma-delimited list of stable Finch uuids for each individual. diff --git a/src/finch/types/hris/benefits/individual_unenroll_many_params.py b/src/finch/types/hris/benefits/individual_unenroll_many_params.py index 28263e89..d68a5a39 100644 --- a/src/finch/types/hris/benefits/individual_unenroll_many_params.py +++ b/src/finch/types/hris/benefits/individual_unenroll_many_params.py @@ -10,5 +10,8 @@ class IndividualUnenrollManyParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + individual_ids: SequenceNotStr[str] """Array of individual_ids to unenroll.""" diff --git a/src/finch/types/hris/benefits_support.py b/src/finch/types/hris/benefits_support.py index 99160dd4..9b443bc8 100644 --- a/src/finch/types/hris/benefits_support.py +++ b/src/finch/types/hris/benefits_support.py @@ -35,9 +35,14 @@ class BenefitsSupport(BaseModel): simple_ira: Optional[BenefitFeaturesAndOperations] = None - __pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + # Stub to indicate that arbitrary properties are accepted. # To access properties that are not valid identifiers you can use `getattr`, e.g. # `getattr(obj, '$type')` def __getattr__(self, attr: str) -> Optional[BenefitFeaturesAndOperations]: ... + else: + __pydantic_extra__: Dict[str, Optional[BenefitFeaturesAndOperations]] diff --git a/src/finch/types/hris/benfit_contribution.py b/src/finch/types/hris/benfit_contribution.py deleted file mode 100644 index 1e864568..00000000 --- a/src/finch/types/hris/benfit_contribution.py +++ /dev/null @@ -1,8 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .benefit_contribution import BenefitContribution - -__all__ = ["BenfitContribution"] - -BenfitContribution = BenefitContribution -"""use `BenefitContribution` instead""" diff --git a/src/finch/types/hris/company/pay_statement_item/__init__.py b/src/finch/types/hris/company/pay_statement_item/__init__.py index 15e0b3ff..4ff8bafc 100644 --- a/src/finch/types/hris/company/pay_statement_item/__init__.py +++ b/src/finch/types/hris/company/pay_statement_item/__init__.py @@ -2,7 +2,9 @@ from __future__ import annotations +from .rule_list_params import RuleListParams as RuleListParams from .rule_create_params import RuleCreateParams as RuleCreateParams +from .rule_delete_params import RuleDeleteParams as RuleDeleteParams from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .rule_create_response import RuleCreateResponse as RuleCreateResponse 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 index 8154426b..3b380745 100644 --- 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 @@ -5,10 +5,15 @@ from typing import Dict, Iterable, Optional from typing_extensions import Literal, TypedDict +from ....._types import SequenceNotStr + __all__ = ["RuleCreateParams", "Attributes", "Condition"] class RuleCreateParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to create the rule for.""" + attributes: Attributes """Specifies the fields to be applied when the condition is met.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_delete_params.py b/src/finch/types/hris/company/pay_statement_item/rule_delete_params.py new file mode 100644 index 00000000..c242816f --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_delete_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ....._types import SequenceNotStr + +__all__ = ["RuleDeleteParams"] + + +class RuleDeleteParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to delete the rule for.""" diff --git a/src/finch/types/hris/company/pay_statement_item/rule_list_params.py b/src/finch/types/hris/company/pay_statement_item/rule_list_params.py new file mode 100644 index 00000000..5786e11d --- /dev/null +++ b/src/finch/types/hris/company/pay_statement_item/rule_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ....._types import SequenceNotStr + +__all__ = ["RuleListParams"] + + +class RuleListParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to retrieve rules for.""" 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 index e0f18618..5795a8dd 100644 --- 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 @@ -4,10 +4,14 @@ from typing_extensions import Annotated, TypedDict +from ....._types import SequenceNotStr from ....._utils import PropertyInfo __all__ = ["RuleUpdateParams"] class RuleUpdateParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to update the rule for.""" + optional_property: Annotated[object, PropertyInfo(alias="optionalProperty")] 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 index 9d4dabf6..88fc9e77 100644 --- a/src/finch/types/hris/company/pay_statement_item_list_params.py +++ b/src/finch/types/hris/company/pay_statement_item_list_params.py @@ -6,6 +6,7 @@ from datetime import date from typing_extensions import Literal, Annotated, TypedDict +from ...._types import SequenceNotStr from ...._utils import PropertyInfo __all__ = ["PayStatementItemListParams"] @@ -24,6 +25,9 @@ class PayStatementItemListParams(TypedDict, total=False): `YYYY-MM-DD` format. """ + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + name: str """Case-insensitive partial match search by pay statement item name.""" diff --git a/src/finch/types/hris/company_retrieve_params.py b/src/finch/types/hris/company_retrieve_params.py new file mode 100644 index 00000000..c7d819a2 --- /dev/null +++ b/src/finch/types/hris/company_retrieve_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["CompanyRetrieveParams"] + + +class CompanyRetrieveParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/directory_list_individuals_params.py b/src/finch/types/hris/directory_list_individuals_params.py index b70a073e..ec734722 100644 --- a/src/finch/types/hris/directory_list_individuals_params.py +++ b/src/finch/types/hris/directory_list_individuals_params.py @@ -4,10 +4,15 @@ from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["DirectoryListIndividualsParams"] class DirectoryListIndividualsParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + limit: int """Number of employees to return (defaults to all)""" diff --git a/src/finch/types/hris/directory_list_params.py b/src/finch/types/hris/directory_list_params.py index f6aceee4..77a5e5ee 100644 --- a/src/finch/types/hris/directory_list_params.py +++ b/src/finch/types/hris/directory_list_params.py @@ -4,10 +4,15 @@ from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["DirectoryListParams"] class DirectoryListParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + limit: int """Number of employees to return (defaults to all)""" diff --git a/src/finch/types/hris/document_list_params.py b/src/finch/types/hris/document_list_params.py index 23b35355..ad599d1a 100644 --- a/src/finch/types/hris/document_list_params.py +++ b/src/finch/types/hris/document_list_params.py @@ -11,6 +11,9 @@ class DocumentListParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + individual_ids: SequenceNotStr[str] """Comma-delimited list of stable Finch uuids for each individual. diff --git a/src/finch/types/hris/document_response.py b/src/finch/types/hris/document_response.py index eb68db53..6cee9fb5 100644 --- a/src/finch/types/hris/document_response.py +++ b/src/finch/types/hris/document_response.py @@ -9,7 +9,7 @@ class DocumentResponse(BaseModel): - id: Optional[str] = None + id: str """A stable Finch id for the document.""" individual_id: Optional[str] = None @@ -18,14 +18,14 @@ class DocumentResponse(BaseModel): This will be null for employer-level documents. """ - type: Optional[Literal["w4_2020", "w4_2005"]] = None + type: Literal["w4_2020", "w4_2005"] """The type of document.""" - url: Optional[str] = None + url: str """A URL to access the document. Format: `https://api.tryfinch.com/employer/documents/:document_id`. """ - year: Optional[float] = None + year: float """The year the document applies to, if available.""" diff --git a/src/finch/types/hris/document_retreive_params.py b/src/finch/types/hris/document_retreive_params.py new file mode 100644 index 00000000..714fdf13 --- /dev/null +++ b/src/finch/types/hris/document_retreive_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["DocumentRetreiveParams"] + + +class DocumentRetreiveParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/employment_retrieve_many_params.py b/src/finch/types/hris/employment_retrieve_many_params.py index 0aeccf6c..08a6c759 100644 --- a/src/finch/types/hris/employment_retrieve_many_params.py +++ b/src/finch/types/hris/employment_retrieve_many_params.py @@ -5,6 +5,8 @@ from typing import Iterable from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["EmploymentRetrieveManyParams", "Request"] @@ -12,6 +14,9 @@ class EmploymentRetrieveManyParams(TypedDict, total=False): requests: Required[Iterable[Request]] """The array of batch requests.""" + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + class Request(TypedDict, total=False): individual_id: Required[str] diff --git a/src/finch/types/hris/individual_retrieve_many_params.py b/src/finch/types/hris/individual_retrieve_many_params.py index 86686eac..40b62fc6 100644 --- a/src/finch/types/hris/individual_retrieve_many_params.py +++ b/src/finch/types/hris/individual_retrieve_many_params.py @@ -11,6 +11,9 @@ class IndividualRetrieveManyParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + options: Optional[Options] requests: Iterable[Request] diff --git a/src/finch/types/hris/pay_statement.py b/src/finch/types/hris/pay_statement.py index 22fca52d..d8439faf 100644 --- a/src/finch/types/hris/pay_statement.py +++ b/src/finch/types/hris/pay_statement.py @@ -153,10 +153,10 @@ class PayStatement(BaseModel): earnings: Optional[List[Optional[Earning]]] = None """The array of earnings objects associated with this pay statement""" - employee_deductions: Optional[List[Optional[EmployeeDeduction]]] = None + employee_deductions: Optional[List[EmployeeDeduction]] = None """The array of deductions objects associated with this pay statement.""" - employer_contributions: Optional[List[Optional[EmployerContribution]]] = None + employer_contributions: Optional[List[EmployerContribution]] = None gross_pay: Optional[Money] = None @@ -168,7 +168,7 @@ class PayStatement(BaseModel): payment_method: Optional[Literal["check", "direct_deposit", "other"]] = None """The payment method.""" - taxes: Optional[List[Optional[Tax]]] = None + taxes: Optional[List[Tax]] = None """The array of taxes objects associated with this pay statement.""" total_hours: Optional[float] = None diff --git a/src/finch/types/hris/pay_statement_retrieve_many_params.py b/src/finch/types/hris/pay_statement_retrieve_many_params.py index 7a08009c..8ccb1da9 100644 --- a/src/finch/types/hris/pay_statement_retrieve_many_params.py +++ b/src/finch/types/hris/pay_statement_retrieve_many_params.py @@ -5,6 +5,8 @@ from typing import Iterable from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["PayStatementRetrieveManyParams", "Request"] @@ -12,6 +14,9 @@ class PayStatementRetrieveManyParams(TypedDict, total=False): requests: Required[Iterable[Request]] """The array of batch requests.""" + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + class Request(TypedDict, total=False): payment_id: Required[str] diff --git a/src/finch/types/hris/payment_list_params.py b/src/finch/types/hris/payment_list_params.py index 5b0cd004..e4323ba8 100644 --- a/src/finch/types/hris/payment_list_params.py +++ b/src/finch/types/hris/payment_list_params.py @@ -6,6 +6,7 @@ from datetime import date from typing_extensions import Required, Annotated, TypedDict +from ..._types import SequenceNotStr from ..._utils import PropertyInfo __all__ = ["PaymentListParams"] @@ -23,3 +24,6 @@ class PaymentListParams(TypedDict, total=False): The start date to retrieve payments by a company (inclusive) in `YYYY-MM-DD` format. """ + + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/hris/supported_benefit.py b/src/finch/types/hris/supported_benefit.py index 4b57eeb4..1a3634e3 100644 --- a/src/finch/types/hris/supported_benefit.py +++ b/src/finch/types/hris/supported_benefit.py @@ -13,7 +13,7 @@ class SupportedBenefit(BaseModel): annual_maximum: Optional[bool] = None """Whether the provider supports an annual maximum for this benefit.""" - company_contribution: Optional[List[Optional[Literal["fixed", "percent"]]]] = None + company_contribution: Optional[List[Optional[Literal["fixed", "percent", "tiered"]]]] = None """Supported contribution types. An empty array indicates contributions are not supported. diff --git a/src/finch/types/hris/w42005.py b/src/finch/types/hris/w42005.py index 77d3a130..73b7d277 100644 --- a/src/finch/types/hris/w42005.py +++ b/src/finch/types/hris/w42005.py @@ -9,7 +9,7 @@ class Data(BaseModel): - additional_withholding: Optional[int] = None + additional_withholding: int """Additional withholding amount (in cents).""" exemption: Optional[Literal["exempt", "non_exempt"]] = None @@ -18,19 +18,19 @@ class Data(BaseModel): filing_status: Optional[Literal["married", "married_but_withhold_at_higher_single_rate", "single"]] = None """The individual's filing status for tax purposes.""" - individual_id: Optional[str] = None + individual_id: str """The unique identifier for the individual associated with this 2005 W4 form.""" - total_number_of_allowances: Optional[int] = None + total_number_of_allowances: int """Total number of allowances claimed (in cents).""" class W42005(BaseModel): - data: Optional[Data] = None + data: Data """Detailed information specific to the 2005 W4 form.""" - type: Optional[Literal["w4_2005"]] = None + type: Literal["w4_2005"] """Specifies the form type, indicating that this document is a 2005 W4 form.""" - year: Optional[float] = None + year: float """The tax year this W4 document applies to.""" diff --git a/src/finch/types/hris/w42020.py b/src/finch/types/hris/w42020.py index 840463ec..20749283 100644 --- a/src/finch/types/hris/w42020.py +++ b/src/finch/types/hris/w42020.py @@ -9,19 +9,19 @@ class Data(BaseModel): - amount_for_other_dependents: Optional[int] = None + amount_for_other_dependents: int """ Amount claimed for dependents other than qualifying children under 17 (in cents). """ - amount_for_qualifying_children_under_17: Optional[int] = None + amount_for_qualifying_children_under_17: int """Amount claimed for dependents under 17 years old (in cents).""" - deductions: Optional[int] = None + deductions: int """Deductible expenses (in cents).""" - extra_withholding: Optional[int] = None + extra_withholding: int """Additional withholding amount (in cents).""" filing_status: Optional[ @@ -33,22 +33,22 @@ class Data(BaseModel): ] = None """The individual's filing status for tax purposes.""" - individual_id: Optional[str] = None + individual_id: str """The unique identifier for the individual associated with this document.""" - other_income: Optional[int] = None + other_income: int """Additional income from sources outside of primary employment (in cents).""" - total_claim_dependent_and_other_credits: Optional[int] = None + total_claim_dependent_and_other_credits: int """Total amount claimed for dependents and other credits (in cents).""" class W42020(BaseModel): - data: Optional[Data] = None + data: Data """Detailed information specific to the 2020 W4 form.""" - type: Optional[Literal["w4_2020"]] = None + type: Literal["w4_2020"] """Specifies the form type, indicating that this document is a 2020 W4 form.""" - year: Optional[float] = None + year: float """The tax year this W4 document applies to.""" diff --git a/src/finch/types/introspection.py b/src/finch/types/introspection.py index cfe4fbc3..03730a3c 100644 --- a/src/finch/types/introspection.py +++ b/src/finch/types/introspection.py @@ -7,7 +7,13 @@ from .._models import BaseModel from .shared.connection_status_type import ConnectionStatusType -__all__ = ["Introspection", "ConnectionStatus", "AuthenticationMethod", "AuthenticationMethodConnectionStatus"] +__all__ = [ + "Introspection", + "ConnectionStatus", + "AuthenticationMethod", + "AuthenticationMethodConnectionStatus", + "Entity", +] class ConnectionStatus(BaseModel): @@ -38,6 +44,20 @@ class AuthenticationMethod(BaseModel): """An array of the authorized products associated with the `access_token`""" +class Entity(BaseModel): + id: str + """The connection account ID for this entity""" + + name: Optional[str] = None + """The name of the entity (payroll provider company name)""" + + source_id: Optional[str] = None + """The source ID of the entity""" + + type: Optional[str] = None + """The type of entity""" + + class Introspection(BaseModel): id: str """The Finch UUID of the token being introspected""" @@ -98,11 +118,11 @@ class Introspection(BaseModel): created for this connection """ - entity_ids: Optional[List[str]] = None - """Array of entity IDs associated with this connection.""" - - entity_mode: Optional[Literal["single", "multi"]] = None - """Indicates whether this connection manages a single entity or multiple entities.""" + entities: Optional[List[Entity]] = None + """ + Array of detailed entity information for each connected account in multi-account + mode + """ manual: Optional[bool] = None """ diff --git a/src/finch/types/jobs/__init__.py b/src/finch/types/jobs/__init__.py index b7a24a08..ee2d3e8e 100644 --- a/src/finch/types/jobs/__init__.py +++ b/src/finch/types/jobs/__init__.py @@ -5,8 +5,6 @@ from .manual_async_job import ManualAsyncJob as ManualAsyncJob from .automated_async_job import AutomatedAsyncJob as AutomatedAsyncJob from .automated_list_params import AutomatedListParams as AutomatedListParams -from .manual_retrieve_params import ManualRetrieveParams as ManualRetrieveParams from .automated_create_params import AutomatedCreateParams as AutomatedCreateParams from .automated_list_response import AutomatedListResponse as AutomatedListResponse from .automated_create_response import AutomatedCreateResponse as AutomatedCreateResponse -from .automated_retrieve_params import AutomatedRetrieveParams as AutomatedRetrieveParams diff --git a/src/finch/types/jobs/automated_list_params.py b/src/finch/types/jobs/automated_list_params.py index 2e41586c..21032e2c 100644 --- a/src/finch/types/jobs/automated_list_params.py +++ b/src/finch/types/jobs/automated_list_params.py @@ -8,13 +8,6 @@ class AutomatedListParams(TypedDict, total=False): - entity_id: str - """The entity ID to use when authenticating with a multi-account token. - - Required when using a multi-account token to specify which entity's data to - access. Example: `123e4567-e89b-12d3-a456-426614174000` - """ - limit: int """Number of items to return""" diff --git a/src/finch/types/jobs/automated_retrieve_params.py b/src/finch/types/jobs/automated_retrieve_params.py deleted file mode 100644 index d009691e..00000000 --- a/src/finch/types/jobs/automated_retrieve_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["AutomatedRetrieveParams"] - - -class AutomatedRetrieveParams(TypedDict, total=False): - entity_id: str - """The entity ID to use when authenticating with a multi-account token. - - Required when using a multi-account token to specify which entity's data to - access. Example: `123e4567-e89b-12d3-a456-426614174000` - """ diff --git a/src/finch/types/jobs/manual_retrieve_params.py b/src/finch/types/jobs/manual_retrieve_params.py deleted file mode 100644 index 3a4e4b11..00000000 --- a/src/finch/types/jobs/manual_retrieve_params.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["ManualRetrieveParams"] - - -class ManualRetrieveParams(TypedDict, total=False): - entity_id: str - """The entity ID to use when authenticating with a multi-account token. - - Required when using a multi-account token to specify which entity's data to - access. Example: `123e4567-e89b-12d3-a456-426614174000` - """ diff --git a/src/finch/types/payroll/__init__.py b/src/finch/types/payroll/__init__.py index f98e6098..3697ce53 100644 --- a/src/finch/types/payroll/__init__.py +++ b/src/finch/types/payroll/__init__.py @@ -4,4 +4,5 @@ from .pay_group_list_params import PayGroupListParams as PayGroupListParams from .pay_group_list_response import PayGroupListResponse as PayGroupListResponse +from .pay_group_retrieve_params import PayGroupRetrieveParams as PayGroupRetrieveParams from .pay_group_retrieve_response import PayGroupRetrieveResponse as PayGroupRetrieveResponse diff --git a/src/finch/types/payroll/pay_group_list_params.py b/src/finch/types/payroll/pay_group_list_params.py index 67a6044e..df574bee 100644 --- a/src/finch/types/payroll/pay_group_list_params.py +++ b/src/finch/types/payroll/pay_group_list_params.py @@ -10,6 +10,9 @@ class PayGroupListParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" + individual_id: str pay_frequencies: SequenceNotStr[str] diff --git a/src/finch/types/payroll/pay_group_retrieve_params.py b/src/finch/types/payroll/pay_group_retrieve_params.py new file mode 100644 index 00000000..79143a38 --- /dev/null +++ b/src/finch/types/payroll/pay_group_retrieve_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["PayGroupRetrieveParams"] + + +class PayGroupRetrieveParams(TypedDict, total=False): + entity_ids: SequenceNotStr[str] + """The entity IDs to specify which entities' data to access.""" diff --git a/src/finch/types/provider.py b/src/finch/types/provider.py deleted file mode 100644 index b7051379..00000000 --- a/src/finch/types/provider.py +++ /dev/null @@ -1,449 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .hris.benefits_support import BenefitsSupport - -__all__ = [ - "Provider", - "AuthenticationMethod", - "AuthenticationMethodSupportedFields", - "AuthenticationMethodSupportedFieldsCompany", - "AuthenticationMethodSupportedFieldsCompanyAccounts", - "AuthenticationMethodSupportedFieldsCompanyDepartments", - "AuthenticationMethodSupportedFieldsCompanyDepartmentsParent", - "AuthenticationMethodSupportedFieldsCompanyEntity", - "AuthenticationMethodSupportedFieldsCompanyLocations", - "AuthenticationMethodSupportedFieldsDirectory", - "AuthenticationMethodSupportedFieldsDirectoryIndividuals", - "AuthenticationMethodSupportedFieldsDirectoryIndividualsManager", - "AuthenticationMethodSupportedFieldsDirectoryPaging", - "AuthenticationMethodSupportedFieldsEmployment", - "AuthenticationMethodSupportedFieldsEmploymentDepartment", - "AuthenticationMethodSupportedFieldsEmploymentEmployment", - "AuthenticationMethodSupportedFieldsEmploymentIncome", - "AuthenticationMethodSupportedFieldsEmploymentLocation", - "AuthenticationMethodSupportedFieldsEmploymentManager", - "AuthenticationMethodSupportedFieldsIndividual", - "AuthenticationMethodSupportedFieldsIndividualEmails", - "AuthenticationMethodSupportedFieldsIndividualPhoneNumbers", - "AuthenticationMethodSupportedFieldsIndividualResidence", - "AuthenticationMethodSupportedFieldsPayGroup", - "AuthenticationMethodSupportedFieldsPayStatement", - "AuthenticationMethodSupportedFieldsPayStatementPaging", - "AuthenticationMethodSupportedFieldsPayStatementPayStatements", - "AuthenticationMethodSupportedFieldsPayStatementPayStatementsEarnings", - "AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployeeDeductions", - "AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions", - "AuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes", - "AuthenticationMethodSupportedFieldsPayment", - "AuthenticationMethodSupportedFieldsPaymentPayPeriod", -] - - -class AuthenticationMethodSupportedFieldsCompanyAccounts(BaseModel): - account_name: Optional[bool] = None - - account_number: Optional[bool] = None - - account_type: Optional[bool] = None - - institution_name: Optional[bool] = None - - routing_number: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsCompanyDepartmentsParent(BaseModel): - name: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsCompanyDepartments(BaseModel): - name: Optional[bool] = None - - parent: Optional[AuthenticationMethodSupportedFieldsCompanyDepartmentsParent] = None - - -class AuthenticationMethodSupportedFieldsCompanyEntity(BaseModel): - subtype: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsCompanyLocations(BaseModel): - city: Optional[bool] = None - - country: Optional[bool] = None - - line1: Optional[bool] = None - - line2: Optional[bool] = None - - postal_code: Optional[bool] = None - - state: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsCompany(BaseModel): - id: Optional[bool] = None - - accounts: Optional[AuthenticationMethodSupportedFieldsCompanyAccounts] = None - - departments: Optional[AuthenticationMethodSupportedFieldsCompanyDepartments] = None - - ein: Optional[bool] = None - - entity: Optional[AuthenticationMethodSupportedFieldsCompanyEntity] = None - - legal_name: Optional[bool] = None - - locations: Optional[AuthenticationMethodSupportedFieldsCompanyLocations] = None - - primary_email: Optional[bool] = None - - primary_phone_number: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsDirectoryIndividualsManager(BaseModel): - id: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsDirectoryIndividuals(BaseModel): - id: Optional[bool] = None - - department: Optional[bool] = None - - first_name: Optional[bool] = None - - is_active: Optional[bool] = None - - last_name: Optional[bool] = None - - manager: Optional[AuthenticationMethodSupportedFieldsDirectoryIndividualsManager] = None - - middle_name: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsDirectoryPaging(BaseModel): - count: Optional[bool] = None - - offset: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsDirectory(BaseModel): - individuals: Optional[AuthenticationMethodSupportedFieldsDirectoryIndividuals] = None - - paging: Optional[AuthenticationMethodSupportedFieldsDirectoryPaging] = None - - -class AuthenticationMethodSupportedFieldsEmploymentDepartment(BaseModel): - name: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsEmploymentEmployment(BaseModel): - subtype: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsEmploymentIncome(BaseModel): - amount: Optional[bool] = None - - currency: Optional[bool] = None - - unit: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsEmploymentLocation(BaseModel): - city: Optional[bool] = None - - country: Optional[bool] = None - - line1: Optional[bool] = None - - line2: Optional[bool] = None - - postal_code: Optional[bool] = None - - state: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsEmploymentManager(BaseModel): - id: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsEmployment(BaseModel): - id: Optional[bool] = None - - class_code: Optional[bool] = None - - custom_fields: Optional[bool] = None - - department: Optional[AuthenticationMethodSupportedFieldsEmploymentDepartment] = None - - employment: Optional[AuthenticationMethodSupportedFieldsEmploymentEmployment] = None - - employment_status: Optional[bool] = None - - end_date: Optional[bool] = None - - first_name: Optional[bool] = None - - income_history: Optional[bool] = None - - income: Optional[AuthenticationMethodSupportedFieldsEmploymentIncome] = None - - is_active: Optional[bool] = None - - last_name: Optional[bool] = None - - location: Optional[AuthenticationMethodSupportedFieldsEmploymentLocation] = None - - manager: Optional[AuthenticationMethodSupportedFieldsEmploymentManager] = None - - middle_name: Optional[bool] = None - - start_date: Optional[bool] = None - - title: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsIndividualEmails(BaseModel): - data: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsIndividualPhoneNumbers(BaseModel): - data: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsIndividualResidence(BaseModel): - city: Optional[bool] = None - - country: Optional[bool] = None - - line1: Optional[bool] = None - - line2: Optional[bool] = None - - postal_code: Optional[bool] = None - - state: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsIndividual(BaseModel): - id: Optional[bool] = None - - dob: Optional[bool] = None - - emails: Optional[AuthenticationMethodSupportedFieldsIndividualEmails] = None - - encrypted_ssn: Optional[bool] = None - - ethnicity: Optional[bool] = None - - first_name: Optional[bool] = None - - gender: Optional[bool] = None - - last_name: Optional[bool] = None - - middle_name: Optional[bool] = None - - phone_numbers: Optional[AuthenticationMethodSupportedFieldsIndividualPhoneNumbers] = None - - preferred_name: Optional[bool] = None - - residence: Optional[AuthenticationMethodSupportedFieldsIndividualResidence] = None - - ssn: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayGroup(BaseModel): - id: Optional[bool] = None - - individual_ids: Optional[bool] = None - - name: Optional[bool] = None - - pay_frequencies: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatementPaging(BaseModel): - count: bool - - offset: bool - - -class AuthenticationMethodSupportedFieldsPayStatementPayStatementsEarnings(BaseModel): - amount: Optional[bool] = None - - currency: Optional[bool] = None - - name: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployeeDeductions(BaseModel): - amount: Optional[bool] = None - - currency: Optional[bool] = None - - name: Optional[bool] = None - - pre_tax: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions(BaseModel): - amount: Optional[bool] = None - - currency: Optional[bool] = None - - name: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes(BaseModel): - amount: Optional[bool] = None - - currency: Optional[bool] = None - - employer: Optional[bool] = None - - name: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatementPayStatements(BaseModel): - earnings: Optional[AuthenticationMethodSupportedFieldsPayStatementPayStatementsEarnings] = None - - employee_deductions: Optional[AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployeeDeductions] = None - - employer_contributions: Optional[ - AuthenticationMethodSupportedFieldsPayStatementPayStatementsEmployerContributions - ] = None - - gross_pay: Optional[bool] = None - - individual_id: Optional[bool] = None - - net_pay: Optional[bool] = None - - payment_method: Optional[bool] = None - - taxes: Optional[AuthenticationMethodSupportedFieldsPayStatementPayStatementsTaxes] = None - - total_hours: Optional[bool] = None - - type: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayStatement(BaseModel): - paging: Optional[AuthenticationMethodSupportedFieldsPayStatementPaging] = None - - pay_statements: Optional[AuthenticationMethodSupportedFieldsPayStatementPayStatements] = None - - -class AuthenticationMethodSupportedFieldsPaymentPayPeriod(BaseModel): - end_date: Optional[bool] = None - - start_date: Optional[bool] = None - - -class AuthenticationMethodSupportedFieldsPayment(BaseModel): - id: Optional[bool] = None - - company_debit: Optional[bool] = None - - debit_date: Optional[bool] = None - - employee_taxes: Optional[bool] = None - - employer_taxes: Optional[bool] = None - - gross_pay: Optional[bool] = None - - individual_ids: Optional[bool] = None - - net_pay: Optional[bool] = None - - pay_date: Optional[bool] = None - - pay_frequencies: Optional[bool] = None - - pay_group_ids: Optional[bool] = None - - pay_period: Optional[AuthenticationMethodSupportedFieldsPaymentPayPeriod] = None - - -class AuthenticationMethodSupportedFields(BaseModel): - company: Optional[AuthenticationMethodSupportedFieldsCompany] = None - - directory: Optional[AuthenticationMethodSupportedFieldsDirectory] = None - - employment: Optional[AuthenticationMethodSupportedFieldsEmployment] = None - - individual: Optional[AuthenticationMethodSupportedFieldsIndividual] = None - - pay_group: Optional[AuthenticationMethodSupportedFieldsPayGroup] = None - - pay_statement: Optional[AuthenticationMethodSupportedFieldsPayStatement] = None - - payment: Optional[AuthenticationMethodSupportedFieldsPayment] = None - - -class AuthenticationMethod(BaseModel): - benefits_support: Optional[BenefitsSupport] = None - """Each benefit type and their supported features. - - If the benefit type is not supported, the property will be null - """ - - supported_fields: Optional[AuthenticationMethodSupportedFields] = None - """The supported data fields returned by our HR and payroll endpoints""" - - type: Optional[Literal["assisted", "credential", "api_token", "api_credential", "oauth"]] = None - """The type of authentication method.""" - - -class Provider(BaseModel): - id: Optional[str] = None - """The id of the payroll provider used in Connect.""" - - authentication_methods: Optional[List[AuthenticationMethod]] = None - """The list of authentication methods supported by the provider.""" - - beta: Optional[bool] = None - """`true` if the integration is in a beta state, `false` otherwise""" - - display_name: Optional[str] = None - """The display name of the payroll provider.""" - - icon: Optional[str] = None - """The url to the official icon of the payroll provider.""" - - logo: Optional[str] = None - """The url to the official logo of the payroll provider.""" - - manual: Optional[bool] = None - """ - [DEPRECATED] Whether the Finch integration with this provider uses the Assisted - Connect Flow by default. This field is now deprecated. Please check for a `type` - of `assisted` in the `authentication_methods` field instead. - """ - - mfa_required: Optional[bool] = None - """whether MFA is required for the provider.""" - - primary_color: Optional[str] = None - """The hex code for the primary color of the payroll provider.""" - - products: Optional[List[str]] = None - """The list of Finch products supported on this payroll provider.""" diff --git a/src/finch/types/provider_list_response.py b/src/finch/types/provider_list_response.py new file mode 100644 index 00000000..effab9c2 --- /dev/null +++ b/src/finch/types/provider_list_response.py @@ -0,0 +1,55 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ProviderListResponse", "AuthenticationMethod"] + + +class AuthenticationMethod(BaseModel): + type: Literal["assisted", "credential", "api_token", "api_credential", "oauth", "api"] + """The type of authentication method""" + + benefits_support: Optional[Dict[str, Optional[object]]] = None + """The supported benefit types and their configurations""" + + supported_fields: Optional[Dict[str, Optional[object]]] = None + """The supported fields for each Finch product""" + + +class ProviderListResponse(BaseModel): + id: str + """The id of the payroll provider used in Connect.""" + + display_name: str + """The display name of the payroll provider.""" + + products: List[str] + """The list of Finch products supported on this payroll provider.""" + + authentication_methods: Optional[List[AuthenticationMethod]] = None + """The authentication methods supported by the provider.""" + + beta: Optional[bool] = None + """`true` if the integration is in a beta state, `false` otherwise""" + + icon: Optional[str] = None + """The url to the official icon of the payroll provider.""" + + logo: Optional[str] = None + """The url to the official logo of the payroll provider.""" + + manual: Optional[bool] = None + """ + [DEPRECATED] Whether the Finch integration with this provider uses the Assisted + Connect Flow by default. This field is now deprecated. Please check for a `type` + of `assisted` in the `authentication_methods` field instead. + """ + + mfa_required: Optional[bool] = None + """whether MFA is required for the provider.""" + + primary_color: Optional[str] = None + """The hex code for the primary color of the payroll provider.""" diff --git a/src/finch/types/request_forwarding_forward_params.py b/src/finch/types/request_forwarding_forward_params.py index 76f06fed..a7d9f205 100644 --- a/src/finch/types/request_forwarding_forward_params.py +++ b/src/finch/types/request_forwarding_forward_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["RequestForwardingForwardParams"] @@ -28,14 +28,14 @@ class RequestForwardingForwardParams(TypedDict, total=False): This value must be specified as either a string or a valid JSON object. """ - headers: Optional[object] + headers: Optional[Dict[str, Optional[object]]] """The HTTP headers to include on the forwarded request. This value must be specified as an object of key-value pairs. Example: `{"Content-Type": "application/xml", "X-API-Version": "v1" }` """ - params: Optional[object] + params: Optional[Dict[str, Optional[object]]] """The query parameters for the forwarded request. This value must be specified as a valid JSON object rather than a query string. diff --git a/src/finch/types/request_forwarding_forward_response.py b/src/finch/types/request_forwarding_forward_response.py index 61fde1b5..c9777e09 100644 --- a/src/finch/types/request_forwarding_forward_response.py +++ b/src/finch/types/request_forwarding_forward_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Union, Optional from pydantic import Field as FieldInfo @@ -10,49 +10,26 @@ class Request(BaseModel): - data: Optional[str] = None - """The body that was specified for the forwarded request. - - If a value was not specified in the original request, this value will be - returned as null ; otherwise, this value will always be returned as a string. - """ - - headers: Optional[object] = None - """The specified HTTP headers that were included in the forwarded request. - - If no headers were specified, this will be returned as `null`. - """ - method: str """The HTTP method that was specified for the forwarded request. Valid values include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. """ - params: Optional[object] = None - """The query parameters that were included in the forwarded request. - - If no query parameters were specified, this will be returned as `null`. - """ - route: str """The URL route path that was specified for the forwarded request.""" + data: Union[str, Dict[str, Optional[object]], None] = None + """The body that was specified for the forwarded request.""" -class RequestForwardingForwardResponse(BaseModel): - data: Optional[str] = None - """ - A string representation of the HTTP response body of the forwarded request's - response received from the underlying integration's API. This field may be null - in the case where the upstream system's response is empty. - """ + headers: Optional[Dict[str, Optional[object]]] = None + """The HTTP headers that were specified for the forwarded request.""" - headers: Optional[object] = None - """ - The HTTP headers of the forwarded request's response, exactly as received from - the underlying integration's API. - """ + params: Optional[Dict[str, Optional[object]]] = None + """The query parameters that were specified for the forwarded request.""" + +class RequestForwardingForwardResponse(BaseModel): request: Request """ An object containing details of your original forwarded request, for your ease @@ -64,3 +41,16 @@ class RequestForwardingForwardResponse(BaseModel): The HTTP status code of the forwarded request's response, exactly received from the underlying integration's API. This value will be returned as an integer. """ + + data: Optional[str] = None + """ + A string representation of the HTTP response body of the forwarded request's + response received from the underlying integration's API. This field may be null + in the case where the upstream system's response is empty. + """ + + headers: Optional[Dict[str, Optional[object]]] = None + """ + The HTTP headers of the forwarded request's response, exactly as received from + the underlying integration's API. + """ diff --git a/tests/api_resources/connect/test_sessions.py b/tests/api_resources/connect/test_sessions.py index f437d7e6..1728d397 100644 --- a/tests/api_resources/connect/test_sessions.py +++ b/tests/api_resources/connect/test_sessions.py @@ -24,26 +24,16 @@ class TestSessions: @parametrize def test_method_new(self, client: Finch) -> None: session = client.connect.sessions.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], - ) - assert_matches_type(SessionNewResponse, session, path=["response"]) - - @pytest.mark.skip(reason="prism tests are broken") - @parametrize - def test_method_new_with_all_params(self, client: Finch) -> None: - session = client.connect.sessions.new( - customer_id="x", - customer_name="x", - products=["company"], - customer_email="dev@stainless.com", integration={ "auth_method": "assisted", "provider": "provider", }, manual=True, minutes_to_expire=1, + products=["benefits"], redirect_uri="redirect_uri", sandbox="finch", ) @@ -53,9 +43,18 @@ def test_method_new_with_all_params(self, client: Finch) -> None: @parametrize def test_raw_response_new(self, client: Finch) -> None: response = client.connect.sessions.with_raw_response.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], + integration={ + "auth_method": "assisted", + "provider": "provider", + }, + manual=True, + minutes_to_expire=1, + products=["benefits"], + redirect_uri="redirect_uri", + sandbox="finch", ) assert response.is_closed is True @@ -67,9 +66,18 @@ def test_raw_response_new(self, client: Finch) -> None: @parametrize def test_streaming_response_new(self, client: Finch) -> None: with client.connect.sessions.with_streaming_response.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], + integration={ + "auth_method": "assisted", + "provider": "provider", + }, + manual=True, + minutes_to_expire=1, + products=["benefits"], + redirect_uri="redirect_uri", + sandbox="finch", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -82,18 +90,10 @@ def test_streaming_response_new(self, client: Finch) -> None: @pytest.mark.skip(reason="prism tests are broken") @parametrize def test_method_reauthenticate(self, client: Finch) -> None: - session = client.connect.sessions.reauthenticate( - connection_id="connection_id", - ) - assert_matches_type(SessionReauthenticateResponse, session, path=["response"]) - - @pytest.mark.skip(reason="prism tests are broken") - @parametrize - def test_method_reauthenticate_with_all_params(self, client: Finch) -> None: session = client.connect.sessions.reauthenticate( connection_id="connection_id", minutes_to_expire=0, - products=["company"], + products=["benefits"], redirect_uri="https://example.com", ) assert_matches_type(SessionReauthenticateResponse, session, path=["response"]) @@ -103,6 +103,9 @@ def test_method_reauthenticate_with_all_params(self, client: Finch) -> None: def test_raw_response_reauthenticate(self, client: Finch) -> None: response = client.connect.sessions.with_raw_response.reauthenticate( connection_id="connection_id", + minutes_to_expire=0, + products=["benefits"], + redirect_uri="https://example.com", ) assert response.is_closed is True @@ -115,6 +118,9 @@ def test_raw_response_reauthenticate(self, client: Finch) -> None: def test_streaming_response_reauthenticate(self, client: Finch) -> None: with client.connect.sessions.with_streaming_response.reauthenticate( connection_id="connection_id", + minutes_to_expire=0, + products=["benefits"], + redirect_uri="https://example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -134,26 +140,16 @@ class TestAsyncSessions: @parametrize async def test_method_new(self, async_client: AsyncFinch) -> None: session = await async_client.connect.sessions.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], - ) - assert_matches_type(SessionNewResponse, session, path=["response"]) - - @pytest.mark.skip(reason="prism tests are broken") - @parametrize - async def test_method_new_with_all_params(self, async_client: AsyncFinch) -> None: - session = await async_client.connect.sessions.new( - customer_id="x", - customer_name="x", - products=["company"], - customer_email="dev@stainless.com", integration={ "auth_method": "assisted", "provider": "provider", }, manual=True, minutes_to_expire=1, + products=["benefits"], redirect_uri="redirect_uri", sandbox="finch", ) @@ -163,9 +159,18 @@ async def test_method_new_with_all_params(self, async_client: AsyncFinch) -> Non @parametrize async def test_raw_response_new(self, async_client: AsyncFinch) -> None: response = await async_client.connect.sessions.with_raw_response.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], + integration={ + "auth_method": "assisted", + "provider": "provider", + }, + manual=True, + minutes_to_expire=1, + products=["benefits"], + redirect_uri="redirect_uri", + sandbox="finch", ) assert response.is_closed is True @@ -177,9 +182,18 @@ async def test_raw_response_new(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_new(self, async_client: AsyncFinch) -> None: async with async_client.connect.sessions.with_streaming_response.new( + customer_email="dev@stainless.com", customer_id="x", customer_name="x", - products=["company"], + integration={ + "auth_method": "assisted", + "provider": "provider", + }, + manual=True, + minutes_to_expire=1, + products=["benefits"], + redirect_uri="redirect_uri", + sandbox="finch", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -192,18 +206,10 @@ async def test_streaming_response_new(self, async_client: AsyncFinch) -> None: @pytest.mark.skip(reason="prism tests are broken") @parametrize async def test_method_reauthenticate(self, async_client: AsyncFinch) -> None: - session = await async_client.connect.sessions.reauthenticate( - connection_id="connection_id", - ) - assert_matches_type(SessionReauthenticateResponse, session, path=["response"]) - - @pytest.mark.skip(reason="prism tests are broken") - @parametrize - async def test_method_reauthenticate_with_all_params(self, async_client: AsyncFinch) -> None: session = await async_client.connect.sessions.reauthenticate( connection_id="connection_id", minutes_to_expire=0, - products=["company"], + products=["benefits"], redirect_uri="https://example.com", ) assert_matches_type(SessionReauthenticateResponse, session, path=["response"]) @@ -213,6 +219,9 @@ async def test_method_reauthenticate_with_all_params(self, async_client: AsyncFi async def test_raw_response_reauthenticate(self, async_client: AsyncFinch) -> None: response = await async_client.connect.sessions.with_raw_response.reauthenticate( connection_id="connection_id", + minutes_to_expire=0, + products=["benefits"], + redirect_uri="https://example.com", ) assert response.is_closed is True @@ -225,6 +234,9 @@ async def test_raw_response_reauthenticate(self, async_client: AsyncFinch) -> No async def test_streaming_response_reauthenticate(self, async_client: AsyncFinch) -> None: async with async_client.connect.sessions.with_streaming_response.reauthenticate( connection_id="connection_id", + minutes_to_expire=0, + products=["benefits"], + redirect_uri="https://example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/hris/benefits/test_individuals.py b/tests/api_resources/hris/benefits/test_individuals.py index 13ee6a10..2da502e6 100644 --- a/tests/api_resources/hris/benefits/test_individuals.py +++ b/tests/api_resources/hris/benefits/test_individuals.py @@ -35,6 +35,7 @@ def test_method_enroll_many(self, client: Finch) -> None: def test_method_enroll_many_with_all_params(self, client: Finch) -> None: individual = client.hris.benefits.individuals.enroll_many( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individuals=[ { "configuration": { @@ -43,6 +44,12 @@ def test_method_enroll_many_with_all_params(self, client: Finch) -> None: "catch_up": True, "company_contribution": { "amount": 0, + "tiers": [ + { + "match": 0, + "threshold": 0, + } + ], "type": "fixed", }, "effective_date": parse_date("2019-12-27"), @@ -91,14 +98,22 @@ def test_path_params_enroll_many(self, client: Finch) -> None: @parametrize def test_method_enrolled_ids(self, client: Finch) -> None: individual = client.hris.benefits.individuals.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", + ) + assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"]) + + @parametrize + def test_method_enrolled_ids_with_all_params(self, client: Finch) -> None: + individual = client.hris.benefits.individuals.enrolled_ids( + benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"]) @parametrize def test_raw_response_enrolled_ids(self, client: Finch) -> None: response = client.hris.benefits.individuals.with_raw_response.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", ) assert response.is_closed is True @@ -109,7 +124,7 @@ def test_raw_response_enrolled_ids(self, client: Finch) -> None: @parametrize def test_streaming_response_enrolled_ids(self, client: Finch) -> None: with client.hris.benefits.individuals.with_streaming_response.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -123,7 +138,7 @@ def test_streaming_response_enrolled_ids(self, client: Finch) -> None: def test_path_params_enrolled_ids(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benefit_id` but received ''"): client.hris.benefits.individuals.with_raw_response.enrolled_ids( - "", + benefit_id="", ) @parametrize @@ -137,6 +152,7 @@ def test_method_retrieve_many_benefits(self, client: Finch) -> None: def test_method_retrieve_many_benefits_with_all_params(self, client: Finch) -> None: individual = client.hris.benefits.individuals.retrieve_many_benefits( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids="d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a", ) assert_matches_type(SyncSinglePage[IndividualBenefit], individual, path=["response"]) @@ -183,6 +199,7 @@ def test_method_unenroll_many(self, client: Finch) -> None: def test_method_unenroll_many_with_all_params(self, client: Finch) -> None: individual = client.hris.benefits.individuals.unenroll_many( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids=["string"], ) assert_matches_type(UnenrolledIndividualBenefitResponse, individual, path=["response"]) @@ -235,6 +252,7 @@ async def test_method_enroll_many(self, async_client: AsyncFinch) -> None: async def test_method_enroll_many_with_all_params(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.enroll_many( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individuals=[ { "configuration": { @@ -243,6 +261,12 @@ async def test_method_enroll_many_with_all_params(self, async_client: AsyncFinch "catch_up": True, "company_contribution": { "amount": 0, + "tiers": [ + { + "match": 0, + "threshold": 0, + } + ], "type": "fixed", }, "effective_date": parse_date("2019-12-27"), @@ -291,14 +315,22 @@ async def test_path_params_enroll_many(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_enrolled_ids(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", + ) + assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"]) + + @parametrize + async def test_method_enrolled_ids_with_all_params(self, async_client: AsyncFinch) -> None: + individual = await async_client.hris.benefits.individuals.enrolled_ids( + benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(IndividualEnrolledIDsResponse, individual, path=["response"]) @parametrize async def test_raw_response_enrolled_ids(self, async_client: AsyncFinch) -> None: response = await async_client.hris.benefits.individuals.with_raw_response.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", ) assert response.is_closed is True @@ -309,7 +341,7 @@ async def test_raw_response_enrolled_ids(self, async_client: AsyncFinch) -> None @parametrize async def test_streaming_response_enrolled_ids(self, async_client: AsyncFinch) -> None: async with async_client.hris.benefits.individuals.with_streaming_response.enrolled_ids( - "benefit_id", + benefit_id="benefit_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -323,7 +355,7 @@ async def test_streaming_response_enrolled_ids(self, async_client: AsyncFinch) - async def test_path_params_enrolled_ids(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benefit_id` but received ''"): await async_client.hris.benefits.individuals.with_raw_response.enrolled_ids( - "", + benefit_id="", ) @parametrize @@ -337,6 +369,7 @@ async def test_method_retrieve_many_benefits(self, async_client: AsyncFinch) -> async def test_method_retrieve_many_benefits_with_all_params(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.retrieve_many_benefits( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids="d675d2b7-6d7b-41a8-b2d3-001eb3fb88f6,d02a6346-1f08-4312-a064-49ff3cafaa7a", ) assert_matches_type(AsyncSinglePage[IndividualBenefit], individual, path=["response"]) @@ -383,6 +416,7 @@ async def test_method_unenroll_many(self, async_client: AsyncFinch) -> None: async def test_method_unenroll_many_with_all_params(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.benefits.individuals.unenroll_many( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids=["string"], ) assert_matches_type(UnenrolledIndividualBenefitResponse, individual, path=["response"]) 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 index 340a7d99..39af7a0f 100644 --- a/tests/api_resources/hris/company/pay_statement_item/test_rules.py +++ b/tests/api_resources/hris/company/pay_statement_item/test_rules.py @@ -31,6 +31,7 @@ def test_method_create(self, client: Finch) -> None: @parametrize def test_method_create_with_all_params(self, client: Finch) -> None: rule = client.hris.company.pay_statement_item.rules.create( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], attributes={"metadata": {"foo": "bar"}}, conditions=[ { @@ -76,6 +77,7 @@ def test_method_update(self, client: Finch) -> None: def test_method_update_with_all_params(self, client: Finch) -> None: rule = client.hris.company.pay_statement_item.rules.update( rule_id="rule_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], optional_property={}, ) assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @@ -116,6 +118,13 @@ 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_method_list_with_all_params(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + 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() @@ -139,14 +148,22 @@ def test_streaming_response_list(self, client: Finch) -> None: @parametrize def test_method_delete(self, client: Finch) -> None: rule = client.hris.company.pay_statement_item.rules.delete( - "rule_id", + rule_id="rule_id", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + def test_method_delete_with_all_params(self, client: Finch) -> None: + rule = client.hris.company.pay_statement_item.rules.delete( + rule_id="rule_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) 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", + rule_id="rule_id", ) assert response.is_closed is True @@ -157,7 +174,7 @@ def test_raw_response_delete(self, client: Finch) -> None: @parametrize def test_streaming_response_delete(self, client: Finch) -> None: with client.hris.company.pay_statement_item.rules.with_streaming_response.delete( - "rule_id", + rule_id="rule_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -171,7 +188,7 @@ def test_streaming_response_delete(self, client: Finch) -> None: 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( - "", + rule_id="", ) @@ -188,6 +205,7 @@ async def test_method_create(self, async_client: AsyncFinch) -> None: @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( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], attributes={"metadata": {"foo": "bar"}}, conditions=[ { @@ -233,6 +251,7 @@ async def test_method_update(self, async_client: AsyncFinch) -> None: 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", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], optional_property={}, ) assert_matches_type(RuleUpdateResponse, rule, path=["response"]) @@ -273,6 +292,13 @@ 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_method_list_with_all_params(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + 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() @@ -296,14 +322,22 @@ async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_delete(self, async_client: AsyncFinch) -> None: rule = await async_client.hris.company.pay_statement_item.rules.delete( - "rule_id", + rule_id="rule_id", + ) + assert_matches_type(RuleDeleteResponse, rule, path=["response"]) + + @parametrize + async def test_method_delete_with_all_params(self, async_client: AsyncFinch) -> None: + rule = await async_client.hris.company.pay_statement_item.rules.delete( + rule_id="rule_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) 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", + rule_id="rule_id", ) assert response.is_closed is True @@ -314,7 +348,7 @@ async def test_raw_response_delete(self, async_client: AsyncFinch) -> None: @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", + rule_id="rule_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -328,5 +362,5 @@ async def test_streaming_response_delete(self, async_client: AsyncFinch) -> None 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( - "", + rule_id="", ) diff --git a/tests/api_resources/hris/company/test_pay_statement_item.py b/tests/api_resources/hris/company/test_pay_statement_item.py index c270ce8e..42989f22 100644 --- a/tests/api_resources/hris/company/test_pay_statement_item.py +++ b/tests/api_resources/hris/company/test_pay_statement_item.py @@ -29,6 +29,7 @@ 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"), + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], name="name", start_date=parse_date("2024-01-01"), type="base_compensation", @@ -71,6 +72,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> No pay_statement_item = await async_client.hris.company.pay_statement_item.list( categories=["earnings"], end_date=parse_date("2024-07-01"), + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], name="name", start_date=parse_date("2024-01-01"), type="base_compensation", diff --git a/tests/api_resources/hris/test_benefits.py b/tests/api_resources/hris/test_benefits.py index a9fe0954..68d8da38 100644 --- a/tests/api_resources/hris/test_benefits.py +++ b/tests/api_resources/hris/test_benefits.py @@ -31,6 +31,7 @@ def test_method_create(self, client: Finch) -> None: @parametrize def test_method_create_with_all_params(self, client: Finch) -> None: benefit = client.hris.benefits.create( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], company_contribution={ "tiers": [ { @@ -69,14 +70,22 @@ def test_streaming_response_create(self, client: Finch) -> None: @parametrize def test_method_retrieve(self, client: Finch) -> None: benefit = client.hris.benefits.retrieve( - "benefit_id", + benefit_id="benefit_id", + ) + assert_matches_type(CompanyBenefit, benefit, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Finch) -> None: + benefit = client.hris.benefits.retrieve( + benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(CompanyBenefit, benefit, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Finch) -> None: response = client.hris.benefits.with_raw_response.retrieve( - "benefit_id", + benefit_id="benefit_id", ) assert response.is_closed is True @@ -87,7 +96,7 @@ def test_raw_response_retrieve(self, client: Finch) -> None: @parametrize def test_streaming_response_retrieve(self, client: Finch) -> None: with client.hris.benefits.with_streaming_response.retrieve( - "benefit_id", + benefit_id="benefit_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -101,7 +110,7 @@ def test_streaming_response_retrieve(self, client: Finch) -> None: def test_path_params_retrieve(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benefit_id` but received ''"): client.hris.benefits.with_raw_response.retrieve( - "", + benefit_id="", ) @parametrize @@ -115,6 +124,7 @@ def test_method_update(self, client: Finch) -> None: def test_method_update_with_all_params(self, client: Finch) -> None: benefit = client.hris.benefits.update( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], description="description", ) assert_matches_type(UpdateCompanyBenefitResponse, benefit, path=["response"]) @@ -155,6 +165,13 @@ def test_method_list(self, client: Finch) -> None: benefit = client.hris.benefits.list() assert_matches_type(SyncSinglePage[CompanyBenefit], benefit, path=["response"]) + @parametrize + def test_method_list_with_all_params(self, client: Finch) -> None: + benefit = client.hris.benefits.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(SyncSinglePage[CompanyBenefit], benefit, path=["response"]) + @parametrize def test_raw_response_list(self, client: Finch) -> None: response = client.hris.benefits.with_raw_response.list() @@ -180,6 +197,13 @@ def test_method_list_supported_benefits(self, client: Finch) -> None: benefit = client.hris.benefits.list_supported_benefits() assert_matches_type(SyncSinglePage[SupportedBenefit], benefit, path=["response"]) + @parametrize + def test_method_list_supported_benefits_with_all_params(self, client: Finch) -> None: + benefit = client.hris.benefits.list_supported_benefits( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(SyncSinglePage[SupportedBenefit], benefit, path=["response"]) + @parametrize def test_raw_response_list_supported_benefits(self, client: Finch) -> None: response = client.hris.benefits.with_raw_response.list_supported_benefits() @@ -214,6 +238,7 @@ async def test_method_create(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncFinch) -> None: benefit = await async_client.hris.benefits.create( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], company_contribution={ "tiers": [ { @@ -252,14 +277,22 @@ async def test_streaming_response_create(self, async_client: AsyncFinch) -> None @parametrize async def test_method_retrieve(self, async_client: AsyncFinch) -> None: benefit = await async_client.hris.benefits.retrieve( - "benefit_id", + benefit_id="benefit_id", + ) + assert_matches_type(CompanyBenefit, benefit, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncFinch) -> None: + benefit = await async_client.hris.benefits.retrieve( + benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(CompanyBenefit, benefit, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: response = await async_client.hris.benefits.with_raw_response.retrieve( - "benefit_id", + benefit_id="benefit_id", ) assert response.is_closed is True @@ -270,7 +303,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> None: async with async_client.hris.benefits.with_streaming_response.retrieve( - "benefit_id", + benefit_id="benefit_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,7 +317,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> No async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benefit_id` but received ''"): await async_client.hris.benefits.with_raw_response.retrieve( - "", + benefit_id="", ) @parametrize @@ -298,6 +331,7 @@ async def test_method_update(self, async_client: AsyncFinch) -> None: async def test_method_update_with_all_params(self, async_client: AsyncFinch) -> None: benefit = await async_client.hris.benefits.update( benefit_id="benefit_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], description="description", ) assert_matches_type(UpdateCompanyBenefitResponse, benefit, path=["response"]) @@ -338,6 +372,13 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: benefit = await async_client.hris.benefits.list() assert_matches_type(AsyncSinglePage[CompanyBenefit], benefit, path=["response"]) + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: + benefit = await async_client.hris.benefits.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(AsyncSinglePage[CompanyBenefit], benefit, path=["response"]) + @parametrize async def test_raw_response_list(self, async_client: AsyncFinch) -> None: response = await async_client.hris.benefits.with_raw_response.list() @@ -363,6 +404,13 @@ async def test_method_list_supported_benefits(self, async_client: AsyncFinch) -> benefit = await async_client.hris.benefits.list_supported_benefits() assert_matches_type(AsyncSinglePage[SupportedBenefit], benefit, path=["response"]) + @parametrize + async def test_method_list_supported_benefits_with_all_params(self, async_client: AsyncFinch) -> None: + benefit = await async_client.hris.benefits.list_supported_benefits( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(AsyncSinglePage[SupportedBenefit], benefit, path=["response"]) + @parametrize async def test_raw_response_list_supported_benefits(self, async_client: AsyncFinch) -> None: response = await async_client.hris.benefits.with_raw_response.list_supported_benefits() diff --git a/tests/api_resources/hris/test_company.py b/tests/api_resources/hris/test_company.py index fb206fda..6c8491ea 100644 --- a/tests/api_resources/hris/test_company.py +++ b/tests/api_resources/hris/test_company.py @@ -22,6 +22,13 @@ def test_method_retrieve(self, client: Finch) -> None: company = client.hris.company.retrieve() assert_matches_type(Company, company, path=["response"]) + @parametrize + def test_method_retrieve_with_all_params(self, client: Finch) -> None: + company = client.hris.company.retrieve( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(Company, company, path=["response"]) + @parametrize def test_raw_response_retrieve(self, client: Finch) -> None: response = client.hris.company.with_raw_response.retrieve() @@ -53,6 +60,13 @@ async def test_method_retrieve(self, async_client: AsyncFinch) -> None: company = await async_client.hris.company.retrieve() assert_matches_type(Company, company, path=["response"]) + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncFinch) -> None: + company = await async_client.hris.company.retrieve( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(Company, company, path=["response"]) + @parametrize async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: response = await async_client.hris.company.with_raw_response.retrieve() diff --git a/tests/api_resources/hris/test_directory.py b/tests/api_resources/hris/test_directory.py index 37505168..fdeca307 100644 --- a/tests/api_resources/hris/test_directory.py +++ b/tests/api_resources/hris/test_directory.py @@ -28,6 +28,7 @@ def test_method_list(self, client: Finch) -> None: @parametrize def test_method_list_with_all_params(self, client: Finch) -> None: directory = client.hris.directory.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], limit=0, offset=0, ) @@ -64,6 +65,7 @@ def test_method_list_individuals(self, client: Finch) -> None: def test_method_list_individuals_with_all_params(self, client: Finch) -> None: with pytest.warns(DeprecationWarning): directory = client.hris.directory.list_individuals( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], limit=0, offset=0, ) @@ -106,6 +108,7 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: directory = await async_client.hris.directory.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], limit=0, offset=0, ) @@ -142,6 +145,7 @@ async def test_method_list_individuals(self, async_client: AsyncFinch) -> None: async def test_method_list_individuals_with_all_params(self, async_client: AsyncFinch) -> None: with pytest.warns(DeprecationWarning): directory = await async_client.hris.directory.list_individuals( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], limit=0, offset=0, ) diff --git a/tests/api_resources/hris/test_documents.py b/tests/api_resources/hris/test_documents.py index 2b9d7077..3048f109 100644 --- a/tests/api_resources/hris/test_documents.py +++ b/tests/api_resources/hris/test_documents.py @@ -9,7 +9,10 @@ from finch import Finch, AsyncFinch from tests.utils import assert_matches_type -from finch.types.hris import DocumentListResponse, DocumentRetreiveResponse +from finch.types.hris import ( + DocumentListResponse, + DocumentRetreiveResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,6 +28,7 @@ def test_method_list(self, client: Finch) -> None: @parametrize def test_method_list_with_all_params(self, client: Finch) -> None: document = client.hris.documents.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids=["string"], limit=0, offset=0, @@ -55,14 +59,22 @@ def test_streaming_response_list(self, client: Finch) -> None: @parametrize def test_method_retreive(self, client: Finch) -> None: document = client.hris.documents.retreive( - "document_id", + document_id="document_id", + ) + assert_matches_type(DocumentRetreiveResponse, document, path=["response"]) + + @parametrize + def test_method_retreive_with_all_params(self, client: Finch) -> None: + document = client.hris.documents.retreive( + document_id="document_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(DocumentRetreiveResponse, document, path=["response"]) @parametrize def test_raw_response_retreive(self, client: Finch) -> None: response = client.hris.documents.with_raw_response.retreive( - "document_id", + document_id="document_id", ) assert response.is_closed is True @@ -73,7 +85,7 @@ def test_raw_response_retreive(self, client: Finch) -> None: @parametrize def test_streaming_response_retreive(self, client: Finch) -> None: with client.hris.documents.with_streaming_response.retreive( - "document_id", + document_id="document_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -87,7 +99,7 @@ def test_streaming_response_retreive(self, client: Finch) -> None: def test_path_params_retreive(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `document_id` but received ''"): client.hris.documents.with_raw_response.retreive( - "", + document_id="", ) @@ -104,6 +116,7 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: document = await async_client.hris.documents.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_ids=["string"], limit=0, offset=0, @@ -134,14 +147,22 @@ async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_retreive(self, async_client: AsyncFinch) -> None: document = await async_client.hris.documents.retreive( - "document_id", + document_id="document_id", + ) + assert_matches_type(DocumentRetreiveResponse, document, path=["response"]) + + @parametrize + async def test_method_retreive_with_all_params(self, async_client: AsyncFinch) -> None: + document = await async_client.hris.documents.retreive( + document_id="document_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(DocumentRetreiveResponse, document, path=["response"]) @parametrize async def test_raw_response_retreive(self, async_client: AsyncFinch) -> None: response = await async_client.hris.documents.with_raw_response.retreive( - "document_id", + document_id="document_id", ) assert response.is_closed is True @@ -152,7 +173,7 @@ async def test_raw_response_retreive(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_retreive(self, async_client: AsyncFinch) -> None: async with async_client.hris.documents.with_streaming_response.retreive( - "document_id", + document_id="document_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,5 +187,5 @@ async def test_streaming_response_retreive(self, async_client: AsyncFinch) -> No async def test_path_params_retreive(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `document_id` but received ''"): await async_client.hris.documents.with_raw_response.retreive( - "", + document_id="", ) diff --git a/tests/api_resources/hris/test_employments.py b/tests/api_resources/hris/test_employments.py index f6514da2..45064af7 100644 --- a/tests/api_resources/hris/test_employments.py +++ b/tests/api_resources/hris/test_employments.py @@ -25,6 +25,14 @@ def test_method_retrieve_many(self, client: Finch) -> None: ) assert_matches_type(SyncResponsesPage[EmploymentDataResponse], employment, path=["response"]) + @parametrize + def test_method_retrieve_many_with_all_params(self, client: Finch) -> None: + employment = client.hris.employments.retrieve_many( + requests=[{"individual_id": "individual_id"}], + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(SyncResponsesPage[EmploymentDataResponse], employment, path=["response"]) + @parametrize def test_raw_response_retrieve_many(self, client: Finch) -> None: response = client.hris.employments.with_raw_response.retrieve_many( @@ -62,6 +70,14 @@ async def test_method_retrieve_many(self, async_client: AsyncFinch) -> None: ) assert_matches_type(AsyncResponsesPage[EmploymentDataResponse], employment, path=["response"]) + @parametrize + async def test_method_retrieve_many_with_all_params(self, async_client: AsyncFinch) -> None: + employment = await async_client.hris.employments.retrieve_many( + requests=[{"individual_id": "individual_id"}], + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(AsyncResponsesPage[EmploymentDataResponse], employment, path=["response"]) + @parametrize async def test_raw_response_retrieve_many(self, async_client: AsyncFinch) -> None: response = await async_client.hris.employments.with_raw_response.retrieve_many( diff --git a/tests/api_resources/hris/test_individuals.py b/tests/api_resources/hris/test_individuals.py index 9b16cad2..c2160896 100644 --- a/tests/api_resources/hris/test_individuals.py +++ b/tests/api_resources/hris/test_individuals.py @@ -26,6 +26,7 @@ def test_method_retrieve_many(self, client: Finch) -> None: @parametrize def test_method_retrieve_many_with_all_params(self, client: Finch) -> None: individual = client.hris.individuals.retrieve_many( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], options={"include": ["string"]}, requests=[{"individual_id": "individual_id"}], ) @@ -65,6 +66,7 @@ async def test_method_retrieve_many(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_retrieve_many_with_all_params(self, async_client: AsyncFinch) -> None: individual = await async_client.hris.individuals.retrieve_many( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], options={"include": ["string"]}, requests=[{"individual_id": "individual_id"}], ) diff --git a/tests/api_resources/hris/test_pay_statements.py b/tests/api_resources/hris/test_pay_statements.py index 1631e42c..906a3b44 100644 --- a/tests/api_resources/hris/test_pay_statements.py +++ b/tests/api_resources/hris/test_pay_statements.py @@ -25,6 +25,20 @@ def test_method_retrieve_many(self, client: Finch) -> None: ) assert_matches_type(SyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) + @parametrize + def test_method_retrieve_many_with_all_params(self, client: Finch) -> None: + pay_statement = client.hris.pay_statements.retrieve_many( + requests=[ + { + "payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "limit": 50, + "offset": 0, + } + ], + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + 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( @@ -62,6 +76,20 @@ async def test_method_retrieve_many(self, async_client: AsyncFinch) -> None: ) assert_matches_type(AsyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) + @parametrize + async def test_method_retrieve_many_with_all_params(self, async_client: AsyncFinch) -> None: + pay_statement = await async_client.hris.pay_statements.retrieve_many( + requests=[ + { + "payment_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "limit": 50, + "offset": 0, + } + ], + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + 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( diff --git a/tests/api_resources/hris/test_payments.py b/tests/api_resources/hris/test_payments.py index 8a2ba820..9a7e047e 100644 --- a/tests/api_resources/hris/test_payments.py +++ b/tests/api_resources/hris/test_payments.py @@ -27,6 +27,15 @@ def test_method_list(self, client: Finch) -> None: ) assert_matches_type(SyncSinglePage[Payment], payment, path=["response"]) + @parametrize + def test_method_list_with_all_params(self, client: Finch) -> None: + payment = client.hris.payments.list( + end_date=parse_date("2021-01-01"), + start_date=parse_date("2021-01-01"), + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(SyncSinglePage[Payment], payment, path=["response"]) + @parametrize def test_raw_response_list(self, client: Finch) -> None: response = client.hris.payments.with_raw_response.list( @@ -67,6 +76,15 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: ) assert_matches_type(AsyncSinglePage[Payment], payment, path=["response"]) + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: + payment = await async_client.hris.payments.list( + end_date=parse_date("2021-01-01"), + start_date=parse_date("2021-01-01"), + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], + ) + assert_matches_type(AsyncSinglePage[Payment], payment, path=["response"]) + @parametrize async def test_raw_response_list(self, async_client: AsyncFinch) -> None: response = await async_client.hris.payments.with_raw_response.list( diff --git a/tests/api_resources/jobs/test_automated.py b/tests/api_resources/jobs/test_automated.py index 1593aeda..746efc27 100644 --- a/tests/api_resources/jobs/test_automated.py +++ b/tests/api_resources/jobs/test_automated.py @@ -89,22 +89,14 @@ def test_streaming_response_create_overload_2(self, client: Finch) -> None: @parametrize def test_method_retrieve(self, client: Finch) -> None: automated = client.jobs.automated.retrieve( - job_id="job_id", - ) - assert_matches_type(AutomatedAsyncJob, automated, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Finch) -> None: - automated = client.jobs.automated.retrieve( - job_id="job_id", - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "job_id", ) assert_matches_type(AutomatedAsyncJob, automated, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Finch) -> None: response = client.jobs.automated.with_raw_response.retrieve( - job_id="job_id", + "job_id", ) assert response.is_closed is True @@ -115,7 +107,7 @@ def test_raw_response_retrieve(self, client: Finch) -> None: @parametrize def test_streaming_response_retrieve(self, client: Finch) -> None: with client.jobs.automated.with_streaming_response.retrieve( - job_id="job_id", + "job_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,7 +121,7 @@ def test_streaming_response_retrieve(self, client: Finch) -> None: def test_path_params_retrieve(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): client.jobs.automated.with_raw_response.retrieve( - job_id="", + "", ) @parametrize @@ -140,7 +132,6 @@ def test_method_list(self, client: Finch) -> None: @parametrize def test_method_list_with_all_params(self, client: Finch) -> None: automated = client.jobs.automated.list( - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", limit=0, offset=0, ) @@ -240,22 +231,14 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncFin @parametrize async def test_method_retrieve(self, async_client: AsyncFinch) -> None: automated = await async_client.jobs.automated.retrieve( - job_id="job_id", - ) - assert_matches_type(AutomatedAsyncJob, automated, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncFinch) -> None: - automated = await async_client.jobs.automated.retrieve( - job_id="job_id", - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "job_id", ) assert_matches_type(AutomatedAsyncJob, automated, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: response = await async_client.jobs.automated.with_raw_response.retrieve( - job_id="job_id", + "job_id", ) assert response.is_closed is True @@ -266,7 +249,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> None: async with async_client.jobs.automated.with_streaming_response.retrieve( - job_id="job_id", + "job_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -280,7 +263,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> No async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): await async_client.jobs.automated.with_raw_response.retrieve( - job_id="", + "", ) @parametrize @@ -291,7 +274,6 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: automated = await async_client.jobs.automated.list( - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", limit=0, offset=0, ) diff --git a/tests/api_resources/jobs/test_manual.py b/tests/api_resources/jobs/test_manual.py index bc3d5a8f..1cd30215 100644 --- a/tests/api_resources/jobs/test_manual.py +++ b/tests/api_resources/jobs/test_manual.py @@ -20,22 +20,14 @@ class TestManual: @parametrize def test_method_retrieve(self, client: Finch) -> None: manual = client.jobs.manual.retrieve( - job_id="job_id", - ) - assert_matches_type(ManualAsyncJob, manual, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Finch) -> None: - manual = client.jobs.manual.retrieve( - job_id="job_id", - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "job_id", ) assert_matches_type(ManualAsyncJob, manual, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Finch) -> None: response = client.jobs.manual.with_raw_response.retrieve( - job_id="job_id", + "job_id", ) assert response.is_closed is True @@ -46,7 +38,7 @@ def test_raw_response_retrieve(self, client: Finch) -> None: @parametrize def test_streaming_response_retrieve(self, client: Finch) -> None: with client.jobs.manual.with_streaming_response.retrieve( - job_id="job_id", + "job_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -60,7 +52,7 @@ def test_streaming_response_retrieve(self, client: Finch) -> None: def test_path_params_retrieve(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): client.jobs.manual.with_raw_response.retrieve( - job_id="", + "", ) @@ -72,22 +64,14 @@ class TestAsyncManual: @parametrize async def test_method_retrieve(self, async_client: AsyncFinch) -> None: manual = await async_client.jobs.manual.retrieve( - job_id="job_id", - ) - assert_matches_type(ManualAsyncJob, manual, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncFinch) -> None: - manual = await async_client.jobs.manual.retrieve( - job_id="job_id", - entity_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + "job_id", ) assert_matches_type(ManualAsyncJob, manual, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: response = await async_client.jobs.manual.with_raw_response.retrieve( - job_id="job_id", + "job_id", ) assert response.is_closed is True @@ -98,7 +82,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> None: async with async_client.jobs.manual.with_streaming_response.retrieve( - job_id="job_id", + "job_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,5 +96,5 @@ async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> No async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): await async_client.jobs.manual.with_raw_response.retrieve( - job_id="", + "", ) diff --git a/tests/api_resources/payroll/test_pay_groups.py b/tests/api_resources/payroll/test_pay_groups.py index ebf7dbd4..af65951f 100644 --- a/tests/api_resources/payroll/test_pay_groups.py +++ b/tests/api_resources/payroll/test_pay_groups.py @@ -10,7 +10,10 @@ from finch import Finch, AsyncFinch from tests.utils import assert_matches_type from finch.pagination import SyncSinglePage, AsyncSinglePage -from finch.types.payroll import PayGroupListResponse, PayGroupRetrieveResponse +from finch.types.payroll import ( + PayGroupListResponse, + PayGroupRetrieveResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,14 +24,22 @@ class TestPayGroups: @parametrize def test_method_retrieve(self, client: Finch) -> None: pay_group = client.payroll.pay_groups.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", + ) + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Finch) -> None: + pay_group = client.payroll.pay_groups.retrieve( + pay_group_id="pay_group_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Finch) -> None: response = client.payroll.pay_groups.with_raw_response.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", ) assert response.is_closed is True @@ -39,7 +50,7 @@ def test_raw_response_retrieve(self, client: Finch) -> None: @parametrize def test_streaming_response_retrieve(self, client: Finch) -> None: with client.payroll.pay_groups.with_streaming_response.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -53,7 +64,7 @@ def test_streaming_response_retrieve(self, client: Finch) -> None: def test_path_params_retrieve(self, client: Finch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pay_group_id` but received ''"): client.payroll.pay_groups.with_raw_response.retrieve( - "", + pay_group_id="", ) @parametrize @@ -64,6 +75,7 @@ def test_method_list(self, client: Finch) -> None: @parametrize def test_method_list_with_all_params(self, client: Finch) -> None: pay_group = client.payroll.pay_groups.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", pay_frequencies=["string"], ) @@ -98,14 +110,22 @@ class TestAsyncPayGroups: @parametrize async def test_method_retrieve(self, async_client: AsyncFinch) -> None: pay_group = await async_client.payroll.pay_groups.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", + ) + assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncFinch) -> None: + pay_group = await async_client.payroll.pay_groups.retrieve( + pay_group_id="pay_group_id", + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], ) assert_matches_type(PayGroupRetrieveResponse, pay_group, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: response = await async_client.payroll.pay_groups.with_raw_response.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", ) assert response.is_closed is True @@ -116,7 +136,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> None: async with async_client.payroll.pay_groups.with_streaming_response.retrieve( - "pay_group_id", + pay_group_id="pay_group_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,7 +150,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncFinch) -> No async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `pay_group_id` but received ''"): await async_client.payroll.pay_groups.with_raw_response.retrieve( - "", + pay_group_id="", ) @parametrize @@ -141,6 +161,7 @@ async def test_method_list(self, async_client: AsyncFinch) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None: pay_group = await async_client.payroll.pay_groups.list( + entity_ids=["550e8400-e29b-41d4-a716-446655440000"], individual_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", pay_frequencies=["string"], ) diff --git a/tests/api_resources/test_providers.py b/tests/api_resources/test_providers.py index 7228af21..be5dd8ce 100644 --- a/tests/api_resources/test_providers.py +++ b/tests/api_resources/test_providers.py @@ -8,7 +8,7 @@ import pytest from finch import Finch, AsyncFinch -from finch.types import Provider +from finch.types import ProviderListResponse from tests.utils import assert_matches_type from finch.pagination import SyncSinglePage, AsyncSinglePage @@ -21,7 +21,7 @@ class TestProviders: @parametrize def test_method_list(self, client: Finch) -> None: provider = client.providers.list() - assert_matches_type(SyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(SyncSinglePage[ProviderListResponse], provider, path=["response"]) @parametrize def test_raw_response_list(self, client: Finch) -> None: @@ -30,7 +30,7 @@ def test_raw_response_list(self, client: Finch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" provider = response.parse() - assert_matches_type(SyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(SyncSinglePage[ProviderListResponse], provider, path=["response"]) @parametrize def test_streaming_response_list(self, client: Finch) -> None: @@ -39,7 +39,7 @@ def test_streaming_response_list(self, client: Finch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" provider = response.parse() - assert_matches_type(SyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(SyncSinglePage[ProviderListResponse], provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -52,7 +52,7 @@ class TestAsyncProviders: @parametrize async def test_method_list(self, async_client: AsyncFinch) -> None: provider = await async_client.providers.list() - assert_matches_type(AsyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(AsyncSinglePage[ProviderListResponse], provider, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncFinch) -> None: @@ -61,7 +61,7 @@ async def test_raw_response_list(self, async_client: AsyncFinch) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" provider = response.parse() - assert_matches_type(AsyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(AsyncSinglePage[ProviderListResponse], provider, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: @@ -70,6 +70,6 @@ async def test_streaming_response_list(self, async_client: AsyncFinch) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" provider = await response.parse() - assert_matches_type(AsyncSinglePage[Provider], provider, path=["response"]) + assert_matches_type(AsyncSinglePage[ProviderListResponse], provider, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_request_forwarding.py b/tests/api_resources/test_request_forwarding.py index be7ec45f..5615e4d2 100644 --- a/tests/api_resources/test_request_forwarding.py +++ b/tests/api_resources/test_request_forwarding.py @@ -20,30 +20,27 @@ class TestRequestForwarding: @parametrize def test_method_forward(self, client: Finch) -> None: request_forwarding = client.request_forwarding.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"]) @parametrize def test_method_forward_with_all_params(self, client: Finch) -> None: request_forwarding = client.request_forwarding.forward( - method="POST", - route="/people/search", - data=None, - headers={"content-type": "application/json"}, - params={ - "showInactive": True, - "humanReadable": True, - }, + method="method", + route="route", + data="data", + headers={"foo": "bar"}, + params={"foo": "bar"}, ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"]) @parametrize def test_raw_response_forward(self, client: Finch) -> None: response = client.request_forwarding.with_raw_response.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) assert response.is_closed is True @@ -54,8 +51,8 @@ def test_raw_response_forward(self, client: Finch) -> None: @parametrize def test_streaming_response_forward(self, client: Finch) -> None: with client.request_forwarding.with_streaming_response.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -74,30 +71,27 @@ class TestAsyncRequestForwarding: @parametrize async def test_method_forward(self, async_client: AsyncFinch) -> None: request_forwarding = await async_client.request_forwarding.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"]) @parametrize async def test_method_forward_with_all_params(self, async_client: AsyncFinch) -> None: request_forwarding = await async_client.request_forwarding.forward( - method="POST", - route="/people/search", - data=None, - headers={"content-type": "application/json"}, - params={ - "showInactive": True, - "humanReadable": True, - }, + method="method", + route="route", + data="data", + headers={"foo": "bar"}, + params={"foo": "bar"}, ) assert_matches_type(RequestForwardingForwardResponse, request_forwarding, path=["response"]) @parametrize async def test_raw_response_forward(self, async_client: AsyncFinch) -> None: response = await async_client.request_forwarding.with_raw_response.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) assert response.is_closed is True @@ -108,8 +102,8 @@ async def test_raw_response_forward(self, async_client: AsyncFinch) -> None: @parametrize async def test_streaming_response_forward(self, async_client: AsyncFinch) -> None: async with async_client.request_forwarding.with_streaming_response.forward( - method="POST", - route="/people/search", + method="method", + route="route", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/test_transform.py b/tests/test_transform.py index 916fd75c..223fa54c 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from finch._types import NOT_GIVEN, Base64FileInput +from finch._types import Base64FileInput, omit, not_given from finch._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {}