diff options
| author | Kevin King <[email protected]> | 2025-10-28 19:32:45 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-28 18:32:45 -0500 |
| commit | 0e60f666043910afb96e9de2f84b0b8a68c7e4d6 (patch) | |
| tree | 6ca20af712e2faca6262f029d6d8499c9888eb50 /packages/sdk/python/src/opencode_ai/api | |
| parent | fc8db6cdf9cb81e29c5dda69c8646aa52e453a9c (diff) | |
| download | opencode-0e60f666043910afb96e9de2f84b0b8a68c7e4d6.tar.gz opencode-0e60f666043910afb96e9de2f84b0b8a68c7e4d6.zip | |
ignore: python sdk (#2779)
Co-authored-by: Aiden Cline <[email protected]>
Diffstat (limited to 'packages/sdk/python/src/opencode_ai/api')
19 files changed, 2967 insertions, 0 deletions
diff --git a/packages/sdk/python/src/opencode_ai/api/__init__.py b/packages/sdk/python/src/opencode_ai/api/__init__.py new file mode 100644 index 000000000..81f9fa241 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/__init__.py @@ -0,0 +1 @@ +"""Contains methods for accessing the API""" diff --git a/packages/sdk/python/src/opencode_ai/api/default/__init__.py b/packages/sdk/python/src/opencode_ai/api/default/__init__.py new file mode 100644 index 000000000..2d7c0b23d --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/packages/sdk/python/src/opencode_ai/api/default/app_agents.py b/packages/sdk/python/src/opencode_ai/api/default/app_agents.py new file mode 100644 index 000000000..075b6ed2b --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/app_agents.py @@ -0,0 +1,160 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.agent import Agent +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/agent", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list["Agent"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Agent.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list["Agent"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Agent"]]: + """List all agents + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Agent']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Agent"]]: + """List all agents + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Agent'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Agent"]]: + """List all agents + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Agent']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Agent"]]: + """List all agents + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Agent'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/command_list.py b/packages/sdk/python/src/opencode_ai/api/default/command_list.py new file mode 100644 index 000000000..976a24584 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/command_list.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.command import Command +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/command", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[list["Command"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Command.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[list["Command"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Command"]]: + """List all commands + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Command']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Command"]]: + """List all commands + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Command'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Command"]]: + """List all commands + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Command']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Command"]]: + """List all commands + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Command'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/config_get.py b/packages/sdk/python/src/opencode_ai/api/default/config_get.py new file mode 100644 index 000000000..71e387ffb --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/config_get.py @@ -0,0 +1,155 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.config import Config +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/config", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Config]: + if response.status_code == 200: + response_200 = Config.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Config]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Config]: + """Get config info + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Config] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Config]: + """Get config info + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Config + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Config]: + """Get config info + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Config] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Config]: + """Get config info + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Config + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/config_providers.py b/packages/sdk/python/src/opencode_ai/api/default/config_providers.py new file mode 100644 index 000000000..a7f031c49 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/config_providers.py @@ -0,0 +1,159 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.config_providers_response_200 import ConfigProvidersResponse200 +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/config/providers", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[ConfigProvidersResponse200]: + if response.status_code == 200: + response_200 = ConfigProvidersResponse200.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[ConfigProvidersResponse200]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[ConfigProvidersResponse200]: + """List all providers + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ConfigProvidersResponse200] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[ConfigProvidersResponse200]: + """List all providers + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ConfigProvidersResponse200 + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[ConfigProvidersResponse200]: + """List all providers + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ConfigProvidersResponse200] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[ConfigProvidersResponse200]: + """List all providers + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ConfigProvidersResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/event_subscribe.py b/packages/sdk/python/src/opencode_ai/api/default/event_subscribe.py new file mode 100644 index 000000000..9b86214e2 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/event_subscribe.py @@ -0,0 +1,447 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.event_file_edited import EventFileEdited +from ...models.event_file_watcher_updated import EventFileWatcherUpdated +from ...models.event_ide_installed import EventIdeInstalled +from ...models.event_installation_updated import EventInstallationUpdated +from ...models.event_lsp_client_diagnostics import EventLspClientDiagnostics +from ...models.event_message_part_removed import EventMessagePartRemoved +from ...models.event_message_part_updated import EventMessagePartUpdated +from ...models.event_message_removed import EventMessageRemoved +from ...models.event_message_updated import EventMessageUpdated +from ...models.event_permission_replied import EventPermissionReplied +from ...models.event_permission_updated import EventPermissionUpdated +from ...models.event_server_connected import EventServerConnected +from ...models.event_session_compacted import EventSessionCompacted +from ...models.event_session_deleted import EventSessionDeleted +from ...models.event_session_error import EventSessionError +from ...models.event_session_idle import EventSessionIdle +from ...models.event_session_updated import EventSessionUpdated +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/event", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + if response.status_code == 200: + + def _parse_response_200( + data: object, + ) -> Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ]: + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_0 = EventInstallationUpdated.from_dict(data) + + return componentsschemas_event_type_0 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_1 = EventLspClientDiagnostics.from_dict(data) + + return componentsschemas_event_type_1 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_2 = EventMessageUpdated.from_dict(data) + + return componentsschemas_event_type_2 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_3 = EventMessageRemoved.from_dict(data) + + return componentsschemas_event_type_3 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_4 = EventMessagePartUpdated.from_dict(data) + + return componentsschemas_event_type_4 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_5 = EventMessagePartRemoved.from_dict(data) + + return componentsschemas_event_type_5 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_6 = EventSessionCompacted.from_dict(data) + + return componentsschemas_event_type_6 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_7 = EventPermissionUpdated.from_dict(data) + + return componentsschemas_event_type_7 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_8 = EventPermissionReplied.from_dict(data) + + return componentsschemas_event_type_8 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_9 = EventFileEdited.from_dict(data) + + return componentsschemas_event_type_9 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_10 = EventSessionIdle.from_dict(data) + + return componentsschemas_event_type_10 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_11 = EventSessionUpdated.from_dict(data) + + return componentsschemas_event_type_11 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_12 = EventSessionDeleted.from_dict(data) + + return componentsschemas_event_type_12 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_13 = EventSessionError.from_dict(data) + + return componentsschemas_event_type_13 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_14 = EventFileWatcherUpdated.from_dict(data) + + return componentsschemas_event_type_14 + except: # noqa: E722 + pass + try: + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_15 = EventServerConnected.from_dict(data) + + return componentsschemas_event_type_15 + except: # noqa: E722 + pass + if not isinstance(data, dict): + raise TypeError() + componentsschemas_event_type_16 = EventIdeInstalled.from_dict(data) + + return componentsschemas_event_type_16 + + response_200 = _parse_response_200(response.text) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + """Get events + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union['EventFileEdited', 'EventFileWatcherUpdated', 'EventIdeInstalled', 'EventInstallationUpdated', 'EventLspClientDiagnostics', 'EventMessagePartRemoved', 'EventMessagePartUpdated', 'EventMessageRemoved', 'EventMessageUpdated', 'EventPermissionReplied', 'EventPermissionUpdated', 'EventServerConnected', 'EventSessionCompacted', 'EventSessionDeleted', 'EventSessionError', 'EventSessionIdle', 'EventSessionUpdated']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + """Get events + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union['EventFileEdited', 'EventFileWatcherUpdated', 'EventIdeInstalled', 'EventInstallationUpdated', 'EventLspClientDiagnostics', 'EventMessagePartRemoved', 'EventMessagePartUpdated', 'EventMessageRemoved', 'EventMessageUpdated', 'EventPermissionReplied', 'EventPermissionUpdated', 'EventServerConnected', 'EventSessionCompacted', 'EventSessionDeleted', 'EventSessionError', 'EventSessionIdle', 'EventSessionUpdated'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + """Get events + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union['EventFileEdited', 'EventFileWatcherUpdated', 'EventIdeInstalled', 'EventInstallationUpdated', 'EventLspClientDiagnostics', 'EventMessagePartRemoved', 'EventMessagePartUpdated', 'EventMessageRemoved', 'EventMessageUpdated', 'EventPermissionReplied', 'EventPermissionUpdated', 'EventServerConnected', 'EventSessionCompacted', 'EventSessionDeleted', 'EventSessionError', 'EventSessionIdle', 'EventSessionUpdated']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[ + Union[ + "EventFileEdited", + "EventFileWatcherUpdated", + "EventIdeInstalled", + "EventInstallationUpdated", + "EventLspClientDiagnostics", + "EventMessagePartRemoved", + "EventMessagePartUpdated", + "EventMessageRemoved", + "EventMessageUpdated", + "EventPermissionReplied", + "EventPermissionUpdated", + "EventServerConnected", + "EventSessionCompacted", + "EventSessionDeleted", + "EventSessionError", + "EventSessionIdle", + "EventSessionUpdated", + ] +]: + """Get events + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union['EventFileEdited', 'EventFileWatcherUpdated', 'EventIdeInstalled', 'EventInstallationUpdated', 'EventLspClientDiagnostics', 'EventMessagePartRemoved', 'EventMessagePartUpdated', 'EventMessageRemoved', 'EventMessageUpdated', 'EventPermissionReplied', 'EventPermissionUpdated', 'EventServerConnected', 'EventSessionCompacted', 'EventSessionDeleted', 'EventSessionError', 'EventSessionIdle', 'EventSessionUpdated'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/file_status.py b/packages/sdk/python/src/opencode_ai/api/default/file_status.py new file mode 100644 index 000000000..8eecc3f2d --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/file_status.py @@ -0,0 +1,160 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.file import File +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/file/status", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[list["File"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = File.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[list["File"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["File"]]: + """Get file status + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['File']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["File"]]: + """Get file status + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['File'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["File"]]: + """Get file status + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['File']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["File"]]: + """Get file status + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['File'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/path_get.py b/packages/sdk/python/src/opencode_ai/api/default/path_get.py new file mode 100644 index 000000000..c869a4586 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/path_get.py @@ -0,0 +1,155 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.path import Path +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/path", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Path]: + if response.status_code == 200: + response_200 = Path.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Path]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Path]: + """Get the current path + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Path] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Path]: + """Get the current path + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Path + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Path]: + """Get the current path + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Path] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Path]: + """Get the current path + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Path + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/project_current.py b/packages/sdk/python/src/opencode_ai/api/default/project_current.py new file mode 100644 index 000000000..712c6fd43 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/project_current.py @@ -0,0 +1,155 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.project import Project +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/project/current", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Project]: + if response.status_code == 200: + response_200 = Project.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Project]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Project]: + """Get the current project + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Project] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Project]: + """Get the current project + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Project + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Project]: + """Get the current project + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Project] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Project]: + """Get the current project + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Project + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/project_list.py b/packages/sdk/python/src/opencode_ai/api/default/project_list.py new file mode 100644 index 000000000..5ec38ae2b --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/project_list.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.project import Project +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/project", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[list["Project"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Project.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[list["Project"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Project"]]: + """List all projects + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Project']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Project"]]: + """List all projects + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Project'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Project"]]: + """List all projects + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Project']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Project"]]: + """List all projects + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Project'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/session_list.py b/packages/sdk/python/src/opencode_ai/api/default/session_list.py new file mode 100644 index 000000000..8e7fd6a6f --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/session_list.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.session import Session +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/session", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[list["Session"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Session.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[list["Session"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Session"]]: + """List all sessions + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Session']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Session"]]: + """List all sessions + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Session'] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[list["Session"]]: + """List all sessions + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Session']] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[list["Session"]]: + """List all sessions + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Session'] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tool_ids.py b/packages/sdk/python/src/opencode_ai/api/default/tool_ids.py new file mode 100644 index 000000000..0315cd195 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tool_ids.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/experimental/tool/ids", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list[str]]]: + if response.status_code == 200: + response_200 = cast(list[str], response.json()) + + return response_200 + + if response.status_code == 400: + response_400 = Error.from_dict(response.json()) + + return response_400 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list[str]]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list[str]]]: + """List all tool IDs (including built-in and dynamically registered) + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, list[str]]] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list[str]]]: + """List all tool IDs (including built-in and dynamically registered) + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, list[str]] + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list[str]]]: + """List all tool IDs (including built-in and dynamically registered) + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Error, list[str]]] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list[str]]]: + """List all tool IDs (including built-in and dynamically registered) + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Error, list[str]] + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_clear_prompt.py b/packages/sdk/python/src/opencode_ai/api/default/tui_clear_prompt.py new file mode 100644 index 000000000..a7c5ef50d --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_clear_prompt.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/clear-prompt", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Clear the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Clear the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Clear the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Clear the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_open_help.py b/packages/sdk/python/src/opencode_ai/api/default/tui_open_help.py new file mode 100644 index 000000000..e7ae959a7 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_open_help.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/open-help", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the help dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the help dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the help dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the help dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_open_models.py b/packages/sdk/python/src/opencode_ai/api/default/tui_open_models.py new file mode 100644 index 000000000..a6dddf136 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_open_models.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/open-models", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the model dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the model dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the model dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the model dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_open_sessions.py b/packages/sdk/python/src/opencode_ai/api/default/tui_open_sessions.py new file mode 100644 index 000000000..579934f26 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_open_sessions.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/open-sessions", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the session dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the session dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the session dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the session dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_open_themes.py b/packages/sdk/python/src/opencode_ai/api/default/tui_open_themes.py new file mode 100644 index 000000000..05db1aadf --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_open_themes.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/open-themes", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the theme dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the theme dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Open the theme dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Open the theme dialog + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed diff --git a/packages/sdk/python/src/opencode_ai/api/default/tui_submit_prompt.py b/packages/sdk/python/src/opencode_ai/api/default/tui_submit_prompt.py new file mode 100644 index 000000000..d16a75d27 --- /dev/null +++ b/packages/sdk/python/src/opencode_ai/api/default/tui_submit_prompt.py @@ -0,0 +1,153 @@ +from http import HTTPStatus +from typing import Any, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + directory: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["directory"] = directory + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/tui/submit-prompt", + "params": params, + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[bool]: + if response.status_code == 200: + response_200 = cast(bool, response.json()) + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[bool]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Submit the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Submit the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return sync_detailed( + client=client, + directory=directory, + ).parsed + + +async def asyncio_detailed( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Response[bool]: + """Submit the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[bool] + """ + + kwargs = _get_kwargs( + directory=directory, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: Union[AuthenticatedClient, Client], + directory: Union[Unset, str] = UNSET, +) -> Optional[bool]: + """Submit the prompt + + Args: + directory (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + bool + """ + + return ( + await asyncio_detailed( + client=client, + directory=directory, + ) + ).parsed |
