Skip to content

feat(api): updates #398

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
Jun 6, 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
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 35
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-69265939ed1aa33d9890c86a334730210985961db56757efc28ff43696fbd1a7.yml
configured_endpoints: 37
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-f1001da4ad3c1503330eebc1e61319a1a5db5e2da9fec98bc8682cb0967894d2.yml
15 changes: 15 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,18 @@ 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>

# Payroll

## PayGroups

Types:

```python
from finch.types.payroll import PayGroupRetrieveResponse, PayGroupListResponse
```

Methods:

- <code title="get /employer/pay-group/{pay_group_id}">client.payroll.pay_groups.<a href="./src/finch/resources/payroll/pay_groups.py">retrieve</a>(pay_group_id) -> <a href="./src/finch/types/payroll/pay_group_retrieve_response.py">PayGroupRetrieveResponse</a></code>
- <code title="get /employer/pay-groups">client.payroll.pay_groups.<a href="./src/finch/resources/payroll/pay_groups.py">list</a>(\*\*<a href="src/finch/types/payroll/pay_group_list_params.py">params</a>) -> <a href="./src/finch/types/payroll/pay_group_list_response.py">SyncSinglePage[PayGroupListResponse]</a></code>
8 changes: 8 additions & 0 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Finch(SyncAPIClient):
request_forwarding: resources.RequestForwarding
jobs: resources.Jobs
sandbox: resources.Sandbox
payroll: resources.Payroll
with_raw_response: FinchWithRawResponse
with_streaming_response: FinchWithStreamedResponse

Expand Down Expand Up @@ -161,6 +162,7 @@ def __init__(
self.request_forwarding = resources.RequestForwarding(self)
self.jobs = resources.Jobs(self)
self.sandbox = resources.Sandbox(self)
self.payroll = resources.Payroll(self)
self.with_raw_response = FinchWithRawResponse(self)
self.with_streaming_response = FinchWithStreamedResponse(self)

Expand Down Expand Up @@ -343,6 +345,7 @@ class AsyncFinch(AsyncAPIClient):
request_forwarding: resources.AsyncRequestForwarding
jobs: resources.AsyncJobs
sandbox: resources.AsyncSandbox
payroll: resources.AsyncPayroll
with_raw_response: AsyncFinchWithRawResponse
with_streaming_response: AsyncFinchWithStreamedResponse

Expand Down Expand Up @@ -445,6 +448,7 @@ def __init__(
self.request_forwarding = resources.AsyncRequestForwarding(self)
self.jobs = resources.AsyncJobs(self)
self.sandbox = resources.AsyncSandbox(self)
self.payroll = resources.AsyncPayroll(self)
self.with_raw_response = AsyncFinchWithRawResponse(self)
self.with_streaming_response = AsyncFinchWithStreamedResponse(self)

Expand Down Expand Up @@ -628,6 +632,7 @@ def __init__(self, client: Finch) -> None:
self.request_forwarding = resources.RequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.JobsWithRawResponse(client.jobs)
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)
self.payroll = resources.PayrollWithRawResponse(client.payroll)


class AsyncFinchWithRawResponse:
Expand All @@ -639,6 +644,7 @@ def __init__(self, client: AsyncFinch) -> None:
self.request_forwarding = resources.AsyncRequestForwardingWithRawResponse(client.request_forwarding)
self.jobs = resources.AsyncJobsWithRawResponse(client.jobs)
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)
self.payroll = resources.AsyncPayrollWithRawResponse(client.payroll)


class FinchWithStreamedResponse:
Expand All @@ -650,6 +656,7 @@ def __init__(self, client: Finch) -> None:
self.request_forwarding = resources.RequestForwardingWithStreamingResponse(client.request_forwarding)
self.jobs = resources.JobsWithStreamingResponse(client.jobs)
self.sandbox = resources.SandboxWithStreamingResponse(client.sandbox)
self.payroll = resources.PayrollWithStreamingResponse(client.payroll)


class AsyncFinchWithStreamedResponse:
Expand All @@ -661,6 +668,7 @@ def __init__(self, client: AsyncFinch) -> None:
self.request_forwarding = resources.AsyncRequestForwardingWithStreamingResponse(client.request_forwarding)
self.jobs = resources.AsyncJobsWithStreamingResponse(client.jobs)
self.sandbox = resources.AsyncSandboxWithStreamingResponse(client.sandbox)
self.payroll = resources.AsyncPayrollWithStreamingResponse(client.payroll)


Client = Finch
Expand Down
14 changes: 14 additions & 0 deletions src/finch/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
AccountWithStreamingResponse,
AsyncAccountWithStreamingResponse,
)
from .payroll import (
Payroll,
AsyncPayroll,
PayrollWithRawResponse,
AsyncPayrollWithRawResponse,
PayrollWithStreamingResponse,
AsyncPayrollWithStreamingResponse,
)
from .sandbox import (
Sandbox,
AsyncSandbox,
Expand Down Expand Up @@ -100,4 +108,10 @@
"AsyncSandboxWithRawResponse",
"SandboxWithStreamingResponse",
"AsyncSandboxWithStreamingResponse",
"Payroll",
"AsyncPayroll",
"PayrollWithRawResponse",
"AsyncPayrollWithRawResponse",
"PayrollWithStreamingResponse",
"AsyncPayrollWithStreamingResponse",
]
33 changes: 33 additions & 0 deletions src/finch/resources/payroll/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .payroll import (
Payroll,
AsyncPayroll,
PayrollWithRawResponse,
AsyncPayrollWithRawResponse,
PayrollWithStreamingResponse,
AsyncPayrollWithStreamingResponse,
)
from .pay_groups import (
PayGroups,
AsyncPayGroups,
PayGroupsWithRawResponse,
AsyncPayGroupsWithRawResponse,
PayGroupsWithStreamingResponse,
AsyncPayGroupsWithStreamingResponse,
)

