Skip to content

feat: remove redundant endpoint, add sandbox client options (not yet used) #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,6 @@ Methods:

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

# Auth

Methods:

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

# Sandbox

## Connections
Expand Down
42 changes: 36 additions & 6 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ class Finch(SyncAPIClient):
webhooks: resources.Webhooks
request_forwarding: resources.RequestForwarding
jobs: resources.Jobs
auth: resources.Auth
sandbox: resources.Sandbox
with_raw_response: FinchWithRawResponse

# client options
access_token: str | None
client_id: str | None
client_secret: str | None
sandbox_client_id: str | None
sandbox_client_secret: str | None
webhook_secret: str | None

def __init__(
Expand All @@ -74,6 +75,8 @@ def __init__(
access_token: str | None = None,
client_id: str | None = None,
client_secret: str | None = None,
sandbox_client_id: str | None = None,
sandbox_client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
Expand Down Expand Up @@ -103,6 +106,8 @@ def __init__(
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `client_id` from `FINCH_CLIENT_ID`
- `client_secret` from `FINCH_CLIENT_SECRET`
- `sandbox_client_id` from `FINCH_SANDBOX_CLIENT_ID`
- `sandbox_client_secret` from `FINCH_SANDBOX_CLIENT_SECRET`
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
"""
self.access_token = access_token
Expand All @@ -115,6 +120,14 @@ def __init__(
client_secret = os.environ.get("FINCH_CLIENT_SECRET")
self.client_secret = client_secret

if sandbox_client_id is None:
sandbox_client_id = os.environ.get("FINCH_SANDBOX_CLIENT_ID")
self.sandbox_client_id = sandbox_client_id

if sandbox_client_secret is None:
sandbox_client_secret = os.environ.get("FINCH_SANDBOX_CLIENT_SECRET")
self.sandbox_client_secret = sandbox_client_secret

if webhook_secret is None:
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET")
self.webhook_secret = webhook_secret
Expand Down Expand Up @@ -145,7 +158,6 @@ def __init__(
self.webhooks = resources.Webhooks(self)
self.request_forwarding = resources.RequestForwarding(self)
self.jobs = resources.Jobs(self)
self.auth = resources.Auth(self)
self.sandbox = resources.Sandbox(self)
self.with_raw_response = FinchWithRawResponse(self)

Expand Down Expand Up @@ -189,6 +201,8 @@ def copy(
access_token: str | None = None,
client_id: str | None = None,
client_secret: str | None = None,
sandbox_client_id: str | None = None,
sandbox_client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -244,6 +258,8 @@ def copy(
access_token=access_token or self.access_token,
client_id=client_id or self.client_id,
client_secret=client_secret or self.client_secret,
sandbox_client_id=sandbox_client_id or self.sandbox_client_id,
sandbox_client_secret=sandbox_client_secret or self.sandbox_client_secret,
webhook_secret=webhook_secret or self.webhook_secret,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand Down Expand Up @@ -369,14 +385,15 @@ class AsyncFinch(AsyncAPIClient):
webhooks: resources.AsyncWebhooks
request_forwarding: resources.AsyncRequestForwarding
jobs: resources.AsyncJobs
auth: resources.AsyncAuth
sandbox: resources.AsyncSandbox
with_raw_response: AsyncFinchWithRawResponse

# client options
access_token: str | None
client_id: str | None
client_secret: str | None
sandbox_client_id: str | None
sandbox_client_secret: str | None
webhook_secret: str | None

def __init__(
Expand All @@ -385,6 +402,8 @@ def __init__(
access_token: str | None = None,
client_id: str | None = None,
client_secret: str | None = None,
sandbox_client_id: str | None = None,
sandbox_client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
Expand Down Expand Up @@ -414,6 +433,8 @@ def __init__(
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `client_id` from `FINCH_CLIENT_ID`
- `client_secret` from `FINCH_CLIENT_SECRET`
- `sandbox_client_id` from `FINCH_SANDBOX_CLIENT_ID`
- `sandbox_client_secret` from `FINCH_SANDBOX_CLIENT_SECRET`
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
"""
self.access_token = access_token
Expand All @@ -426,6 +447,14 @@ def __init__(
client_secret = os.environ.get("FINCH_CLIENT_SECRET")
self.client_secret = client_secret

if sandbox_client_id is None:
sandbox_client_id = os.environ.get("FINCH_SANDBOX_CLIENT_ID")
self.sandbox_client_id = sandbox_client_id

if sandbox_client_secret is None:
sandbox_client_secret = os.environ.get("FINCH_SANDBOX_CLIENT_SECRET")
self.sandbox_client_secret = sandbox_client_secret

if webhook_secret is None:
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET")
self.webhook_secret = webhook_secret
Expand Down Expand Up @@ -456,7 +485,6 @@ def __init__(
self.webhooks = resources.AsyncWebhooks(self)
self.request_forwarding = resources.AsyncRequestForwarding(self)
self.jobs = resources.AsyncJobs(self)
self.auth = resources.AsyncAuth(self)
self.sandbox = resources.AsyncSandbox(self)
self.with_raw_response = AsyncFinchWithRawResponse(self)

Expand Down Expand Up @@ -500,6 +528,8 @@ def copy(
access_token: str | None = None,
client_id: str | None = None,
client_secret: str | None = None,
sandbox_client_id: str | None = None,
sandbox_client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -555,6 +585,8 @@ def copy(
access_token=access_token or self.access_token,
client_id=client_id or self.client_id,
client_secret=client_secret or self.client_secret,
sandbox_client_id=sandbox_client_id or self.sandbox_client_id,
sandbox_client_secret=sandbox_client_secret or self.sandbox_client_secret,
webhook_secret=webhook_secret or self.webhook_secret,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand Down Expand Up @@ -680,7 +712,6 @@ def __init__(self, client: Finch) -> None:
self.account = resources.AccountWithRawResponse(client.account)
self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.JobsWithRawResponse(client.jobs)
self.auth = resources.AuthWithRawResponse(client.auth)
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)


Expand All @@ -692,7 +723,6 @@ def __init__(self, client: AsyncFinch) -> None:
self.account = resources.AsyncAccountWithRawResponse(client.account)
self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.AsyncJobsWithRawResponse(client.jobs)
self.auth = resources.AsyncAuthWithRawResponse(client.auth)
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)


Expand Down
5 changes: 0 additions & 5 deletions src/finch/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# File generated from our OpenAPI spec by Stainless.

from .auth import Auth, AsyncAuth, AuthWithRawResponse, AsyncAuthWithRawResponse
from .hris import HRIS, AsyncHRIS, HRISWithRawResponse, AsyncHRISWithRawResponse
from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
from .account import Account, AsyncAccount, AccountWithRawResponse, AsyncAccountWithRawResponse
Expand Down Expand Up @@ -47,10 +46,6 @@
"AsyncJobs",
"JobsWithRawResponse",
"AsyncJobsWithRawResponse",
"Auth",
"AsyncAuth",
"AuthWithRawResponse",
"AsyncAuthWithRawResponse",
"Sandbox",
"AsyncSandbox",
"SandboxWithRawResponse",
Expand Down
129 changes: 0 additions & 129 deletions src/finch/resources/auth.py

This file was deleted.

1 change: 0 additions & 1 deletion src/finch/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .introspection import Introspection as Introspection
from .location_param import LocationParam as LocationParam
from .disconnect_response import DisconnectResponse as DisconnectResponse
from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams
from .access_token_create_params import AccessTokenCreateParams as AccessTokenCreateParams
from .create_access_token_response import CreateAccessTokenResponse as CreateAccessTokenResponse
from .request_forwarding_forward_params import RequestForwardingForwardParams as RequestForwardingForwardParams
Expand Down
17 changes: 0 additions & 17 deletions src/finch/types/auth_create_token_params.py

This file was deleted.

Loading