Skip to content

feat(api): api update #584

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 31, 2025
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,2 +1,2 @@
configured_endpoints: 41
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-9c0b41ca8713a9440c624b0d08de0e6cbd9486978188afab2286ae67d8a97817.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-33c66e078bce0755ba6ffea89b65cd065f406dae750be8a23dd0315b736f1c9f.yml
20 changes: 8 additions & 12 deletions src/finch/resources/jobs/automated.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def create(
def create(
self,
*,
individual_id: str,
params: automated_create_params.W4FormEmployeeSyncParams,
type: Literal["w4_form_employee_sync"],
# 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.
Expand All @@ -116,8 +116,6 @@ def create(
access to this endpoint, please contact your Finch account manager.

Args:
individual_id: The unique ID of the individual for W-4 data sync.

type: The type of job to start.

extra_headers: Send extra headers
Expand All @@ -130,12 +128,12 @@ def create(
"""
...

@required_args(["type"], ["individual_id", "type"])
@required_args(["type"], ["params", "type"])
def create(
self,
*,
type: Literal["data_sync_all"] | Literal["w4_form_employee_sync"],
individual_id: str | NotGiven = NOT_GIVEN,
params: automated_create_params.W4FormEmployeeSyncParams | 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,
Expand All @@ -148,7 +146,7 @@ def create(
body=maybe_transform(
{
"type": type,
"individual_id": individual_id,
"params": params,
},
automated_create_params.AutomatedCreateParams,
),
Expand Down Expand Up @@ -307,7 +305,7 @@ async def create(
async def create(
self,
*,
individual_id: str,
params: automated_create_params.W4FormEmployeeSyncParams,
type: Literal["w4_form_employee_sync"],
# 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.
Expand All @@ -333,8 +331,6 @@ async def create(
access to this endpoint, please contact your Finch account manager.

Args:
individual_id: The unique ID of the individual for W-4 data sync.

type: The type of job to start.

extra_headers: Send extra headers
Expand All @@ -347,12 +343,12 @@ async def create(
"""
...

@required_args(["type"], ["individual_id", "type"])
@required_args(["type"], ["params", "type"])
async def create(
self,
*,
type: Literal["data_sync_all"] | Literal["w4_form_employee_sync"],
individual_id: str | NotGiven = NOT_GIVEN,
params: automated_create_params.W4FormEmployeeSyncParams | 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,
Expand All @@ -365,7 +361,7 @@ async def create(
body=await async_maybe_transform(
{
"type": type,
"individual_id": individual_id,
"params": params,
},
automated_create_params.AutomatedCreateParams,
),
Expand Down
10 changes: 7 additions & 3 deletions src/finch/types/jobs/automated_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Union
from typing_extensions import Literal, Required, TypeAlias, TypedDict

__all__ = ["AutomatedCreateParams", "DataSyncAll", "W4FormEmployeeSync"]
__all__ = ["AutomatedCreateParams", "DataSyncAll", "W4FormEmployeeSync", "W4FormEmployeeSyncParams"]


class DataSyncAll(TypedDict, total=False):
Expand All @@ -14,11 +14,15 @@ class DataSyncAll(TypedDict, total=False):


class W4FormEmployeeSync(TypedDict, total=False):
individual_id: Required[str]
"""The unique ID of the individual for W-4 data sync."""
params: Required[W4FormEmployeeSyncParams]

type: Required[Literal["w4_form_employee_sync"]]
"""The type of job to start."""


class W4FormEmployeeSyncParams(TypedDict, total=False):
individual_id: Required[str]
"""The unique ID of the individual for W-4 data sync."""


AutomatedCreateParams: TypeAlias = Union[DataSyncAll, W4FormEmployeeSync]
12 changes: 6 additions & 6 deletions tests/api_resources/jobs/test_automated.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ def test_streaming_response_create_overload_1(self, client: Finch) -> None:
@parametrize
def test_method_create_overload_2(self, client: Finch) -> None:
automated = client.jobs.automated.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
)
assert_matches_type(AutomatedCreateResponse, automated, path=["response"])

@parametrize
def test_raw_response_create_overload_2(self, client: Finch) -> None:
response = client.jobs.automated.with_raw_response.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
)

Expand All @@ -72,7 +72,7 @@ def test_raw_response_create_overload_2(self, client: Finch) -> None:
@parametrize
def test_streaming_response_create_overload_2(self, client: Finch) -> None:
with client.jobs.automated.with_streaming_response.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
) as response:
assert not response.is_closed
Expand Down Expand Up @@ -192,15 +192,15 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncFin
@parametrize
async def test_method_create_overload_2(self, async_client: AsyncFinch) -> None:
automated = await async_client.jobs.automated.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
)
assert_matches_type(AutomatedCreateResponse, automated, path=["response"])

@parametrize
async def test_raw_response_create_overload_2(self, async_client: AsyncFinch) -> None:
response = await async_client.jobs.automated.with_raw_response.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
)

Expand All @@ -212,7 +212,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncFinch) ->
@parametrize
async def test_streaming_response_create_overload_2(self, async_client: AsyncFinch) -> None:
async with async_client.jobs.automated.with_streaming_response.create(
individual_id="individual_id",
params={"individual_id": "individual_id"},
type="w4_form_employee_sync",
) as response:
assert not response.is_closed
Expand Down