10
10
11
11
from . import resources , _exceptions
12
12
from ._qs import Querystring
13
+ from .types import ForwardResponse , top_level_forward_params
13
14
from ._types import (
14
15
NOT_GIVEN ,
16
+ Body ,
15
17
Omit ,
18
+ Query ,
16
19
Headers ,
17
20
Timeout ,
18
21
NotGiven ,
19
22
Transport ,
20
23
ProxiesTypes ,
21
24
RequestOptions ,
22
25
)
26
+ from ._utils import maybe_transform
23
27
from ._version import __version__
24
28
from ._streaming import Stream as Stream
25
29
from ._streaming import AsyncStream as AsyncStream
30
34
DEFAULT_MAX_RETRIES ,
31
35
SyncAPIClient ,
32
36
AsyncAPIClient ,
37
+ make_request_options ,
33
38
)
34
39
35
40
__all__ = [
@@ -50,6 +55,7 @@ class Finch(SyncAPIClient):
50
55
providers : resources .Providers
51
56
account : resources .Account
52
57
webhooks : resources .Webhooks
58
+ employer : resources .Employer
53
59
54
60
# client options
55
61
access_token : str | None
@@ -123,6 +129,7 @@ def __init__(
123
129
self .providers = resources .Providers (self )
124
130
self .account = resources .Account (self )
125
131
self .webhooks = resources .Webhooks (self )
132
+ self .employer = resources .Employer (self )
126
133
127
134
@property
128
135
def qs (self ) -> Querystring :
@@ -216,6 +223,72 @@ def copy(
216
223
def __del__ (self ) -> None :
217
224
self .close ()
218
225
226
+ def forward (
227
+ self ,
228
+ * ,
229
+ method : str ,
230
+ route : str ,
231
+ data : Optional [str ] | NotGiven = NOT_GIVEN ,
232
+ headers : Optional [object ] | NotGiven = NOT_GIVEN ,
233
+ params : Optional [object ] | NotGiven = NOT_GIVEN ,
234
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
235
+ # The extra values given here take precedence over values defined on the client or passed to this method.
236
+ extra_headers : Headers | None = None ,
237
+ extra_query : Query | None = None ,
238
+ extra_body : Body | None = None ,
239
+ timeout : float | None | NotGiven = NOT_GIVEN ,
240
+ ) -> ForwardResponse :
241
+ """The Forward API allows you to make direct requests to an employment system.
242
+
243
+ If
244
+ Finch’s unified API doesn’t have a data model that cleanly fits your needs, then
245
+ Forward allows you to push or pull data models directly against an integration’s
246
+ API.
247
+
248
+ Args:
249
+ method: The HTTP method for the forwarded request. Valid values include: `GET` , `POST`
250
+ , `PUT` , `DELETE` , and `PATCH`.
251
+
252
+ route: The URL route path for the forwarded request. This value must begin with a
253
+ forward-slash ( / ) and may only contain alphanumeric characters, hyphens, and
254
+ underscores.
255
+
256
+ data: The body for the forwarded request. This value must be specified as either a
257
+ string or a valid JSON object.
258
+
259
+ headers: The HTTP headers to include on the forwarded request. This value must be
260
+ specified as an object of key-value pairs. Example:
261
+ `{"Content-Type": "application/xml", "X-API-Version": "v1" }`
262
+
263
+ params: The query parameters for the forwarded request. This value must be specified as
264
+ a valid JSON object rather than a query string.
265
+
266
+ extra_headers: Send extra headers
267
+
268
+ extra_query: Add additional query parameters to the request
269
+
270
+ extra_body: Add additional JSON properties to the request
271
+
272
+ timeout: Override the client-level default timeout for this request, in seconds
273
+ """
274
+ return self .post (
275
+ "/forward" ,
276
+ body = maybe_transform (
277
+ {
278
+ "method" : method ,
279
+ "route" : route ,
280
+ "data" : data ,
281
+ "headers" : headers ,
282
+ "params" : params ,
283
+ },
284
+ top_level_forward_params .TopLevelForwardParams ,
285
+ ),
286
+ options = make_request_options (
287
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
288
+ ),
289
+ cast_to = ForwardResponse ,
290
+ )
291
+
219
292
def get_access_token (
220
293
self ,
221
294
code : str ,
@@ -313,6 +386,7 @@ class AsyncFinch(AsyncAPIClient):
313
386
providers : resources .AsyncProviders
314
387
account : resources .AsyncAccount
315
388
webhooks : resources .AsyncWebhooks
389
+ employer : resources .AsyncEmployer
316
390
317
391
# client options
318
392
access_token : str | None
@@ -386,6 +460,7 @@ def __init__(
386
460
self .providers = resources .AsyncProviders (self )
387
461
self .account = resources .AsyncAccount (self )
388
462
self .webhooks = resources .AsyncWebhooks (self )
463
+ self .employer = resources .AsyncEmployer (self )
389
464
390
465
@property
391
466
def qs (self ) -> Querystring :
@@ -482,6 +557,72 @@ def __del__(self) -> None:
482
557
except Exception :
483
558
pass
484
559
560
+ async def forward (
561
+ self ,
562
+ * ,
563
+ method : str ,
564
+ route : str ,
565
+ data : Optional [str ] | NotGiven = NOT_GIVEN ,
566
+ headers : Optional [object ] | NotGiven = NOT_GIVEN ,
567
+ params : Optional [object ] | NotGiven = NOT_GIVEN ,
568
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
569
+ # The extra values given here take precedence over values defined on the client or passed to this method.
570
+ extra_headers : Headers | None = None ,
571
+ extra_query : Query | None = None ,
572
+ extra_body : Body | None = None ,
573
+ timeout : float | None | NotGiven = NOT_GIVEN ,
574
+ ) -> ForwardResponse :
575
+ """The Forward API allows you to make direct requests to an employment system.
576
+
577
+ If
578
+ Finch’s unified API doesn’t have a data model that cleanly fits your needs, then
579
+ Forward allows you to push or pull data models directly against an integration’s
580
+ API.
581
+
582
+ Args:
583
+ method: The HTTP method for the forwarded request. Valid values include: `GET` , `POST`
584
+ , `PUT` , `DELETE` , and `PATCH`.
585
+
586
+ route: The URL route path for the forwarded request. This value must begin with a
587
+ forward-slash ( / ) and may only contain alphanumeric characters, hyphens, and
588
+ underscores.
589
+
590
+ data: The body for the forwarded request. This value must be specified as either a
591
+ string or a valid JSON object.
592
+
593
+ headers: The HTTP headers to include on the forwarded request. This value must be
594
+ specified as an object of key-value pairs. Example:
595
+ `{"Content-Type": "application/xml", "X-API-Version": "v1" }`
596
+
597
+ params: The query parameters for the forwarded request. This value must be specified as
598
+ a valid JSON object rather than a query string.
599
+
600
+ extra_headers: Send extra headers
601
+
602
+ extra_query: Add additional query parameters to the request
603
+
604
+ extra_body: Add additional JSON properties to the request
605
+
606
+ timeout: Override the client-level default timeout for this request, in seconds
607
+ """
608
+ return await self .post (
609
+ "/forward" ,
610
+ body = maybe_transform (
611
+ {
612
+ "method" : method ,
613
+ "route" : route ,
614
+ "data" : data ,
615
+ "headers" : headers ,
616
+ "params" : params ,
617
+ },
618
+ top_level_forward_params .TopLevelForwardParams ,
619
+ ),
620
+ options = make_request_options (
621
+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
622
+ ),
623
+ cast_to = ForwardResponse ,
624
+ )
625
+
485
626
async def get_access_token (
486
627
self ,
487
628
code : str ,
0 commit comments