__all__ = [
"PayGroups",
"AsyncPayGroups",
"PayGroupsWithRawResponse",
"AsyncPayGroupsWithRawResponse",
"PayGroupsWithStreamingResponse",
"AsyncPayGroupsWithStreamingResponse",
"Payroll",
"AsyncPayroll",
"PayrollWithRawResponse",
"AsyncPayrollWithRawResponse",
"PayrollWithStreamingResponse",
"AsyncPayrollWithStreamingResponse",
]
244 changes: 244 additions & 0 deletions src/finch/resources/payroll/pay_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List

import httpx

from ... import _legacy_response
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_streamed_response_wrapper, async_to_streamed_response_wrapper
from ...pagination import SyncSinglePage, AsyncSinglePage
from ..._base_client import (
AsyncPaginator,
make_request_options,
)
from ...types.payroll import pay_group_list_params
from ...types.payroll.pay_group_list_response import PayGroupListResponse
from ...types.payroll.pay_group_retrieve_response import PayGroupRetrieveResponse

__all__ = ["PayGroups", "AsyncPayGroups"]


class PayGroups(SyncAPIResource):
@cached_property
def with_raw_response(self) -> PayGroupsWithRawResponse:
return PayGroupsWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> PayGroupsWithStreamingResponse:
return PayGroupsWithStreamingResponse(self)

def retrieve(
self,
pay_group_id: 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,
) -> PayGroupRetrieveResponse:
"""
Read information from a single pay group

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
"""
if not pay_group_id:
raise ValueError(f"Expected a non-empty value for `pay_group_id` but received {pay_group_id!r}")
return self._get(
f"/employer/pay-group/{pay_group_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=PayGroupRetrieveResponse,
)

def list(
self,
*,
individual_id: str | NotGiven = NOT_GIVEN,
pay_frequencies: List[str] | NotGiven = NOT_GIVEN,
# 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,
) -> SyncSinglePage[PayGroupListResponse]:
"""
Read company pay groups and frequencies

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._get_api_list(
"/employer/pay-groups",
page=SyncSinglePage[PayGroupListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"individual_id": individual_id,
"pay_frequencies": pay_frequencies,
},
pay_group_list_params.PayGroupListParams,
),
),
model=PayGroupListResponse,
)


class AsyncPayGroups(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncPayGroupsWithRawResponse:
return AsyncPayGroupsWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncPayGroupsWithStreamingResponse:
return AsyncPayGroupsWithStreamingResponse(self)

async def retrieve(
self,
pay_group_id: 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,
) -> PayGroupRetrieveResponse:
"""
Read information from a single pay group

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
"""
if not pay_group_id:
raise ValueError(f"Expected a non-empty value for `pay_group_id` but received {pay_group_id!r}")
return await self._get(
f"/employer/pay-group/{pay_group_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=PayGroupRetrieveResponse,
)

def list(
self,
*,
individual_id: str | NotGiven = NOT_GIVEN,
pay_frequencies: List[str] | NotGiven = NOT_GIVEN,
# 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,
) -> AsyncPaginator[PayGroupListResponse, AsyncSinglePage[PayGroupListResponse]]:
"""
Read company pay groups and frequencies

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._get_api_list(
"/employer/pay-groups",
page=AsyncSinglePage[PayGroupListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"individual_id": individual_id,
"pay_frequencies": pay_frequencies,
},
pay_group_list_params.PayGroupListParams,
),
),
model=PayGroupListResponse,
)


class PayGroupsWithRawResponse:
def __init__(self, pay_groups: PayGroups) -> None:
self._pay_groups = pay_groups

self.retrieve = _legacy_response.to_raw_response_wrapper(
pay_groups.retrieve,
)
self.list = _legacy_response.to_raw_response_wrapper(
pay_groups.list,
)


class AsyncPayGroupsWithRawResponse:
def __init__(self, pay_groups: AsyncPayGroups) -> None:
self._pay_groups = pay_groups

self.retrieve = _legacy_response.async_to_raw_response_wrapper(
pay_groups.retrieve,
)
self.list = _legacy_response.async_to_raw_response_wrapper(
pay_groups.list,
)


class PayGroupsWithStreamingResponse:
def __init__(self, pay_groups: PayGroups) -> None:
self._pay_groups = pay_groups

self.retrieve = to_streamed_response_wrapper(
pay_groups.retrieve,
)
self.list = to_streamed_response_wrapper(
pay_groups.list,
)


class AsyncPayGroupsWithStreamingResponse:
def __init__(self, pay_groups: AsyncPayGroups) -> None:
self._pay_groups = pay_groups

self.retrieve = async_to_streamed_response_wrapper(
pay_groups.retrieve,
)
self.list = async_to_streamed_response_wrapper(
pay_groups.list,
)
Loading