diff --git a/.stats.yml b/.stats.yml
index e396c3c..99e9dfc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 15
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-e54b835d1d64d37343017f4919c60998496a1b2b5c8e0c67af82093efc613f2f.yml
+configured_endpoints: 12
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-eccf2e27a91b41489a70fdbe1253c1142da0f2f2d1e84267b037d6b6af0b26dd.yml
diff --git a/api.md b/api.md
index 9a27ad9..cf33548 100644
--- a/api.md
+++ b/api.md
@@ -63,13 +63,10 @@ Methods:
Types:
```python
-from writerai.types import File, FileDeleteResponse
+from writerai.types import File
```
Methods:
-- client.files.retrieve(file_id) -> File
- client.files.list(\*\*params) -> SyncCursorPage[File]
-- client.files.delete(file_id) -> FileDeleteResponse
-- client.files.download(file_id) -> BinaryAPIResponse
- client.files.upload(\*\*params) -> File
diff --git a/src/writerai/resources/files.py b/src/writerai/resources/files.py
index 3ecec44..d30a6f4 100644
--- a/src/writerai/resources/files.py
+++ b/src/writerai/resources/files.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+from typing import List
from typing_extensions import Literal
import httpx
@@ -15,23 +16,14 @@
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
- BinaryAPIResponse,
- AsyncBinaryAPIResponse,
- StreamedBinaryAPIResponse,
- AsyncStreamedBinaryAPIResponse,
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
- to_custom_raw_response_wrapper,
async_to_streamed_response_wrapper,
- to_custom_streamed_response_wrapper,
- async_to_custom_raw_response_wrapper,
- async_to_custom_streamed_response_wrapper,
)
from ..pagination import SyncCursorPage, AsyncCursorPage
from ..types.file import File
from .._base_client import AsyncPaginator, make_request_options
-from ..types.file_delete_response import FileDeleteResponse
__all__ = ["FilesResource", "AsyncFilesResource"]
@@ -45,45 +37,12 @@ def with_raw_response(self) -> FilesResourceWithRawResponse:
def with_streaming_response(self) -> FilesResourceWithStreamingResponse:
return FilesResourceWithStreamingResponse(self)
- def retrieve(
- self,
- file_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,
- ) -> File:
- """
- Get metadata of a file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- return self._get(
- f"/v1/files/{file_id}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=File,
- )
-
def list(
self,
*,
after: str | NotGiven = NOT_GIVEN,
before: str | NotGiven = NOT_GIVEN,
- graph_id: str | NotGiven = NOT_GIVEN,
+ graph_id: List[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -93,10 +52,25 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncCursorPage[File]:
- """
- Get metadata of all files
+ """List files
Args:
+ after: The ID of the last object in the previous page.
+
+ This parameter instructs the API
+ to return the next page of results.
+
+ before: The ID of the first object in the previous page. This parameter instructs the
+ API to return the previous page of results.
+
+ graph_id: The unique identifier of the graph to which the files belong.
+
+ limit: Specifies the maximum number of objects returned in a page. The default value
+ is 50. The minimum value is 1, and the maximum value is 100.
+
+ order: Specifies the order of the results. Valid values are asc for ascending and desc
+ for descending.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -127,73 +101,6 @@ def list(
model=File,
)
- def delete(
- self,
- file_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,
- ) -> FileDeleteResponse:
- """
- Delete file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- return self._delete(
- f"/v1/files/{file_id}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=FileDeleteResponse,
- )
-
- def download(
- self,
- file_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,
- ) -> BinaryAPIResponse:
- """
- Download a file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
- return self._get(
- f"/v1/files/{file_id}/download",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=BinaryAPIResponse,
- )
-
def upload(
self,
*,
@@ -245,45 +152,12 @@ def with_raw_response(self) -> AsyncFilesResourceWithRawResponse:
def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse:
return AsyncFilesResourceWithStreamingResponse(self)
- async def retrieve(
- self,
- file_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,
- ) -> File:
- """
- Get metadata of a file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- return await self._get(
- f"/v1/files/{file_id}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=File,
- )
-
def list(
self,
*,
after: str | NotGiven = NOT_GIVEN,
before: str | NotGiven = NOT_GIVEN,
- graph_id: str | NotGiven = NOT_GIVEN,
+ graph_id: List[str] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -293,10 +167,25 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[File, AsyncCursorPage[File]]:
- """
- Get metadata of all files
+ """List files
Args:
+ after: The ID of the last object in the previous page.
+
+ This parameter instructs the API
+ to return the next page of results.
+
+ before: The ID of the first object in the previous page. This parameter instructs the
+ API to return the previous page of results.
+
+ graph_id: The unique identifier of the graph to which the files belong.
+
+ limit: Specifies the maximum number of objects returned in a page. The default value
+ is 50. The minimum value is 1, and the maximum value is 100.
+
+ order: Specifies the order of the results. Valid values are asc for ascending and desc
+ for descending.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -327,73 +216,6 @@ def list(
model=File,
)
- async def delete(
- self,
- file_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,
- ) -> FileDeleteResponse:
- """
- Delete file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- return await self._delete(
- f"/v1/files/{file_id}",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=FileDeleteResponse,
- )
-
- async def download(
- self,
- file_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,
- ) -> AsyncBinaryAPIResponse:
- """
- Download a file
-
- 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 file_id:
- raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
- return await self._get(
- f"/v1/files/{file_id}/download",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=AsyncBinaryAPIResponse,
- )
-
async def upload(
self,
*,
@@ -440,19 +262,9 @@ class FilesResourceWithRawResponse:
def __init__(self, files: FilesResource) -> None:
self._files = files
- self.retrieve = to_raw_response_wrapper(
- files.retrieve,
- )
self.list = to_raw_response_wrapper(
files.list,
)
- self.delete = to_raw_response_wrapper(
- files.delete,
- )
- self.download = to_custom_raw_response_wrapper(
- files.download,
- BinaryAPIResponse,
- )
self.upload = to_raw_response_wrapper(
files.upload,
)
@@ -462,19 +274,9 @@ class AsyncFilesResourceWithRawResponse:
def __init__(self, files: AsyncFilesResource) -> None:
self._files = files
- self.retrieve = async_to_raw_response_wrapper(
- files.retrieve,
- )
self.list = async_to_raw_response_wrapper(
files.list,
)
- self.delete = async_to_raw_response_wrapper(
- files.delete,
- )
- self.download = async_to_custom_raw_response_wrapper(
- files.download,
- AsyncBinaryAPIResponse,
- )
self.upload = async_to_raw_response_wrapper(
files.upload,
)
@@ -484,19 +286,9 @@ class FilesResourceWithStreamingResponse:
def __init__(self, files: FilesResource) -> None:
self._files = files
- self.retrieve = to_streamed_response_wrapper(
- files.retrieve,
- )
self.list = to_streamed_response_wrapper(
files.list,
)
- self.delete = to_streamed_response_wrapper(
- files.delete,
- )
- self.download = to_custom_streamed_response_wrapper(
- files.download,
- StreamedBinaryAPIResponse,
- )
self.upload = to_streamed_response_wrapper(
files.upload,
)
@@ -506,19 +298,9 @@ class AsyncFilesResourceWithStreamingResponse:
def __init__(self, files: AsyncFilesResource) -> None:
self._files = files
- self.retrieve = async_to_streamed_response_wrapper(
- files.retrieve,
- )
self.list = async_to_streamed_response_wrapper(
files.list,
)
- self.delete = async_to_streamed_response_wrapper(
- files.delete,
- )
- self.download = async_to_custom_streamed_response_wrapper(
- files.download,
- AsyncStreamedBinaryAPIResponse,
- )
self.upload = async_to_streamed_response_wrapper(
files.upload,
)
diff --git a/src/writerai/resources/graphs.py b/src/writerai/resources/graphs.py
index f3f087c..b31dac4 100644
--- a/src/writerai/resources/graphs.py
+++ b/src/writerai/resources/graphs.py
@@ -59,7 +59,13 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphCreateResponse:
"""
+ Create graph
+
Args:
+ name: The name of the graph.
+
+ description: A description of the graph.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -95,6 +101,8 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Graph:
"""
+ Retrieve graph
+
Args:
extra_headers: Send extra headers
@@ -128,7 +136,13 @@ def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphUpdateResponse:
"""
+ Update graph
+
Args:
+ name: The name of the graph.
+
+ description: A description of the graph.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -168,8 +182,23 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncCursorPage[Graph]:
- """
+ """List graphs
+
Args:
+ after: The ID of the last object in the previous page.
+
+ This parameter instructs the API
+ to return the next page of results.
+
+ before: The ID of the first object in the previous page. This parameter instructs the
+ API to return the previous page of results.
+
+ limit: Specifies the maximum number of objects returned in a page. The default value
+ is 50. The minimum value is 1, and the maximum value is 100.
+
+ order: Specifies the order of the results. Valid values are asc for ascending and desc
+ for descending.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -211,6 +240,8 @@ def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphDeleteResponse:
"""
+ Delete graph
+
Args:
extra_headers: Send extra headers
@@ -243,7 +274,11 @@ def add_file_to_graph(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> File:
"""
+ Add file to graph
+
Args:
+ file_id: The unique identifier of the file.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -276,6 +311,8 @@ def remove_file_from_graph(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphRemoveFileFromGraphResponse:
"""
+ Remove file from graph
+
Args:
extra_headers: Send extra headers
@@ -320,7 +357,13 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphCreateResponse:
"""
+ Create graph
+
Args:
+ name: The name of the graph.
+
+ description: A description of the graph.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -356,6 +399,8 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Graph:
"""
+ Retrieve graph
+
Args:
extra_headers: Send extra headers
@@ -389,7 +434,13 @@ async def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphUpdateResponse:
"""
+ Update graph
+
Args:
+ name: The name of the graph.
+
+ description: A description of the graph.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -429,8 +480,23 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Graph, AsyncCursorPage[Graph]]:
- """
+ """List graphs
+
Args:
+ after: The ID of the last object in the previous page.
+
+ This parameter instructs the API
+ to return the next page of results.
+
+ before: The ID of the first object in the previous page. This parameter instructs the
+ API to return the previous page of results.
+
+ limit: Specifies the maximum number of objects returned in a page. The default value
+ is 50. The minimum value is 1, and the maximum value is 100.
+
+ order: Specifies the order of the results. Valid values are asc for ascending and desc
+ for descending.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -472,6 +538,8 @@ async def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphDeleteResponse:
"""
+ Delete graph
+
Args:
extra_headers: Send extra headers
@@ -504,7 +572,11 @@ async def add_file_to_graph(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> File:
"""
+ Add file to graph
+
Args:
+ file_id: The unique identifier of the file.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -539,6 +611,8 @@ async def remove_file_from_graph(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GraphRemoveFileFromGraphResponse:
"""
+ Remove file from graph
+
Args:
extra_headers: Send extra headers
diff --git a/src/writerai/types/__init__.py b/src/writerai/types/__init__.py
index 0e54913..b2e31c1 100644
--- a/src/writerai/types/__init__.py
+++ b/src/writerai/types/__init__.py
@@ -15,7 +15,6 @@
from .graph_create_params import GraphCreateParams as GraphCreateParams
from .graph_update_params import GraphUpdateParams as GraphUpdateParams
from .model_list_response import ModelListResponse as ModelListResponse
-from .file_delete_response import FileDeleteResponse as FileDeleteResponse
from .graph_create_response import GraphCreateResponse as GraphCreateResponse
from .graph_delete_response import GraphDeleteResponse as GraphDeleteResponse
from .graph_update_response import GraphUpdateResponse as GraphUpdateResponse
diff --git a/src/writerai/types/file.py b/src/writerai/types/file.py
index 9448c40..2f8d563 100644
--- a/src/writerai/types/file.py
+++ b/src/writerai/types/file.py
@@ -10,9 +10,13 @@
class File(BaseModel):
id: str
+ """A unique identifier of the graph."""
created_at: datetime
+ """The timestamp when the graph was created."""
graph_ids: List[str]
+ """A list of graph IDs that the file is associated with."""
name: str
+ """The name of the graph."""
diff --git a/src/writerai/types/file_delete_response.py b/src/writerai/types/file_delete_response.py
deleted file mode 100644
index 450d558..0000000
--- a/src/writerai/types/file_delete_response.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-
-
-from .._models import BaseModel
-
-__all__ = ["FileDeleteResponse"]
-
-
-class FileDeleteResponse(BaseModel):
- id: str
-
- deleted: bool
diff --git a/src/writerai/types/file_list_params.py b/src/writerai/types/file_list_params.py
index 6086695..a890be7 100644
--- a/src/writerai/types/file_list_params.py
+++ b/src/writerai/types/file_list_params.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+from typing import List
from typing_extensions import Literal, TypedDict
__all__ = ["FileListParams"]
@@ -9,11 +10,28 @@
class FileListParams(TypedDict, total=False):
after: str
+ """The ID of the last object in the previous page.
+
+ This parameter instructs the API to return the next page of results.
+ """
before: str
+ """The ID of the first object in the previous page.
+
+ This parameter instructs the API to return the previous page of results.
+ """
- graph_id: str
+ graph_id: List[str]
+ """The unique identifier of the graph to which the files belong."""
limit: int
+ """Specifies the maximum number of objects returned in a page.
+
+ The default value is 50. The minimum value is 1, and the maximum value is 100.
+ """
order: Literal["asc", "desc"]
+ """Specifies the order of the results.
+
+ Valid values are asc for ascending and desc for descending.
+ """
diff --git a/src/writerai/types/graph.py b/src/writerai/types/graph.py
index 2045a5d..27816f0 100644
--- a/src/writerai/types/graph.py
+++ b/src/writerai/types/graph.py
@@ -10,21 +10,29 @@
class FileStatus(BaseModel):
completed: int
+ """The number of files that have been successfully processed."""
failed: int
+ """The number of files that failed to process."""
in_progress: int
+ """The number of files currently being processed."""
total: int
+ """The total number of files associated with the graph."""
class Graph(BaseModel):
id: str
+ """A unique identifier of the file."""
created_at: datetime
+ """The timestamp when the file was created."""
file_status: FileStatus
name: str
+ """The name of the file."""
description: Optional[str] = None
+ """A description of the graph."""
diff --git a/src/writerai/types/graph_add_file_to_graph_params.py b/src/writerai/types/graph_add_file_to_graph_params.py
index b1bab49..b0c471d 100644
--- a/src/writerai/types/graph_add_file_to_graph_params.py
+++ b/src/writerai/types/graph_add_file_to_graph_params.py
@@ -9,3 +9,4 @@
class GraphAddFileToGraphParams(TypedDict, total=False):
file_id: Required[str]
+ """The unique identifier of the file."""
diff --git a/src/writerai/types/graph_create_params.py b/src/writerai/types/graph_create_params.py
index 24638cf..8f1dd27 100644
--- a/src/writerai/types/graph_create_params.py
+++ b/src/writerai/types/graph_create_params.py
@@ -9,5 +9,7 @@
class GraphCreateParams(TypedDict, total=False):
name: Required[str]
+ """The name of the graph."""
description: str
+ """A description of the graph."""
diff --git a/src/writerai/types/graph_create_response.py b/src/writerai/types/graph_create_response.py
index 831d298..408e77c 100644
--- a/src/writerai/types/graph_create_response.py
+++ b/src/writerai/types/graph_create_response.py
@@ -10,9 +10,13 @@
class GraphCreateResponse(BaseModel):
id: str
+ """A unique identifier of the graph."""
created_at: datetime
+ """The timestamp when the graph was created."""
name: str
+ """The name of the graph."""
description: Optional[str] = None
+ """A description of the graph."""
diff --git a/src/writerai/types/graph_delete_response.py b/src/writerai/types/graph_delete_response.py
index e689b60..f5aff6b 100644
--- a/src/writerai/types/graph_delete_response.py
+++ b/src/writerai/types/graph_delete_response.py
@@ -9,5 +9,7 @@
class GraphDeleteResponse(BaseModel):
id: str
+ """A unique identifier of the deleted file."""
deleted: bool
+ """Indicates whether the file was successfully deleted."""
diff --git a/src/writerai/types/graph_list_params.py b/src/writerai/types/graph_list_params.py
index 37668ef..d83fcc3 100644
--- a/src/writerai/types/graph_list_params.py
+++ b/src/writerai/types/graph_list_params.py
@@ -9,9 +9,25 @@
class GraphListParams(TypedDict, total=False):
after: str
+ """The ID of the last object in the previous page.
+
+ This parameter instructs the API to return the next page of results.
+ """
before: str
+ """The ID of the first object in the previous page.
+
+ This parameter instructs the API to return the previous page of results.
+ """
limit: int
+ """Specifies the maximum number of objects returned in a page.
+
+ The default value is 50. The minimum value is 1, and the maximum value is 100.
+ """
order: Literal["asc", "desc"]
+ """Specifies the order of the results.
+
+ Valid values are asc for ascending and desc for descending.
+ """
diff --git a/src/writerai/types/graph_remove_file_from_graph_response.py b/src/writerai/types/graph_remove_file_from_graph_response.py
index bcf6d72..3adc8c2 100644
--- a/src/writerai/types/graph_remove_file_from_graph_response.py
+++ b/src/writerai/types/graph_remove_file_from_graph_response.py
@@ -9,5 +9,7 @@
class GraphRemoveFileFromGraphResponse(BaseModel):
id: str
+ """A unique identifier of the deleted graph."""
deleted: bool
+ """Indicates whether the graph was successfully deleted."""
diff --git a/src/writerai/types/graph_update_params.py b/src/writerai/types/graph_update_params.py
index 06ef5a9..b0d734a 100644
--- a/src/writerai/types/graph_update_params.py
+++ b/src/writerai/types/graph_update_params.py
@@ -9,5 +9,7 @@
class GraphUpdateParams(TypedDict, total=False):
name: Required[str]
+ """The name of the graph."""
description: str
+ """A description of the graph."""
diff --git a/src/writerai/types/graph_update_response.py b/src/writerai/types/graph_update_response.py
index 63a3f42..fcc7825 100644
--- a/src/writerai/types/graph_update_response.py
+++ b/src/writerai/types/graph_update_response.py
@@ -10,9 +10,13 @@
class GraphUpdateResponse(BaseModel):
id: str
+ """A unique identifier of the graph."""
created_at: datetime
+ """The timestamp when the graph was created."""
name: str
+ """The name of the graph."""
description: Optional[str] = None
+ """A description of the graph."""
diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py
index aaa93d8..e947e98 100644
--- a/tests/api_resources/test_files.py
+++ b/tests/api_resources/test_files.py
@@ -5,19 +5,11 @@
import os
from typing import Any, cast
-import httpx
import pytest
-from respx import MockRouter
from writerai import Writer, AsyncWriter
from tests.utils import assert_matches_type
-from writerai.types import File, FileDeleteResponse
-from writerai._response import (
- BinaryAPIResponse,
- AsyncBinaryAPIResponse,
- StreamedBinaryAPIResponse,
- AsyncStreamedBinaryAPIResponse,
-)
+from writerai.types import File
from writerai.pagination import SyncCursorPage, AsyncCursorPage
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -26,44 +18,6 @@
class TestFiles:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
- @parametrize
- def test_method_retrieve(self, client: Writer) -> None:
- file = client.files.retrieve(
- "fileId",
- )
- assert_matches_type(File, file, path=["response"])
-
- @parametrize
- def test_raw_response_retrieve(self, client: Writer) -> None:
- response = client.files.with_raw_response.retrieve(
- "fileId",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file = response.parse()
- assert_matches_type(File, file, path=["response"])
-
- @parametrize
- def test_streaming_response_retrieve(self, client: Writer) -> None:
- with client.files.with_streaming_response.retrieve(
- "fileId",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- file = response.parse()
- assert_matches_type(File, file, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_retrieve(self, client: Writer) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- client.files.with_raw_response.retrieve(
- "",
- )
-
@parametrize
def test_method_list(self, client: Writer) -> None:
file = client.files.list()
@@ -74,7 +28,11 @@ def test_method_list_with_all_params(self, client: Writer) -> None:
file = client.files.list(
after="after",
before="before",
- graph_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ graph_id=[
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ],
limit=0,
order="asc",
)
@@ -100,98 +58,6 @@ def test_streaming_response_list(self, client: Writer) -> None:
assert cast(Any, response.is_closed) is True
- @parametrize
- def test_method_delete(self, client: Writer) -> None:
- file = client.files.delete(
- "fileId",
- )
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- @parametrize
- def test_raw_response_delete(self, client: Writer) -> None:
- response = client.files.with_raw_response.delete(
- "fileId",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file = response.parse()
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- @parametrize
- def test_streaming_response_delete(self, client: Writer) -> None:
- with client.files.with_streaming_response.delete(
- "fileId",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- file = response.parse()
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_delete(self, client: Writer) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- client.files.with_raw_response.delete(
- "",
- )
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- def test_method_download(self, client: Writer, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
- file = client.files.download(
- "fileId",
- )
- assert file.is_closed
- assert file.json() == {"foo": "bar"}
- assert cast(Any, file.is_closed) is True
- assert isinstance(file, BinaryAPIResponse)
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- def test_raw_response_download(self, client: Writer, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
-
- file = client.files.with_raw_response.download(
- "fileId",
- )
-
- assert file.is_closed is True
- assert file.http_request.headers.get("X-Stainless-Lang") == "python"
- assert file.json() == {"foo": "bar"}
- assert isinstance(file, BinaryAPIResponse)
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- def test_streaming_response_download(self, client: Writer, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
- with client.files.with_streaming_response.download(
- "fileId",
- ) as file:
- assert not file.is_closed
- assert file.http_request.headers.get("X-Stainless-Lang") == "python"
-
- assert file.json() == {"foo": "bar"}
- assert cast(Any, file.is_closed) is True
- assert isinstance(file, StreamedBinaryAPIResponse)
-
- assert cast(Any, file.is_closed) is True
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- def test_path_params_download(self, client: Writer) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- client.files.with_raw_response.download(
- "",
- )
-
@pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
@parametrize
def test_method_upload(self, client: Writer) -> None:
@@ -239,44 +105,6 @@ def test_streaming_response_upload(self, client: Writer) -> None:
class TestAsyncFiles:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
- @parametrize
- async def test_method_retrieve(self, async_client: AsyncWriter) -> None:
- file = await async_client.files.retrieve(
- "fileId",
- )
- assert_matches_type(File, file, path=["response"])
-
- @parametrize
- async def test_raw_response_retrieve(self, async_client: AsyncWriter) -> None:
- response = await async_client.files.with_raw_response.retrieve(
- "fileId",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file = await response.parse()
- assert_matches_type(File, file, path=["response"])
-
- @parametrize
- async def test_streaming_response_retrieve(self, async_client: AsyncWriter) -> None:
- async with async_client.files.with_streaming_response.retrieve(
- "fileId",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- file = await response.parse()
- assert_matches_type(File, file, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_retrieve(self, async_client: AsyncWriter) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- await async_client.files.with_raw_response.retrieve(
- "",
- )
-
@parametrize
async def test_method_list(self, async_client: AsyncWriter) -> None:
file = await async_client.files.list()
@@ -287,7 +115,11 @@ async def test_method_list_with_all_params(self, async_client: AsyncWriter) -> N
file = await async_client.files.list(
after="after",
before="before",
- graph_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ graph_id=[
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ],
limit=0,
order="asc",
)
@@ -313,98 +145,6 @@ async def test_streaming_response_list(self, async_client: AsyncWriter) -> None:
assert cast(Any, response.is_closed) is True
- @parametrize
- async def test_method_delete(self, async_client: AsyncWriter) -> None:
- file = await async_client.files.delete(
- "fileId",
- )
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- @parametrize
- async def test_raw_response_delete(self, async_client: AsyncWriter) -> None:
- response = await async_client.files.with_raw_response.delete(
- "fileId",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- file = await response.parse()
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- @parametrize
- async def test_streaming_response_delete(self, async_client: AsyncWriter) -> None:
- async with async_client.files.with_streaming_response.delete(
- "fileId",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- file = await response.parse()
- assert_matches_type(FileDeleteResponse, file, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_delete(self, async_client: AsyncWriter) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- await async_client.files.with_raw_response.delete(
- "",
- )
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- async def test_method_download(self, async_client: AsyncWriter, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
- file = await async_client.files.download(
- "fileId",
- )
- assert file.is_closed
- assert await file.json() == {"foo": "bar"}
- assert cast(Any, file.is_closed) is True
- assert isinstance(file, AsyncBinaryAPIResponse)
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- async def test_raw_response_download(self, async_client: AsyncWriter, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
-
- file = await async_client.files.with_raw_response.download(
- "fileId",
- )
-
- assert file.is_closed is True
- assert file.http_request.headers.get("X-Stainless-Lang") == "python"
- assert await file.json() == {"foo": "bar"}
- assert isinstance(file, AsyncBinaryAPIResponse)
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- async def test_streaming_response_download(self, async_client: AsyncWriter, respx_mock: MockRouter) -> None:
- respx_mock.get("/v1/files/fileId/download").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
- async with async_client.files.with_streaming_response.download(
- "fileId",
- ) as file:
- assert not file.is_closed
- assert file.http_request.headers.get("X-Stainless-Lang") == "python"
-
- assert await file.json() == {"foo": "bar"}
- assert cast(Any, file.is_closed) is True
- assert isinstance(file, AsyncStreamedBinaryAPIResponse)
-
- assert cast(Any, file.is_closed) is True
-
- @pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
- @parametrize
- @pytest.mark.respx(base_url=base_url)
- async def test_path_params_download(self, async_client: AsyncWriter) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"):
- await async_client.files.with_raw_response.download(
- "",
- )
-
@pytest.mark.skip(reason="requests with binary data not yet supported in test environment")
@parametrize
async def test_method_upload(self, async_client: AsyncWriter) -> None: