Skip to content

Commit 3ac7bc5

Browse files
feat(api): add sandbox APIs (#251)
1 parent e5a7c17 commit 3ac7bc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4381
-24
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 24
1+
configured_endpoints: 34

api.md

+114-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Shared Types
22

33
```python
4-
from finch.types import OperationSupport, OperationSupportMatrix, Paging
4+
from finch.types import (
5+
IntrospectResponseConnectionStatus,
6+
OperationSupport,
7+
OperationSupportMatrix,
8+
Paging,
9+
)
510
```
611

712
# Finch
@@ -223,3 +228,111 @@ from finch.types.jobs import ManualAsyncJob
223228
Methods:
224229

225230
- <code title="get /jobs/manual/{job_id}">client.jobs.manual.<a href="./src/finch/resources/jobs/manual.py">retrieve</a>(job_id) -> <a href="./src/finch/types/jobs/manual_async_job.py">ManualAsyncJob</a></code>
231+
232+
# Auth
233+
234+
Methods:
235+
236+
- <code title="post /auth/token">client.auth.<a href="./src/finch/resources/auth.py">create_token</a>(\*\*<a href="src/finch/types/auth_create_token_params.py">params</a>) -> <a href="./src/finch/types/create_access_token_response.py">CreateAccessTokenResponse</a></code>
237+
238+
# Sandbox
239+
240+
## Connections
241+
242+
Types:
243+
244+
```python
245+
from finch.types.sandbox import ConnectionCreateResponse
246+
```
247+
248+
Methods:
249+
250+
- <code title="post /sandbox/connections">client.sandbox.connections.<a href="./src/finch/resources/sandbox/connections/connections.py">create</a>(\*\*<a href="src/finch/types/sandbox/connection_create_params.py">params</a>) -> <a href="./src/finch/types/sandbox/connection_create_response.py">ConnectionCreateResponse</a></code>
251+
252+
### Accounts
253+
254+
Types:
255+
256+
```python
257+
from finch.types.sandbox.connections import AccountCreateResponse, AccountUpdateResponse
258+
```
259+
260+
Methods:
261+
262+
- <code title="post /sandbox/connections/accounts">client.sandbox.connections.accounts.<a href="./src/finch/resources/sandbox/connections/accounts.py">create</a>(\*\*<a href="src/finch/types/sandbox/connections/account_create_params.py">params</a>) -> <a href="./src/finch/types/sandbox/connections/account_create_response.py">AccountCreateResponse</a></code>
263+
- <code title="put /sandbox/connections/accounts">client.sandbox.connections.accounts.<a href="./src/finch/resources/sandbox/connections/accounts.py">update</a>(\*\*<a href="src/finch/types/sandbox/connections/account_update_params.py">params</a>) -> <a href="./src/finch/types/sandbox/connections/account_update_response.py">AccountUpdateResponse</a></code>
264+
265+
## Company
266+
267+
Types:
268+
269+
```python
270+
from finch.types.sandbox import CompanyUpdateResponse
271+
```
272+
273+
Methods:
274+
275+
- <code title="put /sandbox/company">client.sandbox.company.<a href="./src/finch/resources/sandbox/company.py">update</a>(\*\*<a href="src/finch/types/sandbox/company_update_params.py">params</a>) -> <a href="./src/finch/types/sandbox/company_update_response.py">CompanyUpdateResponse</a></code>
276+
277+
## Directory
278+
279+
Types:
280+
281+
```python
282+
from finch.types.sandbox import DirectoryCreateResponse
283+
```
284+
285+
Methods:
286+
287+
- <code title="post /sandbox/directory">client.sandbox.directory.<a href="./src/finch/resources/sandbox/directory.py">create</a>(\*\*<a href="src/finch/types/sandbox/directory_create_params.py">params</a>) -> <a href="./src/finch/types/sandbox/directory_create_response.py">DirectoryCreateResponse</a></code>
288+
289+
## Individual
290+
291+
Types:
292+
293+
```python
294+
from finch.types.sandbox import IndividualUpdateResponse
295+
```
296+
297+
Methods:
298+
299+
- <code title="put /sandbox/individual/{individual_id}">client.sandbox.individual.<a href="./src/finch/resources/sandbox/individual.py">update</a>(individual_id, \*\*<a href="src/finch/types/sandbox/individual_update_params.py">params</a>) -> <a href="./src/finch/types/sandbox/individual_update_response.py">IndividualUpdateResponse</a></code>
300+
301+
## Employment
302+
303+
Types:
304+
305+
```python
306+
from finch.types.sandbox import EmploymentUpdateResponse
307+
```
308+
309+
Methods:
310+
311+
- <code title="put /sandbox/employment/{individual_id}">client.sandbox.employment.<a href="./src/finch/resources/sandbox/employment.py">update</a>(individual_id, \*\*<a href="src/finch/types/sandbox/employment_update_params.py">params</a>) -> <a href="./src/finch/types/sandbox/employment_update_response.py">EmploymentUpdateResponse</a></code>
312+
313+
## Payment
314+
315+
Types:
316+
317+
```python
318+
from finch.types.sandbox import PaymentCreateResponse
319+
```
320+
321+
Methods:
322+
323+
- <code title="post /sandbox/payment">client.sandbox.payment.<a href="./src/finch/resources/sandbox/payment.py">create</a>(\*\*<a href="src/finch/types/sandbox/payment_create_params.py">params</a>) -> <a href="./src/finch/types/sandbox/payment_create_response.py">PaymentCreateResponse</a></code>
324+
325+
## Jobs
326+
327+
### Configuration
328+
329+
Types:
330+
331+
```python
332+
from finch.types.sandbox.jobs import SandboxJobConfiguration, ConfigurationRetrieveResponse
333+
```
334+
335+
Methods:
336+
337+
- <code title="get /sandbox/jobs/configuration">client.sandbox.jobs.configuration.<a href="./src/finch/resources/sandbox/jobs/configuration.py">retrieve</a>() -> <a href="./src/finch/types/sandbox/jobs/configuration_retrieve_response.py">ConfigurationRetrieveResponse</a></code>
338+
- <code title="put /sandbox/jobs/configuration">client.sandbox.jobs.configuration.<a href="./src/finch/resources/sandbox/jobs/configuration.py">update</a>(\*\*<a href="src/finch/types/sandbox/jobs/configuration_update_params.py">params</a>) -> <a href="./src/finch/types/sandbox/jobs/sandbox_job_configuration.py">SandboxJobConfiguration</a></code>

src/finch/_client.py

+12
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Finch(SyncAPIClient):
5858
webhooks: resources.Webhooks
5959
request_forwarding: resources.RequestForwarding
6060
jobs: resources.Jobs
61+
auth: resources.Auth
62+
sandbox: resources.Sandbox
6163
with_raw_response: FinchWithRawResponse
6264

6365
# client options
@@ -143,6 +145,8 @@ def __init__(
143145
self.webhooks = resources.Webhooks(self)
144146
self.request_forwarding = resources.RequestForwarding(self)
145147
self.jobs = resources.Jobs(self)
148+
self.auth = resources.Auth(self)
149+
self.sandbox = resources.Sandbox(self)
146150
self.with_raw_response = FinchWithRawResponse(self)
147151

148152
@property
@@ -365,6 +369,8 @@ class AsyncFinch(AsyncAPIClient):
365369
webhooks: resources.AsyncWebhooks
366370
request_forwarding: resources.AsyncRequestForwarding
367371
jobs: resources.AsyncJobs
372+
auth: resources.AsyncAuth
373+
sandbox: resources.AsyncSandbox
368374
with_raw_response: AsyncFinchWithRawResponse
369375

370376
# client options
@@ -450,6 +456,8 @@ def __init__(
450456
self.webhooks = resources.AsyncWebhooks(self)
451457
self.request_forwarding = resources.AsyncRequestForwarding(self)
452458
self.jobs = resources.AsyncJobs(self)
459+
self.auth = resources.AsyncAuth(self)
460+
self.sandbox = resources.AsyncSandbox(self)
453461
self.with_raw_response = AsyncFinchWithRawResponse(self)
454462

455463
@property
@@ -672,6 +680,8 @@ def __init__(self, client: Finch) -> None:
672680
self.account = resources.AccountWithRawResponse(client.account)
673681
self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding)
674682
self.jobs = resources.JobsWithRawResponse(client.jobs)
683+
self.auth = resources.AuthWithRawResponse(client.auth)
684+
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)
675685

676686

677687
class AsyncFinchWithRawResponse:
@@ -682,6 +692,8 @@ def __init__(self, client: AsyncFinch) -> None:
682692
self.account = resources.AsyncAccountWithRawResponse(client.account)
683693
self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
684694
self.jobs = resources.AsyncJobsWithRawResponse(client.jobs)
695+
self.auth = resources.AsyncAuthWithRawResponse(client.auth)
696+
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)
685697

