From 49e58c8f543a43d405a38c8346fddac4802b059f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 29 Jan 2025 22:41:58 +0000
Subject: [PATCH] docs(api): updates to API spec (#170)
---
.stats.yml | 2 +-
api.md | 2 +-
src/writerai/resources/applications/graphs.py | 14 ++-
src/writerai/resources/applications/jobs.py | 62 +++++-----
.../types/applications/graph_update_params.py | 6 +-
.../types/applications/job_create_params.py | 23 ++--
.../types/applications/job_create_response.py | 13 +--
.../types/applications/job_list_params.py | 35 +-----
.../types/applications/job_list_response.py | 34 +++---
.../applications/job_retrieve_response.py | 34 +++---
.../types/applications/job_retry_response.py | 13 +--
tests/api_resources/applications/test_jobs.py | 110 ++++++++----------
12 files changed, 169 insertions(+), 179 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index e1f3381..6f4a872 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 27
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-95e5c41bc4917566fc6ee1f849795bac2e34e5609afd25bb927252ac7e33e2f0.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-ffd1e266059dd5eabc5a0a437bbf4c7b06d497152e076a91e0cc25243a485344.yml
diff --git a/api.md b/api.md
index 76d757e..5fed86c 100644
--- a/api.md
+++ b/api.md
@@ -47,7 +47,7 @@ Methods:
- client.applications.jobs.create(application_id, \*\*params) -> JobCreateResponse
- client.applications.jobs.retrieve(job_id) -> JobRetrieveResponse
-- client.applications.jobs.list(application_id, \*\*params) -> JobListResponse
+- client.applications.jobs.list(application_id, \*\*params) -> SyncApplicationJobsOffset[JobListResponse]
- client.applications.jobs.retry(job_id) -> JobRetryResponse
## Graphs
diff --git a/src/writerai/resources/applications/graphs.py b/src/writerai/resources/applications/graphs.py
index 3a739d6..f393f66 100644
--- a/src/writerai/resources/applications/graphs.py
+++ b/src/writerai/resources/applications/graphs.py
@@ -59,10 +59,13 @@ def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ApplicationGraphsResponse:
"""
- Associate graphs with a no-code chat application via API.
+ Updates the graphs listed and associates them with the no-code chat app to be
+ used.
Args:
- graph_ids: A list of graph IDs to associate with the application.
+ graph_ids: A list of graph IDs to associate with the application. Note that this will
+ replace the existing list of graphs associated with the application, not add to
+ it.
extra_headers: Send extra headers
@@ -150,10 +153,13 @@ async def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ApplicationGraphsResponse:
"""
- Associate graphs with a no-code chat application via API.
+ Updates the graphs listed and associates them with the no-code chat app to be
+ used.
Args:
- graph_ids: A list of graph IDs to associate with the application.
+ graph_ids: A list of graph IDs to associate with the application. Note that this will
+ replace the existing list of graphs associated with the application, not add to
+ it.
extra_headers: Send extra headers
diff --git a/src/writerai/resources/applications/jobs.py b/src/writerai/resources/applications/jobs.py
index 19f2f3e..88dc8aa 100644
--- a/src/writerai/resources/applications/jobs.py
+++ b/src/writerai/resources/applications/jobs.py
@@ -2,7 +2,8 @@
from __future__ import annotations
-from typing import Dict, Iterable
+from typing import Iterable
+from typing_extensions import Literal
import httpx
@@ -19,7 +20,8 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ..._base_client import make_request_options
+from ...pagination import SyncApplicationJobsOffset, AsyncApplicationJobsOffset
+from ..._base_client import AsyncPaginator, make_request_options
from ...types.applications import job_list_params, job_create_params
from ...types.applications.job_list_response import JobListResponse
from ...types.applications.job_retry_response import JobRetryResponse
@@ -54,7 +56,6 @@ def create(
application_id: str,
*,
inputs: Iterable[job_create_params.Input],
- metadata: Dict[str, 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,
@@ -68,8 +69,6 @@ def create(
Args:
inputs: A list of input objects to generate content for.
- metadata: Optional metadata for the generation request.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -82,13 +81,7 @@ def create(
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
return self._post(
f"/v1/applications/{application_id}/jobs",
- body=maybe_transform(
- {
- "inputs": inputs,
- "metadata": metadata,
- },
- job_create_params.JobCreateParams,
- ),
+ body=maybe_transform({"inputs": inputs}, job_create_params.JobCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -134,19 +127,25 @@ def list(
*,
limit: int | NotGiven = NOT_GIVEN,
offset: int | NotGiven = NOT_GIVEN,
- status: job_list_params.Status | NotGiven = NOT_GIVEN,
+ status: Literal["in_progress", "failed", "completed"] | 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,
- ) -> JobListResponse:
+ ) -> SyncApplicationJobsOffset[JobListResponse]:
"""
Retrieve all jobs created via the async API, linked to the provided application
ID (or alias).
Args:
+ limit: The pagination limit for retrieving the jobs.
+
+ offset: The pagination offset for retrieving the jobs.
+
+ status: The status of the job.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -157,8 +156,9 @@ def list(
"""
if not application_id:
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
- return self._get(
+ return self._get_api_list(
f"/v1/applications/{application_id}/jobs",
+ page=SyncApplicationJobsOffset[JobListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -173,7 +173,7 @@ def list(
job_list_params.JobListParams,
),
),
- cast_to=JobListResponse,
+ model=JobListResponse,
)
def retry(
@@ -236,7 +236,6 @@ async def create(
application_id: str,
*,
inputs: Iterable[job_create_params.Input],
- metadata: Dict[str, 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,
@@ -250,8 +249,6 @@ async def create(
Args:
inputs: A list of input objects to generate content for.
- metadata: Optional metadata for the generation request.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -264,13 +261,7 @@ async def create(
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
return await self._post(
f"/v1/applications/{application_id}/jobs",
- body=await async_maybe_transform(
- {
- "inputs": inputs,
- "metadata": metadata,
- },
- job_create_params.JobCreateParams,
- ),
+ body=await async_maybe_transform({"inputs": inputs}, job_create_params.JobCreateParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
@@ -310,25 +301,31 @@ async def retrieve(
cast_to=JobRetrieveResponse,
)
- async def list(
+ def list(
self,
application_id: str,
*,
limit: int | NotGiven = NOT_GIVEN,
offset: int | NotGiven = NOT_GIVEN,
- status: job_list_params.Status | NotGiven = NOT_GIVEN,
+ status: Literal["in_progress", "failed", "completed"] | 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,
- ) -> JobListResponse:
+ ) -> AsyncPaginator[JobListResponse, AsyncApplicationJobsOffset[JobListResponse]]:
"""
Retrieve all jobs created via the async API, linked to the provided application
ID (or alias).
Args:
+ limit: The pagination limit for retrieving the jobs.
+
+ offset: The pagination offset for retrieving the jobs.
+
+ status: The status of the job.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -339,14 +336,15 @@ async def list(
"""
if not application_id:
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
- return await self._get(
+ return self._get_api_list(
f"/v1/applications/{application_id}/jobs",
+ page=AsyncApplicationJobsOffset[JobListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- query=await async_maybe_transform(
+ query=maybe_transform(
{
"limit": limit,
"offset": offset,
@@ -355,7 +353,7 @@ async def list(
job_list_params.JobListParams,
),
),
- cast_to=JobListResponse,
+ model=JobListResponse,
)
async def retry(
diff --git a/src/writerai/types/applications/graph_update_params.py b/src/writerai/types/applications/graph_update_params.py
index 1e37bf4..ea7be16 100644
--- a/src/writerai/types/applications/graph_update_params.py
+++ b/src/writerai/types/applications/graph_update_params.py
@@ -10,4 +10,8 @@
class GraphUpdateParams(TypedDict, total=False):
graph_ids: Required[List[str]]
- """A list of graph IDs to associate with the application."""
+ """A list of graph IDs to associate with the application.
+
+ Note that this will replace the existing list of graphs associated with the
+ application, not add to it.
+ """
diff --git a/src/writerai/types/applications/job_create_params.py b/src/writerai/types/applications/job_create_params.py
index 2cc98ae..86c6b04 100644
--- a/src/writerai/types/applications/job_create_params.py
+++ b/src/writerai/types/applications/job_create_params.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Dict, Iterable
+from typing import List, Iterable
from typing_extensions import Required, TypedDict
__all__ = ["JobCreateParams", "Input"]
@@ -12,13 +12,20 @@ class JobCreateParams(TypedDict, total=False):
inputs: Required[Iterable[Input]]
"""A list of input objects to generate content for."""
- metadata: Dict[str, str]
- """Optional metadata for the generation request."""
-
class Input(TypedDict, total=False):
- content: str
- """The input content to be processed."""
+ id: Required[str]
+ """The unique identifier for the input field from the application.
+
+ All input types from the No-code application are supported (i.e. Text input,
+ Dropdown, File upload, Image input). The identifier should be the name of the
+ input type.
+ """
+
+ value: Required[List[str]]
+ """The value for the input field.
- input_id: str
- """A unique identifier for the input object."""
+ If file is required you will need to pass a `file_id`. See
+ [here](https://dev.writer.com/api-guides/api-reference/file-api/upload-files)
+ for the Files API.
+ """
diff --git a/src/writerai/types/applications/job_create_response.py b/src/writerai/types/applications/job_create_response.py
index 567785a..f83502c 100644
--- a/src/writerai/types/applications/job_create_response.py
+++ b/src/writerai/types/applications/job_create_response.py
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Optional
from datetime import datetime
+from typing_extensions import Literal
from ..._models import BaseModel
@@ -9,14 +9,11 @@
class JobCreateResponse(BaseModel):
- job_id: str
+ id: str
"""The unique identifier for the async job created."""
- application_id: Optional[str] = None
- """The ID of the application associated with this job."""
-
- created_at: Optional[datetime] = None
+ created_at: datetime
"""The timestamp when the job was created."""
- status: Optional[str] = None
- """The initial status of the job (e.g., 'queued')."""
+ status: Literal["in_progress", "failed", "completed"]
+ """The status of the job."""
diff --git a/src/writerai/types/applications/job_list_params.py b/src/writerai/types/applications/job_list_params.py
index ffdea20..dfb85b6 100644
--- a/src/writerai/types/applications/job_list_params.py
+++ b/src/writerai/types/applications/job_list_params.py
@@ -2,40 +2,17 @@
from __future__ import annotations
-from typing import Union, Iterable
-from datetime import datetime
-from typing_extensions import Required, Annotated, TypedDict
+from typing_extensions import Literal, TypedDict
-from ..._utils import PropertyInfo
-
-__all__ = ["JobListParams", "Status", "StatusJob"]
+__all__ = ["JobListParams"]
class JobListParams(TypedDict, total=False):
limit: int
+ """The pagination limit for retrieving the jobs."""
offset: int
+ """The pagination offset for retrieving the jobs."""
- status: Status
-
-
-class StatusJob(TypedDict, total=False):
- created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
- """The timestamp when the job was created."""
-
- job_id: str
- """The unique identifier for the job."""
-
- result: str
- """The result of the completed job, if applicable."""
-
- status: str
- """The current status of the job."""
-
- updated_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
- """The timestamp when the job was last updated."""
-
-
-class Status(TypedDict, total=False):
- jobs: Required[Iterable[StatusJob]]
- """A list of jobs associated with the application."""
+ status: Literal["in_progress", "failed", "completed"]
+ """The status of the job."""
diff --git a/src/writerai/types/applications/job_list_response.py b/src/writerai/types/applications/job_list_response.py
index eb591ec..83b6199 100644
--- a/src/writerai/types/applications/job_list_response.py
+++ b/src/writerai/types/applications/job_list_response.py
@@ -1,30 +1,36 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Optional
+from typing import Optional
from datetime import datetime
+from typing_extensions import Literal
from ..._models import BaseModel
+from ..application_generate_content_response import ApplicationGenerateContentResponse
-__all__ = ["JobListResponse", "Job"]
+__all__ = ["JobListResponse"]
-class Job(BaseModel):
- created_at: Optional[datetime] = None
+class JobListResponse(BaseModel):
+ id: str
+ """The unique identifier for the job."""
+
+ application_id: str
+ """The ID of the application associated with this job."""
+
+ created_at: datetime
"""The timestamp when the job was created."""
- job_id: Optional[str] = None
- """The unique identifier for the job."""
+ status: Literal["in_progress", "failed", "completed"]
+ """The status of the job."""
- result: Optional[str] = None
+ completed_at: Optional[datetime] = None
+ """The timestamp when the job was completed."""
+
+ data: Optional[ApplicationGenerateContentResponse] = None
"""The result of the completed job, if applicable."""
- status: Optional[str] = None
- """The current status of the job."""
+ error: Optional[str] = None
+ """The error message if the job failed."""
updated_at: Optional[datetime] = None
"""The timestamp when the job was last updated."""
-
-
-class JobListResponse(BaseModel):
- jobs: List[Job]
- """A list of jobs associated with the application."""
diff --git a/src/writerai/types/applications/job_retrieve_response.py b/src/writerai/types/applications/job_retrieve_response.py
index bd8e0d1..8de6ad3 100644
--- a/src/writerai/types/applications/job_retrieve_response.py
+++ b/src/writerai/types/applications/job_retrieve_response.py
@@ -1,30 +1,36 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Optional
+from typing import Optional
from datetime import datetime
+from typing_extensions import Literal
from ..._models import BaseModel
+from ..application_generate_content_response import ApplicationGenerateContentResponse
-__all__ = ["JobRetrieveResponse", "Job"]
+__all__ = ["JobRetrieveResponse"]
-class Job(BaseModel):
- created_at: Optional[datetime] = None
+class JobRetrieveResponse(BaseModel):
+ id: str
+ """The unique identifier for the job."""
+
+ application_id: str
+ """The ID of the application associated with this job."""
+
+ created_at: datetime
"""The timestamp when the job was created."""
- job_id: Optional[str] = None
- """The unique identifier for the job."""
+ status: Literal["in_progress", "failed", "completed"]
+ """The status of the job."""
- result: Optional[str] = None
+ completed_at: Optional[datetime] = None
+ """The timestamp when the job was completed."""
+
+ data: Optional[ApplicationGenerateContentResponse] = None
"""The result of the completed job, if applicable."""
- status: Optional[str] = None
- """The current status of the job."""
+ error: Optional[str] = None
+ """The error message if the job failed."""
updated_at: Optional[datetime] = None
"""The timestamp when the job was last updated."""
-
-
-class JobRetrieveResponse(BaseModel):
- jobs: List[Job]
- """A list of jobs associated with the application."""
diff --git a/src/writerai/types/applications/job_retry_response.py b/src/writerai/types/applications/job_retry_response.py
index d9b4765..9555ce6 100644
--- a/src/writerai/types/applications/job_retry_response.py
+++ b/src/writerai/types/applications/job_retry_response.py
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import Optional
from datetime import datetime
+from typing_extensions import Literal
from ..._models import BaseModel
@@ -9,14 +9,11 @@
class JobRetryResponse(BaseModel):
- job_id: str
+ id: str
"""The unique identifier for the async job created."""
- application_id: Optional[str] = None
- """The ID of the application associated with this job."""
-
- created_at: Optional[datetime] = None
+ created_at: datetime
"""The timestamp when the job was created."""
- status: Optional[str] = None
- """The initial status of the job (e.g., 'queued')."""
+ status: Literal["in_progress", "failed", "completed"]
+ """The status of the job."""
diff --git a/tests/api_resources/applications/test_jobs.py b/tests/api_resources/applications/test_jobs.py
index a10ad56..96a5db3 100644
--- a/tests/api_resources/applications/test_jobs.py
+++ b/tests/api_resources/applications/test_jobs.py
@@ -9,7 +9,7 @@
from writerai import Writer, AsyncWriter
from tests.utils import assert_matches_type
-from writerai._utils import parse_datetime
+from writerai.pagination import SyncApplicationJobsOffset, AsyncApplicationJobsOffset
from writerai.types.applications import (
JobListResponse,
JobRetryResponse,
@@ -25,23 +25,14 @@ class TestJobs:
@parametrize
def test_method_create(self, client: Writer) -> None:
- job = client.applications.jobs.create(
- application_id="application_id",
- inputs=[{}],
- )
- assert_matches_type(JobCreateResponse, job, path=["response"])
-
- @parametrize
- def test_method_create_with_all_params(self, client: Writer) -> None:
job = client.applications.jobs.create(
application_id="application_id",
inputs=[
{
- "content": "content",
- "input_id": "input_id",
+ "id": "id",
+ "value": ["string"],
}
],
- metadata={"foo": "string"},
)
assert_matches_type(JobCreateResponse, job, path=["response"])
@@ -49,7 +40,12 @@ def test_method_create_with_all_params(self, client: Writer) -> None:
def test_raw_response_create(self, client: Writer) -> None:
response = client.applications.jobs.with_raw_response.create(
application_id="application_id",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
)
assert response.is_closed is True
@@ -61,7 +57,12 @@ def test_raw_response_create(self, client: Writer) -> None:
def test_streaming_response_create(self, client: Writer) -> None:
with client.applications.jobs.with_streaming_response.create(
application_id="application_id",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -76,7 +77,12 @@ def test_path_params_create(self, client: Writer) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `application_id` but received ''"):
client.applications.jobs.with_raw_response.create(
application_id="",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
)
@parametrize
@@ -122,7 +128,7 @@ def test_method_list(self, client: Writer) -> None:
job = client.applications.jobs.list(
application_id="application_id",
)
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(SyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Writer) -> None:
@@ -130,19 +136,9 @@ def test_method_list_with_all_params(self, client: Writer) -> None:
application_id="application_id",
limit=0,
offset=0,
- status={
- "jobs": [
- {
- "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
- "job_id": "job_id",
- "result": "result",
- "status": "status",
- "updated_at": parse_datetime("2019-12-27T18:11:19.117Z"),
- }
- ]
- },
+ status="in_progress",
)
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(SyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
def test_raw_response_list(self, client: Writer) -> None:
@@ -153,7 +149,7 @@ def test_raw_response_list(self, client: Writer) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = response.parse()
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(SyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
def test_streaming_response_list(self, client: Writer) -> None:
@@ -164,7 +160,7 @@ def test_streaming_response_list(self, client: Writer) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = response.parse()
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(SyncApplicationJobsOffset[JobListResponse], job, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -219,23 +215,14 @@ class TestAsyncJobs:
@parametrize
async def test_method_create(self, async_client: AsyncWriter) -> None:
- job = await async_client.applications.jobs.create(
- application_id="application_id",
- inputs=[{}],
- )
- assert_matches_type(JobCreateResponse, job, path=["response"])
-
- @parametrize
- async def test_method_create_with_all_params(self, async_client: AsyncWriter) -> None:
job = await async_client.applications.jobs.create(
application_id="application_id",
inputs=[
{
- "content": "content",
- "input_id": "input_id",
+ "id": "id",
+ "value": ["string"],
}
],
- metadata={"foo": "string"},
)
assert_matches_type(JobCreateResponse, job, path=["response"])
@@ -243,7 +230,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncWriter) ->
async def test_raw_response_create(self, async_client: AsyncWriter) -> None:
response = await async_client.applications.jobs.with_raw_response.create(
application_id="application_id",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
)
assert response.is_closed is True
@@ -255,7 +247,12 @@ async def test_raw_response_create(self, async_client: AsyncWriter) -> None:
async def test_streaming_response_create(self, async_client: AsyncWriter) -> None:
async with async_client.applications.jobs.with_streaming_response.create(
application_id="application_id",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -270,7 +267,12 @@ async def test_path_params_create(self, async_client: AsyncWriter) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `application_id` but received ''"):
await async_client.applications.jobs.with_raw_response.create(
application_id="",
- inputs=[{}],
+ inputs=[
+ {
+ "id": "id",
+ "value": ["string"],
+ }
+ ],
)
@parametrize
@@ -316,7 +318,7 @@ async def test_method_list(self, async_client: AsyncWriter) -> None:
job = await async_client.applications.jobs.list(
application_id="application_id",
)
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(AsyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncWriter) -> None:
@@ -324,19 +326,9 @@ async def test_method_list_with_all_params(self, async_client: AsyncWriter) -> N
application_id="application_id",
limit=0,
offset=0,
- status={
- "jobs": [
- {
- "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
- "job_id": "job_id",
- "result": "result",
- "status": "status",
- "updated_at": parse_datetime("2019-12-27T18:11:19.117Z"),
- }
- ]
- },
+ status="in_progress",
)
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(AsyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncWriter) -> None:
@@ -347,7 +339,7 @@ async def test_raw_response_list(self, async_client: AsyncWriter) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = await response.parse()
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(AsyncApplicationJobsOffset[JobListResponse], job, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncWriter) -> None:
@@ -358,7 +350,7 @@ async def test_streaming_response_list(self, async_client: AsyncWriter) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = await response.parse()
- assert_matches_type(JobListResponse, job, path=["response"])
+ assert_matches_type(AsyncApplicationJobsOffset[JobListResponse], job, path=["response"])
assert cast(Any, response.is_closed) is True