Skip to content

feat(api): add sandbox APIs #251

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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 24
configured_endpoints: 34
115 changes: 114 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Shared Types

```python
from finch.types import OperationSupport, OperationSupportMatrix, Paging
from finch.types import (
IntrospectResponseConnectionStatus,
OperationSupport,
OperationSupportMatrix,
Paging,
)
```

# Finch
Expand Down Expand Up @@ -223,3 +228,111 @@ from finch.types.jobs import ManualAsyncJob
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

Types:

```python
from finch.types.sandbox import ConnectionCreateResponse
```

Methods:

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

### Accounts

Types:

```python
from finch.types.sandbox.connections import AccountCreateResponse, AccountUpdateResponse
```

Methods:

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

## Company

Types:

```python
from finch.types.sandbox import CompanyUpdateResponse
```

Methods:

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

## Directory

Types:

```python
from finch.types.sandbox import DirectoryCreateResponse
```

Methods:

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

## Individual

Types:

```python
from finch.types.sandbox import IndividualUpdateResponse
```

Methods:

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

## Employment

Types:

```python
from finch.types.sandbox import EmploymentUpdateResponse
```

Methods:

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

## Payment

Types:

```python
from finch.types.sandbox import PaymentCreateResponse
```

Methods:

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

## Jobs

### Configuration

Types:

```python
from finch.types.sandbox.jobs import SandboxJobConfiguration, ConfigurationRetrieveResponse
```

Methods:

- <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>
- <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>
12 changes: 12 additions & 0 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ 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
Expand Down Expand Up @@ -143,6 +145,8 @@ 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)

@property
Expand Down Expand Up @@ -365,6 +369,8 @@ 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
Expand Down Expand Up @@ -450,6 +456,8 @@ 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)

@property
Expand Down Expand Up @@ -672,6 +680,8 @@ 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)


class AsyncFinchWithRawResponse:
Expand All @@ -682,6 +692,8 @@ 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)


Client = Finch
Expand Down
10 changes: 10 additions & 0 deletions src/finch/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# 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
from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse
from .webhooks import Webhooks, AsyncWebhooks
from .providers import Providers, AsyncProviders, ProvidersWithRawResponse, AsyncProvidersWithRawResponse
from .access_tokens import (
Expand Down Expand Up @@ -45,4 +47,12 @@
"AsyncJobs",
"JobsWithRawResponse",
"AsyncJobsWithRawResponse",
"Auth",
"AsyncAuth",
"AuthWithRawResponse",
"AsyncAuthWithRawResponse",
"Sandbox",
"AsyncSandbox",
"SandboxWithRawResponse",
"AsyncSandboxWithRawResponse",
]
129 changes: 129 additions & 0 deletions src/finch/resources/auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# File generated from our OpenAPI spec by Stainless.

from __future__ import annotations

import httpx

from ..types import CreateAccessTokenResponse, auth_create_token_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)

__all__ = ["Auth", "AsyncAuth"]


class Auth(SyncAPIResource):
@cached_property
def with_raw_response(self) -> AuthWithRawResponse:
return AuthWithRawResponse(self)

def create_token(
self,
*,
client_id: str,
client_secret: str,
code: str,
redirect_uri: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateAccessTokenResponse:
"""
Exchange the authorization code for an access token

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/auth/token",
body=maybe_transform(
{
"client_id": client_id,
"client_secret": client_secret,
"code": code,
"redirect_uri": redirect_uri,
},
auth_create_token_params.AuthCreateTokenParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CreateAccessTokenResponse,
)


class AsyncAuth(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncAuthWithRawResponse:
return AsyncAuthWithRawResponse(self)

async def create_token(
self,
*,
client_id: str,
client_secret: str,
code: str,
redirect_uri: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CreateAccessTokenResponse:
"""
Exchange the authorization code for an access token

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/auth/token",
body=maybe_transform(
{
"client_id": client_id,
"client_secret": client_secret,
"code": code,
"redirect_uri": redirect_uri,
},
auth_create_token_params.AuthCreateTokenParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CreateAccessTokenResponse,
)


class AuthWithRawResponse:
def __init__(self, auth: Auth) -> None:
self.create_token = to_raw_response_wrapper(
auth.create_token,
)


class AsyncAuthWithRawResponse:
def __init__(self, auth: AsyncAuth) -> None:
self.create_token = async_to_raw_response_wrapper(
auth.create_token,
)
45 changes: 45 additions & 0 deletions src/finch/resources/sandbox/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# File generated from our OpenAPI spec by Stainless.

from .jobs import Jobs, AsyncJobs, JobsWithRawResponse, AsyncJobsWithRawResponse
from .company import Company, AsyncCompany, CompanyWithRawResponse, AsyncCompanyWithRawResponse
from .payment import Payment, AsyncPayment, PaymentWithRawResponse, AsyncPaymentWithRawResponse
from .sandbox import Sandbox, AsyncSandbox, SandboxWithRawResponse, AsyncSandboxWithRawResponse
from .directory import Directory, AsyncDirectory, DirectoryWithRawResponse, AsyncDirectoryWithRawResponse
from .employment import Employment, AsyncEmployment, EmploymentWithRawResponse, AsyncEmploymentWithRawResponse
from .individual import Individual, AsyncIndividual, IndividualWithRawResponse, AsyncIndividualWithRawResponse
from .connections import Connections, AsyncConnections, ConnectionsWithRawResponse, AsyncConnectionsWithRawResponse

__all__ = [
"Connections",
"AsyncConnections",
"ConnectionsWithRawResponse",
"AsyncConnectionsWithRawResponse",
"Company",
"AsyncCompany",
"CompanyWithRawResponse",
"AsyncCompanyWithRawResponse",
"Directory",
"AsyncDirectory",
"DirectoryWithRawResponse",
"AsyncDirectoryWithRawResponse",
"Individual",
"AsyncIndividual",
"IndividualWithRawResponse",
"AsyncIndividualWithRawResponse",
"Employment",
"AsyncEmployment",
"EmploymentWithRawResponse",
"AsyncEmploymentWithRawResponse",
"Payment",
"AsyncPayment",
"PaymentWithRawResponse",
"AsyncPaymentWithRawResponse",
"Jobs",
"AsyncJobs",
"JobsWithRawResponse",
"AsyncJobsWithRawResponse",
"Sandbox",
"AsyncSandbox",
"SandboxWithRawResponse",
"AsyncSandboxWithRawResponse",
]
Loading