Skip to content

chore(internal): codegen related update #617

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
Mar 11, 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-777eedfd80c3e04a8739959418783d1c976180f4f09d7a883f7de5c2b6cda5a6.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f1779210fbedfc6099076412405288b489f727cbb0b3a85e7b7c12fabb37ef47.yml
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ Methods:
Types:

```python
from finch.types.jobs import AutomatedAsyncJob, AutomatedCreateResponse
from finch.types.jobs import AutomatedAsyncJob, AutomatedCreateResponse, AutomatedListResponse
```

Methods:

- <code title="post /jobs/automated">client.jobs.automated.<a href="./src/finch/resources/jobs/automated.py">create</a>(\*\*<a href="src/finch/types/jobs/automated_create_params.py">params</a>) -> <a href="./src/finch/types/jobs/automated_create_response.py">AutomatedCreateResponse</a></code>
- <code title="get /jobs/automated/{job_id}">client.jobs.automated.<a href="./src/finch/resources/jobs/automated.py">retrieve</a>(job_id) -> <a href="./src/finch/types/jobs/automated_async_job.py">AutomatedAsyncJob</a></code>
- <code title="get /jobs/automated">client.jobs.automated.<a href="./src/finch/resources/jobs/automated.py">list</a>(\*\*<a href="src/finch/types/jobs/automated_list_params.py">params</a>) -> <a href="./src/finch/types/jobs/automated_async_job.py">SyncPage[AutomatedAsyncJob]</a></code>
- <code title="get /jobs/automated">client.jobs.automated.<a href="./src/finch/resources/jobs/automated.py">list</a>(\*\*<a href="src/finch/types/jobs/automated_list_params.py">params</a>) -> <a href="./src/finch/types/jobs/automated_list_response.py">AutomatedListResponse</a></code>

## Manual

Expand Down
22 changes: 10 additions & 12 deletions src/finch/resources/jobs/automated.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
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 SyncPage, AsyncPage
from ...types.jobs import automated_list_params, automated_create_params
from ..._base_client import AsyncPaginator, make_request_options
from ..._base_client import make_request_options
from ...types.jobs.automated_async_job import AutomatedAsyncJob
from ...types.jobs.automated_list_response import AutomatedListResponse
from ...types.jobs.automated_create_response import AutomatedCreateResponse

__all__ = ["Automated", "AsyncAutomated"]
Expand Down Expand Up @@ -200,7 +200,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncPage[AutomatedAsyncJob]:
) -> AutomatedListResponse:
"""Get all automated jobs.

Automated jobs are completed by a machine. By default,
Expand All @@ -220,9 +220,8 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
return self._get(
"/jobs/automated",
page=SyncPage[AutomatedAsyncJob],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -236,7 +235,7 @@ def list(
automated_list_params.AutomatedListParams,
),
),
model=AutomatedAsyncJob,
cast_to=AutomatedListResponse,
)


Expand Down Expand Up @@ -404,7 +403,7 @@ async def retrieve(
cast_to=AutomatedAsyncJob,
)

def list(
async def list(
self,
*,
limit: int | NotGiven = NOT_GIVEN,
Expand All @@ -415,7 +414,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[AutomatedAsyncJob, AsyncPage[AutomatedAsyncJob]]:
) -> AutomatedListResponse:
"""Get all automated jobs.

Automated jobs are completed by a machine. By default,
Expand All @@ -435,23 +434,22 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get_api_list(
return await self._get(
"/jobs/automated",
page=AsyncPage[AutomatedAsyncJob],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
query=await async_maybe_transform(
{
"limit": limit,
"offset": offset,
},
automated_list_params.AutomatedListParams,
),
),
model=AutomatedAsyncJob,
cast_to=AutomatedListResponse,
)


Expand Down
1 change: 1 addition & 0 deletions src/finch/types/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
from .automated_async_job import AutomatedAsyncJob as AutomatedAsyncJob
from .automated_list_params import AutomatedListParams as AutomatedListParams
from .automated_create_params import AutomatedCreateParams as AutomatedCreateParams
from .automated_list_response import AutomatedListResponse as AutomatedListResponse
from .automated_create_response import AutomatedCreateResponse as AutomatedCreateResponse
34 changes: 34 additions & 0 deletions src/finch/types/jobs/automated_list_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional

from ..._models import BaseModel
from .automated_async_job import AutomatedAsyncJob

__all__ = ["AutomatedListResponse", "Meta", "MetaQuotas", "MetaQuotasDataSyncAll"]


class MetaQuotasDataSyncAll(BaseModel):
allowed_refreshes: Optional[int] = None

remaining_refreshes: Optional[int] = None


class MetaQuotas(BaseModel):
data_sync_all: Optional[MetaQuotasDataSyncAll] = None


class Meta(BaseModel):
quotas: Optional[MetaQuotas] = None
"""Information about remaining quotas for this connection.

Only applicable for customers opted in to use Finch's Data Sync Refresh endpoint
(`POST /jobs/automated`). Please contact a Finch representative for more
details.
"""


class AutomatedListResponse(BaseModel):
data: List[AutomatedAsyncJob]

meta: Meta
23 changes: 13 additions & 10 deletions tests/api_resources/jobs/test_automated.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

from finch import Finch, AsyncFinch
from tests.utils import assert_matches_type
from finch.pagination import SyncPage, AsyncPage
from finch.types.jobs import AutomatedAsyncJob, AutomatedCreateResponse
from finch.types.jobs import (
AutomatedAsyncJob,
AutomatedListResponse,
AutomatedCreateResponse,
)

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand Down Expand Up @@ -124,15 +127,15 @@ def test_path_params_retrieve(self, client: Finch) -> None:
@parametrize
def test_method_list(self, client: Finch) -> None:
automated = client.jobs.automated.list()
assert_matches_type(SyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
def test_method_list_with_all_params(self, client: Finch) -> None:
automated = client.jobs.automated.list(
limit=0,
offset=0,
)
assert_matches_type(SyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
def test_raw_response_list(self, client: Finch) -> None:
Expand All @@ -141,7 +144,7 @@ def test_raw_response_list(self, client: Finch) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
automated = response.parse()
assert_matches_type(SyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
def test_streaming_response_list(self, client: Finch) -> None:
Expand All @@ -150,7 +153,7 @@ def test_streaming_response_list(self, client: Finch) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

automated = response.parse()
assert_matches_type(SyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -264,15 +267,15 @@ async def test_path_params_retrieve(self, async_client: AsyncFinch) -> None:
@parametrize
async def test_method_list(self, async_client: AsyncFinch) -> None:
automated = await async_client.jobs.automated.list()
assert_matches_type(AsyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncFinch) -> None:
automated = await async_client.jobs.automated.list(
limit=0,
offset=0,
)
assert_matches_type(AsyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
async def test_raw_response_list(self, async_client: AsyncFinch) -> None:
Expand All @@ -281,7 +284,7 @@ async def test_raw_response_list(self, async_client: AsyncFinch) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
automated = response.parse()
assert_matches_type(AsyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

@parametrize
async def test_streaming_response_list(self, async_client: AsyncFinch) -> None:
Expand All @@ -290,6 +293,6 @@ async def test_streaming_response_list(self, async_client: AsyncFinch) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

automated = await response.parse()
assert_matches_type(AsyncPage[AutomatedAsyncJob], automated, path=["response"])
assert_matches_type(AutomatedListResponse, automated, path=["response"])

assert cast(Any, response.is_closed) is True