From 244aef94986b9775df68c247dad9e1f576fd0415 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 27 Dec 2023 21:17:51 -0500 Subject: [PATCH 01/11] fix(client): correctly use custom http client auth (#242) --- src/finch/_base_client.py | 13 +++++++++++-- src/finch/_types.py | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index 481171a4..53a53d80 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -58,6 +58,7 @@ PostParser, ProxiesTypes, RequestFiles, + HttpxSendArgs, AsyncTransport, RequestOptions, UnknownResponse, @@ -873,11 +874,15 @@ def _request( request = self._build_request(options) self._prepare_request(request) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + try: response = self._client.send( request, - auth=self.custom_auth, stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) except httpx.TimeoutException as err: if retries > 0: @@ -1335,11 +1340,15 @@ async def _request( request = self._build_request(options) await self._prepare_request(request) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + try: response = await self._client.send( request, - auth=self.custom_auth, stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) except httpx.TimeoutException as err: if retries > 0: diff --git a/src/finch/_types.py b/src/finch/_types.py index 2644981b..115edd0f 100644 --- a/src/finch/_types.py +++ b/src/finch/_types.py @@ -28,6 +28,7 @@ runtime_checkable, ) +import httpx import pydantic from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport @@ -369,3 +370,7 @@ class InheritsGeneric(Protocol): class _GenericAlias(Protocol): __origin__: type[object] + + +class HttpxSendArgs(TypedDict, total=False): + auth: httpx.Auth From b7b01454503efda4542805d4fb335f39b301bc1f Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 2 Jan 2024 05:36:04 -0500 Subject: [PATCH 02/11] chore(internal): bump license (#244) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 6e22ceda..1dac0f68 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 Finch + Copyright 2024 Finch Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 82a7085b46391bbb1a08f45d1fa4469c1225e3dd Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:12:23 -0500 Subject: [PATCH 03/11] chore(internal): replace isort with ruff (#245) --- pyproject.toml | 16 ++-- requirements-dev.lock | 1 - src/finch/__init__.py | 12 +-- src/finch/_client.py | 8 +- src/finch/_compat.py | 30 +++---- src/finch/_models.py | 14 +--- src/finch/_types.py | 9 +- src/finch/_utils/__init__.py | 83 ++++++++++--------- src/finch/_utils/_transform.py | 5 +- src/finch/_utils/_utils.py | 3 +- src/finch/resources/__init__.py | 14 +--- src/finch/resources/account.py | 12 ++- src/finch/resources/hris/__init__.py | 35 ++------ src/finch/resources/hris/benefits/__init__.py | 14 +--- src/finch/resources/hris/benefits/benefits.py | 20 +++-- .../resources/hris/benefits/individuals.py | 13 ++- src/finch/resources/hris/company.py | 12 ++- src/finch/resources/hris/directory.py | 18 +++- src/finch/resources/hris/employments.py | 13 ++- src/finch/resources/hris/hris.py | 35 ++------ src/finch/resources/hris/individuals.py | 13 ++- src/finch/resources/hris/pay_statements.py | 13 ++- src/finch/resources/hris/payments.py | 13 ++- src/finch/resources/jobs/__init__.py | 14 +--- src/finch/resources/jobs/automated.py | 13 ++- src/finch/resources/jobs/jobs.py | 14 +--- src/finch/resources/jobs/manual.py | 12 ++- src/finch/resources/providers.py | 13 ++- src/finch/resources/request_forwarding.py | 17 +++- src/finch/resources/webhooks.py | 8 +- src/finch/types/__init__.py | 16 ++-- src/finch/types/hris/__init__.py | 32 ++----- src/finch/types/hris/benefits/__init__.py | 12 +-- src/finch/types/hris/benfit_contribution.py | 2 + src/finch/types/jobs/__init__.py | 4 +- tests/test_client.py | 7 +- tests/utils.py | 7 +- 37 files changed, 285 insertions(+), 292 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 25bdef95..a422005e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,6 @@ dev-dependencies = [ "pytest", "pytest-asyncio", "ruff", - "isort", "time-machine", "nox", "dirty-equals>=0.6.0", @@ -66,7 +65,6 @@ format = { chain = [ "format:ruff", "format:docs", "fix:ruff", - "format:isort", ]} "format:black" = "black ." "format:docs" = "python bin/ruffen-docs.py README.md api.md" @@ -127,16 +125,13 @@ reportImplicitOverride = true reportImportCycles = false reportPrivateUsage = false -[tool.isort] -profile = "black" -length_sort = true -extra_standard_library = ["typing_extensions"] - [tool.ruff] line-length = 120 output-format = "grouped" target-version = "py37" select = [ + # isort + "I", # bugbear rules "B", # remove unused imports @@ -163,6 +158,13 @@ ignore-init-module-imports = true [tool.ruff.format] docstring-code-format = true +[tool.ruff.lint.isort] +length-sort = true +length-sort-straight = true +combine-as-imports = true +extra-standard-library = ["typing_extensions"] +known-first-party = ["finch", "tests"] + [tool.ruff.per-file-ignores] "bin/**.py" = ["T201", "T203"] "tests/**.py" = ["T201", "T203"] diff --git a/requirements-dev.lock b/requirements-dev.lock index 0b791eab..a0134d65 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -24,7 +24,6 @@ httpx==0.25.2 idna==3.4 importlib-metadata==7.0.0 iniconfig==2.0.0 -isort==5.10.1 mypy==1.7.1 mypy-extensions==1.0.0 nodeenv==1.8.0 diff --git a/src/finch/__init__.py b/src/finch/__init__.py index 37904fae..4fb56959 100644 --- a/src/finch/__init__.py +++ b/src/finch/__init__.py @@ -3,17 +3,7 @@ from . import types from ._types import NoneType, Transport, ProxiesTypes from ._utils import file_from_path -from ._client import ( - Finch, - Client, - Stream, - Timeout, - Transport, - AsyncFinch, - AsyncClient, - AsyncStream, - RequestOptions, -) +from ._client import Finch, Client, Stream, Timeout, Transport, AsyncFinch, AsyncClient, AsyncStream, RequestOptions from ._version import __title__, __version__ from ._exceptions import ( APIError, diff --git a/src/finch/_client.py b/src/finch/_client.py index 45a3b410..f11a51ed 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -21,10 +21,12 @@ AsyncTransport, RequestOptions, ) -from ._utils import is_given, get_async_library +from ._utils import ( + is_given, + get_async_library, +) from ._version import __version__ -from ._streaming import Stream as Stream -from ._streaming import AsyncStream as AsyncStream +from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError from ._base_client import ( DEFAULT_LIMITS, diff --git a/src/finch/_compat.py b/src/finch/_compat.py index 34323c9b..d95db8ed 100644 --- a/src/finch/_compat.py +++ b/src/finch/_compat.py @@ -43,21 +43,23 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 else: if PYDANTIC_V2: - from pydantic.v1.typing import get_args as get_args - from pydantic.v1.typing import is_union as is_union - from pydantic.v1.typing import get_origin as get_origin - from pydantic.v1.typing import is_typeddict as is_typeddict - from pydantic.v1.typing import is_literal_type as is_literal_type - from pydantic.v1.datetime_parse import parse_date as parse_date - from pydantic.v1.datetime_parse import parse_datetime as parse_datetime + from pydantic.v1.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import get_args as get_args - from pydantic.typing import is_union as is_union - from pydantic.typing import get_origin as get_origin - from pydantic.typing import is_typeddict as is_typeddict - from pydantic.typing import is_literal_type as is_literal_type - from pydantic.datetime_parse import parse_date as parse_date - from pydantic.datetime_parse import parse_datetime as parse_datetime + from pydantic.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config diff --git a/src/finch/_models.py b/src/finch/_models.py index 330a2064..48d5624f 100644 --- a/src/finch/_models.py +++ b/src/finch/_models.py @@ -30,17 +30,11 @@ AnyMapping, HttpxRequestFiles, ) -from ._utils import ( - is_list, - is_given, - is_mapping, - parse_date, - parse_datetime, - strip_not_given, -) -from ._compat import PYDANTIC_V2, ConfigDict -from ._compat import GenericModel as BaseGenericModel +from ._utils import is_list, is_given, is_mapping, parse_date, parse_datetime, strip_not_given from ._compat import ( + PYDANTIC_V2, + ConfigDict, + GenericModel as BaseGenericModel, get_args, is_union, parse_obj, diff --git a/src/finch/_types.py b/src/finch/_types.py index 115edd0f..8aafa336 100644 --- a/src/finch/_types.py +++ b/src/finch/_types.py @@ -19,14 +19,7 @@ Sequence, AsyncIterator, ) -from typing_extensions import ( - Literal, - Protocol, - TypeAlias, - TypedDict, - override, - runtime_checkable, -) +from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable import httpx import pydantic diff --git a/src/finch/_utils/__init__.py b/src/finch/_utils/__init__.py index a43201d3..2dcfc122 100644 --- a/src/finch/_utils/__init__.py +++ b/src/finch/_utils/__init__.py @@ -1,40 +1,45 @@ from ._proxy import LazyProxy as LazyProxy -from ._utils import flatten as flatten -from ._utils import is_dict as is_dict -from ._utils import is_list as is_list -from ._utils import is_given as is_given -from ._utils import is_tuple as is_tuple -from ._utils import is_mapping as is_mapping -from ._utils import is_tuple_t as is_tuple_t -from ._utils import parse_date as parse_date -from ._utils import is_sequence as is_sequence -from ._utils import coerce_float as coerce_float -from ._utils import is_mapping_t as is_mapping_t -from ._utils import removeprefix as removeprefix -from ._utils import removesuffix as removesuffix -from ._utils import extract_files as extract_files -from ._utils import is_sequence_t as is_sequence_t -from ._utils import required_args as required_args -from ._utils import coerce_boolean as coerce_boolean -from ._utils import coerce_integer as coerce_integer -from ._utils import file_from_path as file_from_path -from ._utils import parse_datetime as parse_datetime -from ._utils import strip_not_given as strip_not_given -from ._utils import deepcopy_minimal as deepcopy_minimal -from ._utils import get_async_library as get_async_library -from ._utils import maybe_coerce_float as maybe_coerce_float -from ._utils import get_required_header as get_required_header -from ._utils import maybe_coerce_boolean as maybe_coerce_boolean -from ._utils import maybe_coerce_integer as maybe_coerce_integer -from ._typing import is_list_type as is_list_type -from ._typing import is_union_type as is_union_type -from ._typing import extract_type_arg as extract_type_arg -from ._typing import is_required_type as is_required_type -from ._typing import is_annotated_type as is_annotated_type -from ._typing import strip_annotated_type as strip_annotated_type -from ._typing import extract_type_var_from_base as extract_type_var_from_base -from ._streams import consume_sync_iterator as consume_sync_iterator -from ._streams import consume_async_iterator as consume_async_iterator -from ._transform import PropertyInfo as PropertyInfo -from ._transform import transform as transform -from ._transform import maybe_transform as maybe_transform +from ._utils import ( + flatten as flatten, + is_dict as is_dict, + is_list as is_list, + is_given as is_given, + is_tuple as is_tuple, + is_mapping as is_mapping, + is_tuple_t as is_tuple_t, + parse_date as parse_date, + is_sequence as is_sequence, + coerce_float as coerce_float, + is_mapping_t as is_mapping_t, + removeprefix as removeprefix, + removesuffix as removesuffix, + extract_files as extract_files, + is_sequence_t as is_sequence_t, + required_args as required_args, + coerce_boolean as coerce_boolean, + coerce_integer as coerce_integer, + file_from_path as file_from_path, + parse_datetime as parse_datetime, + strip_not_given as strip_not_given, + deepcopy_minimal as deepcopy_minimal, + get_async_library as get_async_library, + maybe_coerce_float as maybe_coerce_float, + get_required_header as get_required_header, + maybe_coerce_boolean as maybe_coerce_boolean, + maybe_coerce_integer as maybe_coerce_integer, +) +from ._typing import ( + is_list_type as is_list_type, + is_union_type as is_union_type, + extract_type_arg as extract_type_arg, + is_required_type as is_required_type, + is_annotated_type as is_annotated_type, + strip_annotated_type as strip_annotated_type, + extract_type_var_from_base as extract_type_var_from_base, +) +from ._streams import consume_sync_iterator as consume_sync_iterator, consume_async_iterator as consume_async_iterator +from ._transform import ( + PropertyInfo as PropertyInfo, + transform as transform, + maybe_transform as maybe_transform, +) diff --git a/src/finch/_utils/_transform.py b/src/finch/_utils/_transform.py index 342b5241..3a1c1496 100644 --- a/src/finch/_utils/_transform.py +++ b/src/finch/_utils/_transform.py @@ -6,7 +6,10 @@ import pydantic -from ._utils import is_list, is_mapping +from ._utils import ( + is_list, + is_mapping, +) from ._typing import ( is_list_type, is_union_type, diff --git a/src/finch/_utils/_utils.py b/src/finch/_utils/_utils.py index cc624b0c..1c5c21a8 100644 --- a/src/finch/_utils/_utils.py +++ b/src/finch/_utils/_utils.py @@ -21,8 +21,7 @@ import sniffio from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date -from .._compat import parse_datetime as parse_datetime +from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) diff --git a/src/finch/resources/__init__.py b/src/finch/resources/__init__.py index dcab5333..32d0cf28 100644 --- a/src/finch/resources/__init__.py +++ b/src/finch/resources/__init__.py @@ -2,19 +2,9 @@ from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse -from .account import ( - Account, - AsyncAccount, - AccountWithRawResponse, - AsyncAccountWithRawResponse, -) +from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse from .webhooks import Webhooks, AsyncWebhooks -from .providers import ( - Providers, - AsyncProviders, - ProvidersWithRawResponse, - AsyncProvidersWithRawResponse, -) +from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse from .request_forwarding import ( RequestForwarding, AsyncRequestForwarding, diff --git a/src/finch/resources/account.py b/src/finch/resources/account.py index 5d90dfdc..0cb7b3aa 100644 --- a/src/finch/resources/account.py +++ b/src/finch/resources/account.py @@ -7,10 +7,18 @@ import httpx from ..types import Introspection, DisconnectResponse -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper -from .._base_client import make_request_options +from .._base_client import ( + make_request_options, +) if TYPE_CHECKING: from .._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/__init__.py b/src/finch/resources/hris/__init__.py index 4659abb9..8f292e8f 100644 --- a/src/finch/resources/hris/__init__.py +++ b/src/finch/resources/hris/__init__.py @@ -7,36 +7,11 @@ CompanyResourceWithRawResponse, AsyncCompanyResourceWithRawResponse, ) -from .benefits import ( - Benefits, - AsyncBenefits, - BenefitsWithRawResponse, - AsyncBenefitsWithRawResponse, -) -from .payments import ( - Payments, - AsyncPayments, - PaymentsWithRawResponse, - AsyncPaymentsWithRawResponse, -) -from .directory import ( - Directory, - AsyncDirectory, - DirectoryWithRawResponse, - AsyncDirectoryWithRawResponse, -) -from .employments import ( - Employments, - AsyncEmployments, - EmploymentsWithRawResponse, - AsyncEmploymentsWithRawResponse, -) -from .individuals import ( - Individuals, - AsyncIndividuals, - IndividualsWithRawResponse, - AsyncIndividualsWithRawResponse, -) +from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse +from .payments import Payments, AsyncPayments, PaymentsWithRawResponse, AsyncPaymentsWithRawResponse +from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse +from .employments import Employments, AsyncEmployments, EmploymentsWithRawResponse, AsyncEmploymentsWithRawResponse +from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse from .pay_statements import ( PayStatements, AsyncPayStatements, diff --git a/src/finch/resources/hris/benefits/__init__.py b/src/finch/resources/hris/benefits/__init__.py index fbbe99ea..9a5b9063 100644 --- a/src/finch/resources/hris/benefits/__init__.py +++ b/src/finch/resources/hris/benefits/__init__.py @@ -1,17 +1,7 @@ # File generated from our OpenAPI spec by Stainless. -from .benefits import ( - Benefits, - AsyncBenefits, - BenefitsWithRawResponse, - AsyncBenefitsWithRawResponse, -) -from .individuals import ( - Individuals, - AsyncIndividuals, - IndividualsWithRawResponse, - AsyncIndividualsWithRawResponse, -) +from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse +from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse __all__ = [ "Individuals", diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index f90a5100..4752a838 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -6,14 +6,15 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import maybe_transform -from .individuals import ( - Individuals, - AsyncIndividuals, - IndividualsWithRawResponse, - AsyncIndividualsWithRawResponse, +from ...._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, ) +from ...._utils import maybe_transform +from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ....pagination import SyncSinglePage, AsyncSinglePage @@ -27,7 +28,10 @@ benefit_create_params, benefit_update_params, ) -from ...._base_client import AsyncPaginator, make_request_options +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ...._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index fb4b3450..cb09ddf4 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -6,12 +6,21 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ...._utils import maybe_transform from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ....pagination import SyncSinglePage, AsyncSinglePage -from ...._base_client import AsyncPaginator, make_request_options +from ...._base_client import ( + AsyncPaginator, + make_request_options, +) from ....types.hris.benefits import ( IndividualBenefit, EnrolledIndividual, diff --git a/src/finch/resources/hris/company.py b/src/finch/resources/hris/company.py index af6d6441..3ee67da7 100644 --- a/src/finch/resources/hris/company.py +++ b/src/finch/resources/hris/company.py @@ -6,11 +6,19 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...types.hris import Company -from ..._base_client import make_request_options +from ..._base_client import ( + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/directory.py b/src/finch/resources/hris/directory.py index ff3950aa..221586f6 100644 --- a/src/finch/resources/hris/directory.py +++ b/src/finch/resources/hris/directory.py @@ -7,13 +7,25 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncIndividualsPage, AsyncIndividualsPage -from ...types.hris import IndividualInDirectory, directory_list_params -from ..._base_client import AsyncPaginator, make_request_options +from ...types.hris import ( + IndividualInDirectory, + directory_list_params, +) +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/employments.py b/src/finch/resources/hris/employments.py index 0b16202e..c0bd79ba 100644 --- a/src/finch/resources/hris/employments.py +++ b/src/finch/resources/hris/employments.py @@ -6,13 +6,22 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage from ...types.hris import EmploymentDataResponse, employment_retrieve_many_params -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/hris.py b/src/finch/resources/hris/hris.py index 8cd4f554..0ba66160 100644 --- a/src/finch/resources/hris/hris.py +++ b/src/finch/resources/hris/hris.py @@ -10,37 +10,12 @@ CompanyResourceWithRawResponse, AsyncCompanyResourceWithRawResponse, ) -from .benefits import ( - Benefits, - AsyncBenefits, - BenefitsWithRawResponse, - AsyncBenefitsWithRawResponse, -) -from .payments import ( - Payments, - AsyncPayments, - PaymentsWithRawResponse, - AsyncPaymentsWithRawResponse, -) -from .directory import ( - Directory, - AsyncDirectory, - DirectoryWithRawResponse, - AsyncDirectoryWithRawResponse, -) +from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse +from .payments import Payments, AsyncPayments, PaymentsWithRawResponse, AsyncPaymentsWithRawResponse +from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse from ..._resource import SyncAPIResource, AsyncAPIResource -from .employments import ( - Employments, - AsyncEmployments, - EmploymentsWithRawResponse, - AsyncEmploymentsWithRawResponse, -) -from .individuals import ( - Individuals, - AsyncIndividuals, - IndividualsWithRawResponse, - AsyncIndividualsWithRawResponse, -) +from .employments import Employments, AsyncEmployments, EmploymentsWithRawResponse, AsyncEmploymentsWithRawResponse +from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse from .pay_statements import ( PayStatements, AsyncPayStatements, diff --git a/src/finch/resources/hris/individuals.py b/src/finch/resources/hris/individuals.py index 892eb820..8ca24125 100644 --- a/src/finch/resources/hris/individuals.py +++ b/src/finch/resources/hris/individuals.py @@ -6,13 +6,22 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage from ...types.hris import IndividualResponse, individual_retrieve_many_params -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/pay_statements.py b/src/finch/resources/hris/pay_statements.py index 4c444e9b..6ad4be76 100644 --- a/src/finch/resources/hris/pay_statements.py +++ b/src/finch/resources/hris/pay_statements.py @@ -6,13 +6,22 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage from ...types.hris import PayStatementResponse, pay_statement_retrieve_many_params -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/hris/payments.py b/src/finch/resources/hris/payments.py index 17364d80..d5d0b28d 100644 --- a/src/finch/resources/hris/payments.py +++ b/src/finch/resources/hris/payments.py @@ -7,13 +7,22 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncSinglePage, AsyncSinglePage from ...types.hris import Payment, payment_list_params -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/jobs/__init__.py b/src/finch/resources/jobs/__init__.py index f1f7692d..112d3130 100644 --- a/src/finch/resources/jobs/__init__.py +++ b/src/finch/resources/jobs/__init__.py @@ -1,18 +1,8 @@ # File generated from our OpenAPI spec by Stainless. from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse -from .manual import ( - Manual, - AsyncManual, - ManualWithRawResponse, - AsyncManualWithRawResponse, -) -from .automated import ( - Automated, - AsyncAutomated, - AutomatedWithRawResponse, - AsyncAutomatedWithRawResponse, -) +from .manual import Manual, AsyncManual, ManualWithRawResponse, AsyncManualWithRawResponse +from .automated import Automated, AsyncAutomated, AutomatedWithRawResponse, AsyncAutomatedWithRawResponse __all__ = [ "Automated", diff --git a/src/finch/resources/jobs/automated.py b/src/finch/resources/jobs/automated.py index 9f43c60a..48f2199b 100644 --- a/src/finch/resources/jobs/automated.py +++ b/src/finch/resources/jobs/automated.py @@ -7,7 +7,13 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._utils import maybe_transform from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper @@ -18,7 +24,10 @@ automated_list_params, automated_create_params, ) -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/jobs/jobs.py b/src/finch/resources/jobs/jobs.py index f522c9c5..a47c4ddd 100644 --- a/src/finch/resources/jobs/jobs.py +++ b/src/finch/resources/jobs/jobs.py @@ -4,18 +4,8 @@ from typing import TYPE_CHECKING -from .manual import ( - Manual, - AsyncManual, - ManualWithRawResponse, - AsyncManualWithRawResponse, -) -from .automated import ( - Automated, - AsyncAutomated, - AutomatedWithRawResponse, - AsyncAutomatedWithRawResponse, -) +from .manual import Manual, AsyncManual, ManualWithRawResponse, AsyncManualWithRawResponse +from .automated import Automated, AsyncAutomated, AutomatedWithRawResponse, AsyncAutomatedWithRawResponse from ..._resource import SyncAPIResource, AsyncAPIResource if TYPE_CHECKING: diff --git a/src/finch/resources/jobs/manual.py b/src/finch/resources/jobs/manual.py index 9334f2da..61f16619 100644 --- a/src/finch/resources/jobs/manual.py +++ b/src/finch/resources/jobs/manual.py @@ -6,11 +6,19 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...types.jobs import ManualAsyncJob -from ..._base_client import make_request_options +from ..._base_client import ( + make_request_options, +) if TYPE_CHECKING: from ..._client import Finch, AsyncFinch diff --git a/src/finch/resources/providers.py b/src/finch/resources/providers.py index aa6eedc5..5f8b17c7 100644 --- a/src/finch/resources/providers.py +++ b/src/finch/resources/providers.py @@ -7,11 +7,20 @@ import httpx from ..types import Provider -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ..pagination import SyncSinglePage, AsyncSinglePage -from .._base_client import AsyncPaginator, make_request_options +from .._base_client import ( + AsyncPaginator, + make_request_options, +) if TYPE_CHECKING: from .._client import Finch, AsyncFinch diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 2464bb35..4c571b39 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -6,12 +6,23 @@ import httpx -from ..types import RequestForwardingForwardResponse, request_forwarding_forward_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..types import ( + RequestForwardingForwardResponse, + request_forwarding_forward_params, +) +from .._types import ( + NOT_GIVEN, + Body, + Query, + Headers, + NotGiven, +) from .._utils import maybe_transform from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper -from .._base_client import make_request_options +from .._base_client import ( + make_request_options, +) if TYPE_CHECKING: from .._client import Finch, AsyncFinch diff --git a/src/finch/resources/webhooks.py b/src/finch/resources/webhooks.py index 40c7678b..28d7ace6 100644 --- a/src/finch/resources/webhooks.py +++ b/src/finch/resources/webhooks.py @@ -10,8 +10,12 @@ from typing import TYPE_CHECKING from datetime import datetime, timezone, timedelta -from .._types import HeadersLike -from .._utils import get_required_header +from .._types import ( + HeadersLike, +) +from .._utils import ( + get_required_header, +) from .._resource import SyncAPIResource, AsyncAPIResource if TYPE_CHECKING: diff --git a/src/finch/types/__init__.py b/src/finch/types/__init__.py index f6a15f80..ece2573d 100644 --- a/src/finch/types/__init__.py +++ b/src/finch/types/__init__.py @@ -4,16 +4,14 @@ from .money import Money as Money from .income import Income as Income -from .shared import Paging as Paging -from .shared import OperationSupport as OperationSupport -from .shared import OperationSupportMatrix as OperationSupportMatrix +from .shared import ( + Paging as Paging, + OperationSupport as OperationSupport, + OperationSupportMatrix as OperationSupportMatrix, +) from .location import Location as Location from .provider import Provider as Provider from .introspection import Introspection as Introspection from .disconnect_response import DisconnectResponse as DisconnectResponse -from .request_forwarding_forward_params import ( - RequestForwardingForwardParams as RequestForwardingForwardParams, -) -from .request_forwarding_forward_response import ( - RequestForwardingForwardResponse as RequestForwardingForwardResponse, -) +from .request_forwarding_forward_params import RequestForwardingForwardParams as RequestForwardingForwardParams +from .request_forwarding_forward_response import RequestForwardingForwardResponse as RequestForwardingForwardResponse diff --git a/src/finch/types/hris/__init__.py b/src/finch/types/hris/__init__.py index da28d4a5..0234b44b 100644 --- a/src/finch/types/hris/__init__.py +++ b/src/finch/types/hris/__init__.py @@ -23,27 +23,11 @@ from .individual_in_directory import IndividualInDirectory as IndividualInDirectory from .employment_data_response import EmploymentDataResponse as EmploymentDataResponse from .support_per_benefit_type import SupportPerBenefitType as SupportPerBenefitType -from .pay_statement_response_body import ( - PayStatementResponseBody as PayStatementResponseBody, -) -from .benefit_features_and_operations import ( - BenefitFeaturesAndOperations as BenefitFeaturesAndOperations, -) -from .employment_retrieve_many_params import ( - EmploymentRetrieveManyParams as EmploymentRetrieveManyParams, -) -from .individual_retrieve_many_params import ( - IndividualRetrieveManyParams as IndividualRetrieveManyParams, -) -from .update_company_benefit_response import ( - UpdateCompanyBenefitResponse as UpdateCompanyBenefitResponse, -) -from .create_company_benefits_response import ( - CreateCompanyBenefitsResponse as CreateCompanyBenefitsResponse, -) -from .directory_list_individuals_params import ( - DirectoryListIndividualsParams as DirectoryListIndividualsParams, -) -from .pay_statement_retrieve_many_params import ( - PayStatementRetrieveManyParams as PayStatementRetrieveManyParams, -) +from .pay_statement_response_body import PayStatementResponseBody as PayStatementResponseBody +from .benefit_features_and_operations import BenefitFeaturesAndOperations as BenefitFeaturesAndOperations +from .employment_retrieve_many_params import EmploymentRetrieveManyParams as EmploymentRetrieveManyParams +from .individual_retrieve_many_params import IndividualRetrieveManyParams as IndividualRetrieveManyParams +from .update_company_benefit_response import UpdateCompanyBenefitResponse as UpdateCompanyBenefitResponse +from .create_company_benefits_response import CreateCompanyBenefitsResponse as CreateCompanyBenefitsResponse +from .directory_list_individuals_params import DirectoryListIndividualsParams as DirectoryListIndividualsParams +from .pay_statement_retrieve_many_params import PayStatementRetrieveManyParams as PayStatementRetrieveManyParams diff --git a/src/finch/types/hris/benefits/__init__.py b/src/finch/types/hris/benefits/__init__.py index dc686ea2..0d548269 100644 --- a/src/finch/types/hris/benefits/__init__.py +++ b/src/finch/types/hris/benefits/__init__.py @@ -5,15 +5,9 @@ from .individual_benefit import IndividualBenefit as IndividualBenefit from .enrolled_individual import EnrolledIndividual as EnrolledIndividual from .unenrolled_individual import UnenrolledIndividual as UnenrolledIndividual -from .individual_enroll_many_params import ( - IndividualEnrollManyParams as IndividualEnrollManyParams, -) -from .individual_unenroll_many_params import ( - IndividualUnenrollManyParams as IndividualUnenrollManyParams, -) -from .individual_enrolled_ids_response import ( - IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse, -) +from .individual_enroll_many_params import IndividualEnrollManyParams as IndividualEnrollManyParams +from .individual_unenroll_many_params import IndividualUnenrollManyParams as IndividualUnenrollManyParams +from .individual_enrolled_ids_response import IndividualEnrolledIDsResponse as IndividualEnrolledIDsResponse from .individual_retrieve_many_benefits_params import ( IndividualRetrieveManyBenefitsParams as IndividualRetrieveManyBenefitsParams, ) diff --git a/src/finch/types/hris/benfit_contribution.py b/src/finch/types/hris/benfit_contribution.py index 676c3b8e..b3bee5cb 100644 --- a/src/finch/types/hris/benfit_contribution.py +++ b/src/finch/types/hris/benfit_contribution.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. + + from .benefit_contribution import BenefitContribution BenfitContribution = BenefitContribution diff --git a/src/finch/types/jobs/__init__.py b/src/finch/types/jobs/__init__.py index 25ad24cf..b0470846 100644 --- a/src/finch/types/jobs/__init__.py +++ b/src/finch/types/jobs/__init__.py @@ -6,6 +6,4 @@ from .automated_async_job import AutomatedAsyncJob as AutomatedAsyncJob from .automated_list_params import AutomatedListParams as AutomatedListParams from .automated_create_params import AutomatedCreateParams as AutomatedCreateParams -from .automated_create_response import ( - AutomatedCreateResponse as AutomatedCreateResponse, -) +from .automated_create_response import AutomatedCreateResponse as AutomatedCreateResponse diff --git a/tests/test_client.py b/tests/test_client.py index 02b09aaf..f2b955cf 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -21,12 +21,7 @@ from finch._client import Finch, AsyncFinch from finch._models import BaseModel, FinalRequestOptions from finch._exceptions import APIResponseValidationError -from finch._base_client import ( - DEFAULT_TIMEOUT, - HTTPX_DEFAULT_TIMEOUT, - BaseClient, - make_request_options, -) +from finch._base_client import DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, make_request_options from .utils import update_env diff --git a/tests/utils.py b/tests/utils.py index 3cd9cf08..da96975e 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,7 +8,12 @@ from typing_extensions import Literal, get_args, get_origin, assert_type from finch._types import NoneType -from finch._utils import is_dict, is_list, is_list_type, is_union_type +from finch._utils import ( + is_dict, + is_list, + is_list_type, + is_union_type, +) from finch._compat import PYDANTIC_V2, field_outer_type, get_model_fields from finch._models import BaseModel From a3c577c2408ca18de1cdfeaf513b2e92f06120c3 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 3 Jan 2024 21:26:56 -0500 Subject: [PATCH 04/11] feat: add `None` default value to nullable response properties (#246) --- src/finch/types/hris/company.py | 16 ++++++++-------- src/finch/types/hris/company_benefit.py | 10 +++++----- src/finch/types/jobs/automated_async_job.py | 6 +++--- src/finch/types/jobs/manual_async_job.py | 2 +- .../types/request_forwarding_forward_response.py | 10 +++++----- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/finch/types/hris/company.py b/src/finch/types/hris/company.py index 6823a150..f87ef3fc 100644 --- a/src/finch/types/hris/company.py +++ b/src/finch/types/hris/company.py @@ -56,25 +56,25 @@ class Company(BaseModel): id: str """A stable Finch `id` (UUID v4) for the company.""" - accounts: Optional[List[Account]] + accounts: Optional[List[Account]] = None """An array of bank account objects associated with the payroll/HRIS system.""" - departments: Optional[List[Optional[Department]]] + departments: Optional[List[Optional[Department]]] = None """The array of company departments.""" - ein: Optional[str] + ein: Optional[str] = None """The employer identification number.""" - entity: Optional[Entity] + entity: Optional[Entity] = None """The entity type object.""" - legal_name: Optional[str] + legal_name: Optional[str] = None """The legal name of the company.""" - locations: Optional[List[Optional[Location]]] + locations: Optional[List[Optional[Location]]] = None - primary_email: Optional[str] + primary_email: Optional[str] = None """The email of the main administrator on the account.""" - primary_phone_number: Optional[str] + primary_phone_number: Optional[str] = None """The phone number of the main administrator on the account. Format: `XXXXXXXXXX`""" diff --git a/src/finch/types/hris/company_benefit.py b/src/finch/types/hris/company_benefit.py index 224f9437..84a36bc3 100644 --- a/src/finch/types/hris/company_benefit.py +++ b/src/finch/types/hris/company_benefit.py @@ -13,13 +13,13 @@ class CompanyBenefit(BaseModel): benefit_id: str - company_contribution: Optional[BenefitContribution] + company_contribution: Optional[BenefitContribution] = None - description: Optional[str] + description: Optional[str] = None - employee_deduction: Optional[BenefitContribution] + employee_deduction: Optional[BenefitContribution] = None - frequency: Optional[BenefitFrequency] + frequency: Optional[BenefitFrequency] = None - type: Optional[BenefitType] + type: Optional[BenefitType] = None """Type of benefit.""" diff --git a/src/finch/types/jobs/automated_async_job.py b/src/finch/types/jobs/automated_async_job.py index 0b3e727d..b09ae9d3 100644 --- a/src/finch/types/jobs/automated_async_job.py +++ b/src/finch/types/jobs/automated_async_job.py @@ -10,7 +10,7 @@ class AutomatedAsyncJob(BaseModel): - completed_at: Optional[datetime] + completed_at: Optional[datetime] = None """The datetime the job completed.""" created_at: datetime @@ -26,14 +26,14 @@ class AutomatedAsyncJob(BaseModel): job_url: str """The url that can be used to retrieve the job status""" - scheduled_at: Optional[datetime] + scheduled_at: Optional[datetime] = None """The datetime a job is scheduled to be run. For scheduled jobs, this datetime can be in the future if the job has not yet been enqueued. For ad-hoc jobs, this field will be null. """ - started_at: Optional[datetime] + started_at: Optional[datetime] = None """The datetime a job entered into the job queue.""" status: Literal["pending", "in_progress", "complete", "error", "reauth_error", "permissions_error"] diff --git a/src/finch/types/jobs/manual_async_job.py b/src/finch/types/jobs/manual_async_job.py index 0f831fb0..fdfbf153 100644 --- a/src/finch/types/jobs/manual_async_job.py +++ b/src/finch/types/jobs/manual_async_job.py @@ -9,7 +9,7 @@ class ManualAsyncJob(BaseModel): - body: Optional[List[object]] + body: Optional[List[object]] = None """Specific information about the job, such as individual statuses for batch jobs.""" job_id: str diff --git a/src/finch/types/request_forwarding_forward_response.py b/src/finch/types/request_forwarding_forward_response.py index 267a4cf9..71ab19a0 100644 --- a/src/finch/types/request_forwarding_forward_response.py +++ b/src/finch/types/request_forwarding_forward_response.py @@ -10,14 +10,14 @@ class Request(BaseModel): - data: Optional[str] + 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] + 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`. @@ -29,7 +29,7 @@ class Request(BaseModel): Valid values include: `GET` , `POST` , `PUT` , `DELETE` , and `PATCH`. """ - params: Optional[object] + 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`. @@ -40,14 +40,14 @@ class Request(BaseModel): class RequestForwardingForwardResponse(BaseModel): - data: Optional[str] + 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[object] + headers: Optional[object] = None """ The HTTP headers of the forwarded request’s response, exactly as received from the underlying integration’s API. From acd29fd6138c0fa23ac429aa2b92e31791560bf4 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:25:48 -0500 Subject: [PATCH 05/11] chore: use property declarations for resource members (#247) This will speedup client instantiation in certain cases. --- pyproject.toml | 1 + src/finch/_compat.py | 10 ++ src/finch/resources/account.py | 22 ++-- src/finch/resources/hris/benefits/benefits.py | 30 +++-- .../resources/hris/benefits/individuals.py | 22 ++-- src/finch/resources/hris/company.py | 22 ++-- src/finch/resources/hris/directory.py | 26 ++--- src/finch/resources/hris/employments.py | 22 ++-- src/finch/resources/hris/hris.py | 107 +++++++++++------- src/finch/resources/hris/individuals.py | 22 ++-- src/finch/resources/hris/pay_statements.py | 22 ++-- src/finch/resources/hris/payments.py | 22 ++-- src/finch/resources/jobs/automated.py | 28 ++--- src/finch/resources/jobs/jobs.py | 44 +++---- src/finch/resources/jobs/manual.py | 22 ++-- src/finch/resources/providers.py | 22 ++-- src/finch/resources/request_forwarding.py | 27 ++--- src/finch/resources/webhooks.py | 10 -- 18 files changed, 204 insertions(+), 277 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a422005e..96698a08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", + "cached-property; python_version < '3.8'", ] requires-python = ">= 3.7" diff --git a/src/finch/_compat.py b/src/finch/_compat.py index d95db8ed..3cda3990 100644 --- a/src/finch/_compat.py +++ b/src/finch/_compat.py @@ -173,3 +173,13 @@ class GenericModel(pydantic.BaseModel): class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + + +# cached properties +if TYPE_CHECKING: + cached_property = property +else: + try: + from functools import cached_property as cached_property + except ImportError: + from cached_property import cached_property as cached_property diff --git a/src/finch/resources/account.py b/src/finch/resources/account.py index 0cb7b3aa..857bb14a 100644 --- a/src/finch/resources/account.py +++ b/src/finch/resources/account.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - import httpx from ..types import Introspection, DisconnectResponse @@ -14,24 +12,20 @@ Headers, NotGiven, ) +from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper from .._base_client import ( make_request_options, ) -if TYPE_CHECKING: - from .._client import Finch, AsyncFinch - __all__ = ["Account", "AsyncAccount"] class Account(SyncAPIResource): - with_raw_response: AccountWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = AccountWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AccountWithRawResponse: + return AccountWithRawResponse(self) def disconnect( self, @@ -77,11 +71,9 @@ def introspect( class AsyncAccount(AsyncAPIResource): - with_raw_response: AsyncAccountWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncAccountWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncAccountWithRawResponse: + return AsyncAccountWithRawResponse(self) async def disconnect( self, diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index 4752a838..575c9d2d 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Optional +from typing import Optional import httpx @@ -14,6 +14,7 @@ NotGiven, ) from ...._utils import maybe_transform +from ...._compat import cached_property from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper @@ -33,20 +34,17 @@ make_request_options, ) -if TYPE_CHECKING: - from ...._client import Finch, AsyncFinch - __all__ = ["Benefits", "AsyncBenefits"] class Benefits(SyncAPIResource): - individuals: Individuals - with_raw_response: BenefitsWithRawResponse + @cached_property + def individuals(self) -> Individuals: + return Individuals(self._client) - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.individuals = Individuals(client) - self.with_raw_response = BenefitsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> BenefitsWithRawResponse: + return BenefitsWithRawResponse(self) def create( self, @@ -215,13 +213,13 @@ def list_supported_benefits( class AsyncBenefits(AsyncAPIResource): - individuals: AsyncIndividuals - with_raw_response: AsyncBenefitsWithRawResponse + @cached_property + def individuals(self) -> AsyncIndividuals: + return AsyncIndividuals(self._client) - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.individuals = AsyncIndividuals(client) - self.with_raw_response = AsyncBenefitsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncBenefitsWithRawResponse: + return AsyncBenefitsWithRawResponse(self) async def create( self, diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index cb09ddf4..cf978066 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List +from typing import List import httpx @@ -14,6 +14,7 @@ NotGiven, ) from ...._utils import maybe_transform +from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ....pagination import SyncSinglePage, AsyncSinglePage @@ -31,18 +32,13 @@ individual_retrieve_many_benefits_params, ) -if TYPE_CHECKING: - from ...._client import Finch, AsyncFinch - __all__ = ["Individuals", "AsyncIndividuals"] class Individuals(SyncAPIResource): - with_raw_response: IndividualsWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = IndividualsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> IndividualsWithRawResponse: + return IndividualsWithRawResponse(self) def enroll_many( self, @@ -211,11 +207,9 @@ def unenroll_many( class AsyncIndividuals(AsyncAPIResource): - with_raw_response: AsyncIndividualsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncIndividualsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncIndividualsWithRawResponse: + return AsyncIndividualsWithRawResponse(self) def enroll_many( self, diff --git a/src/finch/resources/hris/company.py b/src/finch/resources/hris/company.py index 3ee67da7..b4f4ac9e 100644 --- a/src/finch/resources/hris/company.py +++ b/src/finch/resources/hris/company.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - import httpx from ..._types import ( @@ -13,6 +11,7 @@ Headers, NotGiven, ) +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...types.hris import Company @@ -20,18 +19,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["CompanyResource", "AsyncCompanyResource"] class CompanyResource(SyncAPIResource): - with_raw_response: CompanyResourceWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = CompanyResourceWithRawResponse(self) + @cached_property + def with_raw_response(self) -> CompanyResourceWithRawResponse: + return CompanyResourceWithRawResponse(self) def retrieve( self, @@ -54,11 +48,9 @@ def retrieve( class AsyncCompanyResource(AsyncAPIResource): - with_raw_response: AsyncCompanyResourceWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncCompanyResourceWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncCompanyResourceWithRawResponse: + return AsyncCompanyResourceWithRawResponse(self) async def retrieve( self, diff --git a/src/finch/resources/hris/directory.py b/src/finch/resources/hris/directory.py index 221586f6..01f169de 100644 --- a/src/finch/resources/hris/directory.py +++ b/src/finch/resources/hris/directory.py @@ -3,7 +3,6 @@ from __future__ import annotations import typing_extensions -from typing import TYPE_CHECKING import httpx @@ -15,30 +14,23 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncIndividualsPage, AsyncIndividualsPage -from ...types.hris import ( - IndividualInDirectory, - directory_list_params, -) +from ...types.hris import IndividualInDirectory, directory_list_params from ..._base_client import ( AsyncPaginator, make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Directory", "AsyncDirectory"] class Directory(SyncAPIResource): - with_raw_response: DirectoryWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = DirectoryWithRawResponse(self) + @cached_property + def with_raw_response(self) -> DirectoryWithRawResponse: + return DirectoryWithRawResponse(self) def list( self, @@ -127,11 +119,9 @@ def list_individuals( class AsyncDirectory(AsyncAPIResource): - with_raw_response: AsyncDirectoryWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncDirectoryWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncDirectoryWithRawResponse: + return AsyncDirectoryWithRawResponse(self) def list( self, diff --git a/src/finch/resources/hris/employments.py b/src/finch/resources/hris/employments.py index c0bd79ba..6330de09 100644 --- a/src/finch/resources/hris/employments.py +++ b/src/finch/resources/hris/employments.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List +from typing import List import httpx @@ -14,6 +14,7 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage @@ -23,18 +24,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Employments", "AsyncEmployments"] class Employments(SyncAPIResource): - with_raw_response: EmploymentsWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = EmploymentsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> EmploymentsWithRawResponse: + return EmploymentsWithRawResponse(self) def retrieve_many( self, @@ -78,11 +74,9 @@ def retrieve_many( class AsyncEmployments(AsyncAPIResource): - with_raw_response: AsyncEmploymentsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncEmploymentsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncEmploymentsWithRawResponse: + return AsyncEmploymentsWithRawResponse(self) def retrieve_many( self, diff --git a/src/finch/resources/hris/hris.py b/src/finch/resources/hris/hris.py index 0ba66160..e02ebae1 100644 --- a/src/finch/resources/hris/hris.py +++ b/src/finch/resources/hris/hris.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - from .company import ( CompanyResource, AsyncCompanyResource, @@ -12,6 +10,7 @@ ) from .benefits import Benefits, AsyncBenefits, BenefitsWithRawResponse, AsyncBenefitsWithRawResponse from .payments import Payments, AsyncPayments, PaymentsWithRawResponse, AsyncPaymentsWithRawResponse +from ..._compat import cached_property from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse from ..._resource import SyncAPIResource, AsyncAPIResource from .employments import Employments, AsyncEmployments, EmploymentsWithRawResponse, AsyncEmploymentsWithRawResponse @@ -22,55 +21,77 @@ PayStatementsWithRawResponse, AsyncPayStatementsWithRawResponse, ) - -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch +from .benefits.benefits import Benefits, AsyncBenefits __all__ = ["HRIS", "AsyncHRIS"] class HRIS(SyncAPIResource): - company: CompanyResource - directory: Directory - individuals: Individuals - employments: Employments - payments: Payments - pay_statements: PayStatements - benefits: Benefits - with_raw_response: HRISWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.company = CompanyResource(client) - self.directory = Directory(client) - self.individuals = Individuals(client) - self.employments = Employments(client) - self.payments = Payments(client) - self.pay_statements = PayStatements(client) - self.benefits = Benefits(client) - self.with_raw_response = HRISWithRawResponse(self) + @cached_property + def company(self) -> CompanyResource: + return CompanyResource(self._client) + + @cached_property + def directory(self) -> Directory: + return Directory(self._client) + + @cached_property + def individuals(self) -> Individuals: + return Individuals(self._client) + + @cached_property + def employments(self) -> Employments: + return Employments(self._client) + + @cached_property + def payments(self) -> Payments: + return Payments(self._client) + + @cached_property + def pay_statements(self) -> PayStatements: + return PayStatements(self._client) + + @cached_property + def benefits(self) -> Benefits: + return Benefits(self._client) + + @cached_property + def with_raw_response(self) -> HRISWithRawResponse: + return HRISWithRawResponse(self) class AsyncHRIS(AsyncAPIResource): - company: AsyncCompanyResource - directory: AsyncDirectory - individuals: AsyncIndividuals - employments: AsyncEmployments - payments: AsyncPayments - pay_statements: AsyncPayStatements - benefits: AsyncBenefits - with_raw_response: AsyncHRISWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.company = AsyncCompanyResource(client) - self.directory = AsyncDirectory(client) - self.individuals = AsyncIndividuals(client) - self.employments = AsyncEmployments(client) - self.payments = AsyncPayments(client) - self.pay_statements = AsyncPayStatements(client) - self.benefits = AsyncBenefits(client) - self.with_raw_response = AsyncHRISWithRawResponse(self) + @cached_property + def company(self) -> AsyncCompanyResource: + return AsyncCompanyResource(self._client) + + @cached_property + def directory(self) -> AsyncDirectory: + return AsyncDirectory(self._client) + + @cached_property + def individuals(self) -> AsyncIndividuals: + return AsyncIndividuals(self._client) + + @cached_property + def employments(self) -> AsyncEmployments: + return AsyncEmployments(self._client) + + @cached_property + def payments(self) -> AsyncPayments: + return AsyncPayments(self._client) + + @cached_property + def pay_statements(self) -> AsyncPayStatements: + return AsyncPayStatements(self._client) + + @cached_property + def benefits(self) -> AsyncBenefits: + return AsyncBenefits(self._client) + + @cached_property + def with_raw_response(self) -> AsyncHRISWithRawResponse: + return AsyncHRISWithRawResponse(self) class HRISWithRawResponse: diff --git a/src/finch/resources/hris/individuals.py b/src/finch/resources/hris/individuals.py index 8ca24125..ced03825 100644 --- a/src/finch/resources/hris/individuals.py +++ b/src/finch/resources/hris/individuals.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List, Optional +from typing import List, Optional import httpx @@ -14,6 +14,7 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage @@ -23,18 +24,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Individuals", "AsyncIndividuals"] class Individuals(SyncAPIResource): - with_raw_response: IndividualsWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = IndividualsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> IndividualsWithRawResponse: + return IndividualsWithRawResponse(self) def retrieve_many( self, @@ -79,11 +75,9 @@ def retrieve_many( class AsyncIndividuals(AsyncAPIResource): - with_raw_response: AsyncIndividualsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncIndividualsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncIndividualsWithRawResponse: + return AsyncIndividualsWithRawResponse(self) def retrieve_many( self, diff --git a/src/finch/resources/hris/pay_statements.py b/src/finch/resources/hris/pay_statements.py index 6ad4be76..4d0a4730 100644 --- a/src/finch/resources/hris/pay_statements.py +++ b/src/finch/resources/hris/pay_statements.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List +from typing import List import httpx @@ -14,6 +14,7 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncResponsesPage, AsyncResponsesPage @@ -23,18 +24,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["PayStatements", "AsyncPayStatements"] class PayStatements(SyncAPIResource): - with_raw_response: PayStatementsWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = PayStatementsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> PayStatementsWithRawResponse: + return PayStatementsWithRawResponse(self) def retrieve_many( self, @@ -79,11 +75,9 @@ def retrieve_many( class AsyncPayStatements(AsyncAPIResource): - with_raw_response: AsyncPayStatementsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncPayStatementsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncPayStatementsWithRawResponse: + return AsyncPayStatementsWithRawResponse(self) def retrieve_many( self, diff --git a/src/finch/resources/hris/payments.py b/src/finch/resources/hris/payments.py index d5d0b28d..f05b36d6 100644 --- a/src/finch/resources/hris/payments.py +++ b/src/finch/resources/hris/payments.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Union +from typing import Union from datetime import date import httpx @@ -15,6 +15,7 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncSinglePage, AsyncSinglePage @@ -24,18 +25,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Payments", "AsyncPayments"] class Payments(SyncAPIResource): - with_raw_response: PaymentsWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = PaymentsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> PaymentsWithRawResponse: + return PaymentsWithRawResponse(self) def list( self, @@ -88,11 +84,9 @@ def list( class AsyncPayments(AsyncAPIResource): - with_raw_response: AsyncPaymentsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncPaymentsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncPaymentsWithRawResponse: + return AsyncPaymentsWithRawResponse(self) def list( self, diff --git a/src/finch/resources/jobs/automated.py b/src/finch/resources/jobs/automated.py index 48f2199b..54a77f09 100644 --- a/src/finch/resources/jobs/automated.py +++ b/src/finch/resources/jobs/automated.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING from typing_extensions import Literal import httpx @@ -15,32 +14,23 @@ NotGiven, ) from ..._utils import maybe_transform +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...pagination import SyncPage, AsyncPage -from ...types.jobs import ( - AutomatedAsyncJob, - AutomatedCreateResponse, - automated_list_params, - automated_create_params, -) +from ...types.jobs import AutomatedAsyncJob, AutomatedCreateResponse, automated_list_params, automated_create_params from ..._base_client import ( AsyncPaginator, make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Automated", "AsyncAutomated"] class Automated(SyncAPIResource): - with_raw_response: AutomatedWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = AutomatedWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AutomatedWithRawResponse: + return AutomatedWithRawResponse(self) def create( self, @@ -169,11 +159,9 @@ def list( class AsyncAutomated(AsyncAPIResource): - with_raw_response: AsyncAutomatedWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncAutomatedWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncAutomatedWithRawResponse: + return AsyncAutomatedWithRawResponse(self) async def create( self, diff --git a/src/finch/resources/jobs/jobs.py b/src/finch/resources/jobs/jobs.py index a47c4ddd..314cd630 100644 --- a/src/finch/resources/jobs/jobs.py +++ b/src/finch/resources/jobs/jobs.py @@ -2,40 +2,40 @@ from __future__ import annotations -from typing import TYPE_CHECKING - from .manual import Manual, AsyncManual, ManualWithRawResponse, AsyncManualWithRawResponse +from ..._compat import cached_property from .automated import Automated, AsyncAutomated, AutomatedWithRawResponse, AsyncAutomatedWithRawResponse from ..._resource import SyncAPIResource, AsyncAPIResource -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Jobs", "AsyncJobs"] class Jobs(SyncAPIResource): - automated: Automated - manual: Manual - with_raw_response: JobsWithRawResponse + @cached_property + def automated(self) -> Automated: + return Automated(self._client) + + @cached_property + def manual(self) -> Manual: + return Manual(self._client) - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.automated = Automated(client) - self.manual = Manual(client) - self.with_raw_response = JobsWithRawResponse(self) + @cached_property + def with_raw_response(self) -> JobsWithRawResponse: + return JobsWithRawResponse(self) class AsyncJobs(AsyncAPIResource): - automated: AsyncAutomated - manual: AsyncManual - with_raw_response: AsyncJobsWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.automated = AsyncAutomated(client) - self.manual = AsyncManual(client) - self.with_raw_response = AsyncJobsWithRawResponse(self) + @cached_property + def automated(self) -> AsyncAutomated: + return AsyncAutomated(self._client) + + @cached_property + def manual(self) -> AsyncManual: + return AsyncManual(self._client) + + @cached_property + def with_raw_response(self) -> AsyncJobsWithRawResponse: + return AsyncJobsWithRawResponse(self) class JobsWithRawResponse: diff --git a/src/finch/resources/jobs/manual.py b/src/finch/resources/jobs/manual.py index 61f16619..aa613e92 100644 --- a/src/finch/resources/jobs/manual.py +++ b/src/finch/resources/jobs/manual.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - import httpx from ..._types import ( @@ -13,6 +11,7 @@ Headers, NotGiven, ) +from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ...types.jobs import ManualAsyncJob @@ -20,18 +19,13 @@ make_request_options, ) -if TYPE_CHECKING: - from ..._client import Finch, AsyncFinch - __all__ = ["Manual", "AsyncManual"] class Manual(SyncAPIResource): - with_raw_response: ManualWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = ManualWithRawResponse(self) + @cached_property + def with_raw_response(self) -> ManualWithRawResponse: + return ManualWithRawResponse(self) def retrieve( self, @@ -68,11 +62,9 @@ def retrieve( class AsyncManual(AsyncAPIResource): - with_raw_response: AsyncManualWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncManualWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncManualWithRawResponse: + return AsyncManualWithRawResponse(self) async def retrieve( self, diff --git a/src/finch/resources/providers.py b/src/finch/resources/providers.py index 5f8b17c7..f2ff34c8 100644 --- a/src/finch/resources/providers.py +++ b/src/finch/resources/providers.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - import httpx from ..types import Provider @@ -14,6 +12,7 @@ Headers, NotGiven, ) +from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper from ..pagination import SyncSinglePage, AsyncSinglePage @@ -22,18 +21,13 @@ make_request_options, ) -if TYPE_CHECKING: - from .._client import Finch, AsyncFinch - __all__ = ["Providers", "AsyncProviders"] class Providers(SyncAPIResource): - with_raw_response: ProvidersWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = ProvidersWithRawResponse(self) + @cached_property + def with_raw_response(self) -> ProvidersWithRawResponse: + return ProvidersWithRawResponse(self) def list( self, @@ -57,11 +51,9 @@ def list( class AsyncProviders(AsyncAPIResource): - with_raw_response: AsyncProvidersWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncProvidersWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncProvidersWithRawResponse: + return AsyncProvidersWithRawResponse(self) def list( self, diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 4c571b39..256481b6 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -2,14 +2,11 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Optional +from typing import Optional import httpx -from ..types import ( - RequestForwardingForwardResponse, - request_forwarding_forward_params, -) +from ..types import RequestForwardingForwardResponse, request_forwarding_forward_params from .._types import ( NOT_GIVEN, Body, @@ -18,24 +15,20 @@ NotGiven, ) from .._utils import maybe_transform +from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper from .._base_client import ( make_request_options, ) -if TYPE_CHECKING: - from .._client import Finch, AsyncFinch - __all__ = ["RequestForwarding", "AsyncRequestForwarding"] class RequestForwarding(SyncAPIResource): - with_raw_response: RequestForwardingWithRawResponse - - def __init__(self, client: Finch) -> None: - super().__init__(client) - self.with_raw_response = RequestForwardingWithRawResponse(self) + @cached_property + def with_raw_response(self) -> RequestForwardingWithRawResponse: + return RequestForwardingWithRawResponse(self) def forward( self, @@ -105,11 +98,9 @@ def forward( class AsyncRequestForwarding(AsyncAPIResource): - with_raw_response: AsyncRequestForwardingWithRawResponse - - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - self.with_raw_response = AsyncRequestForwardingWithRawResponse(self) + @cached_property + def with_raw_response(self) -> AsyncRequestForwardingWithRawResponse: + return AsyncRequestForwardingWithRawResponse(self) async def forward( self, diff --git a/src/finch/resources/webhooks.py b/src/finch/resources/webhooks.py index 28d7ace6..6d68645f 100644 --- a/src/finch/resources/webhooks.py +++ b/src/finch/resources/webhooks.py @@ -7,7 +7,6 @@ import math import base64 import hashlib -from typing import TYPE_CHECKING from datetime import datetime, timezone, timedelta from .._types import ( @@ -18,16 +17,10 @@ ) from .._resource import SyncAPIResource, AsyncAPIResource -if TYPE_CHECKING: - from .._client import Finch, AsyncFinch - __all__ = ["Webhooks", "AsyncWebhooks"] class Webhooks(SyncAPIResource): - def __init__(self, client: Finch) -> None: - super().__init__(client) - def unwrap( self, payload: str | bytes, @@ -121,9 +114,6 @@ def verify_signature( class AsyncWebhooks(AsyncAPIResource): - def __init__(self, client: AsyncFinch) -> None: - super().__init__(client) - def unwrap( self, payload: str | bytes, From f0701652f2e85b5d6b139eb68c2b3fe665618dd9 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:07:39 -0500 Subject: [PATCH 06/11] chore(internal): loosen type var restrictions (#248) --- src/finch/_base_client.py | 41 +++++++-------- src/finch/_response.py | 4 +- src/finch/_types.py | 17 ++++--- src/finch/pagination.py | 51 ++++++++++--------- src/finch/resources/account.py | 8 +-- src/finch/resources/hris/benefits/benefits.py | 8 +-- .../resources/hris/benefits/individuals.py | 8 +-- src/finch/resources/hris/company.py | 8 +-- src/finch/resources/hris/directory.py | 8 +-- src/finch/resources/hris/employments.py | 8 +-- src/finch/resources/hris/individuals.py | 8 +-- src/finch/resources/hris/pay_statements.py | 8 +-- src/finch/resources/hris/payments.py | 8 +-- src/finch/resources/jobs/automated.py | 8 +-- src/finch/resources/jobs/manual.py | 8 +-- src/finch/resources/providers.py | 8 +-- src/finch/resources/request_forwarding.py | 8 +-- 17 files changed, 71 insertions(+), 146 deletions(-) diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index 53a53d80..97c6bef9 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -48,7 +48,6 @@ Body, Omit, Query, - ModelT, Headers, Timeout, NotGiven, @@ -61,7 +60,6 @@ HttpxSendArgs, AsyncTransport, RequestOptions, - UnknownResponse, ModelBuilderProtocol, BinaryResponseContent, ) @@ -142,7 +140,7 @@ def __init__( self.params = params -class BasePage(GenericModel, Generic[ModelT]): +class BasePage(GenericModel, Generic[_T]): """ Defines the core interface for pagination. @@ -155,7 +153,7 @@ class BasePage(GenericModel, Generic[ModelT]): """ _options: FinalRequestOptions = PrivateAttr() - _model: Type[ModelT] = PrivateAttr() + _model: Type[_T] = PrivateAttr() def has_next_page(self) -> bool: items = self._get_page_items() @@ -166,7 +164,7 @@ def has_next_page(self) -> bool: def next_page_info(self) -> Optional[PageInfo]: ... - def _get_page_items(self) -> Iterable[ModelT]: # type: ignore[empty-body] + def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... def _params_from_url(self, url: URL) -> httpx.QueryParams: @@ -191,13 +189,13 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: raise ValueError("Unexpected PageInfo state") -class BaseSyncPage(BasePage[ModelT], Generic[ModelT]): +class BaseSyncPage(BasePage[_T], Generic[_T]): _client: SyncAPIClient = pydantic.PrivateAttr() def _set_private_attributes( self, client: SyncAPIClient, - model: Type[ModelT], + model: Type[_T], options: FinalRequestOptions, ) -> None: self._model = model @@ -212,7 +210,7 @@ def _set_private_attributes( # methods should continue to work as expected as there is an alternative method # to cast a model to a dictionary, model.dict(), which is used internally # by pydantic. - def __iter__(self) -> Iterator[ModelT]: # type: ignore + def __iter__(self) -> Iterator[_T]: # type: ignore for page in self.iter_pages(): for item in page._get_page_items(): yield item @@ -237,13 +235,13 @@ def get_next_page(self: SyncPageT) -> SyncPageT: return self._client._request_api_list(self._model, page=self.__class__, options=options) -class AsyncPaginator(Generic[ModelT, AsyncPageT]): +class AsyncPaginator(Generic[_T, AsyncPageT]): def __init__( self, client: AsyncAPIClient, options: FinalRequestOptions, page_cls: Type[AsyncPageT], - model: Type[ModelT], + model: Type[_T], ) -> None: self._model = model self._client = client @@ -266,7 +264,7 @@ def _parser(resp: AsyncPageT) -> AsyncPageT: return await self._client.request(self._page_cls, self._options) - async def __aiter__(self) -> AsyncIterator[ModelT]: + async def __aiter__(self) -> AsyncIterator[_T]: # https://github.com/microsoft/pyright/issues/3464 page = cast( AsyncPageT, @@ -276,12 +274,12 @@ async def __aiter__(self) -> AsyncIterator[ModelT]: yield item -class BaseAsyncPage(BasePage[ModelT], Generic[ModelT]): +class BaseAsyncPage(BasePage[_T], Generic[_T]): _client: AsyncAPIClient = pydantic.PrivateAttr() def _set_private_attributes( self, - model: Type[ModelT], + model: Type[_T], client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: @@ -289,7 +287,7 @@ def _set_private_attributes( self._client = client self._options = options - async def __aiter__(self) -> AsyncIterator[ModelT]: + async def __aiter__(self) -> AsyncIterator[_T]: async for page in self.iter_pages(): for item in page._get_page_items(): yield item @@ -528,7 +526,7 @@ def _process_response_data( if data is None: return cast(ResponseT, None) - if cast_to is UnknownResponse: + if cast_to is object: return cast(ResponseT, data) try: @@ -970,7 +968,7 @@ def _retry_request( def _request_api_list( self, - model: Type[ModelT], + model: Type[object], page: Type[SyncPageT], options: FinalRequestOptions, ) -> SyncPageT: @@ -1132,7 +1130,7 @@ def get_api_list( self, path: str, *, - model: Type[ModelT], + model: Type[object], page: Type[SyncPageT], body: Body | None = None, options: RequestOptions = {}, @@ -1434,10 +1432,10 @@ async def _retry_request( def _request_api_list( self, - model: Type[ModelT], + model: Type[_T], page: Type[AsyncPageT], options: FinalRequestOptions, - ) -> AsyncPaginator[ModelT, AsyncPageT]: + ) -> AsyncPaginator[_T, AsyncPageT]: return AsyncPaginator(client=self, options=options, page_cls=page, model=model) @overload @@ -1584,13 +1582,12 @@ def get_api_list( self, path: str, *, - # TODO: support paginating `str` - model: Type[ModelT], + model: Type[_T], page: Type[AsyncPageT], body: Body | None = None, options: RequestOptions = {}, method: str = "get", - ) -> AsyncPaginator[ModelT, AsyncPageT]: + ) -> AsyncPaginator[_T, AsyncPageT]: opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options) return self._request_api_list(model, page, opts) diff --git a/src/finch/_response.py b/src/finch/_response.py index 7ec60451..36af2199 100644 --- a/src/finch/_response.py +++ b/src/finch/_response.py @@ -9,7 +9,7 @@ import httpx -from ._types import NoneType, UnknownResponse, BinaryResponseContent +from ._types import NoneType, BinaryResponseContent from ._utils import is_given, extract_type_var_from_base from ._models import BaseModel, is_basemodel from ._constants import RAW_RESPONSE_HEADER @@ -162,7 +162,7 @@ def _parse(self) -> R: # `ResponseT` TypeVar, however if that TypeVar is ever updated in the future, then # this function would become unsafe but a type checker would not report an error. if ( - cast_to is not UnknownResponse + cast_to is not object and not origin is list and not origin is dict and not origin is Union diff --git a/src/finch/_types.py b/src/finch/_types.py index 8aafa336..04fa5bf8 100644 --- a/src/finch/_types.py +++ b/src/finch/_types.py @@ -258,11 +258,6 @@ class RequestOptions(TypedDict, total=False): idempotency_key: str -# Sentinel class used when the response type is an object with an unknown schema -class UnknownResponse: - ... - - # Sentinel class used until PEP 0661 is accepted class NotGiven: """ @@ -339,7 +334,17 @@ def get(self, __key: str) -> str | None: ResponseT = TypeVar( "ResponseT", - bound="Union[str, None, BaseModel, List[Any], Dict[str, Any], Response, UnknownResponse, ModelBuilderProtocol, BinaryResponseContent]", + bound=Union[ + object, + str, + None, + "BaseModel", + List[Any], + Dict[str, Any], + Response, + ModelBuilderProtocol, + BinaryResponseContent, + ], ) StrBytesIntFloat = Union[str, bytes, int, float] diff --git a/src/finch/pagination.py b/src/finch/pagination.py index f1b6e37a..0bf0a615 100644 --- a/src/finch/pagination.py +++ b/src/finch/pagination.py @@ -5,7 +5,6 @@ from httpx import Response -from ._types import ModelT from ._utils import is_mapping from ._models import BaseModel from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage @@ -24,12 +23,14 @@ _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) +_T = TypeVar("_T") -class SyncSinglePage(BaseSyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - items: List[ModelT] + +class SyncSinglePage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.items @override @@ -50,11 +51,11 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM ) -class AsyncSinglePage(BaseAsyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - items: List[ModelT] +class AsyncSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + items: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.items @override @@ -75,11 +76,11 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM ) -class SyncResponsesPage(BaseSyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - responses: List[ModelT] +class SyncResponsesPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + responses: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.responses @override @@ -91,11 +92,11 @@ def next_page_info(self) -> None: return None -class AsyncResponsesPage(BaseAsyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - responses: List[ModelT] +class AsyncResponsesPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + responses: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.responses @override @@ -107,12 +108,12 @@ def next_page_info(self) -> None: return None -class SyncIndividualsPage(BaseSyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - individuals: List[ModelT] +class SyncIndividualsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): + individuals: List[_T] paging: Paging @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.individuals @override @@ -134,12 +135,12 @@ def next_page_info(self) -> Optional[PageInfo]: return None -class AsyncIndividualsPage(BaseAsyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): - individuals: List[ModelT] +class AsyncIndividualsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): + individuals: List[_T] paging: Paging @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.individuals @override @@ -161,12 +162,12 @@ def next_page_info(self) -> Optional[PageInfo]: return None -class SyncPage(BaseSyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): +class SyncPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): paging: Paging - data: List[ModelT] + data: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.data @override @@ -188,12 +189,12 @@ def next_page_info(self) -> Optional[PageInfo]: return None -class AsyncPage(BaseAsyncPage[ModelT], BasePage[ModelT], Generic[ModelT]): +class AsyncPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): paging: Paging - data: List[ModelT] + data: List[_T] @override - def _get_page_items(self) -> List[ModelT]: + def _get_page_items(self) -> List[_T]: return self.data @override diff --git a/src/finch/resources/account.py b/src/finch/resources/account.py index 857bb14a..04f8eb14 100644 --- a/src/finch/resources/account.py +++ b/src/finch/resources/account.py @@ -5,13 +5,7 @@ import httpx from ..types import Introspection, DisconnectResponse -from .._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper diff --git a/src/finch/resources/hris/benefits/benefits.py b/src/finch/resources/hris/benefits/benefits.py index 575c9d2d..9d5f1555 100644 --- a/src/finch/resources/hris/benefits/benefits.py +++ b/src/finch/resources/hris/benefits/benefits.py @@ -6,13 +6,7 @@ import httpx -from ...._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import maybe_transform from ...._compat import cached_property from .individuals import Individuals, AsyncIndividuals, IndividualsWithRawResponse, AsyncIndividualsWithRawResponse diff --git a/src/finch/resources/hris/benefits/individuals.py b/src/finch/resources/hris/benefits/individuals.py index cf978066..4b6a83bb 100644 --- a/src/finch/resources/hris/benefits/individuals.py +++ b/src/finch/resources/hris/benefits/individuals.py @@ -6,13 +6,7 @@ import httpx -from ...._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/hris/company.py b/src/finch/resources/hris/company.py index b4f4ac9e..2a73d3b3 100644 --- a/src/finch/resources/hris/company.py +++ b/src/finch/resources/hris/company.py @@ -4,13 +4,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper diff --git a/src/finch/resources/hris/directory.py b/src/finch/resources/hris/directory.py index 01f169de..5c4e3930 100644 --- a/src/finch/resources/hris/directory.py +++ b/src/finch/resources/hris/directory.py @@ -6,13 +6,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/hris/employments.py b/src/finch/resources/hris/employments.py index 6330de09..d44b32a1 100644 --- a/src/finch/resources/hris/employments.py +++ b/src/finch/resources/hris/employments.py @@ -6,13 +6,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/hris/individuals.py b/src/finch/resources/hris/individuals.py index ced03825..4eea801e 100644 --- a/src/finch/resources/hris/individuals.py +++ b/src/finch/resources/hris/individuals.py @@ -6,13 +6,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/hris/pay_statements.py b/src/finch/resources/hris/pay_statements.py index 4d0a4730..46eea68f 100644 --- a/src/finch/resources/hris/pay_statements.py +++ b/src/finch/resources/hris/pay_statements.py @@ -6,13 +6,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/hris/payments.py b/src/finch/resources/hris/payments.py index f05b36d6..50ed186d 100644 --- a/src/finch/resources/hris/payments.py +++ b/src/finch/resources/hris/payments.py @@ -7,13 +7,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/jobs/automated.py b/src/finch/resources/jobs/automated.py index 54a77f09..990f9033 100644 --- a/src/finch/resources/jobs/automated.py +++ b/src/finch/resources/jobs/automated.py @@ -6,13 +6,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/finch/resources/jobs/manual.py b/src/finch/resources/jobs/manual.py index aa613e92..565513a4 100644 --- a/src/finch/resources/jobs/manual.py +++ b/src/finch/resources/jobs/manual.py @@ -4,13 +4,7 @@ import httpx -from ..._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper diff --git a/src/finch/resources/providers.py b/src/finch/resources/providers.py index f2ff34c8..bac6a203 100644 --- a/src/finch/resources/providers.py +++ b/src/finch/resources/providers.py @@ -5,13 +5,7 @@ import httpx from ..types import Provider -from .._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper diff --git a/src/finch/resources/request_forwarding.py b/src/finch/resources/request_forwarding.py index 256481b6..90bd0f13 100644 --- a/src/finch/resources/request_forwarding.py +++ b/src/finch/resources/request_forwarding.py @@ -7,13 +7,7 @@ import httpx from ..types import RequestForwardingForwardResponse, request_forwarding_forward_params -from .._types import ( - NOT_GIVEN, - Body, - Query, - Headers, - NotGiven, -) +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource From 3dedeb6bc0912e18d0574005eabe41490434bea1 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:00:15 -0500 Subject: [PATCH 07/11] feat(api): add method to create access token (#249) --- .stats.yml | 2 +- api.md | 13 ++ src/finch/_client.py | 26 ++++ src/finch/resources/__init__.py | 10 ++ src/finch/resources/access_tokens.py | 129 ++++++++++++++++++ src/finch/types/__init__.py | 2 + src/finch/types/access_token_create_params.py | 17 +++ .../types/create_access_token_response.py | 9 ++ tests/api_resources/test_access_tokens.py | 71 ++++++++++ 9 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 src/finch/resources/access_tokens.py create mode 100644 src/finch/types/access_token_create_params.py create mode 100644 src/finch/types/create_access_token_response.py create mode 100644 tests/api_resources/test_access_tokens.py diff --git a/.stats.yml b/.stats.yml index c125dfb2..e16f1ad2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 23 +configured_endpoints: 24 diff --git a/api.md b/api.md index 6207a701..b920447c 100644 --- a/api.md +++ b/api.md @@ -10,6 +10,19 @@ Methods: - client.get_access_token(\*args) -> str - client.get_auth_url(\*args) -> str +- client.with_access_token(\*args) -> Self + +# AccessTokens + +Types: + +```python +from finch.types import CreateAccessTokenResponse +``` + +Methods: + +- client.access_tokens.create(\*\*params) -> CreateAccessTokenResponse # HRIS diff --git a/src/finch/_client.py b/src/finch/_client.py index f11a51ed..d6e88d57 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -51,6 +51,7 @@ class Finch(SyncAPIClient): + access_tokens: resources.AccessTokens hris: resources.HRIS providers: resources.Providers account: resources.Account @@ -135,6 +136,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.access_tokens = resources.AccessTokens(self) self.hris = resources.HRIS(self) self.providers = resources.Providers(self) self.account = resources.Account(self) @@ -311,6 +313,16 @@ def get_auth_url( ) ) + def with_access_token( + self, + access_token: str, + ) -> Self: + """ + Returns a copy of the current Finch client with the given access token for + authentication. + """ + return self.with_options(access_token=access_token) + @override def _make_status_error( self, @@ -346,6 +358,7 @@ def _make_status_error( class AsyncFinch(AsyncAPIClient): + access_tokens: resources.AsyncAccessTokens hris: resources.AsyncHRIS providers: resources.AsyncProviders account: resources.AsyncAccount @@ -430,6 +443,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) + self.access_tokens = resources.AsyncAccessTokens(self) self.hris = resources.AsyncHRIS(self) self.providers = resources.AsyncProviders(self) self.account = resources.AsyncAccount(self) @@ -606,6 +620,16 @@ def get_auth_url( ) ) + def with_access_token( + self, + access_token: str, + ) -> Self: + """ + Returns a copy of the current Finch client with the given access token for + authentication. + """ + return self.with_options(access_token=access_token) + @override def _make_status_error( self, @@ -642,6 +666,7 @@ def _make_status_error( class FinchWithRawResponse: def __init__(self, client: Finch) -> None: + self.access_tokens = resources.AccessTokensWithRawResponse(client.access_tokens) self.hris = resources.HRISWithRawResponse(client.hris) self.providers = resources.ProvidersWithRawResponse(client.providers) self.account = resources.AccountWithRawResponse(client.account) @@ -651,6 +676,7 @@ def __init__(self, client: Finch) -> None: class AsyncFinchWithRawResponse: def __init__(self, client: AsyncFinch) -> None: + self.access_tokens = resources.AsyncAccessTokensWithRawResponse(client.access_tokens) self.hris = resources.AsyncHRISWithRawResponse(client.hris) self.providers = resources.AsyncProvidersWithRawResponse(client.providers) self.account = resources.AsyncAccountWithRawResponse(client.account) diff --git a/src/finch/resources/__init__.py b/src/finch/resources/__init__.py index 32d0cf28..152e5776 100644 --- a/src/finch/resources/__init__.py +++ b/src/finch/resources/__init__.py @@ -5,6 +5,12 @@ from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse from .webhooks import Webhooks, AsyncWebhooks from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse +from .access_tokens import ( + AccessTokens, + AsyncAccessTokens, + AccessTokensWithRawResponse, + AsyncAccessTokensWithRawResponse, +) from .request_forwarding import ( RequestForwarding, AsyncRequestForwarding, @@ -13,6 +19,10 @@ ) __all__ = [ + "AccessTokens", + "AsyncAccessTokens", + "AccessTokensWithRawResponse", + "AsyncAccessTokensWithRawResponse", "HRIS", "AsyncHRIS", "HRISWithRawResponse", diff --git a/src/finch/resources/access_tokens.py b/src/finch/resources/access_tokens.py new file mode 100644 index 00000000..161da255 --- /dev/null +++ b/src/finch/resources/access_tokens.py @@ -0,0 +1,129 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import httpx + +from ..types import CreateAccessTokenResponse, access_token_create_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from .._base_client import ( + make_request_options, +) + +__all__ = ["AccessTokens", "AsyncAccessTokens"] + + +class AccessTokens(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AccessTokensWithRawResponse: + return AccessTokensWithRawResponse(self) + + def create( + self, + *, + client_id: str, + client_secret: str, + code: str, + redirect_uri: 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, + ) -> CreateAccessTokenResponse: + """ + Exchange the authorization code for an access token + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/auth/token", + body=maybe_transform( + { + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + }, + access_token_create_params.AccessTokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreateAccessTokenResponse, + ) + + +class AsyncAccessTokens(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAccessTokensWithRawResponse: + return AsyncAccessTokensWithRawResponse(self) + + async def create( + self, + *, + client_id: str, + client_secret: str, + code: str, + redirect_uri: 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, + ) -> CreateAccessTokenResponse: + """ + Exchange the authorization code for an access token + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/auth/token", + body=maybe_transform( + { + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + }, + access_token_create_params.AccessTokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreateAccessTokenResponse, + ) + + +class AccessTokensWithRawResponse: + def __init__(self, access_tokens: AccessTokens) -> None: + self.create = to_raw_response_wrapper( + access_tokens.create, + ) + + +class AsyncAccessTokensWithRawResponse: + def __init__(self, access_tokens: AsyncAccessTokens) -> None: + self.create = async_to_raw_response_wrapper( + access_tokens.create, + ) diff --git a/src/finch/types/__init__.py b/src/finch/types/__init__.py index ece2573d..e8b6a6dd 100644 --- a/src/finch/types/__init__.py +++ b/src/finch/types/__init__.py @@ -13,5 +13,7 @@ from .provider import Provider as Provider from .introspection import Introspection as Introspection from .disconnect_response import DisconnectResponse as DisconnectResponse +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 from .request_forwarding_forward_response import RequestForwardingForwardResponse as RequestForwardingForwardResponse diff --git a/src/finch/types/access_token_create_params.py b/src/finch/types/access_token_create_params.py new file mode 100644 index 00000000..2fc25749 --- /dev/null +++ b/src/finch/types/access_token_create_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AccessTokenCreateParams"] + + +class AccessTokenCreateParams(TypedDict, total=False): + client_id: Required[str] + + client_secret: Required[str] + + code: Required[str] + + redirect_uri: Required[str] diff --git a/src/finch/types/create_access_token_response.py b/src/finch/types/create_access_token_response.py new file mode 100644 index 00000000..5b017fc2 --- /dev/null +++ b/src/finch/types/create_access_token_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. + +from .._models import BaseModel + +__all__ = ["CreateAccessTokenResponse"] + + +class CreateAccessTokenResponse(BaseModel): + access_token: str diff --git a/tests/api_resources/test_access_tokens.py b/tests/api_resources/test_access_tokens.py new file mode 100644 index 00000000..4a89d515 --- /dev/null +++ b/tests/api_resources/test_access_tokens.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from finch.types import CreateAccessTokenResponse +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestAccessTokens: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + access_token = client.access_tokens.create( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.access_tokens.with_raw_response.create( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_token = response.parse() + assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) + + +class TestAsyncAccessTokens: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create(self, client: AsyncFinch) -> None: + access_token = await client.access_tokens.create( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) + + @parametrize + async def test_raw_response_create(self, client: AsyncFinch) -> None: + response = await client.access_tokens.with_raw_response.create( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + access_token = response.parse() + assert_matches_type(CreateAccessTokenResponse, access_token, path=["response"]) From e5a7c17686359f0a121c815635f70e83f0e21092 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:27:15 -0500 Subject: [PATCH 08/11] chore: add .keep files for examples and custom code directories (#250) --- examples/.keep | 4 ++++ src/finch/lib/.keep | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 examples/.keep create mode 100644 src/finch/lib/.keep diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 00000000..d8c73e93 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/finch/lib/.keep b/src/finch/lib/.keep new file mode 100644 index 00000000..5e2c99fd --- /dev/null +++ b/src/finch/lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file From 3ac7bc52c912008baa9d2b6da548aea858b8fbde Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:43:34 -0500 Subject: [PATCH 09/11] feat(api): add sandbox APIs (#251) --- .stats.yml | 2 +- api.md | 115 +++++++- src/finch/_client.py | 12 + src/finch/resources/__init__.py | 10 + src/finch/resources/auth.py | 129 +++++++++ src/finch/resources/sandbox/__init__.py | 45 ++++ src/finch/resources/sandbox/company.py | 176 ++++++++++++ .../resources/sandbox/connections/__init__.py | 15 ++ .../resources/sandbox/connections/accounts.py | 218 +++++++++++++++ .../sandbox/connections/connections.py | 151 +++++++++++ src/finch/resources/sandbox/directory.py | 115 ++++++++ src/finch/resources/sandbox/employment.py | 246 +++++++++++++++++ src/finch/resources/sandbox/individual.py | 235 ++++++++++++++++ src/finch/resources/sandbox/jobs/__init__.py | 20 ++ .../resources/sandbox/jobs/configuration.py | 167 ++++++++++++ src/finch/resources/sandbox/jobs/jobs.py | 44 +++ src/finch/resources/sandbox/payment.py | 127 +++++++++ src/finch/resources/sandbox/sandbox.py | 107 ++++++++ src/finch/types/__init__.py | 5 + src/finch/types/auth_create_token_params.py | 17 ++ src/finch/types/income_param.py | 28 ++ src/finch/types/introspection.py | 19 +- src/finch/types/location_param.py | 32 +++ src/finch/types/money_param.py | 15 ++ src/finch/types/sandbox/__init__.py | 16 ++ .../types/sandbox/company_update_params.py | 76 ++++++ .../types/sandbox/company_update_response.py | 77 ++++++ .../types/sandbox/connection_create_params.py | 22 ++ .../sandbox/connection_create_response.py | 22 ++ .../types/sandbox/connections/__init__.py | 8 + .../connections/account_create_params.py | 22 ++ .../connections/account_create_response.py | 22 ++ .../connections/account_update_params.py | 13 + .../connections/account_update_response.py | 20 ++ .../types/sandbox/directory_create_params.py | 166 ++++++++++++ .../sandbox/directory_create_response.py | 7 + .../types/sandbox/employment_update_params.py | 94 +++++++ .../sandbox/employment_update_response.py | 96 +++++++ .../types/sandbox/individual_update_params.py | 75 ++++++ .../sandbox/individual_update_response.py | 77 ++++++ src/finch/types/sandbox/jobs/__init__.py | 7 + .../jobs/configuration_retrieve_response.py | 9 + .../jobs/configuration_update_params.py | 13 + .../sandbox/jobs/sandbox_job_configuration.py | 13 + .../types/sandbox/payment_create_params.py | 140 ++++++++++ .../types/sandbox/payment_create_response.py | 13 + src/finch/types/shared/__init__.py | 3 + .../introspect_response_connection_status.py | 9 + src/finch/types/shared_params/__init__.py | 5 + .../introspect_response_connection_status.py | 11 + .../api_resources/hris/test_pay_statements.py | 24 +- tests/api_resources/sandbox/__init__.py | 1 + .../sandbox/connections/__init__.py | 1 + .../sandbox/connections/test_accounts.py | 124 +++++++++ tests/api_resources/sandbox/jobs/__init__.py | 1 + .../sandbox/jobs/test_configuration.py | 87 ++++++ tests/api_resources/sandbox/test_company.py | 253 ++++++++++++++++++ .../api_resources/sandbox/test_connections.py | 79 ++++++ tests/api_resources/sandbox/test_directory.py | 59 ++++ .../api_resources/sandbox/test_employment.py | 203 ++++++++++++++ .../api_resources/sandbox/test_individual.py | 167 ++++++++++++ tests/api_resources/sandbox/test_payment.py | 249 +++++++++++++++++ tests/api_resources/test_auth.py | 71 +++++ 63 files changed, 4381 insertions(+), 24 deletions(-) create mode 100644 src/finch/resources/auth.py create mode 100644 src/finch/resources/sandbox/__init__.py create mode 100644 src/finch/resources/sandbox/company.py create mode 100644 src/finch/resources/sandbox/connections/__init__.py create mode 100644 src/finch/resources/sandbox/connections/accounts.py create mode 100644 src/finch/resources/sandbox/connections/connections.py create mode 100644 src/finch/resources/sandbox/directory.py create mode 100644 src/finch/resources/sandbox/employment.py create mode 100644 src/finch/resources/sandbox/individual.py create mode 100644 src/finch/resources/sandbox/jobs/__init__.py create mode 100644 src/finch/resources/sandbox/jobs/configuration.py create mode 100644 src/finch/resources/sandbox/jobs/jobs.py create mode 100644 src/finch/resources/sandbox/payment.py create mode 100644 src/finch/resources/sandbox/sandbox.py create mode 100644 src/finch/types/auth_create_token_params.py create mode 100644 src/finch/types/income_param.py create mode 100644 src/finch/types/location_param.py create mode 100644 src/finch/types/money_param.py create mode 100644 src/finch/types/sandbox/__init__.py create mode 100644 src/finch/types/sandbox/company_update_params.py create mode 100644 src/finch/types/sandbox/company_update_response.py create mode 100644 src/finch/types/sandbox/connection_create_params.py create mode 100644 src/finch/types/sandbox/connection_create_response.py create mode 100644 src/finch/types/sandbox/connections/__init__.py create mode 100644 src/finch/types/sandbox/connections/account_create_params.py create mode 100644 src/finch/types/sandbox/connections/account_create_response.py create mode 100644 src/finch/types/sandbox/connections/account_update_params.py create mode 100644 src/finch/types/sandbox/connections/account_update_response.py create mode 100644 src/finch/types/sandbox/directory_create_params.py create mode 100644 src/finch/types/sandbox/directory_create_response.py create mode 100644 src/finch/types/sandbox/employment_update_params.py create mode 100644 src/finch/types/sandbox/employment_update_response.py create mode 100644 src/finch/types/sandbox/individual_update_params.py create mode 100644 src/finch/types/sandbox/individual_update_response.py create mode 100644 src/finch/types/sandbox/jobs/__init__.py create mode 100644 src/finch/types/sandbox/jobs/configuration_retrieve_response.py create mode 100644 src/finch/types/sandbox/jobs/configuration_update_params.py create mode 100644 src/finch/types/sandbox/jobs/sandbox_job_configuration.py create mode 100644 src/finch/types/sandbox/payment_create_params.py create mode 100644 src/finch/types/sandbox/payment_create_response.py create mode 100644 src/finch/types/shared/introspect_response_connection_status.py create mode 100644 src/finch/types/shared_params/__init__.py create mode 100644 src/finch/types/shared_params/introspect_response_connection_status.py create mode 100644 tests/api_resources/sandbox/__init__.py create mode 100644 tests/api_resources/sandbox/connections/__init__.py create mode 100644 tests/api_resources/sandbox/connections/test_accounts.py create mode 100644 tests/api_resources/sandbox/jobs/__init__.py create mode 100644 tests/api_resources/sandbox/jobs/test_configuration.py create mode 100644 tests/api_resources/sandbox/test_company.py create mode 100644 tests/api_resources/sandbox/test_connections.py create mode 100644 tests/api_resources/sandbox/test_directory.py create mode 100644 tests/api_resources/sandbox/test_employment.py create mode 100644 tests/api_resources/sandbox/test_individual.py create mode 100644 tests/api_resources/sandbox/test_payment.py create mode 100644 tests/api_resources/test_auth.py diff --git a/.stats.yml b/.stats.yml index e16f1ad2..966331a1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 24 +configured_endpoints: 34 diff --git a/api.md b/api.md index b920447c..0529d9d2 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,12 @@ # Shared Types ```python -from finch.types import OperationSupport, OperationSupportMatrix, Paging +from finch.types import ( + IntrospectResponseConnectionStatus, + OperationSupport, + OperationSupportMatrix, + Paging, +) ``` # Finch @@ -223,3 +228,111 @@ from finch.types.jobs import ManualAsyncJob Methods: - client.jobs.manual.retrieve(job_id) -> ManualAsyncJob + +# Auth + +Methods: + +- client.auth.create_token(\*\*params) -> CreateAccessTokenResponse + +# Sandbox + +## Connections + +Types: + +```python +from finch.types.sandbox import ConnectionCreateResponse +``` + +Methods: + +- client.sandbox.connections.create(\*\*params) -> ConnectionCreateResponse + +### Accounts + +Types: + +```python +from finch.types.sandbox.connections import AccountCreateResponse, AccountUpdateResponse +``` + +Methods: + +- client.sandbox.connections.accounts.create(\*\*params) -> AccountCreateResponse +- client.sandbox.connections.accounts.update(\*\*params) -> AccountUpdateResponse + +## Company + +Types: + +```python +from finch.types.sandbox import CompanyUpdateResponse +``` + +Methods: + +- client.sandbox.company.update(\*\*params) -> CompanyUpdateResponse + +## Directory + +Types: + +```python +from finch.types.sandbox import DirectoryCreateResponse +``` + +Methods: + +- client.sandbox.directory.create(\*\*params) -> DirectoryCreateResponse + +## Individual + +Types: + +```python +from finch.types.sandbox import IndividualUpdateResponse +``` + +Methods: + +- client.sandbox.individual.update(individual_id, \*\*params) -> IndividualUpdateResponse + +## Employment + +Types: + +```python +from finch.types.sandbox import EmploymentUpdateResponse +``` + +Methods: + +- client.sandbox.employment.update(individual_id, \*\*params) -> EmploymentUpdateResponse + +## Payment + +Types: + +```python +from finch.types.sandbox import PaymentCreateResponse +``` + +Methods: + +- client.sandbox.payment.create(\*\*params) -> PaymentCreateResponse + +## Jobs + +### Configuration + +Types: + +```python +from finch.types.sandbox.jobs import SandboxJobConfiguration, ConfigurationRetrieveResponse +``` + +Methods: + +- client.sandbox.jobs.configuration.retrieve() -> ConfigurationRetrieveResponse +- client.sandbox.jobs.configuration.update(\*\*params) -> SandboxJobConfiguration diff --git a/src/finch/_client.py b/src/finch/_client.py index d6e88d57..6e220ad4 100644 --- a/src/finch/_client.py +++ b/src/finch/_client.py @@ -58,6 +58,8 @@ class Finch(SyncAPIClient): webhooks: resources.Webhooks request_forwarding: resources.RequestForwarding jobs: resources.Jobs + auth: resources.Auth + sandbox: resources.Sandbox with_raw_response: FinchWithRawResponse # client options @@ -143,6 +145,8 @@ def __init__( self.webhooks = resources.Webhooks(self) self.request_forwarding = resources.RequestForwarding(self) self.jobs = resources.Jobs(self) + self.auth = resources.Auth(self) + self.sandbox = resources.Sandbox(self) self.with_raw_response = FinchWithRawResponse(self) @property @@ -365,6 +369,8 @@ class AsyncFinch(AsyncAPIClient): webhooks: resources.AsyncWebhooks request_forwarding: resources.AsyncRequestForwarding jobs: resources.AsyncJobs + auth: resources.AsyncAuth + sandbox: resources.AsyncSandbox with_raw_response: AsyncFinchWithRawResponse # client options @@ -450,6 +456,8 @@ def __init__( self.webhooks = resources.AsyncWebhooks(self) self.request_forwarding = resources.AsyncRequestForwarding(self) self.jobs = resources.AsyncJobs(self) + self.auth = resources.AsyncAuth(self) + self.sandbox = resources.AsyncSandbox(self) self.with_raw_response = AsyncFinchWithRawResponse(self) @property @@ -672,6 +680,8 @@ def __init__(self, client: Finch) -> None: self.account = resources.AccountWithRawResponse(client.account) self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding) self.jobs = resources.JobsWithRawResponse(client.jobs) + self.auth = resources.AuthWithRawResponse(client.auth) + self.sandbox = resources.SandboxWithRawResponse(client.sandbox) class AsyncFinchWithRawResponse: @@ -682,6 +692,8 @@ def __init__(self, client: AsyncFinch) -> None: self.account = resources.AsyncAccountWithRawResponse(client.account) self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding) self.jobs = resources.AsyncJobsWithRawResponse(client.jobs) + self.auth = resources.AsyncAuthWithRawResponse(client.auth) + self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox) Client = Finch diff --git a/src/finch/resources/__init__.py b/src/finch/resources/__init__.py index 152e5776..f5912eb0 100644 --- a/src/finch/resources/__init__.py +++ b/src/finch/resources/__init__.py @@ -1,8 +1,10 @@ # File generated from our OpenAPI spec by Stainless. +from .auth import Auth, AsyncAuth, AuthWithRawResponse, AsyncAuthWithRawResponse from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse +from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse from .webhooks import Webhooks, AsyncWebhooks from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse from .access_tokens import ( @@ -45,4 +47,12 @@ "AsyncJobs", "JobsWithRawResponse", "AsyncJobsWithRawResponse", + "Auth", + "AsyncAuth", + "AuthWithRawResponse", + "AsyncAuthWithRawResponse", + "Sandbox", + "AsyncSandbox", + "SandboxWithRawResponse", + "AsyncSandboxWithRawResponse", ] diff --git a/src/finch/resources/auth.py b/src/finch/resources/auth.py new file mode 100644 index 00000000..1a7bd991 --- /dev/null +++ b/src/finch/resources/auth.py @@ -0,0 +1,129 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import httpx + +from ..types import CreateAccessTokenResponse, auth_create_token_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from .._base_client import ( + make_request_options, +) + +__all__ = ["Auth", "AsyncAuth"] + + +class Auth(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AuthWithRawResponse: + return AuthWithRawResponse(self) + + def create_token( + self, + *, + client_id: str, + client_secret: str, + code: str, + redirect_uri: 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, + ) -> CreateAccessTokenResponse: + """ + Exchange the authorization code for an access token + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/auth/token", + body=maybe_transform( + { + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + }, + auth_create_token_params.AuthCreateTokenParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreateAccessTokenResponse, + ) + + +class AsyncAuth(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAuthWithRawResponse: + return AsyncAuthWithRawResponse(self) + + async def create_token( + self, + *, + client_id: str, + client_secret: str, + code: str, + redirect_uri: 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, + ) -> CreateAccessTokenResponse: + """ + Exchange the authorization code for an access token + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/auth/token", + body=maybe_transform( + { + "client_id": client_id, + "client_secret": client_secret, + "code": code, + "redirect_uri": redirect_uri, + }, + auth_create_token_params.AuthCreateTokenParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreateAccessTokenResponse, + ) + + +class AuthWithRawResponse: + def __init__(self, auth: Auth) -> None: + self.create_token = to_raw_response_wrapper( + auth.create_token, + ) + + +class AsyncAuthWithRawResponse: + def __init__(self, auth: AsyncAuth) -> None: + self.create_token = async_to_raw_response_wrapper( + auth.create_token, + ) diff --git a/src/finch/resources/sandbox/__init__.py b/src/finch/resources/sandbox/__init__.py new file mode 100644 index 00000000..41f27f60 --- /dev/null +++ b/src/finch/resources/sandbox/__init__.py @@ -0,0 +1,45 @@ +# File generated from our OpenAPI spec by Stainless. + +from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse +from .company import Company, AsyncCompany, CompanyWithRawResponse, AsyncCompanyWithRawResponse +from .payment import Payment, AsyncPayment, PaymentWithRawResponse, AsyncPaymentWithRawResponse +from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse +from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse +from .employment import Employment, AsyncEmployment, EmploymentWithRawResponse, AsyncEmploymentWithRawResponse +from .individual import Individual, AsyncIndividual, IndividualWithRawResponse, AsyncIndividualWithRawResponse +from .connections import Connections, AsyncConnections, ConnectionsWithRawResponse, AsyncConnectionsWithRawResponse + +__all__ = [ + "Connections", + "AsyncConnections", + "ConnectionsWithRawResponse", + "AsyncConnectionsWithRawResponse", + "Company", + "AsyncCompany", + "CompanyWithRawResponse", + "AsyncCompanyWithRawResponse", + "Directory", + "AsyncDirectory", + "DirectoryWithRawResponse", + "AsyncDirectoryWithRawResponse", + "Individual", + "AsyncIndividual", + "IndividualWithRawResponse", + "AsyncIndividualWithRawResponse", + "Employment", + "AsyncEmployment", + "EmploymentWithRawResponse", + "AsyncEmploymentWithRawResponse", + "Payment", + "AsyncPayment", + "PaymentWithRawResponse", + "AsyncPaymentWithRawResponse", + "Jobs", + "AsyncJobs", + "JobsWithRawResponse", + "AsyncJobsWithRawResponse", + "Sandbox", + "AsyncSandbox", + "SandboxWithRawResponse", + "AsyncSandboxWithRawResponse", +] diff --git a/src/finch/resources/sandbox/company.py b/src/finch/resources/sandbox/company.py new file mode 100644 index 00000000..82bb0239 --- /dev/null +++ b/src/finch/resources/sandbox/company.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional + +import httpx + +from ...types import LocationParam +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ..._base_client import ( + make_request_options, +) +from ...types.sandbox import CompanyUpdateResponse, company_update_params + +__all__ = ["Company", "AsyncCompany"] + + +class Company(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CompanyWithRawResponse: + return CompanyWithRawResponse(self) + + def update( + self, + *, + accounts: Optional[List[company_update_params.Account]], + departments: Optional[List[Optional[company_update_params.Department]]], + ein: Optional[str], + entity: Optional[company_update_params.Entity], + legal_name: Optional[str], + locations: Optional[List[Optional[LocationParam]]], + primary_email: Optional[str], + primary_phone_number: 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, + ) -> CompanyUpdateResponse: + """ + Update a sandbox company's data + + Args: + accounts: An array of bank account objects associated with the payroll/HRIS system. + + departments: The array of company departments. + + ein: The employer identification number. + + entity: The entity type object. + + legal_name: The legal name of the company. + + primary_email: The email of the main administrator on the account. + + primary_phone_number: The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + + 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._put( + "/sandbox/company", + body=maybe_transform( + { + "accounts": accounts, + "departments": departments, + "ein": ein, + "entity": entity, + "legal_name": legal_name, + "locations": locations, + "primary_email": primary_email, + "primary_phone_number": primary_phone_number, + }, + company_update_params.CompanyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CompanyUpdateResponse, + ) + + +class AsyncCompany(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCompanyWithRawResponse: + return AsyncCompanyWithRawResponse(self) + + async def update( + self, + *, + accounts: Optional[List[company_update_params.Account]], + departments: Optional[List[Optional[company_update_params.Department]]], + ein: Optional[str], + entity: Optional[company_update_params.Entity], + legal_name: Optional[str], + locations: Optional[List[Optional[LocationParam]]], + primary_email: Optional[str], + primary_phone_number: 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, + ) -> CompanyUpdateResponse: + """ + Update a sandbox company's data + + Args: + accounts: An array of bank account objects associated with the payroll/HRIS system. + + departments: The array of company departments. + + ein: The employer identification number. + + entity: The entity type object. + + legal_name: The legal name of the company. + + primary_email: The email of the main administrator on the account. + + primary_phone_number: The phone number of the main administrator on the account. Format: `XXXXXXXXXX` + + 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._put( + "/sandbox/company", + body=maybe_transform( + { + "accounts": accounts, + "departments": departments, + "ein": ein, + "entity": entity, + "legal_name": legal_name, + "locations": locations, + "primary_email": primary_email, + "primary_phone_number": primary_phone_number, + }, + company_update_params.CompanyUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CompanyUpdateResponse, + ) + + +class CompanyWithRawResponse: + def __init__(self, company: Company) -> None: + self.update = to_raw_response_wrapper( + company.update, + ) + + +class AsyncCompanyWithRawResponse: + def __init__(self, company: AsyncCompany) -> None: + self.update = async_to_raw_response_wrapper( + company.update, + ) diff --git a/src/finch/resources/sandbox/connections/__init__.py b/src/finch/resources/sandbox/connections/__init__.py new file mode 100644 index 00000000..747635e9 --- /dev/null +++ b/src/finch/resources/sandbox/connections/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. + +from .accounts import Accounts, AsyncAccounts, AccountsWithRawResponse, AsyncAccountsWithRawResponse +from .connections import Connections, AsyncConnections, ConnectionsWithRawResponse, AsyncConnectionsWithRawResponse + +__all__ = [ + "Accounts", + "AsyncAccounts", + "AccountsWithRawResponse", + "AsyncAccountsWithRawResponse", + "Connections", + "AsyncConnections", + "ConnectionsWithRawResponse", + "AsyncConnectionsWithRawResponse", +] diff --git a/src/finch/resources/sandbox/connections/accounts.py b/src/finch/resources/sandbox/connections/accounts.py new file mode 100644 index 00000000..c685e92a --- /dev/null +++ b/src/finch/resources/sandbox/connections/accounts.py @@ -0,0 +1,218 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ...._base_client import ( + make_request_options, +) +from ....types.shared import IntrospectResponseConnectionStatus +from ....types.sandbox.connections import ( + AccountCreateResponse, + AccountUpdateResponse, + account_create_params, + account_update_params, +) + +__all__ = ["Accounts", "AsyncAccounts"] + + +class Accounts(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AccountsWithRawResponse: + return AccountsWithRawResponse(self) + + def create( + self, + *, + company_id: str, + provider_id: str, + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, + products: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccountCreateResponse: + """ + Create a new account for an existing connection (company/provider pair) + + Args: + products: Optional, defaults to Organization products (`company`, `directory`, + `employment`, `individual`) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/sandbox/connections/accounts", + body=maybe_transform( + { + "company_id": company_id, + "provider_id": provider_id, + "authentication_type": authentication_type, + "products": products, + }, + account_create_params.AccountCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountCreateResponse, + ) + + def update( + self, + *, + connection_status: IntrospectResponseConnectionStatus | 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, + ) -> AccountUpdateResponse: + """Update an existing sandbox account. + + Change the connection status to understand + how the Finch API responds. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + "/sandbox/connections/accounts", + body=maybe_transform({"connection_status": connection_status}, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountUpdateResponse, + ) + + +class AsyncAccounts(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAccountsWithRawResponse: + return AsyncAccountsWithRawResponse(self) + + async def create( + self, + *, + company_id: str, + provider_id: str, + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, + products: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AccountCreateResponse: + """ + Create a new account for an existing connection (company/provider pair) + + Args: + products: Optional, defaults to Organization products (`company`, `directory`, + `employment`, `individual`) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/sandbox/connections/accounts", + body=maybe_transform( + { + "company_id": company_id, + "provider_id": provider_id, + "authentication_type": authentication_type, + "products": products, + }, + account_create_params.AccountCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountCreateResponse, + ) + + async def update( + self, + *, + connection_status: IntrospectResponseConnectionStatus | 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, + ) -> AccountUpdateResponse: + """Update an existing sandbox account. + + Change the connection status to understand + how the Finch API responds. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + "/sandbox/connections/accounts", + body=maybe_transform({"connection_status": connection_status}, account_update_params.AccountUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=AccountUpdateResponse, + ) + + +class AccountsWithRawResponse: + def __init__(self, accounts: Accounts) -> None: + self.create = to_raw_response_wrapper( + accounts.create, + ) + self.update = to_raw_response_wrapper( + accounts.update, + ) + + +class AsyncAccountsWithRawResponse: + def __init__(self, accounts: AsyncAccounts) -> None: + self.create = async_to_raw_response_wrapper( + accounts.create, + ) + self.update = async_to_raw_response_wrapper( + accounts.update, + ) diff --git a/src/finch/resources/sandbox/connections/connections.py b/src/finch/resources/sandbox/connections/connections.py new file mode 100644 index 00000000..b3b522bc --- /dev/null +++ b/src/finch/resources/sandbox/connections/connections.py @@ -0,0 +1,151 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from .accounts import Accounts, AsyncAccounts, AccountsWithRawResponse, AsyncAccountsWithRawResponse +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ...._base_client import ( + make_request_options, +) +from ....types.sandbox import ConnectionCreateResponse, connection_create_params + +__all__ = ["Connections", "AsyncConnections"] + + +class Connections(SyncAPIResource): + @cached_property + def accounts(self) -> Accounts: + return Accounts(self._client) + + @cached_property + def with_raw_response(self) -> ConnectionsWithRawResponse: + return ConnectionsWithRawResponse(self) + + def create( + self, + *, + provider_id: str, + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, + employer_size: int | NotGiven = NOT_GIVEN, + products: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectionCreateResponse: + """ + Create a new connection (new company/provider pair) with a new account + + Args: + employer_size: Optional: the size of the employer to be created with this connection. Defaults + to 20 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/sandbox/connections", + body=maybe_transform( + { + "provider_id": provider_id, + "authentication_type": authentication_type, + "employer_size": employer_size, + "products": products, + }, + connection_create_params.ConnectionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionCreateResponse, + ) + + +class AsyncConnections(AsyncAPIResource): + @cached_property + def accounts(self) -> AsyncAccounts: + return AsyncAccounts(self._client) + + @cached_property + def with_raw_response(self) -> AsyncConnectionsWithRawResponse: + return AsyncConnectionsWithRawResponse(self) + + async def create( + self, + *, + provider_id: str, + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] | NotGiven = NOT_GIVEN, + employer_size: int | NotGiven = NOT_GIVEN, + products: List[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConnectionCreateResponse: + """ + Create a new connection (new company/provider pair) with a new account + + Args: + employer_size: Optional: the size of the employer to be created with this connection. Defaults + to 20 + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/sandbox/connections", + body=maybe_transform( + { + "provider_id": provider_id, + "authentication_type": authentication_type, + "employer_size": employer_size, + "products": products, + }, + connection_create_params.ConnectionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConnectionCreateResponse, + ) + + +class ConnectionsWithRawResponse: + def __init__(self, connections: Connections) -> None: + self.accounts = AccountsWithRawResponse(connections.accounts) + + self.create = to_raw_response_wrapper( + connections.create, + ) + + +class AsyncConnectionsWithRawResponse: + def __init__(self, connections: AsyncConnections) -> None: + self.accounts = AsyncAccountsWithRawResponse(connections.accounts) + + self.create = async_to_raw_response_wrapper( + connections.create, + ) diff --git a/src/finch/resources/sandbox/directory.py b/src/finch/resources/sandbox/directory.py new file mode 100644 index 00000000..3249c71e --- /dev/null +++ b/src/finch/resources/sandbox/directory.py @@ -0,0 +1,115 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ..._base_client import ( + make_request_options, +) +from ...types.sandbox import DirectoryCreateResponse, directory_create_params + +__all__ = ["Directory", "AsyncDirectory"] + + +class Directory(SyncAPIResource): + @cached_property + def with_raw_response(self) -> DirectoryWithRawResponse: + return DirectoryWithRawResponse(self) + + def create( + self, + *, + body: List[directory_create_params.Body], + # 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, + ) -> DirectoryCreateResponse: + """ + Add new individuals to a sandbox company + + Args: + body: Array of individuals to create. Takes all combined fields from `/individual` and + `/employment` endpoints. All fields are optional. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/sandbox/directory", + body=maybe_transform(body, directory_create_params.DirectoryCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryCreateResponse, + ) + + +class AsyncDirectory(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncDirectoryWithRawResponse: + return AsyncDirectoryWithRawResponse(self) + + async def create( + self, + *, + body: List[directory_create_params.Body], + # 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, + ) -> DirectoryCreateResponse: + """ + Add new individuals to a sandbox company + + Args: + body: Array of individuals to create. Takes all combined fields from `/individual` and + `/employment` endpoints. All fields are optional. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/sandbox/directory", + body=maybe_transform(body, directory_create_params.DirectoryCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=DirectoryCreateResponse, + ) + + +class DirectoryWithRawResponse: + def __init__(self, directory: Directory) -> None: + self.create = to_raw_response_wrapper( + directory.create, + ) + + +class AsyncDirectoryWithRawResponse: + def __init__(self, directory: AsyncDirectory) -> None: + self.create = async_to_raw_response_wrapper( + directory.create, + ) diff --git a/src/finch/resources/sandbox/employment.py b/src/finch/resources/sandbox/employment.py new file mode 100644 index 00000000..b38757b4 --- /dev/null +++ b/src/finch/resources/sandbox/employment.py @@ -0,0 +1,246 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional + +import httpx + +from ...types import IncomeParam, LocationParam +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ..._base_client import ( + make_request_options, +) +from ...types.sandbox import EmploymentUpdateResponse, employment_update_params + +__all__ = ["Employment", "AsyncEmployment"] + + +class Employment(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EmploymentWithRawResponse: + return EmploymentWithRawResponse(self) + + def update( + self, + individual_id: str, + *, + class_code: Optional[str] | NotGiven = NOT_GIVEN, + custom_fields: List[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, + end_date: Optional[str] | NotGiven = NOT_GIVEN, + first_name: Optional[str] | NotGiven = NOT_GIVEN, + income: Optional[IncomeParam] | NotGiven = NOT_GIVEN, + income_history: Optional[List[Optional[IncomeParam]]] | NotGiven = NOT_GIVEN, + is_active: Optional[bool] | NotGiven = NOT_GIVEN, + last_name: 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: str | NotGiven = NOT_GIVEN, + start_date: Optional[str] | NotGiven = NOT_GIVEN, + title: Optional[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, + ) -> EmploymentUpdateResponse: + """ + Update sandbox employment + + Args: + class_code: Worker's compensation classification code for this employee + + custom_fields: Custom fields for the individual. These are fields which are defined by the + employer in the system. Custom fields are not currently supported for assisted + connections. + + department: The department object. + + employment: The employment object. + + first_name: The legal first name of the individual. + + income: The employee's income as reported by the provider. This may not always be + annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc, + depending on what information the provider returns. + + income_history: The array of income history. + + is_active: `true` if the individual an an active employee or contractor at the company. + + last_name: The legal last name of the individual. + + location + + manager: The manager object representing the manager of the individual within the org. + + middle_name: The legal middle name of the individual. + + source_id: The source system's unique employment identifier for this individual + + title: The current title of the individual. + + 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._put( + f"/sandbox/employment/{individual_id}", + body=maybe_transform( + { + "class_code": class_code, + "custom_fields": custom_fields, + "department": department, + "employment": employment, + "end_date": end_date, + "first_name": first_name, + "income": income, + "income_history": income_history, + "is_active": is_active, + "last_name": last_name, + "location": location, + "manager": manager, + "middle_name": middle_name, + "source_id": source_id, + "start_date": start_date, + "title": title, + }, + employment_update_params.EmploymentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EmploymentUpdateResponse, + ) + + +class AsyncEmployment(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEmploymentWithRawResponse: + return AsyncEmploymentWithRawResponse(self) + + async def update( + self, + individual_id: str, + *, + class_code: Optional[str] | NotGiven = NOT_GIVEN, + custom_fields: List[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, + end_date: Optional[str] | NotGiven = NOT_GIVEN, + first_name: Optional[str] | NotGiven = NOT_GIVEN, + income: Optional[IncomeParam] | NotGiven = NOT_GIVEN, + income_history: Optional[List[Optional[IncomeParam]]] | NotGiven = NOT_GIVEN, + is_active: Optional[bool] | NotGiven = NOT_GIVEN, + last_name: 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: str | NotGiven = NOT_GIVEN, + start_date: Optional[str] | NotGiven = NOT_GIVEN, + title: Optional[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, + ) -> EmploymentUpdateResponse: + """ + Update sandbox employment + + Args: + class_code: Worker's compensation classification code for this employee + + custom_fields: Custom fields for the individual. These are fields which are defined by the + employer in the system. Custom fields are not currently supported for assisted + connections. + + department: The department object. + + employment: The employment object. + + first_name: The legal first name of the individual. + + income: The employee's income as reported by the provider. This may not always be + annualized income, but may be in units of bi-weekly, semi-monthly, daily, etc, + depending on what information the provider returns. + + income_history: The array of income history. + + is_active: `true` if the individual an an active employee or contractor at the company. + + last_name: The legal last name of the individual. + + location + + manager: The manager object representing the manager of the individual within the org. + + middle_name: The legal middle name of the individual. + + source_id: The source system's unique employment identifier for this individual + + title: The current title of the individual. + + 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._put( + f"/sandbox/employment/{individual_id}", + body=maybe_transform( + { + "class_code": class_code, + "custom_fields": custom_fields, + "department": department, + "employment": employment, + "end_date": end_date, + "first_name": first_name, + "income": income, + "income_history": income_history, + "is_active": is_active, + "last_name": last_name, + "location": location, + "manager": manager, + "middle_name": middle_name, + "source_id": source_id, + "start_date": start_date, + "title": title, + }, + employment_update_params.EmploymentUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EmploymentUpdateResponse, + ) + + +class EmploymentWithRawResponse: + def __init__(self, employment: Employment) -> None: + self.update = to_raw_response_wrapper( + employment.update, + ) + + +class AsyncEmploymentWithRawResponse: + def __init__(self, employment: AsyncEmployment) -> None: + self.update = async_to_raw_response_wrapper( + employment.update, + ) diff --git a/src/finch/resources/sandbox/individual.py b/src/finch/resources/sandbox/individual.py new file mode 100644 index 00000000..d0da230a --- /dev/null +++ b/src/finch/resources/sandbox/individual.py @@ -0,0 +1,235 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +import httpx + +from ...types import LocationParam +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ..._base_client import ( + make_request_options, +) +from ...types.sandbox import IndividualUpdateResponse, individual_update_params + +__all__ = ["Individual", "AsyncIndividual"] + + +class Individual(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IndividualWithRawResponse: + return IndividualWithRawResponse(self) + + def update( + self, + individual_id: str, + *, + dob: Optional[str] | NotGiven = NOT_GIVEN, + emails: Optional[List[individual_update_params.Email]] | NotGiven = NOT_GIVEN, + encrypted_ssn: Optional[str] | NotGiven = NOT_GIVEN, + ethnicity: Optional[ + Literal[ + "asian", + "white", + "black_or_african_american", + "native_hawaiian_or_pacific_islander", + "american_indian_or_alaska_native", + "hispanic_or_latino", + "two_or_more_races", + "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[List[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, + # 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, + ) -> IndividualUpdateResponse: + """ + Update sandbox individual + + Args: + encrypted_ssn: Social Security Number of the individual in **encrypted** format. This field is + only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + + ethnicity: The EEOC-defined ethnicity of the individual. + + first_name: The legal first name of the individual. + + gender: The gender of the individual. + + last_name: The legal last name of the individual. + + middle_name: The legal middle name of the individual. + + preferred_name: The preferred name of the individual. + + residence + + ssn: Social Security Number of the individual. This field is only available with the + `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in the + body. + + 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._put( + f"/sandbox/individual/{individual_id}", + body=maybe_transform( + { + "dob": dob, + "emails": emails, + "encrypted_ssn": encrypted_ssn, + "ethnicity": ethnicity, + "first_name": first_name, + "gender": gender, + "last_name": last_name, + "middle_name": middle_name, + "phone_numbers": phone_numbers, + "preferred_name": preferred_name, + "residence": residence, + "ssn": ssn, + }, + individual_update_params.IndividualUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IndividualUpdateResponse, + ) + + +class AsyncIndividual(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIndividualWithRawResponse: + return AsyncIndividualWithRawResponse(self) + + async def update( + self, + individual_id: str, + *, + dob: Optional[str] | NotGiven = NOT_GIVEN, + emails: Optional[List[individual_update_params.Email]] | NotGiven = NOT_GIVEN, + encrypted_ssn: Optional[str] | NotGiven = NOT_GIVEN, + ethnicity: Optional[ + Literal[ + "asian", + "white", + "black_or_african_american", + "native_hawaiian_or_pacific_islander", + "american_indian_or_alaska_native", + "hispanic_or_latino", + "two_or_more_races", + "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[List[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, + # 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, + ) -> IndividualUpdateResponse: + """ + Update sandbox individual + + Args: + encrypted_ssn: Social Security Number of the individual in **encrypted** format. This field is + only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + + ethnicity: The EEOC-defined ethnicity of the individual. + + first_name: The legal first name of the individual. + + gender: The gender of the individual. + + last_name: The legal last name of the individual. + + middle_name: The legal middle name of the individual. + + preferred_name: The preferred name of the individual. + + residence + + ssn: Social Security Number of the individual. This field is only available with the + `ssn` scope enabled and the `options: { include: ['ssn'] }` param set in the + body. + + 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._put( + f"/sandbox/individual/{individual_id}", + body=maybe_transform( + { + "dob": dob, + "emails": emails, + "encrypted_ssn": encrypted_ssn, + "ethnicity": ethnicity, + "first_name": first_name, + "gender": gender, + "last_name": last_name, + "middle_name": middle_name, + "phone_numbers": phone_numbers, + "preferred_name": preferred_name, + "residence": residence, + "ssn": ssn, + }, + individual_update_params.IndividualUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IndividualUpdateResponse, + ) + + +class IndividualWithRawResponse: + def __init__(self, individual: Individual) -> None: + self.update = to_raw_response_wrapper( + individual.update, + ) + + +class AsyncIndividualWithRawResponse: + def __init__(self, individual: AsyncIndividual) -> None: + self.update = async_to_raw_response_wrapper( + individual.update, + ) diff --git a/src/finch/resources/sandbox/jobs/__init__.py b/src/finch/resources/sandbox/jobs/__init__.py new file mode 100644 index 00000000..1a21f174 --- /dev/null +++ b/src/finch/resources/sandbox/jobs/__init__.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. + +from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse +from .configuration import ( + Configuration, + AsyncConfiguration, + ConfigurationWithRawResponse, + AsyncConfigurationWithRawResponse, +) + +__all__ = [ + "Configuration", + "AsyncConfiguration", + "ConfigurationWithRawResponse", + "AsyncConfigurationWithRawResponse", + "Jobs", + "AsyncJobs", + "JobsWithRawResponse", + "AsyncJobsWithRawResponse", +] diff --git a/src/finch/resources/sandbox/jobs/configuration.py b/src/finch/resources/sandbox/jobs/configuration.py new file mode 100644 index 00000000..f3e8d6ab --- /dev/null +++ b/src/finch/resources/sandbox/jobs/configuration.py @@ -0,0 +1,167 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._utils import maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ...._base_client import ( + make_request_options, +) +from ....types.sandbox.jobs import SandboxJobConfiguration, ConfigurationRetrieveResponse, configuration_update_params + +__all__ = ["Configuration", "AsyncConfiguration"] + + +class Configuration(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ConfigurationWithRawResponse: + return ConfigurationWithRawResponse(self) + + def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConfigurationRetrieveResponse: + """Get configurations for sandbox jobs""" + return self._get( + "/sandbox/jobs/configuration", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConfigurationRetrieveResponse, + ) + + def update( + self, + *, + completion_status: Literal["complete", "reauth_error", "permissions_error", "error"], + type: Literal["data_sync_all"], + # 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, + ) -> SandboxJobConfiguration: + """ + Update configurations for sandbox jobs + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + "/sandbox/jobs/configuration", + body=maybe_transform( + { + "completion_status": completion_status, + "type": type, + }, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SandboxJobConfiguration, + ) + + +class AsyncConfiguration(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncConfigurationWithRawResponse: + return AsyncConfigurationWithRawResponse(self) + + async def retrieve( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> ConfigurationRetrieveResponse: + """Get configurations for sandbox jobs""" + return await self._get( + "/sandbox/jobs/configuration", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ConfigurationRetrieveResponse, + ) + + async def update( + self, + *, + completion_status: Literal["complete", "reauth_error", "permissions_error", "error"], + type: Literal["data_sync_all"], + # 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, + ) -> SandboxJobConfiguration: + """ + Update configurations for sandbox jobs + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + "/sandbox/jobs/configuration", + body=maybe_transform( + { + "completion_status": completion_status, + "type": type, + }, + configuration_update_params.ConfigurationUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SandboxJobConfiguration, + ) + + +class ConfigurationWithRawResponse: + def __init__(self, configuration: Configuration) -> None: + self.retrieve = to_raw_response_wrapper( + configuration.retrieve, + ) + self.update = to_raw_response_wrapper( + configuration.update, + ) + + +class AsyncConfigurationWithRawResponse: + def __init__(self, configuration: AsyncConfiguration) -> None: + self.retrieve = async_to_raw_response_wrapper( + configuration.retrieve, + ) + self.update = async_to_raw_response_wrapper( + configuration.update, + ) diff --git a/src/finch/resources/sandbox/jobs/jobs.py b/src/finch/resources/sandbox/jobs/jobs.py new file mode 100644 index 00000000..3f45e345 --- /dev/null +++ b/src/finch/resources/sandbox/jobs/jobs.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from .configuration import ( + Configuration, + AsyncConfiguration, + ConfigurationWithRawResponse, + AsyncConfigurationWithRawResponse, +) + +__all__ = ["Jobs", "AsyncJobs"] + + +class Jobs(SyncAPIResource): + @cached_property + def configuration(self) -> Configuration: + return Configuration(self._client) + + @cached_property + def with_raw_response(self) -> JobsWithRawResponse: + return JobsWithRawResponse(self) + + +class AsyncJobs(AsyncAPIResource): + @cached_property + def configuration(self) -> AsyncConfiguration: + return AsyncConfiguration(self._client) + + @cached_property + def with_raw_response(self) -> AsyncJobsWithRawResponse: + return AsyncJobsWithRawResponse(self) + + +class JobsWithRawResponse: + def __init__(self, jobs: Jobs) -> None: + self.configuration = ConfigurationWithRawResponse(jobs.configuration) + + +class AsyncJobsWithRawResponse: + def __init__(self, jobs: AsyncJobs) -> None: + self.configuration = AsyncConfigurationWithRawResponse(jobs.configuration) diff --git a/src/finch/resources/sandbox/payment.py b/src/finch/resources/sandbox/payment.py new file mode 100644 index 00000000..18753bd6 --- /dev/null +++ b/src/finch/resources/sandbox/payment.py @@ -0,0 +1,127 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper +from ..._base_client import ( + make_request_options, +) +from ...types.sandbox import PaymentCreateResponse, payment_create_params + +__all__ = ["Payment", "AsyncPayment"] + + +class Payment(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PaymentWithRawResponse: + return PaymentWithRawResponse(self) + + def create( + self, + *, + end_date: str | NotGiven = NOT_GIVEN, + pay_statements: List[payment_create_params.PayStatement] | NotGiven = NOT_GIVEN, + start_date: 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, + ) -> PaymentCreateResponse: + """ + Add a new sandbox payment + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/sandbox/payment", + body=maybe_transform( + { + "end_date": end_date, + "pay_statements": pay_statements, + "start_date": start_date, + }, + payment_create_params.PaymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PaymentCreateResponse, + ) + + +class AsyncPayment(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPaymentWithRawResponse: + return AsyncPaymentWithRawResponse(self) + + async def create( + self, + *, + end_date: str | NotGiven = NOT_GIVEN, + pay_statements: List[payment_create_params.PayStatement] | NotGiven = NOT_GIVEN, + start_date: 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, + ) -> PaymentCreateResponse: + """ + Add a new sandbox payment + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/sandbox/payment", + body=maybe_transform( + { + "end_date": end_date, + "pay_statements": pay_statements, + "start_date": start_date, + }, + payment_create_params.PaymentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=PaymentCreateResponse, + ) + + +class PaymentWithRawResponse: + def __init__(self, payment: Payment) -> None: + self.create = to_raw_response_wrapper( + payment.create, + ) + + +class AsyncPaymentWithRawResponse: + def __init__(self, payment: AsyncPayment) -> None: + self.create = async_to_raw_response_wrapper( + payment.create, + ) diff --git a/src/finch/resources/sandbox/sandbox.py b/src/finch/resources/sandbox/sandbox.py new file mode 100644 index 00000000..23b1994d --- /dev/null +++ b/src/finch/resources/sandbox/sandbox.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse +from .company import Company, AsyncCompany, CompanyWithRawResponse, AsyncCompanyWithRawResponse +from .payment import Payment, AsyncPayment, PaymentWithRawResponse, AsyncPaymentWithRawResponse +from ..._compat import cached_property +from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse +from .jobs.jobs import Jobs, AsyncJobs +from .employment import Employment, AsyncEmployment, EmploymentWithRawResponse, AsyncEmploymentWithRawResponse +from .individual import Individual, AsyncIndividual, IndividualWithRawResponse, AsyncIndividualWithRawResponse +from ..._resource import SyncAPIResource, AsyncAPIResource +from .connections import Connections, AsyncConnections, ConnectionsWithRawResponse, AsyncConnectionsWithRawResponse +from .connections.connections import Connections, AsyncConnections + +__all__ = ["Sandbox", "AsyncSandbox"] + + +class Sandbox(SyncAPIResource): + @cached_property + def connections(self) -> Connections: + return Connections(self._client) + + @cached_property + def company(self) -> Company: + return Company(self._client) + + @cached_property + def directory(self) -> Directory: + return Directory(self._client) + + @cached_property + def individual(self) -> Individual: + return Individual(self._client) + + @cached_property + def employment(self) -> Employment: + return Employment(self._client) + + @cached_property + def payment(self) -> Payment: + return Payment(self._client) + + @cached_property + def jobs(self) -> Jobs: + return Jobs(self._client) + + @cached_property + def with_raw_response(self) -> SandboxWithRawResponse: + return SandboxWithRawResponse(self) + + +class AsyncSandbox(AsyncAPIResource): + @cached_property + def connections(self) -> AsyncConnections: + return AsyncConnections(self._client) + + @cached_property + def company(self) -> AsyncCompany: + return AsyncCompany(self._client) + + @cached_property + def directory(self) -> AsyncDirectory: + return AsyncDirectory(self._client) + + @cached_property + def individual(self) -> AsyncIndividual: + return AsyncIndividual(self._client) + + @cached_property + def employment(self) -> AsyncEmployment: + return AsyncEmployment(self._client) + + @cached_property + def payment(self) -> AsyncPayment: + return AsyncPayment(self._client) + + @cached_property + def jobs(self) -> AsyncJobs: + return AsyncJobs(self._client) + + @cached_property + def with_raw_response(self) -> AsyncSandboxWithRawResponse: + return AsyncSandboxWithRawResponse(self) + + +class SandboxWithRawResponse: + def __init__(self, sandbox: Sandbox) -> None: + self.connections = ConnectionsWithRawResponse(sandbox.connections) + self.company = CompanyWithRawResponse(sandbox.company) + self.directory = DirectoryWithRawResponse(sandbox.directory) + self.individual = IndividualWithRawResponse(sandbox.individual) + self.employment = EmploymentWithRawResponse(sandbox.employment) + self.payment = PaymentWithRawResponse(sandbox.payment) + self.jobs = JobsWithRawResponse(sandbox.jobs) + + +class AsyncSandboxWithRawResponse: + def __init__(self, sandbox: AsyncSandbox) -> None: + self.connections = AsyncConnectionsWithRawResponse(sandbox.connections) + self.company = AsyncCompanyWithRawResponse(sandbox.company) + self.directory = AsyncDirectoryWithRawResponse(sandbox.directory) + self.individual = AsyncIndividualWithRawResponse(sandbox.individual) + self.employment = AsyncEmploymentWithRawResponse(sandbox.employment) + self.payment = AsyncPaymentWithRawResponse(sandbox.payment) + self.jobs = AsyncJobsWithRawResponse(sandbox.jobs) diff --git a/src/finch/types/__init__.py b/src/finch/types/__init__.py index e8b6a6dd..aaa3cad1 100644 --- a/src/finch/types/__init__.py +++ b/src/finch/types/__init__.py @@ -8,11 +8,16 @@ Paging as Paging, OperationSupport as OperationSupport, OperationSupportMatrix as OperationSupportMatrix, + IntrospectResponseConnectionStatus as IntrospectResponseConnectionStatus, ) from .location import Location as Location from .provider import Provider as Provider +from .money_param import MoneyParam as MoneyParam +from .income_param import IncomeParam as IncomeParam from .introspection import Introspection as Introspection +from .location_param import LocationParam as LocationParam from .disconnect_response import DisconnectResponse as DisconnectResponse +from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams 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/auth_create_token_params.py b/src/finch/types/auth_create_token_params.py new file mode 100644 index 00000000..9cce752f --- /dev/null +++ b/src/finch/types/auth_create_token_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["AuthCreateTokenParams"] + + +class AuthCreateTokenParams(TypedDict, total=False): + client_id: Required[str] + + client_secret: Required[str] + + code: Required[str] + + redirect_uri: Required[str] diff --git a/src/finch/types/income_param.py b/src/finch/types/income_param.py new file mode 100644 index 00000000..5c378edd --- /dev/null +++ b/src/finch/types/income_param.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, TypedDict + +__all__ = ["IncomeParam"] + + +class IncomeParam(TypedDict, total=False): + amount: Optional[int] + """The income amount in cents.""" + + currency: Optional[str] + """The currency code.""" + + effective_date: Optional[str] + """The date the income amount went into effect.""" + + unit: Optional[ + Literal["yearly", "quarterly", "monthly", "semi_monthly", "bi_weekly", "weekly", "daily", "hourly", "fixed"] + ] + """The income unit of payment. + + Options: `yearly`, `quarterly`, `monthly`, `semi_monthly`, `bi_weekly`, + `weekly`, `daily`, `hourly`, and `fixed`. + """ diff --git a/src/finch/types/introspection.py b/src/finch/types/introspection.py index 41ad1f6c..bdf99fa7 100644 --- a/src/finch/types/introspection.py +++ b/src/finch/types/introspection.py @@ -1,17 +1,32 @@ # File generated from our OpenAPI spec by Stainless. -from typing import List +from typing import List, Optional from typing_extensions import Literal +from .shared import IntrospectResponseConnectionStatus from .._models import BaseModel -__all__ = ["Introspection"] +__all__ = ["Introspection", "AuthenticationMethods", "AuthenticationMethodsConnectionStatus"] + + +class AuthenticationMethodsConnectionStatus(BaseModel): + message: Optional[str] = None + + status: Optional[IntrospectResponseConnectionStatus] = None + + +class AuthenticationMethods(BaseModel): + connection_status: Optional[AuthenticationMethodsConnectionStatus] = None + + type: Optional[str] = None class Introspection(BaseModel): account_id: str """The Finch uuid of the account used to connect this company.""" + authentication_methods: AuthenticationMethods + client_id: str """The client id of the application associated with the `access_token`.""" diff --git a/src/finch/types/location_param.py b/src/finch/types/location_param.py new file mode 100644 index 00000000..11f4e33e --- /dev/null +++ b/src/finch/types/location_param.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["LocationParam"] + + +class LocationParam(TypedDict, total=False): + city: Optional[str] + """City, district, suburb, town, or village.""" + + country: Optional[str] + """The 2-letter ISO 3166 country code.""" + + line1: Optional[str] + """Street address or PO box.""" + + line2: Optional[str] + """Apartment, suite, unit, or building.""" + + name: Optional[str] + + postal_code: Optional[str] + """The postal code or zip code.""" + + source_id: Optional[str] + + state: Optional[str] + """The state code.""" diff --git a/src/finch/types/money_param.py b/src/finch/types/money_param.py new file mode 100644 index 00000000..6d86df6c --- /dev/null +++ b/src/finch/types/money_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["MoneyParam"] + + +class MoneyParam(TypedDict, total=False): + amount: Optional[int] + """Amount for money object (in cents)""" + + currency: str diff --git a/src/finch/types/sandbox/__init__.py b/src/finch/types/sandbox/__init__.py new file mode 100644 index 00000000..74361b09 --- /dev/null +++ b/src/finch/types/sandbox/__init__.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .company_update_params import CompanyUpdateParams as CompanyUpdateParams +from .payment_create_params import PaymentCreateParams as PaymentCreateParams +from .company_update_response import CompanyUpdateResponse as CompanyUpdateResponse +from .directory_create_params import DirectoryCreateParams as DirectoryCreateParams +from .payment_create_response import PaymentCreateResponse as PaymentCreateResponse +from .connection_create_params import ConnectionCreateParams as ConnectionCreateParams +from .employment_update_params import EmploymentUpdateParams as EmploymentUpdateParams +from .individual_update_params import IndividualUpdateParams as IndividualUpdateParams +from .directory_create_response import DirectoryCreateResponse as DirectoryCreateResponse +from .connection_create_response import ConnectionCreateResponse as ConnectionCreateResponse +from .employment_update_response import EmploymentUpdateResponse as EmploymentUpdateResponse +from .individual_update_response import IndividualUpdateResponse as IndividualUpdateResponse diff --git a/src/finch/types/sandbox/company_update_params.py b/src/finch/types/sandbox/company_update_params.py new file mode 100644 index 00000000..1141ca6a --- /dev/null +++ b/src/finch/types/sandbox/company_update_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +from ..location_param import LocationParam + +__all__ = ["CompanyUpdateParams", "Account", "Department", "DepartmentParent", "Entity"] + + +class CompanyUpdateParams(TypedDict, total=False): + accounts: Required[Optional[List[Account]]] + """An array of bank account objects associated with the payroll/HRIS system.""" + + departments: Required[Optional[List[Optional[Department]]]] + """The array of company departments.""" + + ein: Required[Optional[str]] + """The employer identification number.""" + + entity: Required[Optional[Entity]] + """The entity type object.""" + + legal_name: Required[Optional[str]] + """The legal name of the company.""" + + locations: Required[Optional[List[Optional[LocationParam]]]] + + primary_email: Required[Optional[str]] + """The email of the main administrator on the account.""" + + primary_phone_number: Required[Optional[str]] + """The phone number of the main administrator on the account. Format: `XXXXXXXXXX`""" + + +class Account(TypedDict, total=False): + account_name: Optional[str] + """The name of the bank associated in the payroll/HRIS system.""" + + account_number: Optional[str] + """10-12 digit number to specify the bank account""" + + account_type: Optional[Literal["checking", "savings"]] + """The type of bank account.""" + + institution_name: Optional[str] + """Name of the banking institution.""" + + routing_number: Optional[str] + """A nine-digit code that's based on the U.S. + + Bank location where your account was opened. + """ + + +class DepartmentParent(TypedDict, total=False): + name: Optional[str] + """The parent department's name.""" + + +class Department(TypedDict, total=False): + name: Optional[str] + """The department name.""" + + parent: Optional[DepartmentParent] + """The parent department, if present.""" + + +class Entity(TypedDict, total=False): + subtype: Optional[Literal["s_corporation", "c_corporation", "b_corporation"]] + """The tax payer subtype of the company.""" + + type: Optional[Literal["llc", "lp", "corporation", "sole_proprietor", "non_profit", "partnership", "cooperative"]] + """The tax payer type of the company.""" diff --git a/src/finch/types/sandbox/company_update_response.py b/src/finch/types/sandbox/company_update_response.py new file mode 100644 index 00000000..e5a4d2d6 --- /dev/null +++ b/src/finch/types/sandbox/company_update_response.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from ..location import Location + +__all__ = ["CompanyUpdateResponse", "Account", "Department", "DepartmentParent", "Entity"] + + +class Account(BaseModel): + account_name: Optional[str] = None + """The name of the bank associated in the payroll/HRIS system.""" + + account_number: Optional[str] = None + """10-12 digit number to specify the bank account""" + + account_type: Optional[Literal["checking", "savings"]] = None + """The type of bank account.""" + + institution_name: Optional[str] = None + """Name of the banking institution.""" + + routing_number: Optional[str] = None + """A nine-digit code that's based on the U.S. + + Bank location where your account was opened. + """ + + +class DepartmentParent(BaseModel): + name: Optional[str] = None + """The parent department's name.""" + + +class Department(BaseModel): + name: Optional[str] = None + """The department name.""" + + parent: Optional[DepartmentParent] = None + """The parent department, if present.""" + + +class Entity(BaseModel): + subtype: Optional[Literal["s_corporation", "c_corporation", "b_corporation"]] = None + """The tax payer subtype of the company.""" + + type: Optional[ + Literal["llc", "lp", "corporation", "sole_proprietor", "non_profit", "partnership", "cooperative"] + ] = None + """The tax payer type of the company.""" + + +class CompanyUpdateResponse(BaseModel): + accounts: Optional[List[Account]] = None + """An array of bank account objects associated with the payroll/HRIS system.""" + + departments: Optional[List[Optional[Department]]] = None + """The array of company departments.""" + + ein: Optional[str] = None + """The employer identification number.""" + + entity: Optional[Entity] = None + """The entity type object.""" + + legal_name: Optional[str] = None + """The legal name of the company.""" + + locations: Optional[List[Optional[Location]]] = None + + primary_email: Optional[str] = None + """The email of the main administrator on the account.""" + + primary_phone_number: Optional[str] = None + """The phone number of the main administrator on the account. Format: `XXXXXXXXXX`""" diff --git a/src/finch/types/sandbox/connection_create_params.py b/src/finch/types/sandbox/connection_create_params.py new file mode 100644 index 00000000..bd2908e8 --- /dev/null +++ b/src/finch/types/sandbox/connection_create_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ConnectionCreateParams"] + + +class ConnectionCreateParams(TypedDict, total=False): + provider_id: Required[str] + + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] + + employer_size: int + """Optional: the size of the employer to be created with this connection. + + Defaults to 20 + """ + + products: List[str] diff --git a/src/finch/types/sandbox/connection_create_response.py b/src/finch/types/sandbox/connection_create_response.py new file mode 100644 index 00000000..bc31f5b5 --- /dev/null +++ b/src/finch/types/sandbox/connection_create_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["ConnectionCreateResponse"] + + +class ConnectionCreateResponse(BaseModel): + access_token: str + + account_id: str + + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] + + company_id: str + + products: List[str] + + provider_id: str diff --git a/src/finch/types/sandbox/connections/__init__.py b/src/finch/types/sandbox/connections/__init__.py new file mode 100644 index 00000000..7d68eabb --- /dev/null +++ b/src/finch/types/sandbox/connections/__init__.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .account_create_params import AccountCreateParams as AccountCreateParams +from .account_update_params import AccountUpdateParams as AccountUpdateParams +from .account_create_response import AccountCreateResponse as AccountCreateResponse +from .account_update_response import AccountUpdateResponse as AccountUpdateResponse diff --git a/src/finch/types/sandbox/connections/account_create_params.py b/src/finch/types/sandbox/connections/account_create_params.py new file mode 100644 index 00000000..bc6e5bf4 --- /dev/null +++ b/src/finch/types/sandbox/connections/account_create_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["AccountCreateParams"] + + +class AccountCreateParams(TypedDict, total=False): + company_id: Required[str] + + provider_id: Required[str] + + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] + + products: List[str] + """ + Optional, defaults to Organization products (`company`, `directory`, + `employment`, `individual`) + """ diff --git a/src/finch/types/sandbox/connections/account_create_response.py b/src/finch/types/sandbox/connections/account_create_response.py new file mode 100644 index 00000000..5bb2c84f --- /dev/null +++ b/src/finch/types/sandbox/connections/account_create_response.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AccountCreateResponse"] + + +class AccountCreateResponse(BaseModel): + access_token: str + + account_id: str + + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] + + company_id: str + + products: List[str] + + provider_id: str diff --git a/src/finch/types/sandbox/connections/account_update_params.py b/src/finch/types/sandbox/connections/account_update_params.py new file mode 100644 index 00000000..c7af5455 --- /dev/null +++ b/src/finch/types/sandbox/connections/account_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import TypedDict + +from ...shared import IntrospectResponseConnectionStatus + +__all__ = ["AccountUpdateParams"] + + +class AccountUpdateParams(TypedDict, total=False): + connection_status: IntrospectResponseConnectionStatus diff --git a/src/finch/types/sandbox/connections/account_update_response.py b/src/finch/types/sandbox/connections/account_update_response.py new file mode 100644 index 00000000..2e8cae7e --- /dev/null +++ b/src/finch/types/sandbox/connections/account_update_response.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["AccountUpdateResponse"] + + +class AccountUpdateResponse(BaseModel): + account_id: str + + authentication_type: Literal["credentials", "api_token", "oauth", "assisted"] + + company_id: str + + products: List[str] + + provider_id: str diff --git a/src/finch/types/sandbox/directory_create_params.py b/src/finch/types/sandbox/directory_create_params.py new file mode 100644 index 00000000..a1e949fd --- /dev/null +++ b/src/finch/types/sandbox/directory_create_params.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +from ..income_param import IncomeParam +from ..location_param import LocationParam + +__all__ = [ + "DirectoryCreateParams", + "Body", + "BodyCustomField", + "BodyDepartment", + "BodyEmail", + "BodyEmployment", + "BodyManager", + "BodyPhoneNumber", +] + + +class DirectoryCreateParams(TypedDict, total=False): + body: Required[List[Body]] + """Array of individuals to create. + + Takes all combined fields from `/individual` and `/employment` endpoints. All + fields are optional. + """ + + +class BodyCustomField(TypedDict, total=False): + name: Optional[str] + + value: object + + +class BodyDepartment(TypedDict, total=False): + name: Optional[str] + """The name of the department associated with the individual.""" + + +class BodyEmail(TypedDict, total=False): + data: str + + type: Literal["work", "personal"] + + +class BodyEmployment(TypedDict, total=False): + subtype: Optional[Literal["full_time", "intern", "part_time", "temp", "seasonal", "individual_contractor"]] + """The secondary employment type of the individual. + + Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and + `individual_contractor`. + """ + + type: Optional[Literal["employee", "contractor"]] + """The main employment type of the individual.""" + + +class BodyManager(TypedDict, total=False): + id: str + """A stable Finch `id` (UUID v4) for an individual in the company.""" + + +class BodyPhoneNumber(TypedDict, total=False): + data: str + + type: Literal["work", "personal"] + + +class Body(TypedDict, total=False): + class_code: Optional[str] + """Worker's compensation classification code for this employee""" + + custom_fields: List[BodyCustomField] + """Custom fields for the individual. + + These are fields which are defined by the employer in the system. Custom fields + are not currently supported for assisted connections. + """ + + department: Optional[BodyDepartment] + """The department object.""" + + dob: Optional[str] + + emails: Optional[List[BodyEmail]] + + employment: Optional[BodyEmployment] + """The employment object.""" + + encrypted_ssn: Optional[str] + """Social Security Number of the individual in **encrypted** format. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ + + end_date: Optional[str] + + ethnicity: Optional[ + Literal[ + "asian", + "white", + "black_or_african_american", + "native_hawaiian_or_pacific_islander", + "american_indian_or_alaska_native", + "hispanic_or_latino", + "two_or_more_races", + "decline_to_specify", + ] + ] + """The EEOC-defined ethnicity of the individual.""" + + first_name: Optional[str] + """The legal first name of the individual.""" + + gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] + """The gender of the individual.""" + + income: Optional[IncomeParam] + """The employee's income as reported by the provider. + + This may not always be annualized income, but may be in units of bi-weekly, + semi-monthly, daily, etc, depending on what information the provider returns. + """ + + income_history: Optional[List[Optional[IncomeParam]]] + """The array of income history.""" + + is_active: Optional[bool] + """`true` if the individual an an active employee or contractor at the company.""" + + last_name: Optional[str] + """The legal last name of the individual.""" + + location: Optional[LocationParam] + + manager: Optional[BodyManager] + """The manager object representing the manager of the individual within the org.""" + + middle_name: Optional[str] + """The legal middle name of the individual.""" + + phone_numbers: Optional[List[Optional[BodyPhoneNumber]]] + + preferred_name: Optional[str] + """The preferred name of the individual.""" + + residence: Optional[LocationParam] + + source_id: str + """The source system's unique employment identifier for this individual""" + + ssn: Optional[str] + """Social Security Number of the individual. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ + + start_date: Optional[str] + + title: Optional[str] + """The current title of the individual.""" diff --git a/src/finch/types/sandbox/directory_create_response.py b/src/finch/types/sandbox/directory_create_response.py new file mode 100644 index 00000000..6a0a4025 --- /dev/null +++ b/src/finch/types/sandbox/directory_create_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List + +__all__ = ["DirectoryCreateResponse"] + +DirectoryCreateResponse = List[object] diff --git a/src/finch/types/sandbox/employment_update_params.py b/src/finch/types/sandbox/employment_update_params.py new file mode 100644 index 00000000..be90cca6 --- /dev/null +++ b/src/finch/types/sandbox/employment_update_params.py @@ -0,0 +1,94 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +from ..income_param import IncomeParam +from ..location_param import LocationParam + +__all__ = ["EmploymentUpdateParams", "CustomField", "Department", "Employment", "Manager"] + + +class EmploymentUpdateParams(TypedDict, total=False): + class_code: Optional[str] + """Worker's compensation classification code for this employee""" + + custom_fields: List[CustomField] + """Custom fields for the individual. + + These are fields which are defined by the employer in the system. Custom fields + are not currently supported for assisted connections. + """ + + department: Optional[Department] + """The department object.""" + + employment: Optional[Employment] + """The employment object.""" + + end_date: Optional[str] + + first_name: Optional[str] + """The legal first name of the individual.""" + + income: Optional[IncomeParam] + """The employee's income as reported by the provider. + + This may not always be annualized income, but may be in units of bi-weekly, + semi-monthly, daily, etc, depending on what information the provider returns. + """ + + income_history: Optional[List[Optional[IncomeParam]]] + """The array of income history.""" + + is_active: Optional[bool] + """`true` if the individual an an active employee or contractor at the company.""" + + last_name: Optional[str] + """The legal last name of the individual.""" + + location: Optional[LocationParam] + + manager: Optional[Manager] + """The manager object representing the manager of the individual within the org.""" + + middle_name: Optional[str] + """The legal middle name of the individual.""" + + source_id: str + """The source system's unique employment identifier for this individual""" + + start_date: Optional[str] + + title: Optional[str] + """The current title of the individual.""" + + +class CustomField(TypedDict, total=False): + name: Optional[str] + + value: object + + +class Department(TypedDict, total=False): + name: Optional[str] + """The name of the department associated with the individual.""" + + +class Employment(TypedDict, total=False): + subtype: Optional[Literal["full_time", "intern", "part_time", "temp", "seasonal", "individual_contractor"]] + """The secondary employment type of the individual. + + Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and + `individual_contractor`. + """ + + type: Optional[Literal["employee", "contractor"]] + """The main employment type of the individual.""" + + +class Manager(TypedDict, total=False): + id: str + """A stable Finch `id` (UUID v4) for an individual in the company.""" diff --git a/src/finch/types/sandbox/employment_update_response.py b/src/finch/types/sandbox/employment_update_response.py new file mode 100644 index 00000000..796aa25d --- /dev/null +++ b/src/finch/types/sandbox/employment_update_response.py @@ -0,0 +1,96 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List, Optional +from typing_extensions import Literal + +from ..income import Income +from ..._models import BaseModel +from ..location import Location + +__all__ = ["EmploymentUpdateResponse", "CustomField", "Department", "Employment", "Manager"] + + +class CustomField(BaseModel): + name: Optional[str] = None + + value: Optional[object] = None + + +class Department(BaseModel): + name: Optional[str] = None + """The name of the department associated with the individual.""" + + +class Employment(BaseModel): + subtype: Optional[Literal["full_time", "intern", "part_time", "temp", "seasonal", "individual_contractor"]] = None + """The secondary employment type of the individual. + + Options: `full_time`, `part_time`, `intern`, `temp`, `seasonal` and + `individual_contractor`. + """ + + type: Optional[Literal["employee", "contractor"]] = None + """The main employment type of the individual.""" + + +class Manager(BaseModel): + id: Optional[str] = None + """A stable Finch `id` (UUID v4) for an individual in the company.""" + + +class EmploymentUpdateResponse(BaseModel): + id: Optional[str] = None + """A stable Finch `id` (UUID v4) for an individual in the company.""" + + class_code: Optional[str] = None + """Worker's compensation classification code for this employee""" + + custom_fields: Optional[List[CustomField]] = None + """Custom fields for the individual. + + These are fields which are defined by the employer in the system. Custom fields + are not currently supported for assisted connections. + """ + + department: Optional[Department] = None + """The department object.""" + + employment: Optional[Employment] = None + """The employment object.""" + + end_date: Optional[str] = None + + first_name: Optional[str] = None + """The legal first name of the individual.""" + + income_history: Optional[List[Optional[Income]]] = None + """The array of income history.""" + + income: Optional[Income] = None + """The employee's income as reported by the provider. + + This may not always be annualized income, but may be in units of bi-weekly, + semi-monthly, daily, etc, depending on what information the provider returns. + """ + + is_active: Optional[bool] = None + """`true` if the individual an an active employee or contractor at the company.""" + + last_name: Optional[str] = None + """The legal last name of the individual.""" + + location: Optional[Location] = None + + manager: Optional[Manager] = None + """The manager object representing the manager of the individual within the org.""" + + middle_name: Optional[str] = None + """The legal middle name of the individual.""" + + source_id: Optional[str] = None + """The source system's unique employment identifier for this individual""" + + start_date: Optional[str] = None + + title: Optional[str] = None + """The current title of the individual.""" diff --git a/src/finch/types/sandbox/individual_update_params.py b/src/finch/types/sandbox/individual_update_params.py new file mode 100644 index 00000000..8e40198e --- /dev/null +++ b/src/finch/types/sandbox/individual_update_params.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +from ..location_param import LocationParam + +__all__ = ["IndividualUpdateParams", "Email", "PhoneNumber"] + + +class IndividualUpdateParams(TypedDict, total=False): + dob: Optional[str] + + emails: Optional[List[Email]] + + encrypted_ssn: Optional[str] + """Social Security Number of the individual in **encrypted** format. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ + + ethnicity: Optional[ + Literal[ + "asian", + "white", + "black_or_african_american", + "native_hawaiian_or_pacific_islander", + "american_indian_or_alaska_native", + "hispanic_or_latino", + "two_or_more_races", + "decline_to_specify", + ] + ] + """The EEOC-defined ethnicity of the individual.""" + + first_name: Optional[str] + """The legal first name of the individual.""" + + gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] + """The gender of the individual.""" + + last_name: Optional[str] + """The legal last name of the individual.""" + + middle_name: Optional[str] + """The legal middle name of the individual.""" + + phone_numbers: Optional[List[Optional[PhoneNumber]]] + + preferred_name: Optional[str] + """The preferred name of the individual.""" + + residence: Optional[LocationParam] + + ssn: Optional[str] + """Social Security Number of the individual. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ + + +class Email(TypedDict, total=False): + data: str + + type: Literal["work", "personal"] + + +class PhoneNumber(TypedDict, total=False): + data: str + + type: Literal["work", "personal"] diff --git a/src/finch/types/sandbox/individual_update_response.py b/src/finch/types/sandbox/individual_update_response.py new file mode 100644 index 00000000..4db655e1 --- /dev/null +++ b/src/finch/types/sandbox/individual_update_response.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List, Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from ..location import Location + +__all__ = ["IndividualUpdateResponse", "Email", "PhoneNumber"] + + +class Email(BaseModel): + data: Optional[str] = None + + type: Optional[Literal["work", "personal"]] = None + + +class PhoneNumber(BaseModel): + data: Optional[str] = None + + type: Optional[Literal["work", "personal"]] = None + + +class IndividualUpdateResponse(BaseModel): + id: Optional[str] = None + """A stable Finch `id` (UUID v4) for an individual in the company.""" + + dob: Optional[str] = None + + emails: Optional[List[Email]] = None + + encrypted_ssn: Optional[str] = None + """Social Security Number of the individual in **encrypted** format. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ + + ethnicity: Optional[ + Literal[ + "asian", + "white", + "black_or_african_american", + "native_hawaiian_or_pacific_islander", + "american_indian_or_alaska_native", + "hispanic_or_latino", + "two_or_more_races", + "decline_to_specify", + ] + ] = None + """The EEOC-defined ethnicity of the individual.""" + + first_name: Optional[str] = None + """The legal first name of the individual.""" + + gender: Optional[Literal["female", "male", "other", "decline_to_specify"]] = None + """The gender of the individual.""" + + last_name: Optional[str] = None + """The legal last name of the individual.""" + + middle_name: Optional[str] = None + """The legal middle name of the individual.""" + + phone_numbers: Optional[List[Optional[PhoneNumber]]] = None + + preferred_name: Optional[str] = None + """The preferred name of the individual.""" + + residence: Optional[Location] = None + + ssn: Optional[str] = None + """Social Security Number of the individual. + + This field is only available with the `ssn` scope enabled and the + `options: { include: ['ssn'] }` param set in the body. + """ diff --git a/src/finch/types/sandbox/jobs/__init__.py b/src/finch/types/sandbox/jobs/__init__.py new file mode 100644 index 00000000..cec01f2e --- /dev/null +++ b/src/finch/types/sandbox/jobs/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from .sandbox_job_configuration import SandboxJobConfiguration as SandboxJobConfiguration +from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams +from .configuration_retrieve_response import ConfigurationRetrieveResponse as ConfigurationRetrieveResponse diff --git a/src/finch/types/sandbox/jobs/configuration_retrieve_response.py b/src/finch/types/sandbox/jobs/configuration_retrieve_response.py new file mode 100644 index 00000000..e46121ab --- /dev/null +++ b/src/finch/types/sandbox/jobs/configuration_retrieve_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing import List + +from .sandbox_job_configuration import SandboxJobConfiguration + +__all__ = ["ConfigurationRetrieveResponse"] + +ConfigurationRetrieveResponse = List[SandboxJobConfiguration] diff --git a/src/finch/types/sandbox/jobs/configuration_update_params.py b/src/finch/types/sandbox/jobs/configuration_update_params.py new file mode 100644 index 00000000..5a4955e6 --- /dev/null +++ b/src/finch/types/sandbox/jobs/configuration_update_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ConfigurationUpdateParams"] + + +class ConfigurationUpdateParams(TypedDict, total=False): + completion_status: Required[Literal["complete", "reauth_error", "permissions_error", "error"]] + + type: Required[Literal["data_sync_all"]] diff --git a/src/finch/types/sandbox/jobs/sandbox_job_configuration.py b/src/finch/types/sandbox/jobs/sandbox_job_configuration.py new file mode 100644 index 00000000..ff1be519 --- /dev/null +++ b/src/finch/types/sandbox/jobs/sandbox_job_configuration.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["SandboxJobConfiguration"] + + +class SandboxJobConfiguration(BaseModel): + completion_status: Literal["complete", "reauth_error", "permissions_error", "error"] + + type: Literal["data_sync_all"] diff --git a/src/finch/types/sandbox/payment_create_params.py b/src/finch/types/sandbox/payment_create_params.py new file mode 100644 index 00000000..47587206 --- /dev/null +++ b/src/finch/types/sandbox/payment_create_params.py @@ -0,0 +1,140 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, TypedDict + +from ..hris import BenefitType +from ..money_param import MoneyParam + +__all__ = [ + "PaymentCreateParams", + "PayStatement", + "PayStatementEarning", + "PayStatementEmployeeDeduction", + "PayStatementEmployerContribution", + "PayStatementTax", +] + + +class PaymentCreateParams(TypedDict, total=False): + end_date: str + + pay_statements: List[PayStatement] + + start_date: str + + +class PayStatementEarning(TypedDict, total=False): + amount: Optional[int] + """The earnings amount in cents.""" + + currency: Optional[str] + """The earnings currency code.""" + + hours: Optional[float] + """The number of hours associated with this earning. + + (For salaried employees, this could be hours per pay period, `0` or `null`, + depending on the provider). + """ + + name: Optional[str] + """The exact name of the deduction from the pay statement.""" + + type: Optional[ + Literal[ + "salary", + "wage", + "reimbursement", + "overtime", + "severance", + "double_overtime", + "pto", + "sick", + "bonus", + "commission", + "tips", + "1099", + "other", + ] + ] + """The type of earning.""" + + +class PayStatementEmployeeDeduction(TypedDict, total=False): + amount: Optional[int] + """The deduction amount in cents.""" + + currency: Optional[str] + """The deduction currency.""" + + name: Optional[str] + """The deduction name from the pay statement.""" + + pre_tax: Optional[bool] + """Boolean indicating if the deduction is pre-tax.""" + + type: Optional[BenefitType] + """Type of benefit.""" + + +class PayStatementEmployerContribution(TypedDict, total=False): + amount: Optional[int] + """The contribution amount in cents.""" + + currency: Optional[str] + """The contribution currency.""" + + name: Optional[str] + """The contribution name from the pay statement.""" + + type: Optional[BenefitType] + """Type of benefit.""" + + +class PayStatementTax(TypedDict, total=False): + amount: Optional[int] + """The tax amount in cents.""" + + currency: Optional[str] + """The currency code.""" + + employer: Optional[bool] + """`true` if the amount is paid by the employers.""" + + name: Optional[str] + """The exact name of tax from the pay statement.""" + + type: Optional[Literal["state", "federal", "local", "fica"]] + """The type of taxes.""" + + +class PayStatement(TypedDict, total=False): + earnings: Optional[List[Optional[PayStatementEarning]]] + """The array of earnings objects associated with this pay statement""" + + employee_deductions: Optional[List[Optional[PayStatementEmployeeDeduction]]] + """The array of deductions objects associated with this pay statement.""" + + employer_contributions: Optional[List[Optional[PayStatementEmployerContribution]]] + + gross_pay: Optional[MoneyParam] + + individual_id: str + """A stable Finch `id` (UUID v4) for an individual in the company""" + + net_pay: Optional[MoneyParam] + + payment_method: Optional[Literal["check", "direct_deposit"]] + """The payment method.""" + + taxes: Optional[List[Optional[PayStatementTax]]] + """The array of taxes objects associated with this pay statement.""" + + total_hours: Optional[float] + """The number of hours worked for this pay period""" + + type: Optional[Literal["regular_payroll", "off_cycle_payroll", "one_time_payment"]] + """The type of the payment associated with the pay statement.""" diff --git a/src/finch/types/sandbox/payment_create_response.py b/src/finch/types/sandbox/payment_create_response.py new file mode 100644 index 00000000..4e3bcf57 --- /dev/null +++ b/src/finch/types/sandbox/payment_create_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. + +from ..._models import BaseModel + +__all__ = ["PaymentCreateResponse"] + + +class PaymentCreateResponse(BaseModel): + pay_date: str + """The date of the payment.""" + + payment_id: str + """The ID of the payment.""" diff --git a/src/finch/types/shared/__init__.py b/src/finch/types/shared/__init__.py index 6c699bd7..8aada49c 100644 --- a/src/finch/types/shared/__init__.py +++ b/src/finch/types/shared/__init__.py @@ -3,3 +3,6 @@ from .paging import Paging as Paging from .operation_support import OperationSupport as OperationSupport from .operation_support_matrix import OperationSupportMatrix as OperationSupportMatrix +from .introspect_response_connection_status import ( + IntrospectResponseConnectionStatus as IntrospectResponseConnectionStatus, +) diff --git a/src/finch/types/shared/introspect_response_connection_status.py b/src/finch/types/shared/introspect_response_connection_status.py new file mode 100644 index 00000000..bd418208 --- /dev/null +++ b/src/finch/types/shared/introspect_response_connection_status.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. + +from typing_extensions import Literal + +__all__ = ["IntrospectResponseConnectionStatus"] + +IntrospectResponseConnectionStatus = Literal[ + "pending", "processing", "connected", "error_no_account_setup", "error_permissions", "reauth" +] diff --git a/src/finch/types/shared_params/__init__.py b/src/finch/types/shared_params/__init__.py new file mode 100644 index 00000000..aa9fdc38 --- /dev/null +++ b/src/finch/types/shared_params/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. + +from .introspect_response_connection_status import ( + IntrospectResponseConnectionStatus as IntrospectResponseConnectionStatus, +) diff --git a/src/finch/types/shared_params/introspect_response_connection_status.py b/src/finch/types/shared_params/introspect_response_connection_status.py new file mode 100644 index 00000000..02ca322c --- /dev/null +++ b/src/finch/types/shared_params/introspect_response_connection_status.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +from typing_extensions import Literal + +__all__ = ["IntrospectResponseConnectionStatus"] + +IntrospectResponseConnectionStatus = Literal[ + "pending", "processing", "connected", "error_no_account_setup", "error_permissions", "reauth" +] diff --git a/tests/api_resources/hris/test_pay_statements.py b/tests/api_resources/hris/test_pay_statements.py index bc6b3d39..ec2cac24 100644 --- a/tests/api_resources/hris/test_pay_statements.py +++ b/tests/api_resources/hris/test_pay_statements.py @@ -24,22 +24,14 @@ class TestPayStatements: @parametrize def test_method_retrieve_many(self, client: Finch) -> None: pay_statement = client.hris.pay_statements.retrieve_many( - requests=[ - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - ], + requests=[{"payment_id": "string"}], ) assert_matches_type(SyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) @parametrize def test_raw_response_retrieve_many(self, client: Finch) -> None: response = client.hris.pay_statements.with_raw_response.retrieve_many( - requests=[ - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - ], + requests=[{"payment_id": "string"}], ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" pay_statement = response.parse() @@ -54,22 +46,14 @@ class TestAsyncPayStatements: @parametrize async def test_method_retrieve_many(self, client: AsyncFinch) -> None: pay_statement = await client.hris.pay_statements.retrieve_many( - requests=[ - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - ], + requests=[{"payment_id": "string"}], ) assert_matches_type(AsyncResponsesPage[PayStatementResponse], pay_statement, path=["response"]) @parametrize async def test_raw_response_retrieve_many(self, client: AsyncFinch) -> None: response = await client.hris.pay_statements.with_raw_response.retrieve_many( - requests=[ - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - {"payment_id": "e8b90071-0c11-471c-86e8-e303ef2f6782"}, - ], + requests=[{"payment_id": "string"}], ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" pay_statement = response.parse() diff --git a/tests/api_resources/sandbox/__init__.py b/tests/api_resources/sandbox/__init__.py new file mode 100644 index 00000000..1016754e --- /dev/null +++ b/tests/api_resources/sandbox/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. diff --git a/tests/api_resources/sandbox/connections/__init__.py b/tests/api_resources/sandbox/connections/__init__.py new file mode 100644 index 00000000..1016754e --- /dev/null +++ b/tests/api_resources/sandbox/connections/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. diff --git a/tests/api_resources/sandbox/connections/test_accounts.py b/tests/api_resources/sandbox/connections/test_accounts.py new file mode 100644 index 00000000..e61edc81 --- /dev/null +++ b/tests/api_resources/sandbox/connections/test_accounts.py @@ -0,0 +1,124 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox.connections import ( + AccountCreateResponse, + AccountUpdateResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestAccounts: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + account = client.sandbox.connections.accounts.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + ) + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Finch) -> None: + account = client.sandbox.connections.accounts.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + authentication_type="credentials", + products=["string", "string", "string"], + ) + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.sandbox.connections.accounts.with_raw_response.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + def test_method_update(self, client: Finch) -> None: + account = client.sandbox.connections.accounts.update() + assert_matches_type(AccountUpdateResponse, account, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Finch) -> None: + account = client.sandbox.connections.accounts.update( + connection_status="reauth", + ) + assert_matches_type(AccountUpdateResponse, account, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.sandbox.connections.accounts.with_raw_response.update() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountUpdateResponse, account, path=["response"]) + + +class TestAsyncAccounts: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create(self, client: AsyncFinch) -> None: + account = await client.sandbox.connections.accounts.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + ) + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, client: AsyncFinch) -> None: + account = await client.sandbox.connections.accounts.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + authentication_type="credentials", + products=["string", "string", "string"], + ) + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + async def test_raw_response_create(self, client: AsyncFinch) -> None: + response = await client.sandbox.connections.accounts.with_raw_response.create( + company_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + provider_id="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountCreateResponse, account, path=["response"]) + + @parametrize + async def test_method_update(self, client: AsyncFinch) -> None: + account = await client.sandbox.connections.accounts.update() + assert_matches_type(AccountUpdateResponse, account, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: + account = await client.sandbox.connections.accounts.update( + connection_status="reauth", + ) + assert_matches_type(AccountUpdateResponse, account, path=["response"]) + + @parametrize + async def test_raw_response_update(self, client: AsyncFinch) -> None: + response = await client.sandbox.connections.accounts.with_raw_response.update() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + account = response.parse() + assert_matches_type(AccountUpdateResponse, account, path=["response"]) diff --git a/tests/api_resources/sandbox/jobs/__init__.py b/tests/api_resources/sandbox/jobs/__init__.py new file mode 100644 index 00000000..1016754e --- /dev/null +++ b/tests/api_resources/sandbox/jobs/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. diff --git a/tests/api_resources/sandbox/jobs/test_configuration.py b/tests/api_resources/sandbox/jobs/test_configuration.py new file mode 100644 index 00000000..c9a6f5e2 --- /dev/null +++ b/tests/api_resources/sandbox/jobs/test_configuration.py @@ -0,0 +1,87 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox.jobs import SandboxJobConfiguration, ConfigurationRetrieveResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestConfiguration: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_retrieve(self, client: Finch) -> None: + configuration = client.sandbox.jobs.configuration.retrieve() + assert_matches_type(ConfigurationRetrieveResponse, configuration, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Finch) -> None: + response = client.sandbox.jobs.configuration.with_raw_response.retrieve() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(ConfigurationRetrieveResponse, configuration, path=["response"]) + + @parametrize + def test_method_update(self, client: Finch) -> None: + configuration = client.sandbox.jobs.configuration.update( + completion_status="complete", + type="data_sync_all", + ) + assert_matches_type(SandboxJobConfiguration, configuration, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.sandbox.jobs.configuration.with_raw_response.update( + completion_status="complete", + type="data_sync_all", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(SandboxJobConfiguration, configuration, path=["response"]) + + +class TestAsyncConfiguration: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_retrieve(self, client: AsyncFinch) -> None: + configuration = await client.sandbox.jobs.configuration.retrieve() + assert_matches_type(ConfigurationRetrieveResponse, configuration, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, client: AsyncFinch) -> None: + response = await client.sandbox.jobs.configuration.with_raw_response.retrieve() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(ConfigurationRetrieveResponse, configuration, path=["response"]) + + @parametrize + async def test_method_update(self, client: AsyncFinch) -> None: + configuration = await client.sandbox.jobs.configuration.update( + completion_status="complete", + type="data_sync_all", + ) + assert_matches_type(SandboxJobConfiguration, configuration, path=["response"]) + + @parametrize + async def test_raw_response_update(self, client: AsyncFinch) -> None: + response = await client.sandbox.jobs.configuration.with_raw_response.update( + completion_status="complete", + type="data_sync_all", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + configuration = response.parse() + assert_matches_type(SandboxJobConfiguration, configuration, path=["response"]) diff --git a/tests/api_resources/sandbox/test_company.py b/tests/api_resources/sandbox/test_company.py new file mode 100644 index 00000000..23a76f9c --- /dev/null +++ b/tests/api_resources/sandbox/test_company.py @@ -0,0 +1,253 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import CompanyUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestCompany: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_update(self, client: Finch) -> None: + company = client.sandbox.company.update( + accounts=[{}, {}, {}], + departments=[{}, {}, {}], + ein="string", + entity={}, + legal_name="string", + locations=[{}, {}, {}], + primary_email="string", + primary_phone_number="string", + ) + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Finch) -> None: + company = client.sandbox.company.update( + accounts=[ + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + ], + departments=[ + { + "name": "string", + "parent": {"name": "string"}, + }, + { + "name": "string", + "parent": {"name": "string"}, + }, + { + "name": "string", + "parent": {"name": "string"}, + }, + ], + ein="string", + entity={ + "type": "llc", + "subtype": "s_corporation", + }, + legal_name="string", + locations=[ + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + ], + primary_email="string", + primary_phone_number="string", + ) + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.sandbox.company.with_raw_response.update( + accounts=[{}, {}, {}], + departments=[{}, {}, {}], + ein="string", + entity={}, + legal_name="string", + locations=[{}, {}, {}], + primary_email="string", + primary_phone_number="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + company = response.parse() + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) + + +class TestAsyncCompany: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_update(self, client: AsyncFinch) -> None: + company = await client.sandbox.company.update( + accounts=[{}, {}, {}], + departments=[{}, {}, {}], + ein="string", + entity={}, + legal_name="string", + locations=[{}, {}, {}], + primary_email="string", + primary_phone_number="string", + ) + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: + company = await client.sandbox.company.update( + accounts=[ + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + { + "routing_number": "string", + "account_name": "string", + "institution_name": "string", + "account_type": "checking", + "account_number": "string", + }, + ], + departments=[ + { + "name": "string", + "parent": {"name": "string"}, + }, + { + "name": "string", + "parent": {"name": "string"}, + }, + { + "name": "string", + "parent": {"name": "string"}, + }, + ], + ein="string", + entity={ + "type": "llc", + "subtype": "s_corporation", + }, + legal_name="string", + locations=[ + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + { + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + ], + primary_email="string", + primary_phone_number="string", + ) + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) + + @parametrize + async def test_raw_response_update(self, client: AsyncFinch) -> None: + response = await client.sandbox.company.with_raw_response.update( + accounts=[{}, {}, {}], + departments=[{}, {}, {}], + ein="string", + entity={}, + legal_name="string", + locations=[{}, {}, {}], + primary_email="string", + primary_phone_number="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + company = response.parse() + assert_matches_type(CompanyUpdateResponse, company, path=["response"]) diff --git a/tests/api_resources/sandbox/test_connections.py b/tests/api_resources/sandbox/test_connections.py new file mode 100644 index 00000000..160c0ad5 --- /dev/null +++ b/tests/api_resources/sandbox/test_connections.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import ConnectionCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestConnections: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + connection = client.sandbox.connections.create( + provider_id="string", + ) + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Finch) -> None: + connection = client.sandbox.connections.create( + provider_id="string", + authentication_type="credentials", + employer_size=0, + products=["string", "string", "string"], + ) + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.sandbox.connections.with_raw_response.create( + provider_id="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) + + +class TestAsyncConnections: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create(self, client: AsyncFinch) -> None: + connection = await client.sandbox.connections.create( + provider_id="string", + ) + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, client: AsyncFinch) -> None: + connection = await client.sandbox.connections.create( + provider_id="string", + authentication_type="credentials", + employer_size=0, + products=["string", "string", "string"], + ) + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) + + @parametrize + async def test_raw_response_create(self, client: AsyncFinch) -> None: + response = await client.sandbox.connections.with_raw_response.create( + provider_id="string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + connection = response.parse() + assert_matches_type(ConnectionCreateResponse, connection, path=["response"]) diff --git a/tests/api_resources/sandbox/test_directory.py b/tests/api_resources/sandbox/test_directory.py new file mode 100644 index 00000000..3d6ba5f3 --- /dev/null +++ b/tests/api_resources/sandbox/test_directory.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import DirectoryCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestDirectory: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + directory = client.sandbox.directory.create( + body=[{}, {}, {}], + ) + assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.sandbox.directory.with_raw_response.create( + body=[{}, {}, {}], + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) + + +class TestAsyncDirectory: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create(self, client: AsyncFinch) -> None: + directory = await client.sandbox.directory.create( + body=[{}, {}, {}], + ) + assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) + + @parametrize + async def test_raw_response_create(self, client: AsyncFinch) -> None: + response = await client.sandbox.directory.with_raw_response.create( + body=[{}, {}, {}], + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + directory = response.parse() + assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) diff --git a/tests/api_resources/sandbox/test_employment.py b/tests/api_resources/sandbox/test_employment.py new file mode 100644 index 00000000..3995c21a --- /dev/null +++ b/tests/api_resources/sandbox/test_employment.py @@ -0,0 +1,203 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import EmploymentUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestEmployment: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_update(self, client: Finch) -> None: + employment = client.sandbox.employment.update( + "string", + ) + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Finch) -> None: + employment = client.sandbox.employment.update( + "string", + class_code="string", + custom_fields=[ + { + "name": "string", + "value": {}, + }, + { + "name": "string", + "value": {}, + }, + { + "name": "string", + "value": {}, + }, + ], + department={"name": "string"}, + employment={ + "type": "employee", + "subtype": "full_time", + }, + end_date="string", + first_name="string", + income={ + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + income_history=[ + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + ], + is_active=True, + last_name="string", + location={ + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + manager={"id": "string"}, + middle_name="string", + source_id="string", + start_date="string", + title="string", + ) + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.sandbox.employment.with_raw_response.update( + "string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + employment = response.parse() + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) + + +class TestAsyncEmployment: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_update(self, client: AsyncFinch) -> None: + employment = await client.sandbox.employment.update( + "string", + ) + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: + employment = await client.sandbox.employment.update( + "string", + class_code="string", + custom_fields=[ + { + "name": "string", + "value": {}, + }, + { + "name": "string", + "value": {}, + }, + { + "name": "string", + "value": {}, + }, + ], + department={"name": "string"}, + employment={ + "type": "employee", + "subtype": "full_time", + }, + end_date="string", + first_name="string", + income={ + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + income_history=[ + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + { + "unit": "yearly", + "amount": 0, + "currency": "string", + "effective_date": "string", + }, + ], + is_active=True, + last_name="string", + location={ + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + manager={"id": "string"}, + middle_name="string", + source_id="string", + start_date="string", + title="string", + ) + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) + + @parametrize + async def test_raw_response_update(self, client: AsyncFinch) -> None: + response = await client.sandbox.employment.with_raw_response.update( + "string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + employment = response.parse() + assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) diff --git a/tests/api_resources/sandbox/test_individual.py b/tests/api_resources/sandbox/test_individual.py new file mode 100644 index 00000000..21f4affc --- /dev/null +++ b/tests/api_resources/sandbox/test_individual.py @@ -0,0 +1,167 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import IndividualUpdateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestIndividual: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_update(self, client: Finch) -> None: + individual = client.sandbox.individual.update( + "string", + ) + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Finch) -> None: + individual = client.sandbox.individual.update( + "string", + dob="string", + emails=[ + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + ], + encrypted_ssn="string", + ethnicity="asian", + first_name="string", + gender="female", + last_name="string", + middle_name="string", + phone_numbers=[ + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + ], + preferred_name="string", + residence={ + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + ssn="string", + ) + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Finch) -> None: + response = client.sandbox.individual.with_raw_response.update( + "string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + individual = response.parse() + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) + + +class TestAsyncIndividual: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_update(self, client: AsyncFinch) -> None: + individual = await client.sandbox.individual.update( + "string", + ) + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: + individual = await client.sandbox.individual.update( + "string", + dob="string", + emails=[ + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + ], + encrypted_ssn="string", + ethnicity="asian", + first_name="string", + gender="female", + last_name="string", + middle_name="string", + phone_numbers=[ + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + { + "data": "string", + "type": "work", + }, + ], + preferred_name="string", + residence={ + "line1": "string", + "line2": "string", + "city": "string", + "state": "string", + "postal_code": "string", + "country": "string", + "name": "string", + "source_id": "string", + }, + ssn="string", + ) + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) + + @parametrize + async def test_raw_response_update(self, client: AsyncFinch) -> None: + response = await client.sandbox.individual.with_raw_response.update( + "string", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + individual = response.parse() + assert_matches_type(IndividualUpdateResponse, individual, path=["response"]) diff --git a/tests/api_resources/sandbox/test_payment.py b/tests/api_resources/sandbox/test_payment.py new file mode 100644 index 00000000..ee4a2a1d --- /dev/null +++ b/tests/api_resources/sandbox/test_payment.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch +from finch.types.sandbox import PaymentCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestPayment: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create(self, client: Finch) -> None: + payment = client.sandbox.payment.create() + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Finch) -> None: + payment = client.sandbox.payment.create( + end_date="string", + pay_statements=[ + { + "individual_id": "b2338cfb-472f-4f72-9faa-e028c083144a", + "type": "regular_payroll", + "payment_method": "check", + "total_hours": 0, + "gross_pay": { + "amount": 0, + "currency": "string", + }, + "net_pay": { + "amount": 0, + "currency": "string", + }, + "earnings": [ + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + ], + "taxes": [ + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + ], + "employee_deductions": [ + { + "name": "401k test", + "amount": 2000, + "currency": "usd", + "pre_tax": True, + "type": "401k", + } + ], + "employer_contributions": [ + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + ], + } + ], + start_date="string", + ) + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Finch) -> None: + response = client.sandbox.payment.with_raw_response.create() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + payment = response.parse() + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) + + +class TestAsyncPayment: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create(self, client: AsyncFinch) -> None: + payment = await client.sandbox.payment.create() + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, client: AsyncFinch) -> None: + payment = await client.sandbox.payment.create( + end_date="string", + pay_statements=[ + { + "individual_id": "b2338cfb-472f-4f72-9faa-e028c083144a", + "type": "regular_payroll", + "payment_method": "check", + "total_hours": 0, + "gross_pay": { + "amount": 0, + "currency": "string", + }, + "net_pay": { + "amount": 0, + "currency": "string", + }, + "earnings": [ + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + { + "type": "salary", + "name": "string", + "amount": 0, + "currency": "string", + "hours": 0, + }, + ], + "taxes": [ + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + { + "type": "state", + "name": "string", + "employer": True, + "amount": 0, + "currency": "string", + }, + ], + "employee_deductions": [ + { + "name": "401k test", + "amount": 2000, + "currency": "usd", + "pre_tax": True, + "type": "401k", + } + ], + "employer_contributions": [ + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + { + "name": "string", + "amount": 0, + "currency": "string", + "type": "401k", + }, + ], + } + ], + start_date="string", + ) + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) + + @parametrize + async def test_raw_response_create(self, client: AsyncFinch) -> None: + response = await client.sandbox.payment.with_raw_response.create() + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + payment = response.parse() + assert_matches_type(PaymentCreateResponse, payment, path=["response"]) diff --git a/tests/api_resources/test_auth.py b/tests/api_resources/test_auth.py new file mode 100644 index 00000000..f826ee79 --- /dev/null +++ b/tests/api_resources/test_auth.py @@ -0,0 +1,71 @@ +# File generated from our OpenAPI spec by Stainless. + +from __future__ import annotations + +import os + +import pytest + +from finch import Finch, AsyncFinch +from finch.types import CreateAccessTokenResponse +from tests.utils import assert_matches_type +from finch._client import Finch, AsyncFinch + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +access_token = "My Access Token" + + +class TestAuth: + strict_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = Finch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + def test_method_create_token(self, client: Finch) -> None: + auth = client.auth.create_token( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert_matches_type(CreateAccessTokenResponse, auth, path=["response"]) + + @parametrize + def test_raw_response_create_token(self, client: Finch) -> None: + response = client.auth.with_raw_response.create_token( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(CreateAccessTokenResponse, auth, path=["response"]) + + +class TestAsyncAuth: + strict_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=True) + loose_client = AsyncFinch(base_url=base_url, access_token=access_token, _strict_response_validation=False) + parametrize = pytest.mark.parametrize("client", [strict_client, loose_client], ids=["strict", "loose"]) + + @parametrize + async def test_method_create_token(self, client: AsyncFinch) -> None: + auth = await client.auth.create_token( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert_matches_type(CreateAccessTokenResponse, auth, path=["response"]) + + @parametrize + async def test_raw_response_create_token(self, client: AsyncFinch) -> None: + response = await client.auth.with_raw_response.create_token( + client_id="", + client_secret="", + code="", + redirect_uri="https://example.com", + ) + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + auth = response.parse() + assert_matches_type(CreateAccessTokenResponse, auth, path=["response"]) From b802828c164bd32eab6e778128003a10d16d6dba Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:36:33 -0500 Subject: [PATCH 10/11] chore(test): update examples (#252) --- tests/api_resources/sandbox/test_directory.py | 8 ++++---- tests/api_resources/sandbox/test_employment.py | 4 ++-- tests/api_resources/sandbox/test_individual.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/api_resources/sandbox/test_directory.py b/tests/api_resources/sandbox/test_directory.py index 3d6ba5f3..ef7776db 100644 --- a/tests/api_resources/sandbox/test_directory.py +++ b/tests/api_resources/sandbox/test_directory.py @@ -23,14 +23,14 @@ class TestDirectory: @parametrize def test_method_create(self, client: Finch) -> None: directory = client.sandbox.directory.create( - body=[{}, {}, {}], + body=[{}], ) assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) @parametrize def test_raw_response_create(self, client: Finch) -> None: response = client.sandbox.directory.with_raw_response.create( - body=[{}, {}, {}], + body=[{}], ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" directory = response.parse() @@ -45,14 +45,14 @@ class TestAsyncDirectory: @parametrize async def test_method_create(self, client: AsyncFinch) -> None: directory = await client.sandbox.directory.create( - body=[{}, {}, {}], + body=[{}], ) assert_matches_type(DirectoryCreateResponse, directory, path=["response"]) @parametrize async def test_raw_response_create(self, client: AsyncFinch) -> None: response = await client.sandbox.directory.with_raw_response.create( - body=[{}, {}, {}], + body=[{}], ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" directory = response.parse() diff --git a/tests/api_resources/sandbox/test_employment.py b/tests/api_resources/sandbox/test_employment.py index 3995c21a..9a1c9bf2 100644 --- a/tests/api_resources/sandbox/test_employment.py +++ b/tests/api_resources/sandbox/test_employment.py @@ -94,7 +94,7 @@ def test_method_update_with_all_params(self, client: Finch) -> None: manager={"id": "string"}, middle_name="string", source_id="string", - start_date="string", + start_date="3/4/2020", title="string", ) assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) @@ -188,7 +188,7 @@ async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: manager={"id": "string"}, middle_name="string", source_id="string", - start_date="string", + start_date="3/4/2020", title="string", ) assert_matches_type(EmploymentUpdateResponse, employment, path=["response"]) diff --git a/tests/api_resources/sandbox/test_individual.py b/tests/api_resources/sandbox/test_individual.py index 21f4affc..8a32a64c 100644 --- a/tests/api_resources/sandbox/test_individual.py +++ b/tests/api_resources/sandbox/test_individual.py @@ -31,7 +31,7 @@ def test_method_update(self, client: Finch) -> None: def test_method_update_with_all_params(self, client: Finch) -> None: individual = client.sandbox.individual.update( "string", - dob="string", + dob="12/20/1989", emails=[ { "data": "string", @@ -107,7 +107,7 @@ async def test_method_update(self, client: AsyncFinch) -> None: async def test_method_update_with_all_params(self, client: AsyncFinch) -> None: individual = await client.sandbox.individual.update( "string", - dob="string", + dob="12/20/1989", emails=[ { "data": "string", From a1ab9d377755641e58455f956742d29697b13ca4 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:36:51 -0500 Subject: [PATCH 11/11] release: 0.10.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 25 +++++++++++++++++++++++++ pyproject.toml | 2 +- src/finch/_version.py | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d9db8b99..091cfb12 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.5" + ".": "0.10.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a02f977b..5548309c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 0.10.0 (2024-01-09) + +Full Changelog: [v0.9.5...v0.10.0](https://github.com/Finch-API/finch-api-python/compare/v0.9.5...v0.10.0) + +### Features + +* add `None` default value to nullable response properties ([#246](https://github.com/Finch-API/finch-api-python/issues/246)) ([a3c577c](https://github.com/Finch-API/finch-api-python/commit/a3c577c2408ca18de1cdfeaf513b2e92f06120c3)) +* **api:** add method to create access token ([#249](https://github.com/Finch-API/finch-api-python/issues/249)) ([3dedeb6](https://github.com/Finch-API/finch-api-python/commit/3dedeb6bc0912e18d0574005eabe41490434bea1)) +* **api:** add sandbox APIs ([#251](https://github.com/Finch-API/finch-api-python/issues/251)) ([3ac7bc5](https://github.com/Finch-API/finch-api-python/commit/3ac7bc52c912008baa9d2b6da548aea858b8fbde)) + + +### Bug Fixes + +* **client:** correctly use custom http client auth ([#242](https://github.com/Finch-API/finch-api-python/issues/242)) ([244aef9](https://github.com/Finch-API/finch-api-python/commit/244aef94986b9775df68c247dad9e1f576fd0415)) + + +### Chores + +* add .keep files for examples and custom code directories ([#250](https://github.com/Finch-API/finch-api-python/issues/250)) ([e5a7c17](https://github.com/Finch-API/finch-api-python/commit/e5a7c17686359f0a121c815635f70e83f0e21092)) +* **internal:** bump license ([#244](https://github.com/Finch-API/finch-api-python/issues/244)) ([b7b0145](https://github.com/Finch-API/finch-api-python/commit/b7b01454503efda4542805d4fb335f39b301bc1f)) +* **internal:** loosen type var restrictions ([#248](https://github.com/Finch-API/finch-api-python/issues/248)) ([f070165](https://github.com/Finch-API/finch-api-python/commit/f0701652f2e85b5d6b139eb68c2b3fe665618dd9)) +* **internal:** replace isort with ruff ([#245](https://github.com/Finch-API/finch-api-python/issues/245)) ([82a7085](https://github.com/Finch-API/finch-api-python/commit/82a7085b46391bbb1a08f45d1fa4469c1225e3dd)) +* **test:** update examples ([#252](https://github.com/Finch-API/finch-api-python/issues/252)) ([b802828](https://github.com/Finch-API/finch-api-python/commit/b802828c164bd32eab6e778128003a10d16d6dba)) +* use property declarations for resource members ([#247](https://github.com/Finch-API/finch-api-python/issues/247)) ([acd29fd](https://github.com/Finch-API/finch-api-python/commit/acd29fd6138c0fa23ac429aa2b92e31791560bf4)) + ## 0.9.5 (2023-12-22) Full Changelog: [v0.9.4...v0.9.5](https://github.com/Finch-API/finch-api-python/compare/v0.9.4...v0.9.5) diff --git a/pyproject.toml b/pyproject.toml index 96698a08..a374dc26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "finch-api" -version = "0.9.5" +version = "0.10.0" description = "The official Python library for the Finch API" readme = "README.md" license = "Apache-2.0" diff --git a/src/finch/_version.py b/src/finch/_version.py index c22feb71..e6546369 100644 --- a/src/finch/_version.py +++ b/src/finch/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. __title__ = "finch" -__version__ = "0.9.5" # x-release-please-version +__version__ = "0.10.0" # x-release-please-version