686698

687699
Client = Finch

src/finch/resources/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless.
22

3+
from .auth import Auth, AsyncAuth, AuthWithRawResponse, AsyncAuthWithRawResponse
34
from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse
45
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
56
from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse
7+
from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse
68
from .webhooks import Webhooks, AsyncWebhooks
79
from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse
810
from .access_tokens import (
@@ -45,4 +47,12 @@
4547
"AsyncJobs",
4648
"JobsWithRawResponse",
4749
"AsyncJobsWithRawResponse",
50+
"Auth",
51+
"AsyncAuth",
52+
"AuthWithRawResponse",
53+
"AsyncAuthWithRawResponse",
54+
"Sandbox",
55+
"AsyncSandbox",
56+
"SandboxWithRawResponse",
57+
"AsyncSandboxWithRawResponse",
4858
]

src/finch/resources/auth.py

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# File generated from our OpenAPI spec by Stainless.
2+
3+
from __future__ import annotations
4+
5+
import httpx
6+
7+
from ..types import CreateAccessTokenResponse, auth_create_token_params
8+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from .._utils import maybe_transform
10+
from .._compat import cached_property
11+
from .._resource import SyncAPIResource, AsyncAPIResource
12+
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
13+
from .._base_client import (
14+
make_request_options,
15+
)
16+
17+
__all__ = ["Auth", "AsyncAuth"]
18+
19+
20+
class Auth(SyncAPIResource):
21+
@cached_property
22+
def with_raw_response(self) -> AuthWithRawResponse:
23+
return AuthWithRawResponse(self)
24+
25+
def create_token(
26+
self,
27+
*,
28+
client_id: str,
29+
client_secret: str,
30+
code: str,
31+
redirect_uri: str,
32+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
33+
# The extra values given here take precedence over values defined on the client or passed to this method.
34+
extra_headers: Headers | None = None,
35+
extra_query: Query | None = None,
36+
extra_body: Body | None = None,
37+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
38+
) -> CreateAccessTokenResponse:
39+
"""
40+
Exchange the authorization code for an access token
41+
42+
Args:
43+
extra_headers: Send extra headers
44+
45+
extra_query: Add additional query parameters to the request
46+
47+
extra_body: Add additional JSON properties to the request
48+
49+
timeout: Override the client-level default timeout for this request, in seconds
50+
"""
51+
return self._post(
52+
"/auth/token",
53+
body=maybe_transform(
54+
{
55+
"client_id": client_id,
56+
"client_secret": client_secret,
57+
"code": code,
58+
"redirect_uri": redirect_uri,
59+
},
60+
auth_create_token_params.AuthCreateTokenParams,
61+
),
62+
options=make_request_options(
63+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
64+
),
65+
cast_to=CreateAccessTokenResponse,
66+
)
67+
68+
69+
class AsyncAuth(AsyncAPIResource):
70+
@cached_property
71+
def with_raw_response(self) -> AsyncAuthWithRawResponse:
72+
return AsyncAuthWithRawResponse(self)
73+
74+
async def create_token(
75+
self,
76+
*,
77+
client_id: str,
78+
client_secret: str,
79+
code: str,
80+
redirect_uri: str,
81+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
82+
# The extra values given here take precedence over values defined on the client or passed to this method.
83+
extra_headers: Headers | None = None,
84+
extra_query: Query | None = None,
85+
extra_body: Body | None = None,
86+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
87+
) -> CreateAccessTokenResponse:
88+
"""
89+
Exchange the authorization code for an access token
90+
91+
Args:
92+
extra_headers: Send extra headers
93+
94+
extra_query: Add additional query parameters to the request
95+
96+
extra_body: Add additional JSON properties to the request
97+
98+
timeout: Override the client-level default timeout for this request, in seconds
99+
"""
100+
return await self._post(
101+
"/auth/token",
102+
body=maybe_transform(
103+
{
104+
"client_id": client_id,
105+
"client_secret": client_secret,
106+
"code": code,
107+
"redirect_uri": redirect_uri,
108+
},
109+
auth_create_token_params.AuthCreateTokenParams,
110+
),
111+
options=make_request_options(
112+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
113+
),
114+
cast_to=CreateAccessTokenResponse,
115+
)
116+
117+
118+
class AuthWithRawResponse:
119+
def __init__(self, auth: Auth) -> None:
120+
self.create_token = to_raw_response_wrapper(
121+
auth.create_token,
122+
)
123+
124+
125+
class AsyncAuthWithRawResponse:
126+
def __init__(self, auth: AsyncAuth) -> None:
127+
self.create_token = async_to_raw_response_wrapper(
128+
auth.create_token,
129+
)
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# File generated from our OpenAPI spec by Stainless.
2+
3+
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
4+
from .company import Company, AsyncCompany, CompanyWithRawResponse, AsyncCompanyWithRawResponse
5+
from .payment import Payment, AsyncPayment, PaymentWithRawResponse, AsyncPaymentWithRawResponse
6+
from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse
7+
from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse
8+
from .employment import Employment, AsyncEmployment, EmploymentWithRawResponse, AsyncEmploymentWithRawResponse
9+
from .individual import Individual, AsyncIndividual, IndividualWithRawResponse, AsyncIndividualWithRawResponse
10+
from .connections import Connections, AsyncConnections, ConnectionsWithRawResponse, AsyncConnectionsWithRawResponse
11+
12+
__all__ = [
13+
"Connections",
14+
"AsyncConnections",
15+
"ConnectionsWithRawResponse",
16+
"AsyncConnectionsWithRawResponse",
17+
"Company",
18+
"AsyncCompany",
19+
"CompanyWithRawResponse",
20+
"AsyncCompanyWithRawResponse",
21+
"Directory",
22+
"AsyncDirectory",
23+
"DirectoryWithRawResponse",
24+
"AsyncDirectoryWithRawResponse",
25+
"Individual",
26+
"AsyncIndividual",
27+
"IndividualWithRawResponse",
28+
"AsyncIndividualWithRawResponse",
29+
"Employment",
30+
"AsyncEmployment",
31+
"EmploymentWithRawResponse",
32+
"AsyncEmploymentWithRawResponse",
33+
"Payment",
34+
"AsyncPayment",
35+
"PaymentWithRawResponse",
36+
"AsyncPaymentWithRawResponse",
37+
"Jobs",
38+
"AsyncJobs",
39+
"JobsWithRawResponse",
40+
"AsyncJobsWithRawResponse",
41+
"Sandbox",
42+
"AsyncSandbox",
43+
"SandboxWithRawResponse",
44+
"AsyncSandboxWithRawResponse",
45+
]

0 commit comments

Comments
 (0)