Skip to content
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: 27
configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/writerai%2Fwriter-6a4042c053accc87fd10b42e19e8ebe27b81127cf6ff8aa246d7f30bc6b8776f.yml
9 changes: 8 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ from writerai.types import (
Types:

```python
from writerai.types import ApplicationGenerateContentChunk, ApplicationGenerateContentResponse
from writerai.types import (
ApplicationGenerateContentChunk,
ApplicationGenerateContentResponse,
ApplicationRetrieveResponse,
ApplicationListResponse,
)
```

Methods:

- <code title="get /v1/applications/{application_id}">client.applications.<a href="./src/writerai/resources/applications/applications.py">retrieve</a>(application_id) -> <a href="./src/writerai/types/application_retrieve_response.py">ApplicationRetrieveResponse</a></code>
- <code title="get /v1/applications">client.applications.<a href="./src/writerai/resources/applications/applications.py">list</a>(\*\*<a href="src/writerai/types/application_list_params.py">params</a>) -> <a href="./src/writerai/types/application_list_response.py">SyncCursorPage[ApplicationListResponse]</a></code>
- <code title="post /v1/applications/{application_id}">client.applications.<a href="./src/writerai/resources/applications/applications.py">generate_content</a>(application_id, \*\*<a href="src/writerai/types/application_generate_content_params.py">params</a>) -> <a href="./src/writerai/types/application_generate_content_response.py">ApplicationGenerateContentResponse</a></code>

## Jobs
Expand Down
219 changes: 217 additions & 2 deletions src/writerai/resources/applications/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
GraphsResourceWithStreamingResponse,
AsyncGraphsResourceWithStreamingResponse,
)
from ...types import application_generate_content_params
from ...types import application_list_params, application_generate_content_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
required_args,
Expand All @@ -39,7 +39,10 @@
async_to_streamed_response_wrapper,
)
from ..._streaming import Stream, AsyncStream
from ..._base_client import make_request_options
from ...pagination import SyncCursorPage, AsyncCursorPage
from ..._base_client import AsyncPaginator, make_request_options
from ...types.application_list_response import ApplicationListResponse
from ...types.application_retrieve_response import ApplicationRetrieveResponse
from ...types.application_generate_content_chunk import ApplicationGenerateContentChunk
from ...types.application_generate_content_response import ApplicationGenerateContentResponse

Expand Down Expand Up @@ -74,6 +77,100 @@ def with_streaming_response(self) -> ApplicationsResourceWithStreamingResponse:
"""
return ApplicationsResourceWithStreamingResponse(self)

def retrieve(
self,
application_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,
) -> ApplicationRetrieveResponse:
"""
Retrieves detailed information for a specific no-code application, including its
configuration and current status.

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 application_id:
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
return self._get(
f"/v1/applications/{application_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ApplicationRetrieveResponse,
)

def list(
self,
*,
after: str | NotGiven = NOT_GIVEN,
before: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
type: Literal["generation"] | 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,
) -> SyncCursorPage[ApplicationListResponse]:
"""
Retrieves a paginated list of no-code applications with optional filtering and
sorting capabilities.

Args:
after: Return results after this application ID for pagination.

before: Return results before this application ID for pagination.

limit: Maximum number of applications to return in the response.

order: Sort order for the results based on creation time.

type: Filter applications by their type.

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(
"/v1/applications",
page=SyncCursorPage[ApplicationListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"after": after,
"before": before,
"limit": limit,
"order": order,
"type": type,
},
application_list_params.ApplicationListParams,
),
),
model=ApplicationListResponse,
)

@overload
def generate_content(
self,
Expand Down Expand Up @@ -229,6 +326,100 @@ def with_streaming_response(self) -> AsyncApplicationsResourceWithStreamingRespo
"""
return AsyncApplicationsResourceWithStreamingResponse(self)

async def retrieve(
self,
application_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,
) -> ApplicationRetrieveResponse:
"""
Retrieves detailed information for a specific no-code application, including its
configuration and current status.

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 application_id:
raise ValueError(f"Expected a non-empty value for `application_id` but received {application_id!r}")
return await self._get(
f"/v1/applications/{application_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ApplicationRetrieveResponse,
)

def list(
self,
*,
after: str | NotGiven = NOT_GIVEN,
before: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
type: Literal["generation"] | 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[ApplicationListResponse, AsyncCursorPage[ApplicationListResponse]]:
"""
Retrieves a paginated list of no-code applications with optional filtering and
sorting capabilities.

