Skip to content

Commit 3fbedde

Browse files
feat: remove redundant endpoint, add sandbox client options (not yet used) (#255)
1 parent e7f4e7d commit 3fbedde

File tree

7 files changed

+36
-235
lines changed

7 files changed

+36
-235
lines changed

api.md

-6
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,6 @@ Methods:
224224

225225
- <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>
226226

227-
# Auth
228-
229-
Methods:
230-
231-
- <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>
232-
233227
# Sandbox
234228

235229
## Connections

src/finch/_client.py

+36-6
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ class Finch(SyncAPIClient):
5858
webhooks: resources.Webhooks
5959
request_forwarding: resources.RequestForwarding
6060
jobs: resources.Jobs
61-
auth: resources.Auth
6261
sandbox: resources.Sandbox
6362
with_raw_response: FinchWithRawResponse
6463

6564
# client options
6665
access_token: str | None
6766
client_id: str | None
6867
client_secret: str | None
68+
sandbox_client_id: str | None
69+
sandbox_client_secret: str | None
6970
webhook_secret: str | None
7071

7172
def __init__(
@@ -74,6 +75,8 @@ def __init__(
7475
access_token: str | None = None,
7576
client_id: str | None = None,
7677
client_secret: str | None = None,
78+
sandbox_client_id: str | None = None,
79+
sandbox_client_secret: str | None = None,
7780
webhook_secret: str | None = None,
7881
base_url: str | httpx.URL | None = None,
7982
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -103,6 +106,8 @@ def __init__(
103106
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
104107
- `client_id` from `FINCH_CLIENT_ID`
105108
- `client_secret` from `FINCH_CLIENT_SECRET`
109+
- `sandbox_client_id` from `FINCH_SANDBOX_CLIENT_ID`
110+
- `sandbox_client_secret` from `FINCH_SANDBOX_CLIENT_SECRET`
106111
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
107112
"""
108113
self.access_token = access_token
@@ -115,6 +120,14 @@ def __init__(
115120
client_secret = os.environ.get("FINCH_CLIENT_SECRET")
116121
self.client_secret = client_secret
117122

123+
if sandbox_client_id is None:
124+
sandbox_client_id = os.environ.get("FINCH_SANDBOX_CLIENT_ID")
125+
self.sandbox_client_id = sandbox_client_id
126+
127+
if sandbox_client_secret is None:
128+
sandbox_client_secret = os.environ.get("FINCH_SANDBOX_CLIENT_SECRET")
129+
self.sandbox_client_secret = sandbox_client_secret
130+
118131
if webhook_secret is None:
119132
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET")
120133
self.webhook_secret = webhook_secret
@@ -145,7 +158,6 @@ def __init__(
145158
self.webhooks = resources.Webhooks(self)
146159
self.request_forwarding = resources.RequestForwarding(self)
147160
self.jobs = resources.Jobs(self)
148-
self.auth = resources.Auth(self)
149161
self.sandbox = resources.Sandbox(self)
150162
self.with_raw_response = FinchWithRawResponse(self)
151163

@@ -189,6 +201,8 @@ def copy(
189201
access_token: str | None = None,
190202
client_id: str | None = None,
191203
client_secret: str | None = None,
204+
sandbox_client_id: str | None = None,
205+
sandbox_client_secret: str | None = None,
192206
webhook_secret: str | None = None,
193207
base_url: str | httpx.URL | None = None,
194208
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -244,6 +258,8 @@ def copy(
244258
access_token=access_token or self.access_token,
245259
client_id=client_id or self.client_id,
246260
client_secret=client_secret or self.client_secret,
261+
sandbox_client_id=sandbox_client_id or self.sandbox_client_id,
262+
sandbox_client_secret=sandbox_client_secret or self.sandbox_client_secret,
247263
webhook_secret=webhook_secret or self.webhook_secret,
248264
base_url=base_url or self.base_url,
249265
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -369,14 +385,15 @@ class AsyncFinch(AsyncAPIClient):
369385
webhooks: resources.AsyncWebhooks
370386
request_forwarding: resources.AsyncRequestForwarding
371387
jobs: resources.AsyncJobs
372-
auth: resources.AsyncAuth
373388
sandbox: resources.AsyncSandbox
374389
with_raw_response: AsyncFinchWithRawResponse
375390

376391
# client options
377392
access_token: str | None
378393
client_id: str | None
379394
client_secret: str | None
395+
sandbox_client_id: str | None
396+
sandbox_client_secret: str | None
380397
webhook_secret: str | None
381398

382399
def __init__(
@@ -385,6 +402,8 @@ def __init__(
385402
access_token: str | None = None,
386403
client_id: str | None = None,
387404
client_secret: str | None = None,
405+
sandbox_client_id: str | None = None,
406+
sandbox_client_secret: str | None = None,
388407
webhook_secret: str | None = None,
389408
base_url: str | httpx.URL | None = None,
390409
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
@@ -414,6 +433,8 @@ def __init__(
414433
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
415434
- `client_id` from `FINCH_CLIENT_ID`
416435
- `client_secret` from `FINCH_CLIENT_SECRET`
436+
- `sandbox_client_id` from `FINCH_SANDBOX_CLIENT_ID`
437+
- `sandbox_client_secret` from `FINCH_SANDBOX_CLIENT_SECRET`
417438
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
418439
"""
419440
self.access_token = access_token
@@ -426,6 +447,14 @@ def __init__(
426447
client_secret = os.environ.get("FINCH_CLIENT_SECRET")
427448
self.client_secret = client_secret
428449

450+
if sandbox_client_id is None:
451+
sandbox_client_id = os.environ.get("FINCH_SANDBOX_CLIENT_ID")
452+
self.sandbox_client_id = sandbox_client_id
453+
454+
if sandbox_client_secret is None:
455+
sandbox_client_secret = os.environ.get("FINCH_SANDBOX_CLIENT_SECRET")
456+
self.sandbox_client_secret = sandbox_client_secret
457+
429458
if webhook_secret is None:
430459
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET")
431460
self.webhook_secret = webhook_secret
@@ -456,7 +485,6 @@ def __init__(
456485
self.webhooks = resources.AsyncWebhooks(self)
457486
self.request_forwarding = resources.AsyncRequestForwarding(self)
458487
self.jobs = resources.AsyncJobs(self)
459-
self.auth = resources.AsyncAuth(self)
460488
self.sandbox = resources.AsyncSandbox(self)
461489
self.with_raw_response = AsyncFinchWithRawResponse(self)
462490

@@ -500,6 +528,8 @@ def copy(
500528
access_token: str | None = None,
501529
client_id: str | None = None,
502530
client_secret: str | None = None,
531+
sandbox_client_id: str | None = None,
532+
sandbox_client_secret: str | None = None,
503533
webhook_secret: str | None = None,
504534
base_url: str | httpx.URL | None = None,
505535
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
@@ -555,6 +585,8 @@ def copy(
555585
access_token=access_token or self.access_token,
556586
client_id=client_id or self.client_id,
557587
client_secret=client_secret or self.client_secret,
588+
sandbox_client_id=sandbox_client_id or self.sandbox_client_id,
589+
sandbox_client_secret=sandbox_client_secret or self.sandbox_client_secret,
558590
webhook_secret=webhook_secret or self.webhook_secret,
559591
base_url=base_url or self.base_url,
560592
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
@@ -680,7 +712,6 @@ def __init__(self, client: Finch) -> None:
680712
self.account = resources.AccountWithRawResponse(client.account)
681713
self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding)
682714
self.jobs = resources.JobsWithRawResponse(client.jobs)
683-
self.auth = resources.AuthWithRawResponse(client.auth)
684715
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)
685716

686717

@@ -692,7 +723,6 @@ def __init__(self, client: AsyncFinch) -> None:
692723
self.account = resources.AsyncAccountWithRawResponse(client.account)
693724
self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
694725
self.jobs = resources.AsyncJobsWithRawResponse(client.jobs)
695-
self.auth = resources.AsyncAuthWithRawResponse(client.auth)
696726
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)
697727

698728

src/finch/resources/__init__.py

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

3-
from .auth import Auth, AsyncAuth, AuthWithRawResponse, AsyncAuthWithRawResponse
43
from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse
54
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
65
from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse
@@ -47,10 +46,6 @@
4746
"AsyncJobs",
4847
"JobsWithRawResponse",
4948
"AsyncJobsWithRawResponse",
50-
"Auth",
51-
"AsyncAuth",
52-
"AuthWithRawResponse",
53-
"AsyncAuthWithRawResponse",
5449
"Sandbox",
5550
"AsyncSandbox",
5651
"SandboxWithRawResponse",

src/finch/resources/auth.py

-129
This file was deleted.

src/finch/types/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .introspection import Introspection as Introspection
1818
from .location_param import LocationParam as LocationParam
1919
from .disconnect_response import DisconnectResponse as DisconnectResponse
20-
from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams
2120
from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams
2221
from .create_access_token_response import CreateAccessTokenResponse as CreateAccessTokenResponse
2322
from .request_forwarding_forward_params import RequestForwardingForwardParams as RequestForwardingForwardParams

src/finch/types/auth_create_token_params.py

-17
This file was deleted.

0 commit comments

Comments
 (0)