Skip to content

Commit a3dcd4b

Browse files
feat(client): support passing httpx.Timeout to method timeout argument (#171)
1 parent fc12d83 commit a3dcd4b

12 files changed

+63
-41
lines changed

src/finch/_base_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ def make_request_options(
15371537
extra_query: Query | None = None,
15381538
extra_body: Body | None = None,
15391539
idempotency_key: str | None = None,
1540-
timeout: float | None | NotGiven = NOT_GIVEN,
1540+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
15411541
post_parser: PostParser | NotGiven = NOT_GIVEN,
15421542
) -> RequestOptions:
15431543
"""Create a dict of type RequestOptions without keys of NotGiven values."""

src/finch/resources/account.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING
66

7+
import httpx
8+
79
from ..types import Introspection, DisconnectResponse
810
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
911
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -31,7 +33,7 @@ def disconnect(
3133
extra_headers: Headers | None = None,
3234
extra_query: Query | None = None,
3335
extra_body: Body | None = None,
34-
timeout: float | None | NotGiven = NOT_GIVEN,
36+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3537
) -> DisconnectResponse:
3638
"""
3739
Disconnect an employer from your application and invalidate all `access_token`s
@@ -54,7 +56,7 @@ def introspect(
5456
extra_headers: Headers | None = None,
5557
extra_query: Query | None = None,
5658
extra_body: Body | None = None,
57-
timeout: float | None | NotGiven = NOT_GIVEN,
59+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5860
) -> Introspection:
5961
"""Read account information associated with an `access_token`"""
6062
return self._get(
@@ -81,7 +83,7 @@ async def disconnect(
8183
extra_headers: Headers | None = None,
8284
extra_query: Query | None = None,
8385
extra_body: Body | None = None,
84-
timeout: float | None | NotGiven = NOT_GIVEN,
86+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8587
) -> DisconnectResponse:
8688
"""
8789
Disconnect an employer from your application and invalidate all `access_token`s
@@ -104,7 +106,7 @@ async def introspect(
104106
extra_headers: Headers | None = None,
105107
extra_query: Query | None = None,
106108
extra_body: Body | None = None,
107-
timeout: float | None | NotGiven = NOT_GIVEN,
109+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
108110
) -> Introspection:
109111
"""Read account information associated with an `access_token`"""
110112
return await self._get(

src/finch/resources/hris/benefits/benefits.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, Optional
66

7+
import httpx
8+
79
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ...._utils import maybe_transform
911
from .individuals import (
@@ -53,7 +55,7 @@ def create(
5355
extra_headers: Headers | None = None,
5456
extra_query: Query | None = None,
5557
extra_body: Body | None = None,
56-
timeout: float | None | NotGiven = NOT_GIVEN,
58+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5759
) -> CreateCompanyBenefitsResponse:
5860
"""
5961
**Availability: Automated and Assisted Benefits providers**
@@ -97,7 +99,7 @@ def retrieve(
9799
extra_headers: Headers | None = None,
98100
extra_query: Query | None = None,
99101
extra_body: Body | None = None,
100-
timeout: float | None | NotGiven = NOT_GIVEN,
102+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
101103
) -> CompanyBenefit:
102104
"""
103105
**Availability: Automated Benefits providers only**
@@ -131,7 +133,7 @@ def update(
131133
extra_headers: Headers | None = None,
132134
extra_query: Query | None = None,
133135
extra_body: Body | None = None,
134-
timeout: float | None | NotGiven = NOT_GIVEN,
136+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
135137
) -> UpdateCompanyBenefitResponse:
136138
"""
137139
**Availability: Automated and Assisted Benefits providers**
@@ -166,7 +168,7 @@ def list(
166168
extra_headers: Headers | None = None,
167169
extra_query: Query | None = None,
168170
extra_body: Body | None = None,
169-
timeout: float | None | NotGiven = NOT_GIVEN,
171+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
170172
) -> SyncSinglePage[CompanyBenefit]:
171173
"""
172174
**Availability: Automated Benefits providers only**
@@ -190,7 +192,7 @@ def list_supported_benefits(
190192
extra_headers: Headers | None = None,
191193
extra_query: Query | None = None,
192194
extra_body: Body | None = None,
193-
timeout: float | None | NotGiven = NOT_GIVEN,
195+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
194196
) -> SyncSinglePage[SupportedBenefit]:
195197
"""
196198
**Availability: Automated and Assisted Benefits providers**
@@ -228,7 +230,7 @@ async def create(
228230
extra_headers: Headers | None = None,
229231
extra_query: Query | None = None,
230232
extra_body: Body | None = None,
231-
timeout: float | None | NotGiven = NOT_GIVEN,
233+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
232234
) -> CreateCompanyBenefitsResponse:
233235
"""
234236
**Availability: Automated and Assisted Benefits providers**
@@ -272,7 +274,7 @@ async def retrieve(
272274
extra_headers: Headers | None = None,
273275
extra_query: Query | None = None,
274276
extra_body: Body | None = None,
275-
timeout: float | None | NotGiven = NOT_GIVEN,
277+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
276278
) -> CompanyBenefit:
277279
"""
278280
**Availability: Automated Benefits providers only**
@@ -306,7 +308,7 @@ async def update(
306308
extra_headers: Headers | None = None,
307309
extra_query: Query | None = None,
308310
extra_body: Body | None = None,
309-
timeout: float | None | NotGiven = NOT_GIVEN,
311+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
310312
) -> UpdateCompanyBenefitResponse:
311313
"""
312314
**Availability: Automated and Assisted Benefits providers**
@@ -341,7 +343,7 @@ def list(
341343
extra_headers: Headers | None = None,
342344
extra_query: Query | None = None,
343345
extra_body: Body | None = None,
344-
timeout: float | None | NotGiven = NOT_GIVEN,
346+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
345347
) -> AsyncPaginator[CompanyBenefit, AsyncSinglePage[CompanyBenefit]]:
346348
"""
347349
**Availability: Automated Benefits providers only**
@@ -365,7 +367,7 @@ def list_supported_benefits(
365367
extra_headers: Headers | None = None,
366368
extra_query: Query | None = None,
367369
extra_body: Body | None = None,
368-
timeout: float | None | NotGiven = NOT_GIVEN,
370+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
369371
) -> AsyncPaginator[SupportedBenefit, AsyncSinglePage[SupportedBenefit]]:
370372
"""
371373
**Availability: Automated and Assisted Benefits providers**

src/finch/resources/hris/benefits/individuals.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, List
66

7+
import httpx
8+
79
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ...._utils import maybe_transform
911
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -43,7 +45,7 @@ def enroll_many(
4345
extra_headers: Headers | None = None,
4446
extra_query: Query | None = None,
4547
extra_body: Body | None = None,
46-
timeout: float | None | NotGiven = NOT_GIVEN,
48+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4749
) -> SyncSinglePage[EnrolledIndividual]:
4850
"""
4951
**Availability: Automated and Assisted Benefits providers**
@@ -88,7 +90,7 @@ def enrolled_ids(
8890
extra_headers: Headers | None = None,
8991
extra_query: Query | None = None,
9092
extra_body: Body | None = None,
91-
timeout: float | None | NotGiven = NOT_GIVEN,
93+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
9294
) -> IndividualEnrolledIDsResponse:
9395
"""
9496
**Availability: Automated Benefits providers only**
@@ -122,7 +124,7 @@ def retrieve_many_benefits(
122124
extra_headers: Headers | None = None,
123125
extra_query: Query | None = None,
124126
extra_body: Body | None = None,
125-
timeout: float | None | NotGiven = NOT_GIVEN,
127+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
126128
) -> SyncSinglePage[IndividualBenefit]:
127129
"""
128130
**Availability: Automated Benefits providers only**
@@ -167,7 +169,7 @@ def unenroll_many(
167169
extra_headers: Headers | None = None,
168170
extra_query: Query | None = None,
169171
extra_body: Body | None = None,
170-
timeout: float | None | NotGiven = NOT_GIVEN,
172+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
171173
) -> SyncSinglePage[UnenrolledIndividual]:
172174
"""
173175
**Availability: Automated and Assisted Benefits providers**
@@ -216,7 +218,7 @@ def enroll_many(
216218
extra_headers: Headers | None = None,
217219
extra_query: Query | None = None,
218220
extra_body: Body | None = None,
219-
timeout: float | None | NotGiven = NOT_GIVEN,
221+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
220222
) -> AsyncPaginator[EnrolledIndividual, AsyncSinglePage[EnrolledIndividual]]:
221223
"""
222224
**Availability: Automated and Assisted Benefits providers**
@@ -261,7 +263,7 @@ async def enrolled_ids(
261263
extra_headers: Headers | None = None,
262264
extra_query: Query | None = None,
263265
extra_body: Body | None = None,
264-
timeout: float | None | NotGiven = NOT_GIVEN,
266+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
265267
) -> IndividualEnrolledIDsResponse:
266268
"""
267269
**Availability: Automated Benefits providers only**
@@ -295,7 +297,7 @@ def retrieve_many_benefits(
295297
extra_headers: Headers | None = None,
296298
extra_query: Query | None = None,
297299
extra_body: Body | None = None,
298-
timeout: float | None | NotGiven = NOT_GIVEN,
300+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
299301
) -> AsyncPaginator[IndividualBenefit, AsyncSinglePage[IndividualBenefit]]:
300302
"""
301303
**Availability: Automated Benefits providers only**
@@ -340,7 +342,7 @@ def unenroll_many(
340342
extra_headers: Headers | None = None,
341343
extra_query: Query | None = None,
342344
extra_body: Body | None = None,
343-
timeout: float | None | NotGiven = NOT_GIVEN,
345+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
344346
) -> AsyncPaginator[UnenrolledIndividual, AsyncSinglePage[UnenrolledIndividual]]:
345347
"""
346348
**Availability: Automated and Assisted Benefits providers**

src/finch/resources/hris/company.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING
66

7+
import httpx
8+
79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ..._resource import SyncAPIResource, AsyncAPIResource
911
from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
@@ -31,7 +33,7 @@ def retrieve(
3133
extra_headers: Headers | None = None,
3234
extra_query: Query | None = None,
3335
extra_body: Body | None = None,
34-
timeout: float | None | NotGiven = NOT_GIVEN,
36+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3537
) -> Company:
3638
"""Read basic company data"""
3739
return self._get(
@@ -58,7 +60,7 @@ async def retrieve(
5860
extra_headers: Headers | None = None,
5961
extra_query: Query | None = None,
6062
extra_body: Body | None = None,
61-
timeout: float | None | NotGiven = NOT_GIVEN,
63+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6264
) -> Company:
6365
"""Read basic company data"""
6466
return await self._get(

src/finch/resources/hris/directory.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import typing_extensions
66
from typing import TYPE_CHECKING
77

8+
import httpx
9+
810
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
911
from ..._utils import maybe_transform
1012
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -36,7 +38,7 @@ def list(
3638
extra_headers: Headers | None = None,
3739
extra_query: Query | None = None,
3840
extra_body: Body | None = None,
39-
timeout: float | None | NotGiven = NOT_GIVEN,
41+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4042
) -> SyncIndividualsPage[IndividualInDirectory]:
4143
"""
4244
Read company directory and organization structure
@@ -84,7 +86,7 @@ def list_individuals(
8486
extra_headers: Headers | None = None,
8587
extra_query: Query | None = None,
8688
extra_body: Body | None = None,
87-
timeout: float | None | NotGiven = NOT_GIVEN,
89+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8890
) -> SyncIndividualsPage[IndividualInDirectory]:
8991
"""
9092
Read company directory and organization structure
@@ -129,7 +131,7 @@ def list(
129131
extra_headers: Headers | None = None,
130132
extra_query: Query | None = None,
131133
extra_body: Body | None = None,
132-
timeout: float | None | NotGiven = NOT_GIVEN,
134+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
133135
) -> AsyncPaginator[IndividualInDirectory, AsyncIndividualsPage[IndividualInDirectory]]:
134136
"""
135137
Read company directory and organization structure
@@ -177,7 +179,7 @@ def list_individuals(
177179
extra_headers: Headers | None = None,
178180
extra_query: Query | None = None,
179181
extra_body: Body | None = None,
180-
timeout: float | None | NotGiven = NOT_GIVEN,
182+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
181183
) -> AsyncPaginator[IndividualInDirectory, AsyncIndividualsPage[IndividualInDirectory]]:
182184
"""
183185
Read company directory and organization structure

src/finch/resources/hris/employments.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, List
66

7+
import httpx
8+
79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ..._utils import maybe_transform
911
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -34,7 +36,7 @@ def retrieve_many(
3436
extra_headers: Headers | None = None,
3537
extra_query: Query | None = None,
3638
extra_body: Body | None = None,
37-
timeout: float | None | NotGiven = NOT_GIVEN,
39+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3840
) -> SyncResponsesPage[EmploymentDataResponse]:
3941
"""
4042
Read individual employment and income data
@@ -82,7 +84,7 @@ def retrieve_many(
8284
extra_headers: Headers | None = None,
8385
extra_query: Query | None = None,
8486
extra_body: Body | None = None,
85-
timeout: float | None | NotGiven = NOT_GIVEN,
87+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8688
) -> AsyncPaginator[EmploymentDataResponse, AsyncResponsesPage[EmploymentDataResponse]]:
8789
"""
8890
Read individual employment and income data

src/finch/resources/hris/individuals.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, List, Optional
66

7+
import httpx
8+
79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ..._utils import maybe_transform
911
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -35,7 +37,7 @@ def retrieve_many(
3537
extra_headers: Headers | None = None,
3638
extra_query: Query | None = None,
3739
extra_body: Body | None = None,
38-
timeout: float | None | NotGiven = NOT_GIVEN,
40+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3941
) -> SyncResponsesPage[IndividualResponse]:
4042
"""
4143
Read individual data, excluding income and employment data
@@ -84,7 +86,7 @@ def retrieve_many(
8486
extra_headers: Headers | None = None,
8587
extra_query: Query | None = None,
8688
extra_body: Body | None = None,
87-
timeout: float | None | NotGiven = NOT_GIVEN,
89+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8890
) -> AsyncPaginator[IndividualResponse, AsyncResponsesPage[IndividualResponse]]:
8991
"""
9092
Read individual data, excluding income and employment data

src/finch/resources/hris/pay_statements.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import TYPE_CHECKING, List
66

7+
import httpx
8+
79
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
810
from ..._utils import maybe_transform
911
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -34,7 +36,7 @@ def retrieve_many(
3436
extra_headers: Headers | None = None,
3537
extra_query: Query | None = None,
3638
extra_body: Body | None = None,
37-
timeout: float | None | NotGiven = NOT_GIVEN,
39+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3840
) -> SyncResponsesPage[PayStatementResponse]:
3941
"""
4042
Read detailed pay statements for each individual.
@@ -83,7 +85,7 @@ def retrieve_many(
8385
extra_headers: Headers | None = None,
8486
extra_query: Query | None = None,
8587
extra_body: Body | None = None,
86-
timeout: float | None | NotGiven = NOT_GIVEN,
88+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
8789
) -> AsyncPaginator[PayStatementResponse, AsyncResponsesPage[PayStatementResponse]]:
8890
"""
8991
Read detailed pay statements for each individual.

0 commit comments

Comments
 (0)