Args:
after: Return results after this application ID for pagination.

before: Return results before this application ID for pagination.

limit: Maximum number of applications to return in the response.

order: Sort order for the results based on creation time.

type: Filter applications by their type.

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(
"/v1/applications",
page=AsyncCursorPage[ApplicationListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"after": after,
"before": before,
"limit": limit,
"order": order,
"type": type,
},
application_list_params.ApplicationListParams,
),
),
model=ApplicationListResponse,
)

@overload
async def generate_content(
self,
Expand Down Expand Up @@ -360,6 +551,12 @@ class ApplicationsResourceWithRawResponse:
def __init__(self, applications: ApplicationsResource) -> None:
self._applications = applications

self.retrieve = to_raw_response_wrapper(
applications.retrieve,
)
self.list = to_raw_response_wrapper(
applications.list,
)
self.generate_content = to_raw_response_wrapper(
applications.generate_content,
)
Expand All @@ -377,6 +574,12 @@ class AsyncApplicationsResourceWithRawResponse:
def __init__(self, applications: AsyncApplicationsResource) -> None:
self._applications = applications

self.retrieve = async_to_raw_response_wrapper(
applications.retrieve,
)
self.list = async_to_raw_response_wrapper(
applications.list,
)
self.generate_content = async_to_raw_response_wrapper(
applications.generate_content,
)
Expand All @@ -394,6 +597,12 @@ class ApplicationsResourceWithStreamingResponse:
def __init__(self, applications: ApplicationsResource) -> None:
self._applications = applications

self.retrieve = to_streamed_response_wrapper(
applications.retrieve,
)
self.list = to_streamed_response_wrapper(
applications.list,
)
self.generate_content = to_streamed_response_wrapper(
applications.generate_content,
)
Expand All @@ -411,6 +620,12 @@ class AsyncApplicationsResourceWithStreamingResponse:
def __init__(self, applications: AsyncApplicationsResource) -> None:
self._applications = applications

self.retrieve = async_to_streamed_response_wrapper(
applications.retrieve,
)
self.list = async_to_streamed_response_wrapper(
applications.list,
)
self.generate_content = async_to_streamed_response_wrapper(
applications.generate_content,
)
Expand Down
3 changes: 3 additions & 0 deletions src/writerai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@
from .graph_update_response import GraphUpdateResponse as GraphUpdateResponse
from .tool_parse_pdf_params import ToolParsePdfParams as ToolParsePdfParams
from .chat_completion_choice import ChatCompletionChoice as ChatCompletionChoice
from .application_list_params import ApplicationListParams as ApplicationListParams
from .chat_completion_message import ChatCompletionMessage as ChatCompletionMessage
from .question_response_chunk import QuestionResponseChunk as QuestionResponseChunk
from .tool_parse_pdf_response import ToolParsePdfResponse as ToolParsePdfResponse
from .completion_create_params import CompletionCreateParams as CompletionCreateParams
from .application_list_response import ApplicationListResponse as ApplicationListResponse
from .application_retrieve_response import ApplicationRetrieveResponse as ApplicationRetrieveResponse
from .graph_add_file_to_graph_params import GraphAddFileToGraphParams as GraphAddFileToGraphParams
from .application_generate_content_chunk import ApplicationGenerateContentChunk as ApplicationGenerateContentChunk
from .application_generate_content_params import ApplicationGenerateContentParams as ApplicationGenerateContentParams
Expand Down
24 changes: 24 additions & 0 deletions src/writerai/types/application_list_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, TypedDict

__all__ = ["ApplicationListParams"]


class ApplicationListParams(TypedDict, total=False):
after: str
"""Return results after this application ID for pagination."""

before: str
"""Return results before this application ID for pagination."""

limit: int
"""Maximum number of applications to return in the response."""

order: Literal["asc", "desc"]
"""Sort order for the results based on creation time."""

type: Literal["generation"]
"""Filter applications by their type."""
Loading