Skip to content

Commit ec02b1e

Browse files
feat(api): api update (#523)
1 parent e99f4bf commit ec02b1e

File tree

4 files changed

+241
-22
lines changed

4 files changed

+241
-22
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 39
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-b67c6cc5bff73851c98deeabb3ef7548eb89abfa88aca36886084416fdc347f4.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-a340c9ef2dc8b9c0e755549d473fb1033ce6b75b606aacdc1a4ae22d2456c6ad.yml

src/finch/resources/jobs/automated.py

Lines changed: 150 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal
5+
from typing_extensions import Literal, overload
66

77
import httpx
88

99
from ... import _legacy_response
1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1111
from ..._utils import (
12+
required_args,
1213
maybe_transform,
1314
async_maybe_transform,
1415
)
@@ -44,6 +45,7 @@ def with_streaming_response(self) -> AutomatedWithStreamingResponse:
4445
"""
4546
return AutomatedWithStreamingResponse(self)
4647

48+
@overload
4749
def create(
4850
self,
4951
*,
@@ -55,21 +57,68 @@ def create(
5557
extra_body: Body | None = None,
5658
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5759
) -> AutomatedCreateResponse:
58-
"""Enqueue an automated job.
60+
"""
61+
Enqueue an automated job.
62+
63+
`data_sync_all`: Enqueue a job to re-sync all data for a connection.
64+
`data_sync_all` has a concurrency limit of 1 job at a time per connection. This
65+
means that if this endpoint is called while a job is already in progress for
66+
this connection, Finch will return the `job_id` of the job that is currently in
67+
progress. Finch allows a fixed window rate limit of 1 forced refresh per hour
68+
per connection.
69+
70+
`w4_data_sync`: Enqueues a job for sync W-4 data for a particular individual,
71+
identified by `individual_id`. This feature is currently in beta.
72+
73+
This endpoint is available for _Scale_ tier customers as an add-on. To request
74+
access to this endpoint, please contact your Finch account manager.
75+
76+
Args:
77+
type: The type of job to start.
78+
79+
extra_headers: Send extra headers
80+
81+
extra_query: Add additional query parameters to the request
82+
83+
extra_body: Add additional JSON properties to the request
84+
85+
timeout: Override the client-level default timeout for this request, in seconds
86+
"""
87+
...
88+
89+
@overload
90+
def create(
91+
self,
92+
*,
93+
individual_id: str,
94+
type: Literal["w4_data_sync"],
95+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
96+
# The extra values given here take precedence over values defined on the client or passed to this method.
97+
extra_headers: Headers | None = None,
98+
extra_query: Query | None = None,
99+
extra_body: Body | None = None,
100+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
101+
) -> AutomatedCreateResponse:
102+
"""
103+
Enqueue an automated job.
59104
60-
Currently, only the `data_sync_all` job type is
61-
supported, which will enqueue a job to re-sync all data for a connection.
105+
`data_sync_all`: Enqueue a job to re-sync all data for a connection.
62106
`data_sync_all` has a concurrency limit of 1 job at a time per connection. This
63107
means that if this endpoint is called while a job is already in progress for
64108
this connection, Finch will return the `job_id` of the job that is currently in
65109
progress. Finch allows a fixed window rate limit of 1 forced refresh per hour
66110
per connection.
67111
112+
`w4_data_sync`: Enqueues a job for sync W-4 data for a particular individual,
113+
identified by `individual_id`. This feature is currently in beta.
114+
68115
This endpoint is available for _Scale_ tier customers as an add-on. To request
69116
access to this endpoint, please contact your Finch account manager.
70117
71118
Args:
72-
type: The type of job to start. Currently the only supported type is `data_sync_all`
119+
individual_id: The unique ID of the individual for W-4 data sync.
120+
121+
type: The type of job to start.
73122
74123
extra_headers: Send extra headers
75124
@@ -79,9 +128,30 @@ def create(
79128
80129
timeout: Override the client-level default timeout for this request, in seconds
81130
"""
131+
...
132+
133+
@required_args(["type"], ["individual_id", "type"])
134+
def create(
135+
self,
136+
*,
137+
type: Literal["data_sync_all"] | Literal["w4_data_sync"],
138+
individual_id: str | NotGiven = NOT_GIVEN,
139+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
140+
# The extra values given here take precedence over values defined on the client or passed to this method.
141+
extra_headers: Headers | None = None,
142+
extra_query: Query | None = None,
143+
extra_body: Body | None = None,
144+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
145+
) -> AutomatedCreateResponse:
82146
return self._post(
83147
"/jobs/automated",
84-
body=maybe_transform({"type": type}, automated_create_params.AutomatedCreateParams),
148+
body=maybe_transform(
149+
{
150+
"type": type,
151+
"individual_id": individual_id,
152+
},
153+
automated_create_params.AutomatedCreateParams,
154+
),
85155
options=make_request_options(
86156
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
87157
),
@@ -192,6 +262,7 @@ def with_streaming_response(self) -> AsyncAutomatedWithStreamingResponse:
192262
"""
193263
return AsyncAutomatedWithStreamingResponse(self)
194264

265+
@overload
195266
async def create(
196267
self,
197268
*,
@@ -203,21 +274,68 @@ async def create(
203274
extra_body: Body | None = None,
204275
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
205276
) -> AutomatedCreateResponse:
206-
"""Enqueue an automated job.
277+
"""
278+
Enqueue an automated job.
279+
280+
`data_sync_all`: Enqueue a job to re-sync all data for a connection.
281+
`data_sync_all` has a concurrency limit of 1 job at a time per connection. This
282+
means that if this endpoint is called while a job is already in progress for
283+
this connection, Finch will return the `job_id` of the job that is currently in
284+
progress. Finch allows a fixed window rate limit of 1 forced refresh per hour
285+
per connection.
286+
287+
`w4_data_sync`: Enqueues a job for sync W-4 data for a particular individual,
288+
identified by `individual_id`. This feature is currently in beta.
289+
290+
This endpoint is available for _Scale_ tier customers as an add-on. To request
291+
access to this endpoint, please contact your Finch account manager.
292+
293+
Args:
294+
type: The type of job to start.
295+
296+
extra_headers: Send extra headers
297+
298+
extra_query: Add additional query parameters to the request
299+
300+
extra_body: Add additional JSON properties to the request
301+
302+
timeout: Override the client-level default timeout for this request, in seconds
303+
"""
304+
...
305+
306+
@overload
307+
async def create(
308+
self,
309+
*,
310+
individual_id: str,
311+
type: Literal["w4_data_sync"],
312+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
313+
# The extra values given here take precedence over values defined on the client or passed to this method.
314+
extra_headers: Headers | None = None,
315+
extra_query: Query | None = None,
316+
extra_body: Body | None = None,
317+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
318+
) -> AutomatedCreateResponse:
319+
"""
320+
Enqueue an automated job.
207321
208-
Currently, only the `data_sync_all` job type is
209-
supported, which will enqueue a job to re-sync all data for a connection.
322+
`data_sync_all`: Enqueue a job to re-sync all data for a connection.
210323
`data_sync_all` has a concurrency limit of 1 job at a time per connection. This
211324
means that if this endpoint is called while a job is already in progress for
212325
this connection, Finch will return the `job_id` of the job that is currently in
213326
progress. Finch allows a fixed window rate limit of 1 forced refresh per hour
214327
per connection.
215328
329+
`w4_data_sync`: Enqueues a job for sync W-4 data for a particular individual,
330+
identified by `individual_id`. This feature is currently in beta.
331+
216332
This endpoint is available for _Scale_ tier customers as an add-on. To request
217333
access to this endpoint, please contact your Finch account manager.
218334
219335
Args:
220-
type: The type of job to start. Currently the only supported type is `data_sync_all`
336+
individual_id: The unique ID of the individual for W-4 data sync.
337+
338+
type: The type of job to start.
221339
222340
extra_headers: Send extra headers
223341
@@ -227,9 +345,30 @@ async def create(
227345
228346
timeout: Override the client-level default timeout for this request, in seconds
229347
"""
348+
...
349+
350+
@required_args(["type"], ["individual_id", "type"])
351+
async def create(
352+
self,
353+
*,
354+
type: Literal["data_sync_all"] | Literal["w4_data_sync"],
355+
individual_id: str | NotGiven = NOT_GIVEN,
356+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
357+
# The extra values given here take precedence over values defined on the client or passed to this method.
358+
extra_headers: Headers | None = None,
359+
extra_query: Query | None = None,
360+
extra_body: Body | None = None,
361+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
362+
) -> AutomatedCreateResponse:
230363
return await self._post(
231364
"/jobs/automated",
232-
body=await async_maybe_transform({"type": type}, automated_create_params.AutomatedCreateParams),
365+
body=await async_maybe_transform(
366+
{
367+
"type": type,
368+
"individual_id": individual_id,
369+
},
370+
automated_create_params.AutomatedCreateParams,
371+
),
233372
options=make_request_options(
234373
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
235374
),

src/finch/types/jobs/automated_create_params.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, Required, TypedDict
5+
from typing import Union
6+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
67

7-
__all__ = ["AutomatedCreateParams"]
8+
__all__ = ["AutomatedCreateParams", "DataSyncAll", "W4DataSync"]
89

910

10-
class AutomatedCreateParams(TypedDict, total=False):
11+
class DataSyncAll(TypedDict, total=False):
1112
type: Required[Literal["data_sync_all"]]
12-
"""The type of job to start. Currently the only supported type is `data_sync_all`"""
13+
"""The type of job to start."""
14+
15+
16+
class W4DataSync(TypedDict, total=False):
17+
individual_id: Required[str]
18+
"""The unique ID of the individual for W-4 data sync."""
19+
20+
type: Required[Literal["w4_data_sync"]]
21+
"""The type of job to start."""
22+
23+
24+
AutomatedCreateParams: TypeAlias = Union[DataSyncAll, W4DataSync]

0 commit comments

Comments
 (0)