mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 09:14:22 +01:00
ignore: python sdk (#2779)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
14
packages/sdk/python/src/opencode_ai/__init__.py
Normal file
14
packages/sdk/python/src/opencode_ai/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""A client library for accessing opencode
|
||||
|
||||
This package is generated by openapi-python-client.
|
||||
A thin convenience wrapper `OpenCodeClient` is also provided.
|
||||
"""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
from .extras import OpenCodeClient
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
"OpenCodeClient",
|
||||
)
|
||||
1
packages/sdk/python/src/opencode_ai/api/__init__.py
Normal file
1
packages/sdk/python/src/opencode_ai/api/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Contains methods for accessing the API"""
|
||||
@@ -0,0 +1 @@
|
||||
"""Contains endpoint functions for accessing the API"""
|
||||
160
packages/sdk/python/src/opencode_ai/api/default/app_agents.py
Normal file
160
packages/sdk/python/src/opencode_ai/api/default/app_agents.py
Normal file
@@ -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
|
||||
164
packages/sdk/python/src/opencode_ai/api/default/command_list.py
Normal file
164
packages/sdk/python/src/opencode_ai/api/default/command_list.py
Normal file
@@ -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
|
||||
155
packages/sdk/python/src/opencode_ai/api/default/config_get.py
Normal file
155
packages/sdk/python/src/opencode_ai/api/default/config_get.py
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
160
packages/sdk/python/src/opencode_ai/api/default/file_status.py
Normal file
160
packages/sdk/python/src/opencode_ai/api/default/file_status.py
Normal file
@@ -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
|
||||
155
packages/sdk/python/src/opencode_ai/api/default/path_get.py
Normal file
155
packages/sdk/python/src/opencode_ai/api/default/path_get.py
Normal file
@@ -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
|
||||
@@ -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
|
||||
164
packages/sdk/python/src/opencode_ai/api/default/project_list.py
Normal file
164
packages/sdk/python/src/opencode_ai/api/default/project_list.py
Normal file
@@ -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
|
||||
164
packages/sdk/python/src/opencode_ai/api/default/session_list.py
Normal file
164
packages/sdk/python/src/opencode_ai/api/default/session_list.py
Normal file
@@ -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
|
||||
164
packages/sdk/python/src/opencode_ai/api/default/tool_ids.py
Normal file
164
packages/sdk/python/src/opencode_ai/api/default/tool_ids.py
Normal file
@@ -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
|
||||
@@ -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
|
||||
153
packages/sdk/python/src/opencode_ai/api/default/tui_open_help.py
Normal file
153
packages/sdk/python/src/opencode_ai/api/default/tui_open_help.py
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
268
packages/sdk/python/src/opencode_ai/client.py
Normal file
268
packages/sdk/python/src/opencode_ai/client.py
Normal file
@@ -0,0 +1,268 @@
|
||||
import ssl
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
from attrs import define, evolve, field
|
||||
|
||||
|
||||
@define
|
||||
class Client:
|
||||
"""A class for keeping track of data related to the API
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
def with_headers(self, headers: dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
||||
"""Manually set the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "Client":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "Client":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||
|
||||
|
||||
@define
|
||||
class AuthenticatedClient:
|
||||
"""A Client which has been authenticated for use on secured endpoints
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
token: The token to use for authentication
|
||||
prefix: The prefix to use for the Authorization header
|
||||
auth_header_name: The name of the Authorization header
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
token: str
|
||||
prefix: str = "Bearer"
|
||||
auth_header_name: str = "Authorization"
|
||||
|
||||
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
||||
"""Manually set the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||
16
packages/sdk/python/src/opencode_ai/errors.py
Normal file
16
packages/sdk/python/src/opencode_ai/errors.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Contains shared errors types that can be raised from API functions"""
|
||||
|
||||
|
||||
class UnexpectedStatus(Exception):
|
||||
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||
|
||||
def __init__(self, status_code: int, content: bytes):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
|
||||
super().__init__(
|
||||
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["UnexpectedStatus"]
|
||||
186
packages/sdk/python/src/opencode_ai/extras.py
Normal file
186
packages/sdk/python/src/opencode_ai/extras.py
Normal file
@@ -0,0 +1,186 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from typing import AsyncIterator, Dict, Iterator, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from .api.default import (
|
||||
app_agents,
|
||||
command_list,
|
||||
config_get,
|
||||
config_providers,
|
||||
file_status,
|
||||
path_get,
|
||||
project_current,
|
||||
project_list,
|
||||
session_list,
|
||||
tool_ids,
|
||||
)
|
||||
from .client import Client
|
||||
from .types import UNSET, Unset
|
||||
|
||||
|
||||
class OpenCodeClient:
|
||||
"""High-level convenience wrapper around the generated Client.
|
||||
|
||||
Provides sensible defaults and a couple of helper methods, with optional retries.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
base_url: str = "http://localhost:4096",
|
||||
*,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
timeout: Optional[float] = None,
|
||||
verify_ssl: bool | str | httpx.URLTypes | None = True,
|
||||
token: Optional[str] = None,
|
||||
auth_header_name: str = "Authorization",
|
||||
auth_prefix: str = "Bearer",
|
||||
retries: int = 0,
|
||||
backoff_factor: float = 0.5,
|
||||
status_forcelist: tuple[int, ...] = (429, 500, 502, 503, 504),
|
||||
) -> None:
|
||||
httpx_timeout = None if timeout is None else httpx.Timeout(timeout)
|
||||
all_headers = dict(headers or {})
|
||||
if token:
|
||||
all_headers[auth_header_name] = f"{auth_prefix} {token}".strip()
|
||||
self._client = Client(
|
||||
base_url=base_url,
|
||||
headers=all_headers,
|
||||
timeout=httpx_timeout,
|
||||
verify_ssl=verify_ssl if isinstance(verify_ssl, bool) else True,
|
||||
)
|
||||
self._retries = max(0, int(retries))
|
||||
self._backoff = float(backoff_factor)
|
||||
self._status_forcelist = set(status_forcelist)
|
||||
|
||||
@property
|
||||
def client(self) -> Client:
|
||||
return self._client
|
||||
|
||||
# ---- Internal retry helper ----
|
||||
|
||||
def _call_with_retries(self, fn, *args, **kwargs):
|
||||
attempt = 0
|
||||
while True:
|
||||
try:
|
||||
return fn(*args, **kwargs)
|
||||
except httpx.RequestError:
|
||||
pass
|
||||
except httpx.HTTPStatusError as e:
|
||||
if e.response is None or e.response.status_code not in self._status_forcelist:
|
||||
raise
|
||||
if attempt >= self._retries:
|
||||
# re-raise last exception if we have one
|
||||
raise
|
||||
sleep = self._backoff * (2**attempt)
|
||||
time.sleep(sleep)
|
||||
attempt += 1
|
||||
|
||||
# ---- Convenience wrappers over generated endpoints ----
|
||||
|
||||
def list_sessions(self, *, directory: str | Unset = UNSET):
|
||||
"""Return sessions in the current project.
|
||||
|
||||
Wraps GET /session. Pass `directory` to target a specific project/directory if needed.
|
||||
"""
|
||||
return self._call_with_retries(session_list.sync, client=self._client, directory=directory)
|
||||
|
||||
def get_config(self, *, directory: str | Unset = UNSET):
|
||||
"""Return opencode configuration for the current project (GET /config)."""
|
||||
return self._call_with_retries(config_get.sync, client=self._client, directory=directory)
|
||||
|
||||
def list_agents(self, *, directory: str | Unset = UNSET):
|
||||
"""List configured agents (GET /agent)."""
|
||||
return self._call_with_retries(app_agents.sync, client=self._client, directory=directory)
|
||||
|
||||
def list_projects(self, *, directory: str | Unset = UNSET):
|
||||
"""List known projects (GET /project)."""
|
||||
return self._call_with_retries(project_list.sync, client=self._client, directory=directory)
|
||||
|
||||
def current_project(self, *, directory: str | Unset = UNSET):
|
||||
"""Return current project (GET /project/current)."""
|
||||
return self._call_with_retries(project_current.sync, client=self._client, directory=directory)
|
||||
|
||||
def file_status(self, *, directory: str | Unset = UNSET):
|
||||
"""Return file status list (GET /file/status)."""
|
||||
return self._call_with_retries(file_status.sync, client=self._client, directory=directory)
|
||||
|
||||
def get_path(self, *, directory: str | Unset = UNSET):
|
||||
"""Return opencode path info (GET /path)."""
|
||||
return self._call_with_retries(path_get.sync, client=self._client, directory=directory)
|
||||
|
||||
def config_providers(self, *, directory: str | Unset = UNSET):
|
||||
"""Return configured providers (GET /config/providers)."""
|
||||
return self._call_with_retries(config_providers.sync, client=self._client, directory=directory)
|
||||
|
||||
def tool_ids(self, *, directory: str | Unset = UNSET):
|
||||
"""Return tool identifiers for a provider/model pair (GET /experimental/tool)."""
|
||||
return self._call_with_retries(tool_ids.sync, client=self._client, directory=directory)
|
||||
|
||||
def list_commands(self, *, directory: str | Unset = UNSET):
|
||||
"""List commands (GET /command)."""
|
||||
return self._call_with_retries(command_list.sync, client=self._client, directory=directory)
|
||||
|
||||
# ---- Server-Sent Events (SSE) streaming ----
|
||||
|
||||
def subscribe_events(self, *, directory: str | Unset = UNSET) -> Iterator[dict]:
|
||||
"""Subscribe to /event SSE endpoint and yield parsed JSON events.
|
||||
|
||||
This is a blocking generator which yields one event dict per message.
|
||||
"""
|
||||
client = self._client.get_httpx_client()
|
||||
params: dict[str, str] = {}
|
||||
if directory is not UNSET and directory is not None:
|
||||
params["directory"] = str(directory)
|
||||
with client.stream("GET", "/event", headers={"Accept": "text/event-stream"}, params=params) as r:
|
||||
r.raise_for_status()
|
||||
buf = ""
|
||||
for line_bytes in r.iter_lines():
|
||||
line = line_bytes.decode("utf-8") if isinstance(line_bytes, (bytes, bytearray)) else str(line_bytes)
|
||||
if line.startswith(":"):
|
||||
# comment/heartbeat
|
||||
continue
|
||||
if line == "":
|
||||
if buf:
|
||||
# end of event
|
||||
for part in buf.split("\n"):
|
||||
if part.startswith("data:"):
|
||||
data = part[5:].strip()
|
||||
if data:
|
||||
try:
|
||||
yield httpx._models.jsonlib.loads(data) # type: ignore[attr-defined]
|
||||
except Exception:
|
||||
# fall back: skip malformed
|
||||
pass
|
||||
buf = ""
|
||||
continue
|
||||
buf += line + "\n"
|
||||
|
||||
async def subscribe_events_async(self, *, directory: str | Unset = UNSET) -> AsyncIterator[dict]:
|
||||
"""Async variant of subscribe_events using httpx.AsyncClient."""
|
||||
aclient = self._client.get_async_httpx_client()
|
||||
params: dict[str, str] = {}
|
||||
if directory is not UNSET and directory is not None:
|
||||
params["directory"] = str(directory)
|
||||
async with aclient.stream("GET", "/event", headers={"Accept": "text/event-stream"}, params=params) as r:
|
||||
r.raise_for_status()
|
||||
buf = ""
|
||||
async for line_bytes in r.aiter_lines():
|
||||
line = line_bytes
|
||||
if line.startswith(":"):
|
||||
continue
|
||||
if line == "":
|
||||
if buf:
|
||||
for part in buf.split("\n"):
|
||||
if part.startswith("data:"):
|
||||
data = part[5:].strip()
|
||||
if data:
|
||||
try:
|
||||
yield httpx._models.jsonlib.loads(data) # type: ignore[attr-defined]
|
||||
except Exception:
|
||||
pass
|
||||
buf = ""
|
||||
continue
|
||||
buf += line + "\n"
|
||||
367
packages/sdk/python/src/opencode_ai/models/__init__.py
Normal file
367
packages/sdk/python/src/opencode_ai/models/__init__.py
Normal file
@@ -0,0 +1,367 @@
|
||||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .agent import Agent
|
||||
from .agent_config import AgentConfig
|
||||
from .agent_config_permission import AgentConfigPermission
|
||||
from .agent_config_permission_bash_type_1 import AgentConfigPermissionBashType1
|
||||
from .agent_config_tools import AgentConfigTools
|
||||
from .agent_model import AgentModel
|
||||
from .agent_options import AgentOptions
|
||||
from .agent_part import AgentPart
|
||||
from .agent_part_input import AgentPartInput
|
||||
from .agent_part_input_source import AgentPartInputSource
|
||||
from .agent_part_source import AgentPartSource
|
||||
from .agent_permission import AgentPermission
|
||||
from .agent_permission_bash import AgentPermissionBash
|
||||
from .agent_tools import AgentTools
|
||||
from .api_auth import ApiAuth
|
||||
from .assistant_message import AssistantMessage
|
||||
from .assistant_message_path import AssistantMessagePath
|
||||
from .assistant_message_time import AssistantMessageTime
|
||||
from .assistant_message_tokens import AssistantMessageTokens
|
||||
from .assistant_message_tokens_cache import AssistantMessageTokensCache
|
||||
from .command import Command
|
||||
from .config import Config
|
||||
from .config_agent import ConfigAgent
|
||||
from .config_command import ConfigCommand
|
||||
from .config_command_additional_property import ConfigCommandAdditionalProperty
|
||||
from .config_experimental import ConfigExperimental
|
||||
from .config_experimental_hook import ConfigExperimentalHook
|
||||
from .config_experimental_hook_file_edited import ConfigExperimentalHookFileEdited
|
||||
from .config_experimental_hook_file_edited_additional_property_item import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItem,
|
||||
)
|
||||
from .config_experimental_hook_file_edited_additional_property_item_environment import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment,
|
||||
)
|
||||
from .config_experimental_hook_session_completed_item import ConfigExperimentalHookSessionCompletedItem
|
||||
from .config_experimental_hook_session_completed_item_environment import (
|
||||
ConfigExperimentalHookSessionCompletedItemEnvironment,
|
||||
)
|
||||
from .config_formatter import ConfigFormatter
|
||||
from .config_formatter_additional_property import ConfigFormatterAdditionalProperty
|
||||
from .config_formatter_additional_property_environment import ConfigFormatterAdditionalPropertyEnvironment
|
||||
from .config_lsp import ConfigLsp
|
||||
from .config_lsp_additional_property_type_0 import ConfigLspAdditionalPropertyType0
|
||||
from .config_lsp_additional_property_type_1 import ConfigLspAdditionalPropertyType1
|
||||
from .config_lsp_additional_property_type_1_env import ConfigLspAdditionalPropertyType1Env
|
||||
from .config_lsp_additional_property_type_1_initialization import ConfigLspAdditionalPropertyType1Initialization
|
||||
from .config_mcp import ConfigMcp
|
||||
from .config_mode import ConfigMode
|
||||
from .config_permission import ConfigPermission
|
||||
from .config_permission_bash_type_1 import ConfigPermissionBashType1
|
||||
from .config_provider import ConfigProvider
|
||||
from .config_provider_additional_property import ConfigProviderAdditionalProperty
|
||||
from .config_provider_additional_property_models import ConfigProviderAdditionalPropertyModels
|
||||
from .config_provider_additional_property_models_additional_property import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalProperty,
|
||||
)
|
||||
from .config_provider_additional_property_models_additional_property_cost import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost,
|
||||
)
|
||||
from .config_provider_additional_property_models_additional_property_limit import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit,
|
||||
)
|
||||
from .config_provider_additional_property_models_additional_property_options import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions,
|
||||
)
|
||||
from .config_provider_additional_property_models_additional_property_provider import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider,
|
||||
)
|
||||
from .config_provider_additional_property_options import ConfigProviderAdditionalPropertyOptions
|
||||
from .config_providers_response_200 import ConfigProvidersResponse200
|
||||
from .config_providers_response_200_default import ConfigProvidersResponse200Default
|
||||
from .config_share import ConfigShare
|
||||
from .config_tools import ConfigTools
|
||||
from .config_tui import ConfigTui
|
||||
from .config_watcher import ConfigWatcher
|
||||
from .error import Error
|
||||
from .error_data import ErrorData
|
||||
from .event_file_edited import EventFileEdited
|
||||
from .event_file_edited_properties import EventFileEditedProperties
|
||||
from .event_file_watcher_updated import EventFileWatcherUpdated
|
||||
from .event_file_watcher_updated_properties import EventFileWatcherUpdatedProperties
|
||||
from .event_ide_installed import EventIdeInstalled
|
||||
from .event_ide_installed_properties import EventIdeInstalledProperties
|
||||
from .event_installation_updated import EventInstallationUpdated
|
||||
from .event_installation_updated_properties import EventInstallationUpdatedProperties
|
||||
from .event_lsp_client_diagnostics import EventLspClientDiagnostics
|
||||
from .event_lsp_client_diagnostics_properties import EventLspClientDiagnosticsProperties
|
||||
from .event_message_part_removed import EventMessagePartRemoved
|
||||
from .event_message_part_removed_properties import EventMessagePartRemovedProperties
|
||||
from .event_message_part_updated import EventMessagePartUpdated
|
||||
from .event_message_part_updated_properties import EventMessagePartUpdatedProperties
|
||||
from .event_message_removed import EventMessageRemoved
|
||||
from .event_message_removed_properties import EventMessageRemovedProperties
|
||||
from .event_message_updated import EventMessageUpdated
|
||||
from .event_message_updated_properties import EventMessageUpdatedProperties
|
||||
from .event_permission_replied import EventPermissionReplied
|
||||
from .event_permission_replied_properties import EventPermissionRepliedProperties
|
||||
from .event_permission_updated import EventPermissionUpdated
|
||||
from .event_server_connected import EventServerConnected
|
||||
from .event_server_connected_properties import EventServerConnectedProperties
|
||||
from .event_session_compacted import EventSessionCompacted
|
||||
from .event_session_compacted_properties import EventSessionCompactedProperties
|
||||
from .event_session_deleted import EventSessionDeleted
|
||||
from .event_session_deleted_properties import EventSessionDeletedProperties
|
||||
from .event_session_error import EventSessionError
|
||||
from .event_session_error_properties import EventSessionErrorProperties
|
||||
from .event_session_idle import EventSessionIdle
|
||||
from .event_session_idle_properties import EventSessionIdleProperties
|
||||
from .event_session_updated import EventSessionUpdated
|
||||
from .event_session_updated_properties import EventSessionUpdatedProperties
|
||||
from .file import File
|
||||
from .file_content import FileContent
|
||||
from .file_content_patch import FileContentPatch
|
||||
from .file_content_patch_hunks_item import FileContentPatchHunksItem
|
||||
from .file_node import FileNode
|
||||
from .file_node_type import FileNodeType
|
||||
from .file_part import FilePart
|
||||
from .file_part_input import FilePartInput
|
||||
from .file_part_source_text import FilePartSourceText
|
||||
from .file_source import FileSource
|
||||
from .file_status import FileStatus
|
||||
from .keybinds_config import KeybindsConfig
|
||||
from .layout_config import LayoutConfig
|
||||
from .mcp_local_config import McpLocalConfig
|
||||
from .mcp_local_config_environment import McpLocalConfigEnvironment
|
||||
from .mcp_remote_config import McpRemoteConfig
|
||||
from .mcp_remote_config_headers import McpRemoteConfigHeaders
|
||||
from .message_aborted_error import MessageAbortedError
|
||||
from .message_aborted_error_data import MessageAbortedErrorData
|
||||
from .message_output_length_error import MessageOutputLengthError
|
||||
from .message_output_length_error_data import MessageOutputLengthErrorData
|
||||
from .model import Model
|
||||
from .model_cost import ModelCost
|
||||
from .model_limit import ModelLimit
|
||||
from .model_options import ModelOptions
|
||||
from .model_provider import ModelProvider
|
||||
from .o_auth import OAuth
|
||||
from .patch_part import PatchPart
|
||||
from .path import Path
|
||||
from .permission import Permission
|
||||
from .permission_metadata import PermissionMetadata
|
||||
from .permission_time import PermissionTime
|
||||
from .project import Project
|
||||
from .project_time import ProjectTime
|
||||
from .provider import Provider
|
||||
from .provider_auth_error import ProviderAuthError
|
||||
from .provider_auth_error_data import ProviderAuthErrorData
|
||||
from .provider_models import ProviderModels
|
||||
from .range_ import Range
|
||||
from .range_end import RangeEnd
|
||||
from .range_start import RangeStart
|
||||
from .reasoning_part import ReasoningPart
|
||||
from .reasoning_part_metadata import ReasoningPartMetadata
|
||||
from .reasoning_part_time import ReasoningPartTime
|
||||
from .session import Session
|
||||
from .session_revert import SessionRevert
|
||||
from .session_share import SessionShare
|
||||
from .session_time import SessionTime
|
||||
from .snapshot_part import SnapshotPart
|
||||
from .step_finish_part import StepFinishPart
|
||||
from .step_finish_part_tokens import StepFinishPartTokens
|
||||
from .step_finish_part_tokens_cache import StepFinishPartTokensCache
|
||||
from .step_start_part import StepStartPart
|
||||
from .symbol import Symbol
|
||||
from .symbol_location import SymbolLocation
|
||||
from .symbol_source import SymbolSource
|
||||
from .text_part import TextPart
|
||||
from .text_part_input import TextPartInput
|
||||
from .text_part_input_time import TextPartInputTime
|
||||
from .text_part_time import TextPartTime
|
||||
from .tool_list_item import ToolListItem
|
||||
from .tool_part import ToolPart
|
||||
from .tool_state_completed import ToolStateCompleted
|
||||
from .tool_state_completed_input import ToolStateCompletedInput
|
||||
from .tool_state_completed_metadata import ToolStateCompletedMetadata
|
||||
from .tool_state_completed_time import ToolStateCompletedTime
|
||||
from .tool_state_error import ToolStateError
|
||||
from .tool_state_error_input import ToolStateErrorInput
|
||||
from .tool_state_error_metadata import ToolStateErrorMetadata
|
||||
from .tool_state_error_time import ToolStateErrorTime
|
||||
from .tool_state_pending import ToolStatePending
|
||||
from .tool_state_running import ToolStateRunning
|
||||
from .tool_state_running_metadata import ToolStateRunningMetadata
|
||||
from .tool_state_running_time import ToolStateRunningTime
|
||||
from .unknown_error import UnknownError
|
||||
from .unknown_error_data import UnknownErrorData
|
||||
from .user_message import UserMessage
|
||||
from .user_message_time import UserMessageTime
|
||||
from .well_known_auth import WellKnownAuth
|
||||
|
||||
__all__ = (
|
||||
"Agent",
|
||||
"AgentConfig",
|
||||
"AgentConfigPermission",
|
||||
"AgentConfigPermissionBashType1",
|
||||
"AgentConfigTools",
|
||||
"AgentModel",
|
||||
"AgentOptions",
|
||||
"AgentPart",
|
||||
"AgentPartInput",
|
||||
"AgentPartInputSource",
|
||||
"AgentPartSource",
|
||||
"AgentPermission",
|
||||
"AgentPermissionBash",
|
||||
"AgentTools",
|
||||
"ApiAuth",
|
||||
"AssistantMessage",
|
||||
"AssistantMessagePath",
|
||||
"AssistantMessageTime",
|
||||
"AssistantMessageTokens",
|
||||
"AssistantMessageTokensCache",
|
||||
"Command",
|
||||
"Config",
|
||||
"ConfigAgent",
|
||||
"ConfigCommand",
|
||||
"ConfigCommandAdditionalProperty",
|
||||
"ConfigExperimental",
|
||||
"ConfigExperimentalHook",
|
||||
"ConfigExperimentalHookFileEdited",
|
||||
"ConfigExperimentalHookFileEditedAdditionalPropertyItem",
|
||||
"ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment",
|
||||
"ConfigExperimentalHookSessionCompletedItem",
|
||||
"ConfigExperimentalHookSessionCompletedItemEnvironment",
|
||||
"ConfigFormatter",
|
||||
"ConfigFormatterAdditionalProperty",
|
||||
"ConfigFormatterAdditionalPropertyEnvironment",
|
||||
"ConfigLsp",
|
||||
"ConfigLspAdditionalPropertyType0",
|
||||
"ConfigLspAdditionalPropertyType1",
|
||||
"ConfigLspAdditionalPropertyType1Env",
|
||||
"ConfigLspAdditionalPropertyType1Initialization",
|
||||
"ConfigMcp",
|
||||
"ConfigMode",
|
||||
"ConfigPermission",
|
||||
"ConfigPermissionBashType1",
|
||||
"ConfigProvider",
|
||||
"ConfigProviderAdditionalProperty",
|
||||
"ConfigProviderAdditionalPropertyModels",
|
||||
"ConfigProviderAdditionalPropertyModelsAdditionalProperty",
|
||||
"ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost",
|
||||
"ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit",
|
||||
"ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions",
|
||||
"ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider",
|
||||
"ConfigProviderAdditionalPropertyOptions",
|
||||
"ConfigProvidersResponse200",
|
||||
"ConfigProvidersResponse200Default",
|
||||
"ConfigShare",
|
||||
"ConfigTools",
|
||||
"ConfigTui",
|
||||
"ConfigWatcher",
|
||||
"Error",
|
||||
"ErrorData",
|
||||
"EventFileEdited",
|
||||
"EventFileEditedProperties",
|
||||
"EventFileWatcherUpdated",
|
||||
"EventFileWatcherUpdatedProperties",
|
||||
"EventIdeInstalled",
|
||||
"EventIdeInstalledProperties",
|
||||
"EventInstallationUpdated",
|
||||
"EventInstallationUpdatedProperties",
|
||||
"EventLspClientDiagnostics",
|
||||
"EventLspClientDiagnosticsProperties",
|
||||
"EventMessagePartRemoved",
|
||||
"EventMessagePartRemovedProperties",
|
||||
"EventMessagePartUpdated",
|
||||
"EventMessagePartUpdatedProperties",
|
||||
"EventMessageRemoved",
|
||||
"EventMessageRemovedProperties",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventPermissionReplied",
|
||||
"EventPermissionRepliedProperties",
|
||||
"EventPermissionUpdated",
|
||||
"EventServerConnected",
|
||||
"EventServerConnectedProperties",
|
||||
"EventSessionCompacted",
|
||||
"EventSessionCompactedProperties",
|
||||
"EventSessionDeleted",
|
||||
"EventSessionDeletedProperties",
|
||||
"EventSessionError",
|
||||
"EventSessionErrorProperties",
|
||||
"EventSessionIdle",
|
||||
"EventSessionIdleProperties",
|
||||
"EventSessionUpdated",
|
||||
"EventSessionUpdatedProperties",
|
||||
"File",
|
||||
"FileContent",
|
||||
"FileContentPatch",
|
||||
"FileContentPatchHunksItem",
|
||||
"FileNode",
|
||||
"FileNodeType",
|
||||
"FilePart",
|
||||
"FilePartInput",
|
||||
"FilePartSourceText",
|
||||
"FileSource",
|
||||
"FileStatus",
|
||||
"KeybindsConfig",
|
||||
"LayoutConfig",
|
||||
"McpLocalConfig",
|
||||
"McpLocalConfigEnvironment",
|
||||
"McpRemoteConfig",
|
||||
"McpRemoteConfigHeaders",
|
||||
"MessageAbortedError",
|
||||
"MessageAbortedErrorData",
|
||||
"MessageOutputLengthError",
|
||||
"MessageOutputLengthErrorData",
|
||||
"Model",
|
||||
"ModelCost",
|
||||
"ModelLimit",
|
||||
"ModelOptions",
|
||||
"ModelProvider",
|
||||
"OAuth",
|
||||
"PatchPart",
|
||||
"Path",
|
||||
"Permission",
|
||||
"PermissionMetadata",
|
||||
"PermissionTime",
|
||||
"Project",
|
||||
"ProjectTime",
|
||||
"Provider",
|
||||
"ProviderAuthError",
|
||||
"ProviderAuthErrorData",
|
||||
"ProviderModels",
|
||||
"Range",
|
||||
"RangeEnd",
|
||||
"RangeStart",
|
||||
"ReasoningPart",
|
||||
"ReasoningPartMetadata",
|
||||
"ReasoningPartTime",
|
||||
"Session",
|
||||
"SessionRevert",
|
||||
"SessionShare",
|
||||
"SessionTime",
|
||||
"SnapshotPart",
|
||||
"StepFinishPart",
|
||||
"StepFinishPartTokens",
|
||||
"StepFinishPartTokensCache",
|
||||
"StepStartPart",
|
||||
"Symbol",
|
||||
"SymbolLocation",
|
||||
"SymbolSource",
|
||||
"TextPart",
|
||||
"TextPartInput",
|
||||
"TextPartInputTime",
|
||||
"TextPartTime",
|
||||
"ToolListItem",
|
||||
"ToolPart",
|
||||
"ToolStateCompleted",
|
||||
"ToolStateCompletedInput",
|
||||
"ToolStateCompletedMetadata",
|
||||
"ToolStateCompletedTime",
|
||||
"ToolStateError",
|
||||
"ToolStateErrorInput",
|
||||
"ToolStateErrorMetadata",
|
||||
"ToolStateErrorTime",
|
||||
"ToolStatePending",
|
||||
"ToolStateRunning",
|
||||
"ToolStateRunningMetadata",
|
||||
"ToolStateRunningTime",
|
||||
"UnknownError",
|
||||
"UnknownErrorData",
|
||||
"UserMessage",
|
||||
"UserMessageTime",
|
||||
"WellKnownAuth",
|
||||
)
|
||||
180
packages/sdk/python/src/opencode_ai/models/agent.py
Normal file
180
packages/sdk/python/src/opencode_ai/models/agent.py
Normal file
@@ -0,0 +1,180 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_model import AgentModel
|
||||
from ..models.agent_options import AgentOptions
|
||||
from ..models.agent_permission import AgentPermission
|
||||
from ..models.agent_tools import AgentTools
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Agent")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Agent:
|
||||
"""
|
||||
Attributes:
|
||||
name (str):
|
||||
mode (Union[Literal['all'], Literal['primary'], Literal['subagent']]):
|
||||
built_in (bool):
|
||||
permission (AgentPermission):
|
||||
tools (AgentTools):
|
||||
options (AgentOptions):
|
||||
description (Union[Unset, str]):
|
||||
top_p (Union[Unset, float]):
|
||||
temperature (Union[Unset, float]):
|
||||
model (Union[Unset, AgentModel]):
|
||||
prompt (Union[Unset, str]):
|
||||
"""
|
||||
|
||||
name: str
|
||||
mode: Union[Literal["all"], Literal["primary"], Literal["subagent"]]
|
||||
built_in: bool
|
||||
permission: "AgentPermission"
|
||||
tools: "AgentTools"
|
||||
options: "AgentOptions"
|
||||
description: Union[Unset, str] = UNSET
|
||||
top_p: Union[Unset, float] = UNSET
|
||||
temperature: Union[Unset, float] = UNSET
|
||||
model: Union[Unset, "AgentModel"] = UNSET
|
||||
prompt: Union[Unset, str] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
name = self.name
|
||||
|
||||
mode: Union[Literal["all"], Literal["primary"], Literal["subagent"]]
|
||||
mode = self.mode
|
||||
|
||||
built_in = self.built_in
|
||||
|
||||
permission = self.permission.to_dict()
|
||||
|
||||
tools = self.tools.to_dict()
|
||||
|
||||
options = self.options.to_dict()
|
||||
|
||||
description = self.description
|
||||
|
||||
top_p = self.top_p
|
||||
|
||||
temperature = self.temperature
|
||||
|
||||
model: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.model, Unset):
|
||||
model = self.model.to_dict()
|
||||
|
||||
prompt = self.prompt
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"name": name,
|
||||
"mode": mode,
|
||||
"builtIn": built_in,
|
||||
"permission": permission,
|
||||
"tools": tools,
|
||||
"options": options,
|
||||
}
|
||||
)
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if top_p is not UNSET:
|
||||
field_dict["topP"] = top_p
|
||||
if temperature is not UNSET:
|
||||
field_dict["temperature"] = temperature
|
||||
if model is not UNSET:
|
||||
field_dict["model"] = model
|
||||
if prompt is not UNSET:
|
||||
field_dict["prompt"] = prompt
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_model import AgentModel
|
||||
from ..models.agent_options import AgentOptions
|
||||
from ..models.agent_permission import AgentPermission
|
||||
from ..models.agent_tools import AgentTools
|
||||
|
||||
d = dict(src_dict)
|
||||
name = d.pop("name")
|
||||
|
||||
def _parse_mode(data: object) -> Union[Literal["all"], Literal["primary"], Literal["subagent"]]:
|
||||
mode_type_0 = cast(Literal["subagent"], data)
|
||||
if mode_type_0 != "subagent":
|
||||
raise ValueError(f"mode_type_0 must match const 'subagent', got '{mode_type_0}'")
|
||||
return mode_type_0
|
||||
mode_type_1 = cast(Literal["primary"], data)
|
||||
if mode_type_1 != "primary":
|
||||
raise ValueError(f"mode_type_1 must match const 'primary', got '{mode_type_1}'")
|
||||
return mode_type_1
|
||||
mode_type_2 = cast(Literal["all"], data)
|
||||
if mode_type_2 != "all":
|
||||
raise ValueError(f"mode_type_2 must match const 'all', got '{mode_type_2}'")
|
||||
return mode_type_2
|
||||
|
||||
mode = _parse_mode(d.pop("mode"))
|
||||
|
||||
built_in = d.pop("builtIn")
|
||||
|
||||
permission = AgentPermission.from_dict(d.pop("permission"))
|
||||
|
||||
tools = AgentTools.from_dict(d.pop("tools"))
|
||||
|
||||
options = AgentOptions.from_dict(d.pop("options"))
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
top_p = d.pop("topP", UNSET)
|
||||
|
||||
temperature = d.pop("temperature", UNSET)
|
||||
|
||||
_model = d.pop("model", UNSET)
|
||||
model: Union[Unset, AgentModel]
|
||||
if isinstance(_model, Unset):
|
||||
model = UNSET
|
||||
else:
|
||||
model = AgentModel.from_dict(_model)
|
||||
|
||||
prompt = d.pop("prompt", UNSET)
|
||||
|
||||
agent = cls(
|
||||
name=name,
|
||||
mode=mode,
|
||||
built_in=built_in,
|
||||
permission=permission,
|
||||
tools=tools,
|
||||
options=options,
|
||||
description=description,
|
||||
top_p=top_p,
|
||||
temperature=temperature,
|
||||
model=model,
|
||||
prompt=prompt,
|
||||
)
|
||||
|
||||
agent.additional_properties = d
|
||||
return agent
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
173
packages/sdk/python/src/opencode_ai/models/agent_config.py
Normal file
173
packages/sdk/python/src/opencode_ai/models/agent_config.py
Normal file
@@ -0,0 +1,173 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_config_permission import AgentConfigPermission
|
||||
from ..models.agent_config_tools import AgentConfigTools
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AgentConfig")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentConfig:
|
||||
"""
|
||||
Attributes:
|
||||
model (Union[Unset, str]):
|
||||
temperature (Union[Unset, float]):
|
||||
top_p (Union[Unset, float]):
|
||||
prompt (Union[Unset, str]):
|
||||
tools (Union[Unset, AgentConfigTools]):
|
||||
disable (Union[Unset, bool]):
|
||||
description (Union[Unset, str]): Description of when to use the agent
|
||||
mode (Union[Literal['all'], Literal['primary'], Literal['subagent'], Unset]):
|
||||
permission (Union[Unset, AgentConfigPermission]):
|
||||
"""
|
||||
|
||||
model: Union[Unset, str] = UNSET
|
||||
temperature: Union[Unset, float] = UNSET
|
||||
top_p: Union[Unset, float] = UNSET
|
||||
prompt: Union[Unset, str] = UNSET
|
||||
tools: Union[Unset, "AgentConfigTools"] = UNSET
|
||||
disable: Union[Unset, bool] = UNSET
|
||||
description: Union[Unset, str] = UNSET
|
||||
mode: Union[Literal["all"], Literal["primary"], Literal["subagent"], Unset] = UNSET
|
||||
permission: Union[Unset, "AgentConfigPermission"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
model = self.model
|
||||
|
||||
temperature = self.temperature
|
||||
|
||||
top_p = self.top_p
|
||||
|
||||
prompt = self.prompt
|
||||
|
||||
tools: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.tools, Unset):
|
||||
tools = self.tools.to_dict()
|
||||
|
||||
disable = self.disable
|
||||
|
||||
description = self.description
|
||||
|
||||
mode: Union[Literal["all"], Literal["primary"], Literal["subagent"], Unset]
|
||||
if isinstance(self.mode, Unset):
|
||||
mode = UNSET
|
||||
else:
|
||||
mode = self.mode
|
||||
|
||||
permission: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.permission, Unset):
|
||||
permission = self.permission.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if model is not UNSET:
|
||||
field_dict["model"] = model
|
||||
if temperature is not UNSET:
|
||||
field_dict["temperature"] = temperature
|
||||
if top_p is not UNSET:
|
||||
field_dict["top_p"] = top_p
|
||||
if prompt is not UNSET:
|
||||
field_dict["prompt"] = prompt
|
||||
if tools is not UNSET:
|
||||
field_dict["tools"] = tools
|
||||
if disable is not UNSET:
|
||||
field_dict["disable"] = disable
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if mode is not UNSET:
|
||||
field_dict["mode"] = mode
|
||||
if permission is not UNSET:
|
||||
field_dict["permission"] = permission
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_config_permission import AgentConfigPermission
|
||||
from ..models.agent_config_tools import AgentConfigTools
|
||||
|
||||
d = dict(src_dict)
|
||||
model = d.pop("model", UNSET)
|
||||
|
||||
temperature = d.pop("temperature", UNSET)
|
||||
|
||||
top_p = d.pop("top_p", UNSET)
|
||||
|
||||
prompt = d.pop("prompt", UNSET)
|
||||
|
||||
_tools = d.pop("tools", UNSET)
|
||||
tools: Union[Unset, AgentConfigTools]
|
||||
if isinstance(_tools, Unset):
|
||||
tools = UNSET
|
||||
else:
|
||||
tools = AgentConfigTools.from_dict(_tools)
|
||||
|
||||
disable = d.pop("disable", UNSET)
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
def _parse_mode(data: object) -> Union[Literal["all"], Literal["primary"], Literal["subagent"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
mode_type_0 = cast(Literal["subagent"], data)
|
||||
if mode_type_0 != "subagent":
|
||||
raise ValueError(f"mode_type_0 must match const 'subagent', got '{mode_type_0}'")
|
||||
return mode_type_0
|
||||
mode_type_1 = cast(Literal["primary"], data)
|
||||
if mode_type_1 != "primary":
|
||||
raise ValueError(f"mode_type_1 must match const 'primary', got '{mode_type_1}'")
|
||||
return mode_type_1
|
||||
mode_type_2 = cast(Literal["all"], data)
|
||||
if mode_type_2 != "all":
|
||||
raise ValueError(f"mode_type_2 must match const 'all', got '{mode_type_2}'")
|
||||
return mode_type_2
|
||||
|
||||
mode = _parse_mode(d.pop("mode", UNSET))
|
||||
|
||||
_permission = d.pop("permission", UNSET)
|
||||
permission: Union[Unset, AgentConfigPermission]
|
||||
if isinstance(_permission, Unset):
|
||||
permission = UNSET
|
||||
else:
|
||||
permission = AgentConfigPermission.from_dict(_permission)
|
||||
|
||||
agent_config = cls(
|
||||
model=model,
|
||||
temperature=temperature,
|
||||
top_p=top_p,
|
||||
prompt=prompt,
|
||||
tools=tools,
|
||||
disable=disable,
|
||||
description=description,
|
||||
mode=mode,
|
||||
permission=permission,
|
||||
)
|
||||
|
||||
agent_config.additional_properties = d
|
||||
return agent_config
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,155 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_config_permission_bash_type_1 import AgentConfigPermissionBashType1
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AgentConfigPermission")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentConfigPermission:
|
||||
"""
|
||||
Attributes:
|
||||
edit (Union[Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
bash (Union['AgentConfigPermissionBashType1', Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
webfetch (Union[Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
"""
|
||||
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
bash: Union["AgentConfigPermissionBashType1", Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.agent_config_permission_bash_type_1 import AgentConfigPermissionBashType1
|
||||
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]
|
||||
if isinstance(self.edit, Unset):
|
||||
edit = UNSET
|
||||
else:
|
||||
edit = self.edit
|
||||
|
||||
bash: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset, dict[str, Any]]
|
||||
if isinstance(self.bash, Unset):
|
||||
bash = UNSET
|
||||
elif isinstance(self.bash, AgentConfigPermissionBashType1):
|
||||
bash = self.bash.to_dict()
|
||||
else:
|
||||
bash = self.bash
|
||||
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]
|
||||
if isinstance(self.webfetch, Unset):
|
||||
webfetch = UNSET
|
||||
else:
|
||||
webfetch = self.webfetch
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if edit is not UNSET:
|
||||
field_dict["edit"] = edit
|
||||
if bash is not UNSET:
|
||||
field_dict["bash"] = bash
|
||||
if webfetch is not UNSET:
|
||||
field_dict["webfetch"] = webfetch
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_config_permission_bash_type_1 import AgentConfigPermissionBashType1
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_edit(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
edit_type_0 = cast(Literal["ask"], data)
|
||||
if edit_type_0 != "ask":
|
||||
raise ValueError(f"edit_type_0 must match const 'ask', got '{edit_type_0}'")
|
||||
return edit_type_0
|
||||
edit_type_1 = cast(Literal["allow"], data)
|
||||
if edit_type_1 != "allow":
|
||||
raise ValueError(f"edit_type_1 must match const 'allow', got '{edit_type_1}'")
|
||||
return edit_type_1
|
||||
edit_type_2 = cast(Literal["deny"], data)
|
||||
if edit_type_2 != "deny":
|
||||
raise ValueError(f"edit_type_2 must match const 'deny', got '{edit_type_2}'")
|
||||
return edit_type_2
|
||||
|
||||
edit = _parse_edit(d.pop("edit", UNSET))
|
||||
|
||||
def _parse_bash(
|
||||
data: object,
|
||||
) -> Union["AgentConfigPermissionBashType1", Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
bash_type_0_type_0 = cast(Literal["ask"], data)
|
||||
if bash_type_0_type_0 != "ask":
|
||||
raise ValueError(f"bash_type_0_type_0 must match const 'ask', got '{bash_type_0_type_0}'")
|
||||
return bash_type_0_type_0
|
||||
bash_type_0_type_1 = cast(Literal["allow"], data)
|
||||
if bash_type_0_type_1 != "allow":
|
||||
raise ValueError(f"bash_type_0_type_1 must match const 'allow', got '{bash_type_0_type_1}'")
|
||||
return bash_type_0_type_1
|
||||
bash_type_0_type_2 = cast(Literal["deny"], data)
|
||||
if bash_type_0_type_2 != "deny":
|
||||
raise ValueError(f"bash_type_0_type_2 must match const 'deny', got '{bash_type_0_type_2}'")
|
||||
return bash_type_0_type_2
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
bash_type_1 = AgentConfigPermissionBashType1.from_dict(data)
|
||||
|
||||
return bash_type_1
|
||||
|
||||
bash = _parse_bash(d.pop("bash", UNSET))
|
||||
|
||||
def _parse_webfetch(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
webfetch_type_0 = cast(Literal["ask"], data)
|
||||
if webfetch_type_0 != "ask":
|
||||
raise ValueError(f"webfetch_type_0 must match const 'ask', got '{webfetch_type_0}'")
|
||||
return webfetch_type_0
|
||||
webfetch_type_1 = cast(Literal["allow"], data)
|
||||
if webfetch_type_1 != "allow":
|
||||
raise ValueError(f"webfetch_type_1 must match const 'allow', got '{webfetch_type_1}'")
|
||||
return webfetch_type_1
|
||||
webfetch_type_2 = cast(Literal["deny"], data)
|
||||
if webfetch_type_2 != "deny":
|
||||
raise ValueError(f"webfetch_type_2 must match const 'deny', got '{webfetch_type_2}'")
|
||||
return webfetch_type_2
|
||||
|
||||
webfetch = _parse_webfetch(d.pop("webfetch", UNSET))
|
||||
|
||||
agent_config_permission = cls(
|
||||
edit=edit,
|
||||
bash=bash,
|
||||
webfetch=webfetch,
|
||||
)
|
||||
|
||||
agent_config_permission.additional_properties = d
|
||||
return agent_config_permission
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,74 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentConfigPermissionBashType1")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentConfigPermissionBashType1:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Union[Literal["allow"], Literal["ask"], Literal["deny"]]] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
agent_config_permission_bash_type_1 = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
|
||||
def _parse_additional_property(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
additional_property_type_0 = cast(Literal["ask"], data)
|
||||
if additional_property_type_0 != "ask":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_0 must match const 'ask', got '{additional_property_type_0}'"
|
||||
)
|
||||
return additional_property_type_0
|
||||
additional_property_type_1 = cast(Literal["allow"], data)
|
||||
if additional_property_type_1 != "allow":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_1 must match const 'allow', got '{additional_property_type_1}'"
|
||||
)
|
||||
return additional_property_type_1
|
||||
additional_property_type_2 = cast(Literal["deny"], data)
|
||||
if additional_property_type_2 != "deny":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_2 must match const 'deny', got '{additional_property_type_2}'"
|
||||
)
|
||||
return additional_property_type_2
|
||||
|
||||
additional_property = _parse_additional_property(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
agent_config_permission_bash_type_1.additional_properties = additional_properties
|
||||
return agent_config_permission_bash_type_1
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Union[Literal["allow"], Literal["ask"], Literal["deny"]]) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentConfigTools")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentConfigTools:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
agent_config_tools = cls()
|
||||
|
||||
agent_config_tools.additional_properties = d
|
||||
return agent_config_tools
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> bool:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: bool) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
67
packages/sdk/python/src/opencode_ai/models/agent_model.py
Normal file
67
packages/sdk/python/src/opencode_ai/models/agent_model.py
Normal file
@@ -0,0 +1,67 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentModel")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentModel:
|
||||
"""
|
||||
Attributes:
|
||||
model_id (str):
|
||||
provider_id (str):
|
||||
"""
|
||||
|
||||
model_id: str
|
||||
provider_id: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
model_id = self.model_id
|
||||
|
||||
provider_id = self.provider_id
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"modelID": model_id,
|
||||
"providerID": provider_id,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
model_id = d.pop("modelID")
|
||||
|
||||
provider_id = d.pop("providerID")
|
||||
|
||||
agent_model = cls(
|
||||
model_id=model_id,
|
||||
provider_id=provider_id,
|
||||
)
|
||||
|
||||
agent_model.additional_properties = d
|
||||
return agent_model
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
44
packages/sdk/python/src/opencode_ai/models/agent_options.py
Normal file
44
packages/sdk/python/src/opencode_ai/models/agent_options.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentOptions")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentOptions:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
agent_options = cls()
|
||||
|
||||
agent_options.additional_properties = d
|
||||
return agent_options
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
117
packages/sdk/python/src/opencode_ai/models/agent_part.py
Normal file
117
packages/sdk/python/src/opencode_ai/models/agent_part.py
Normal file
@@ -0,0 +1,117 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_part_source import AgentPartSource
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AgentPart")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPart:
|
||||
"""
|
||||
Attributes:
|
||||
id (str):
|
||||
session_id (str):
|
||||
message_id (str):
|
||||
type_ (Literal['agent']):
|
||||
name (str):
|
||||
source (Union[Unset, AgentPartSource]):
|
||||
"""
|
||||
|
||||
id: str
|
||||
session_id: str
|
||||
message_id: str
|
||||
type_: Literal["agent"]
|
||||
name: str
|
||||
source: Union[Unset, "AgentPartSource"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
session_id = self.session_id
|
||||
|
||||
message_id = self.message_id
|
||||
|
||||
type_ = self.type_
|
||||
|
||||
name = self.name
|
||||
|
||||
source: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.source, Unset):
|
||||
source = self.source.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"id": id,
|
||||
"sessionID": session_id,
|
||||
"messageID": message_id,
|
||||
"type": type_,
|
||||
"name": name,
|
||||
}
|
||||
)
|
||||
if source is not UNSET:
|
||||
field_dict["source"] = source
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_part_source import AgentPartSource
|
||||
|
||||
d = dict(src_dict)
|
||||
id = d.pop("id")
|
||||
|
||||
session_id = d.pop("sessionID")
|
||||
|
||||
message_id = d.pop("messageID")
|
||||
|
||||
type_ = cast(Literal["agent"], d.pop("type"))
|
||||
if type_ != "agent":
|
||||
raise ValueError(f"type must match const 'agent', got '{type_}'")
|
||||
|
||||
name = d.pop("name")
|
||||
|
||||
_source = d.pop("source", UNSET)
|
||||
source: Union[Unset, AgentPartSource]
|
||||
if isinstance(_source, Unset):
|
||||
source = UNSET
|
||||
else:
|
||||
source = AgentPartSource.from_dict(_source)
|
||||
|
||||
agent_part = cls(
|
||||
id=id,
|
||||
session_id=session_id,
|
||||
message_id=message_id,
|
||||
type_=type_,
|
||||
name=name,
|
||||
source=source,
|
||||
)
|
||||
|
||||
agent_part.additional_properties = d
|
||||
return agent_part
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
102
packages/sdk/python/src/opencode_ai/models/agent_part_input.py
Normal file
102
packages/sdk/python/src/opencode_ai/models/agent_part_input.py
Normal file
@@ -0,0 +1,102 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_part_input_source import AgentPartInputSource
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AgentPartInput")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPartInput:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['agent']):
|
||||
name (str):
|
||||
id (Union[Unset, str]):
|
||||
source (Union[Unset, AgentPartInputSource]):
|
||||
"""
|
||||
|
||||
type_: Literal["agent"]
|
||||
name: str
|
||||
id: Union[Unset, str] = UNSET
|
||||
source: Union[Unset, "AgentPartInputSource"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
name = self.name
|
||||
|
||||
id = self.id
|
||||
|
||||
source: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.source, Unset):
|
||||
source = self.source.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"name": name,
|
||||
}
|
||||
)
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if source is not UNSET:
|
||||
field_dict["source"] = source
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_part_input_source import AgentPartInputSource
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["agent"], d.pop("type"))
|
||||
if type_ != "agent":
|
||||
raise ValueError(f"type must match const 'agent', got '{type_}'")
|
||||
|
||||
name = d.pop("name")
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_source = d.pop("source", UNSET)
|
||||
source: Union[Unset, AgentPartInputSource]
|
||||
if isinstance(_source, Unset):
|
||||
source = UNSET
|
||||
else:
|
||||
source = AgentPartInputSource.from_dict(_source)
|
||||
|
||||
agent_part_input = cls(
|
||||
type_=type_,
|
||||
name=name,
|
||||
id=id,
|
||||
source=source,
|
||||
)
|
||||
|
||||
agent_part_input.additional_properties = d
|
||||
return agent_part_input
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentPartInputSource")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPartInputSource:
|
||||
"""
|
||||
Attributes:
|
||||
value (str):
|
||||
start (int):
|
||||
end (int):
|
||||
"""
|
||||
|
||||
value: str
|
||||
start: int
|
||||
end: int
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
value = self.value
|
||||
|
||||
start = self.start
|
||||
|
||||
end = self.end
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"value": value,
|
||||
"start": start,
|
||||
"end": end,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
value = d.pop("value")
|
||||
|
||||
start = d.pop("start")
|
||||
|
||||
end = d.pop("end")
|
||||
|
||||
agent_part_input_source = cls(
|
||||
value=value,
|
||||
start=start,
|
||||
end=end,
|
||||
)
|
||||
|
||||
agent_part_input_source.additional_properties = d
|
||||
return agent_part_input_source
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentPartSource")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPartSource:
|
||||
"""
|
||||
Attributes:
|
||||
value (str):
|
||||
start (int):
|
||||
end (int):
|
||||
"""
|
||||
|
||||
value: str
|
||||
start: int
|
||||
end: int
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
value = self.value
|
||||
|
||||
start = self.start
|
||||
|
||||
end = self.end
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"value": value,
|
||||
"start": start,
|
||||
"end": end,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
value = d.pop("value")
|
||||
|
||||
start = d.pop("start")
|
||||
|
||||
end = d.pop("end")
|
||||
|
||||
agent_part_source = cls(
|
||||
value=value,
|
||||
start=start,
|
||||
end=end,
|
||||
)
|
||||
|
||||
agent_part_source.additional_properties = d
|
||||
return agent_part_source
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
120
packages/sdk/python/src/opencode_ai/models/agent_permission.py
Normal file
120
packages/sdk/python/src/opencode_ai/models/agent_permission.py
Normal file
@@ -0,0 +1,120 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_permission_bash import AgentPermissionBash
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AgentPermission")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPermission:
|
||||
"""
|
||||
Attributes:
|
||||
edit (Union[Literal['allow'], Literal['ask'], Literal['deny']]):
|
||||
bash (AgentPermissionBash):
|
||||
webfetch (Union[Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
"""
|
||||
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"]]
|
||||
bash: "AgentPermissionBash"
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"]]
|
||||
edit = self.edit
|
||||
|
||||
bash = self.bash.to_dict()
|
||||
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]
|
||||
if isinstance(self.webfetch, Unset):
|
||||
webfetch = UNSET
|
||||
else:
|
||||
webfetch = self.webfetch
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"edit": edit,
|
||||
"bash": bash,
|
||||
}
|
||||
)
|
||||
if webfetch is not UNSET:
|
||||
field_dict["webfetch"] = webfetch
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_permission_bash import AgentPermissionBash
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_edit(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
edit_type_0 = cast(Literal["ask"], data)
|
||||
if edit_type_0 != "ask":
|
||||
raise ValueError(f"edit_type_0 must match const 'ask', got '{edit_type_0}'")
|
||||
return edit_type_0
|
||||
edit_type_1 = cast(Literal["allow"], data)
|
||||
if edit_type_1 != "allow":
|
||||
raise ValueError(f"edit_type_1 must match const 'allow', got '{edit_type_1}'")
|
||||
return edit_type_1
|
||||
edit_type_2 = cast(Literal["deny"], data)
|
||||
if edit_type_2 != "deny":
|
||||
raise ValueError(f"edit_type_2 must match const 'deny', got '{edit_type_2}'")
|
||||
return edit_type_2
|
||||
|
||||
edit = _parse_edit(d.pop("edit"))
|
||||
|
||||
bash = AgentPermissionBash.from_dict(d.pop("bash"))
|
||||
|
||||
def _parse_webfetch(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
webfetch_type_0 = cast(Literal["ask"], data)
|
||||
if webfetch_type_0 != "ask":
|
||||
raise ValueError(f"webfetch_type_0 must match const 'ask', got '{webfetch_type_0}'")
|
||||
return webfetch_type_0
|
||||
webfetch_type_1 = cast(Literal["allow"], data)
|
||||
if webfetch_type_1 != "allow":
|
||||
raise ValueError(f"webfetch_type_1 must match const 'allow', got '{webfetch_type_1}'")
|
||||
return webfetch_type_1
|
||||
webfetch_type_2 = cast(Literal["deny"], data)
|
||||
if webfetch_type_2 != "deny":
|
||||
raise ValueError(f"webfetch_type_2 must match const 'deny', got '{webfetch_type_2}'")
|
||||
return webfetch_type_2
|
||||
|
||||
webfetch = _parse_webfetch(d.pop("webfetch", UNSET))
|
||||
|
||||
agent_permission = cls(
|
||||
edit=edit,
|
||||
bash=bash,
|
||||
webfetch=webfetch,
|
||||
)
|
||||
|
||||
agent_permission.additional_properties = d
|
||||
return agent_permission
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,74 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentPermissionBash")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentPermissionBash:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Union[Literal["allow"], Literal["ask"], Literal["deny"]]] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
agent_permission_bash = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
|
||||
def _parse_additional_property(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
additional_property_type_0 = cast(Literal["ask"], data)
|
||||
if additional_property_type_0 != "ask":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_0 must match const 'ask', got '{additional_property_type_0}'"
|
||||
)
|
||||
return additional_property_type_0
|
||||
additional_property_type_1 = cast(Literal["allow"], data)
|
||||
if additional_property_type_1 != "allow":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_1 must match const 'allow', got '{additional_property_type_1}'"
|
||||
)
|
||||
return additional_property_type_1
|
||||
additional_property_type_2 = cast(Literal["deny"], data)
|
||||
if additional_property_type_2 != "deny":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_2 must match const 'deny', got '{additional_property_type_2}'"
|
||||
)
|
||||
return additional_property_type_2
|
||||
|
||||
additional_property = _parse_additional_property(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
agent_permission_bash.additional_properties = additional_properties
|
||||
return agent_permission_bash
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Union[Literal["allow"], Literal["ask"], Literal["deny"]]) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
44
packages/sdk/python/src/opencode_ai/models/agent_tools.py
Normal file
44
packages/sdk/python/src/opencode_ai/models/agent_tools.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AgentTools")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AgentTools:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
agent_tools = cls()
|
||||
|
||||
agent_tools.additional_properties = d
|
||||
return agent_tools
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> bool:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: bool) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
69
packages/sdk/python/src/opencode_ai/models/api_auth.py
Normal file
69
packages/sdk/python/src/opencode_ai/models/api_auth.py
Normal file
@@ -0,0 +1,69 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ApiAuth")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ApiAuth:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['api']):
|
||||
key (str):
|
||||
"""
|
||||
|
||||
type_: Literal["api"]
|
||||
key: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
key = self.key
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"key": key,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["api"], d.pop("type"))
|
||||
if type_ != "api":
|
||||
raise ValueError(f"type must match const 'api', got '{type_}'")
|
||||
|
||||
key = d.pop("key")
|
||||
|
||||
api_auth = cls(
|
||||
type_=type_,
|
||||
key=key,
|
||||
)
|
||||
|
||||
api_auth.additional_properties = d
|
||||
return api_auth
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
228
packages/sdk/python/src/opencode_ai/models/assistant_message.py
Normal file
228
packages/sdk/python/src/opencode_ai/models/assistant_message.py
Normal file
@@ -0,0 +1,228 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.assistant_message_path import AssistantMessagePath
|
||||
from ..models.assistant_message_time import AssistantMessageTime
|
||||
from ..models.assistant_message_tokens import AssistantMessageTokens
|
||||
from ..models.message_aborted_error import MessageAbortedError
|
||||
from ..models.message_output_length_error import MessageOutputLengthError
|
||||
from ..models.provider_auth_error import ProviderAuthError
|
||||
from ..models.unknown_error import UnknownError
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AssistantMessage")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AssistantMessage:
|
||||
"""
|
||||
Attributes:
|
||||
id (str):
|
||||
session_id (str):
|
||||
role (Literal['assistant']):
|
||||
time (AssistantMessageTime):
|
||||
system (list[str]):
|
||||
model_id (str):
|
||||
provider_id (str):
|
||||
mode (str):
|
||||
path (AssistantMessagePath):
|
||||
cost (float):
|
||||
tokens (AssistantMessageTokens):
|
||||
error (Union['MessageAbortedError', 'MessageOutputLengthError', 'ProviderAuthError', 'UnknownError', Unset]):
|
||||
summary (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
id: str
|
||||
session_id: str
|
||||
role: Literal["assistant"]
|
||||
time: "AssistantMessageTime"
|
||||
system: list[str]
|
||||
model_id: str
|
||||
provider_id: str
|
||||
mode: str
|
||||
path: "AssistantMessagePath"
|
||||
cost: float
|
||||
tokens: "AssistantMessageTokens"
|
||||
error: Union["MessageAbortedError", "MessageOutputLengthError", "ProviderAuthError", "UnknownError", Unset] = UNSET
|
||||
summary: Union[Unset, bool] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.message_output_length_error import MessageOutputLengthError
|
||||
from ..models.provider_auth_error import ProviderAuthError
|
||||
from ..models.unknown_error import UnknownError
|
||||
|
||||
id = self.id
|
||||
|
||||
session_id = self.session_id
|
||||
|
||||
role = self.role
|
||||
|
||||
time = self.time.to_dict()
|
||||
|
||||
system = self.system
|
||||
|
||||
model_id = self.model_id
|
||||
|
||||
provider_id = self.provider_id
|
||||
|
||||
mode = self.mode
|
||||
|
||||
path = self.path.to_dict()
|
||||
|
||||
cost = self.cost
|
||||
|
||||
tokens = self.tokens.to_dict()
|
||||
|
||||
error: Union[Unset, dict[str, Any]]
|
||||
if isinstance(self.error, Unset):
|
||||
error = UNSET
|
||||
elif isinstance(self.error, ProviderAuthError):
|
||||
error = self.error.to_dict()
|
||||
elif isinstance(self.error, UnknownError):
|
||||
error = self.error.to_dict()
|
||||
elif isinstance(self.error, MessageOutputLengthError):
|
||||
error = self.error.to_dict()
|
||||
else:
|
||||
error = self.error.to_dict()
|
||||
|
||||
summary = self.summary
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"id": id,
|
||||
"sessionID": session_id,
|
||||
"role": role,
|
||||
"time": time,
|
||||
"system": system,
|
||||
"modelID": model_id,
|
||||
"providerID": provider_id,
|
||||
"mode": mode,
|
||||
"path": path,
|
||||
"cost": cost,
|
||||
"tokens": tokens,
|
||||
}
|
||||
)
|
||||
if error is not UNSET:
|
||||
field_dict["error"] = error
|
||||
if summary is not UNSET:
|
||||
field_dict["summary"] = summary
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.assistant_message_path import AssistantMessagePath
|
||||
from ..models.assistant_message_time import AssistantMessageTime
|
||||
from ..models.assistant_message_tokens import AssistantMessageTokens
|
||||
from ..models.message_aborted_error import MessageAbortedError
|
||||
from ..models.message_output_length_error import MessageOutputLengthError
|
||||
from ..models.provider_auth_error import ProviderAuthError
|
||||
from ..models.unknown_error import UnknownError
|
||||
|
||||
d = dict(src_dict)
|
||||
id = d.pop("id")
|
||||
|
||||
session_id = d.pop("sessionID")
|
||||
|
||||
role = cast(Literal["assistant"], d.pop("role"))
|
||||
if role != "assistant":
|
||||
raise ValueError(f"role must match const 'assistant', got '{role}'")
|
||||
|
||||
time = AssistantMessageTime.from_dict(d.pop("time"))
|
||||
|
||||
system = cast(list[str], d.pop("system"))
|
||||
|
||||
model_id = d.pop("modelID")
|
||||
|
||||
provider_id = d.pop("providerID")
|
||||
|
||||
mode = d.pop("mode")
|
||||
|
||||
path = AssistantMessagePath.from_dict(d.pop("path"))
|
||||
|
||||
cost = d.pop("cost")
|
||||
|
||||
tokens = AssistantMessageTokens.from_dict(d.pop("tokens"))
|
||||
|
||||
def _parse_error(
|
||||
data: object,
|
||||
) -> Union["MessageAbortedError", "MessageOutputLengthError", "ProviderAuthError", "UnknownError", Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
error_type_0 = ProviderAuthError.from_dict(data)
|
||||
|
||||
return error_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
error_type_1 = UnknownError.from_dict(data)
|
||||
|
||||
return error_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
error_type_2 = MessageOutputLengthError.from_dict(data)
|
||||
|
||||
return error_type_2
|
||||
except: # noqa: E722
|
||||
pass
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
error_type_3 = MessageAbortedError.from_dict(data)
|
||||
|
||||
return error_type_3
|
||||
|
||||
error = _parse_error(d.pop("error", UNSET))
|
||||
|
||||
summary = d.pop("summary", UNSET)
|
||||
|
||||
assistant_message = cls(
|
||||
id=id,
|
||||
session_id=session_id,
|
||||
role=role,
|
||||
time=time,
|
||||
system=system,
|
||||
model_id=model_id,
|
||||
provider_id=provider_id,
|
||||
mode=mode,
|
||||
path=path,
|
||||
cost=cost,
|
||||
tokens=tokens,
|
||||
error=error,
|
||||
summary=summary,
|
||||
)
|
||||
|
||||
assistant_message.additional_properties = d
|
||||
return assistant_message
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,67 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AssistantMessagePath")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AssistantMessagePath:
|
||||
"""
|
||||
Attributes:
|
||||
cwd (str):
|
||||
root (str):
|
||||
"""
|
||||
|
||||
cwd: str
|
||||
root: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
cwd = self.cwd
|
||||
|
||||
root = self.root
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"cwd": cwd,
|
||||
"root": root,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
cwd = d.pop("cwd")
|
||||
|
||||
root = d.pop("root")
|
||||
|
||||
assistant_message_path = cls(
|
||||
cwd=cwd,
|
||||
root=root,
|
||||
)
|
||||
|
||||
assistant_message_path.additional_properties = d
|
||||
return assistant_message_path
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,70 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AssistantMessageTime")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AssistantMessageTime:
|
||||
"""
|
||||
Attributes:
|
||||
created (float):
|
||||
completed (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
created: float
|
||||
completed: Union[Unset, float] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
created = self.created
|
||||
|
||||
completed = self.completed
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"created": created,
|
||||
}
|
||||
)
|
||||
if completed is not UNSET:
|
||||
field_dict["completed"] = completed
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
created = d.pop("created")
|
||||
|
||||
completed = d.pop("completed", UNSET)
|
||||
|
||||
assistant_message_time = cls(
|
||||
created=created,
|
||||
completed=completed,
|
||||
)
|
||||
|
||||
assistant_message_time.additional_properties = d
|
||||
return assistant_message_time
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,89 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.assistant_message_tokens_cache import AssistantMessageTokensCache
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AssistantMessageTokens")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AssistantMessageTokens:
|
||||
"""
|
||||
Attributes:
|
||||
input_ (float):
|
||||
output (float):
|
||||
reasoning (float):
|
||||
cache (AssistantMessageTokensCache):
|
||||
"""
|
||||
|
||||
input_: float
|
||||
output: float
|
||||
reasoning: float
|
||||
cache: "AssistantMessageTokensCache"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
input_ = self.input_
|
||||
|
||||
output = self.output
|
||||
|
||||
reasoning = self.reasoning
|
||||
|
||||
cache = self.cache.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"input": input_,
|
||||
"output": output,
|
||||
"reasoning": reasoning,
|
||||
"cache": cache,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.assistant_message_tokens_cache import AssistantMessageTokensCache
|
||||
|
||||
d = dict(src_dict)
|
||||
input_ = d.pop("input")
|
||||
|
||||
output = d.pop("output")
|
||||
|
||||
reasoning = d.pop("reasoning")
|
||||
|
||||
cache = AssistantMessageTokensCache.from_dict(d.pop("cache"))
|
||||
|
||||
assistant_message_tokens = cls(
|
||||
input_=input_,
|
||||
output=output,
|
||||
reasoning=reasoning,
|
||||
cache=cache,
|
||||
)
|
||||
|
||||
assistant_message_tokens.additional_properties = d
|
||||
return assistant_message_tokens
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,67 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AssistantMessageTokensCache")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AssistantMessageTokensCache:
|
||||
"""
|
||||
Attributes:
|
||||
read (float):
|
||||
write (float):
|
||||
"""
|
||||
|
||||
read: float
|
||||
write: float
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
read = self.read
|
||||
|
||||
write = self.write
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"read": read,
|
||||
"write": write,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
read = d.pop("read")
|
||||
|
||||
write = d.pop("write")
|
||||
|
||||
assistant_message_tokens_cache = cls(
|
||||
read=read,
|
||||
write=write,
|
||||
)
|
||||
|
||||
assistant_message_tokens_cache.additional_properties = d
|
||||
return assistant_message_tokens_cache
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
105
packages/sdk/python/src/opencode_ai/models/command.py
Normal file
105
packages/sdk/python/src/opencode_ai/models/command.py
Normal file
@@ -0,0 +1,105 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Command")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Command:
|
||||
"""
|
||||
Attributes:
|
||||
name (str):
|
||||
template (str):
|
||||
description (Union[Unset, str]):
|
||||
agent (Union[Unset, str]):
|
||||
model (Union[Unset, str]):
|
||||
subtask (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
name: str
|
||||
template: str
|
||||
description: Union[Unset, str] = UNSET
|
||||
agent: Union[Unset, str] = UNSET
|
||||
model: Union[Unset, str] = UNSET
|
||||
subtask: Union[Unset, bool] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
name = self.name
|
||||
|
||||
template = self.template
|
||||
|
||||
description = self.description
|
||||
|
||||
agent = self.agent
|
||||
|
||||
model = self.model
|
||||
|
||||
subtask = self.subtask
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"name": name,
|
||||
"template": template,
|
||||
}
|
||||
)
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if agent is not UNSET:
|
||||
field_dict["agent"] = agent
|
||||
if model is not UNSET:
|
||||
field_dict["model"] = model
|
||||
if subtask is not UNSET:
|
||||
field_dict["subtask"] = subtask
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
name = d.pop("name")
|
||||
|
||||
template = d.pop("template")
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
agent = d.pop("agent", UNSET)
|
||||
|
||||
model = d.pop("model", UNSET)
|
||||
|
||||
subtask = d.pop("subtask", UNSET)
|
||||
|
||||
command = cls(
|
||||
name=name,
|
||||
template=template,
|
||||
description=description,
|
||||
agent=agent,
|
||||
model=model,
|
||||
subtask=subtask,
|
||||
)
|
||||
|
||||
command.additional_properties = d
|
||||
return command
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
411
packages/sdk/python/src/opencode_ai/models/config.py
Normal file
411
packages/sdk/python/src/opencode_ai/models/config.py
Normal file
@@ -0,0 +1,411 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..models.config_share import ConfigShare
|
||||
from ..models.layout_config import LayoutConfig
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_agent import ConfigAgent
|
||||
from ..models.config_command import ConfigCommand
|
||||
from ..models.config_experimental import ConfigExperimental
|
||||
from ..models.config_formatter import ConfigFormatter
|
||||
from ..models.config_lsp import ConfigLsp
|
||||
from ..models.config_mcp import ConfigMcp
|
||||
from ..models.config_mode import ConfigMode
|
||||
from ..models.config_permission import ConfigPermission
|
||||
from ..models.config_provider import ConfigProvider
|
||||
from ..models.config_tools import ConfigTools
|
||||
from ..models.config_tui import ConfigTui
|
||||
from ..models.config_watcher import ConfigWatcher
|
||||
from ..models.keybinds_config import KeybindsConfig
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Config")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Config:
|
||||
"""
|
||||
Attributes:
|
||||
schema (Union[Unset, str]): JSON schema reference for configuration validation
|
||||
theme (Union[Unset, str]): Theme name to use for the interface
|
||||
keybinds (Union[Unset, KeybindsConfig]): Custom keybind configurations
|
||||
tui (Union[Unset, ConfigTui]): TUI specific settings
|
||||
command (Union[Unset, ConfigCommand]): Command configuration, see https://opencode.ai/docs/commands
|
||||
watcher (Union[Unset, ConfigWatcher]):
|
||||
plugin (Union[Unset, list[str]]):
|
||||
snapshot (Union[Unset, bool]):
|
||||
share (Union[Unset, ConfigShare]): Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
|
||||
enables automatic sharing, 'disabled' disables all sharing
|
||||
autoshare (Union[Unset, bool]): @deprecated Use 'share' field instead. Share newly created sessions
|
||||
automatically
|
||||
autoupdate (Union[Unset, bool]): Automatically update to the latest version
|
||||
disabled_providers (Union[Unset, list[str]]): Disable providers that are loaded automatically
|
||||
model (Union[Unset, str]): Model to use in the format of provider/model, eg anthropic/claude-2
|
||||
small_model (Union[Unset, str]): Small model to use for tasks like title generation in the format of
|
||||
provider/model
|
||||
username (Union[Unset, str]): Custom username to display in conversations instead of system username
|
||||
mode (Union[Unset, ConfigMode]): @deprecated Use `agent` field instead.
|
||||
agent (Union[Unset, ConfigAgent]): Agent configuration, see https://opencode.ai/docs/agent
|
||||
provider (Union[Unset, ConfigProvider]): Custom provider configurations and model overrides
|
||||
mcp (Union[Unset, ConfigMcp]): MCP (Model Context Protocol) server configurations
|
||||
formatter (Union[Unset, ConfigFormatter]):
|
||||
lsp (Union[Unset, ConfigLsp]):
|
||||
instructions (Union[Unset, list[str]]): Additional instruction files or patterns to include
|
||||
layout (Union[Unset, LayoutConfig]): @deprecated Always uses stretch layout.
|
||||
permission (Union[Unset, ConfigPermission]):
|
||||
tools (Union[Unset, ConfigTools]):
|
||||
experimental (Union[Unset, ConfigExperimental]):
|
||||
"""
|
||||
|
||||
schema: Union[Unset, str] = UNSET
|
||||
theme: Union[Unset, str] = UNSET
|
||||
keybinds: Union[Unset, "KeybindsConfig"] = UNSET
|
||||
tui: Union[Unset, "ConfigTui"] = UNSET
|
||||
command: Union[Unset, "ConfigCommand"] = UNSET
|
||||
watcher: Union[Unset, "ConfigWatcher"] = UNSET
|
||||
plugin: Union[Unset, list[str]] = UNSET
|
||||
snapshot: Union[Unset, bool] = UNSET
|
||||
share: Union[Unset, ConfigShare] = UNSET
|
||||
autoshare: Union[Unset, bool] = UNSET
|
||||
autoupdate: Union[Unset, bool] = UNSET
|
||||
disabled_providers: Union[Unset, list[str]] = UNSET
|
||||
model: Union[Unset, str] = UNSET
|
||||
small_model: Union[Unset, str] = UNSET
|
||||
username: Union[Unset, str] = UNSET
|
||||
mode: Union[Unset, "ConfigMode"] = UNSET
|
||||
agent: Union[Unset, "ConfigAgent"] = UNSET
|
||||
provider: Union[Unset, "ConfigProvider"] = UNSET
|
||||
mcp: Union[Unset, "ConfigMcp"] = UNSET
|
||||
formatter: Union[Unset, "ConfigFormatter"] = UNSET
|
||||
lsp: Union[Unset, "ConfigLsp"] = UNSET
|
||||
instructions: Union[Unset, list[str]] = UNSET
|
||||
layout: Union[Unset, LayoutConfig] = UNSET
|
||||
permission: Union[Unset, "ConfigPermission"] = UNSET
|
||||
tools: Union[Unset, "ConfigTools"] = UNSET
|
||||
experimental: Union[Unset, "ConfigExperimental"] = UNSET
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
schema = self.schema
|
||||
|
||||
theme = self.theme
|
||||
|
||||
keybinds: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.keybinds, Unset):
|
||||
keybinds = self.keybinds.to_dict()
|
||||
|
||||
tui: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.tui, Unset):
|
||||
tui = self.tui.to_dict()
|
||||
|
||||
command: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.command, Unset):
|
||||
command = self.command.to_dict()
|
||||
|
||||
watcher: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.watcher, Unset):
|
||||
watcher = self.watcher.to_dict()
|
||||
|
||||
plugin: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.plugin, Unset):
|
||||
plugin = self.plugin
|
||||
|
||||
snapshot = self.snapshot
|
||||
|
||||
share: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.share, Unset):
|
||||
share = self.share.value
|
||||
|
||||
autoshare = self.autoshare
|
||||
|
||||
autoupdate = self.autoupdate
|
||||
|
||||
disabled_providers: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.disabled_providers, Unset):
|
||||
disabled_providers = self.disabled_providers
|
||||
|
||||
model = self.model
|
||||
|
||||
small_model = self.small_model
|
||||
|
||||
username = self.username
|
||||
|
||||
mode: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.mode, Unset):
|
||||
mode = self.mode.to_dict()
|
||||
|
||||
agent: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.agent, Unset):
|
||||
agent = self.agent.to_dict()
|
||||
|
||||
provider: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.provider, Unset):
|
||||
provider = self.provider.to_dict()
|
||||
|
||||
mcp: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.mcp, Unset):
|
||||
mcp = self.mcp.to_dict()
|
||||
|
||||
formatter: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.formatter, Unset):
|
||||
formatter = self.formatter.to_dict()
|
||||
|
||||
lsp: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.lsp, Unset):
|
||||
lsp = self.lsp.to_dict()
|
||||
|
||||
instructions: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.instructions, Unset):
|
||||
instructions = self.instructions
|
||||
|
||||
layout: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.layout, Unset):
|
||||
layout = self.layout.value
|
||||
|
||||
permission: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.permission, Unset):
|
||||
permission = self.permission.to_dict()
|
||||
|
||||
tools: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.tools, Unset):
|
||||
tools = self.tools.to_dict()
|
||||
|
||||
experimental: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.experimental, Unset):
|
||||
experimental = self.experimental.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
|
||||
field_dict.update({})
|
||||
if schema is not UNSET:
|
||||
field_dict["$schema"] = schema
|
||||
if theme is not UNSET:
|
||||
field_dict["theme"] = theme
|
||||
if keybinds is not UNSET:
|
||||
field_dict["keybinds"] = keybinds
|
||||
if tui is not UNSET:
|
||||
field_dict["tui"] = tui
|
||||
if command is not UNSET:
|
||||
field_dict["command"] = command
|
||||
if watcher is not UNSET:
|
||||
field_dict["watcher"] = watcher
|
||||
if plugin is not UNSET:
|
||||
field_dict["plugin"] = plugin
|
||||
if snapshot is not UNSET:
|
||||
field_dict["snapshot"] = snapshot
|
||||
if share is not UNSET:
|
||||
field_dict["share"] = share
|
||||
if autoshare is not UNSET:
|
||||
field_dict["autoshare"] = autoshare
|
||||
if autoupdate is not UNSET:
|
||||
field_dict["autoupdate"] = autoupdate
|
||||
if disabled_providers is not UNSET:
|
||||
field_dict["disabled_providers"] = disabled_providers
|
||||
if model is not UNSET:
|
||||
field_dict["model"] = model
|
||||
if small_model is not UNSET:
|
||||
field_dict["small_model"] = small_model
|
||||
if username is not UNSET:
|
||||
field_dict["username"] = username
|
||||
if mode is not UNSET:
|
||||
field_dict["mode"] = mode
|
||||
if agent is not UNSET:
|
||||
field_dict["agent"] = agent
|
||||
if provider is not UNSET:
|
||||
field_dict["provider"] = provider
|
||||
if mcp is not UNSET:
|
||||
field_dict["mcp"] = mcp
|
||||
if formatter is not UNSET:
|
||||
field_dict["formatter"] = formatter
|
||||
if lsp is not UNSET:
|
||||
field_dict["lsp"] = lsp
|
||||
if instructions is not UNSET:
|
||||
field_dict["instructions"] = instructions
|
||||
if layout is not UNSET:
|
||||
field_dict["layout"] = layout
|
||||
if permission is not UNSET:
|
||||
field_dict["permission"] = permission
|
||||
if tools is not UNSET:
|
||||
field_dict["tools"] = tools
|
||||
if experimental is not UNSET:
|
||||
field_dict["experimental"] = experimental
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_agent import ConfigAgent
|
||||
from ..models.config_command import ConfigCommand
|
||||
from ..models.config_experimental import ConfigExperimental
|
||||
from ..models.config_formatter import ConfigFormatter
|
||||
from ..models.config_lsp import ConfigLsp
|
||||
from ..models.config_mcp import ConfigMcp
|
||||
from ..models.config_mode import ConfigMode
|
||||
from ..models.config_permission import ConfigPermission
|
||||
from ..models.config_provider import ConfigProvider
|
||||
from ..models.config_tools import ConfigTools
|
||||
from ..models.config_tui import ConfigTui
|
||||
from ..models.config_watcher import ConfigWatcher
|
||||
from ..models.keybinds_config import KeybindsConfig
|
||||
|
||||
d = dict(src_dict)
|
||||
schema = d.pop("$schema", UNSET)
|
||||
|
||||
theme = d.pop("theme", UNSET)
|
||||
|
||||
_keybinds = d.pop("keybinds", UNSET)
|
||||
keybinds: Union[Unset, KeybindsConfig]
|
||||
if isinstance(_keybinds, Unset):
|
||||
keybinds = UNSET
|
||||
else:
|
||||
keybinds = KeybindsConfig.from_dict(_keybinds)
|
||||
|
||||
_tui = d.pop("tui", UNSET)
|
||||
tui: Union[Unset, ConfigTui]
|
||||
if isinstance(_tui, Unset):
|
||||
tui = UNSET
|
||||
else:
|
||||
tui = ConfigTui.from_dict(_tui)
|
||||
|
||||
_command = d.pop("command", UNSET)
|
||||
command: Union[Unset, ConfigCommand]
|
||||
if isinstance(_command, Unset):
|
||||
command = UNSET
|
||||
else:
|
||||
command = ConfigCommand.from_dict(_command)
|
||||
|
||||
_watcher = d.pop("watcher", UNSET)
|
||||
watcher: Union[Unset, ConfigWatcher]
|
||||
if isinstance(_watcher, Unset):
|
||||
watcher = UNSET
|
||||
else:
|
||||
watcher = ConfigWatcher.from_dict(_watcher)
|
||||
|
||||
plugin = cast(list[str], d.pop("plugin", UNSET))
|
||||
|
||||
snapshot = d.pop("snapshot", UNSET)
|
||||
|
||||
_share = d.pop("share", UNSET)
|
||||
share: Union[Unset, ConfigShare]
|
||||
if isinstance(_share, Unset):
|
||||
share = UNSET
|
||||
else:
|
||||
share = ConfigShare(_share)
|
||||
|
||||
autoshare = d.pop("autoshare", UNSET)
|
||||
|
||||
autoupdate = d.pop("autoupdate", UNSET)
|
||||
|
||||
disabled_providers = cast(list[str], d.pop("disabled_providers", UNSET))
|
||||
|
||||
model = d.pop("model", UNSET)
|
||||
|
||||
small_model = d.pop("small_model", UNSET)
|
||||
|
||||
username = d.pop("username", UNSET)
|
||||
|
||||
_mode = d.pop("mode", UNSET)
|
||||
mode: Union[Unset, ConfigMode]
|
||||
if isinstance(_mode, Unset):
|
||||
mode = UNSET
|
||||
else:
|
||||
mode = ConfigMode.from_dict(_mode)
|
||||
|
||||
_agent = d.pop("agent", UNSET)
|
||||
agent: Union[Unset, ConfigAgent]
|
||||
if isinstance(_agent, Unset):
|
||||
agent = UNSET
|
||||
else:
|
||||
agent = ConfigAgent.from_dict(_agent)
|
||||
|
||||
_provider = d.pop("provider", UNSET)
|
||||
provider: Union[Unset, ConfigProvider]
|
||||
if isinstance(_provider, Unset):
|
||||
provider = UNSET
|
||||
else:
|
||||
provider = ConfigProvider.from_dict(_provider)
|
||||
|
||||
_mcp = d.pop("mcp", UNSET)
|
||||
mcp: Union[Unset, ConfigMcp]
|
||||
if isinstance(_mcp, Unset):
|
||||
mcp = UNSET
|
||||
else:
|
||||
mcp = ConfigMcp.from_dict(_mcp)
|
||||
|
||||
_formatter = d.pop("formatter", UNSET)
|
||||
formatter: Union[Unset, ConfigFormatter]
|
||||
if isinstance(_formatter, Unset):
|
||||
formatter = UNSET
|
||||
else:
|
||||
formatter = ConfigFormatter.from_dict(_formatter)
|
||||
|
||||
_lsp = d.pop("lsp", UNSET)
|
||||
lsp: Union[Unset, ConfigLsp]
|
||||
if isinstance(_lsp, Unset):
|
||||
lsp = UNSET
|
||||
else:
|
||||
lsp = ConfigLsp.from_dict(_lsp)
|
||||
|
||||
instructions = cast(list[str], d.pop("instructions", UNSET))
|
||||
|
||||
_layout = d.pop("layout", UNSET)
|
||||
layout: Union[Unset, LayoutConfig]
|
||||
if isinstance(_layout, Unset):
|
||||
layout = UNSET
|
||||
else:
|
||||
layout = LayoutConfig(_layout)
|
||||
|
||||
_permission = d.pop("permission", UNSET)
|
||||
permission: Union[Unset, ConfigPermission]
|
||||
if isinstance(_permission, Unset):
|
||||
permission = UNSET
|
||||
else:
|
||||
permission = ConfigPermission.from_dict(_permission)
|
||||
|
||||
_tools = d.pop("tools", UNSET)
|
||||
tools: Union[Unset, ConfigTools]
|
||||
if isinstance(_tools, Unset):
|
||||
tools = UNSET
|
||||
else:
|
||||
tools = ConfigTools.from_dict(_tools)
|
||||
|
||||
_experimental = d.pop("experimental", UNSET)
|
||||
experimental: Union[Unset, ConfigExperimental]
|
||||
if isinstance(_experimental, Unset):
|
||||
experimental = UNSET
|
||||
else:
|
||||
experimental = ConfigExperimental.from_dict(_experimental)
|
||||
|
||||
config = cls(
|
||||
schema=schema,
|
||||
theme=theme,
|
||||
keybinds=keybinds,
|
||||
tui=tui,
|
||||
command=command,
|
||||
watcher=watcher,
|
||||
plugin=plugin,
|
||||
snapshot=snapshot,
|
||||
share=share,
|
||||
autoshare=autoshare,
|
||||
autoupdate=autoupdate,
|
||||
disabled_providers=disabled_providers,
|
||||
model=model,
|
||||
small_model=small_model,
|
||||
username=username,
|
||||
mode=mode,
|
||||
agent=agent,
|
||||
provider=provider,
|
||||
mcp=mcp,
|
||||
formatter=formatter,
|
||||
lsp=lsp,
|
||||
instructions=instructions,
|
||||
layout=layout,
|
||||
permission=permission,
|
||||
tools=tools,
|
||||
experimental=experimental,
|
||||
)
|
||||
|
||||
return config
|
||||
113
packages/sdk/python/src/opencode_ai/models/config_agent.py
Normal file
113
packages/sdk/python/src/opencode_ai/models/config_agent.py
Normal file
@@ -0,0 +1,113 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_config import AgentConfig
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigAgent")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigAgent:
|
||||
"""Agent configuration, see https://opencode.ai/docs/agent
|
||||
|
||||
Attributes:
|
||||
plan (Union[Unset, AgentConfig]):
|
||||
build (Union[Unset, AgentConfig]):
|
||||
general (Union[Unset, AgentConfig]):
|
||||
"""
|
||||
|
||||
plan: Union[Unset, "AgentConfig"] = UNSET
|
||||
build: Union[Unset, "AgentConfig"] = UNSET
|
||||
general: Union[Unset, "AgentConfig"] = UNSET
|
||||
additional_properties: dict[str, "AgentConfig"] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
plan: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.plan, Unset):
|
||||
plan = self.plan.to_dict()
|
||||
|
||||
build: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.build, Unset):
|
||||
build = self.build.to_dict()
|
||||
|
||||
general: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.general, Unset):
|
||||
general = self.general.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
field_dict.update({})
|
||||
if plan is not UNSET:
|
||||
field_dict["plan"] = plan
|
||||
if build is not UNSET:
|
||||
field_dict["build"] = build
|
||||
if general is not UNSET:
|
||||
field_dict["general"] = general
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_config import AgentConfig
|
||||
|
||||
d = dict(src_dict)
|
||||
_plan = d.pop("plan", UNSET)
|
||||
plan: Union[Unset, AgentConfig]
|
||||
if isinstance(_plan, Unset):
|
||||
plan = UNSET
|
||||
else:
|
||||
plan = AgentConfig.from_dict(_plan)
|
||||
|
||||
_build = d.pop("build", UNSET)
|
||||
build: Union[Unset, AgentConfig]
|
||||
if isinstance(_build, Unset):
|
||||
build = UNSET
|
||||
else:
|
||||
build = AgentConfig.from_dict(_build)
|
||||
|
||||
_general = d.pop("general", UNSET)
|
||||
general: Union[Unset, AgentConfig]
|
||||
if isinstance(_general, Unset):
|
||||
general = UNSET
|
||||
else:
|
||||
general = AgentConfig.from_dict(_general)
|
||||
|
||||
config_agent = cls(
|
||||
plan=plan,
|
||||
build=build,
|
||||
general=general,
|
||||
)
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = AgentConfig.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_agent.additional_properties = additional_properties
|
||||
return config_agent
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "AgentConfig":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "AgentConfig") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
57
packages/sdk/python/src/opencode_ai/models/config_command.py
Normal file
57
packages/sdk/python/src/opencode_ai/models/config_command.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_command_additional_property import ConfigCommandAdditionalProperty
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigCommand")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigCommand:
|
||||
"""Command configuration, see https://opencode.ai/docs/commands"""
|
||||
|
||||
additional_properties: dict[str, "ConfigCommandAdditionalProperty"] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_command_additional_property import ConfigCommandAdditionalProperty
|
||||
|
||||
d = dict(src_dict)
|
||||
config_command = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = ConfigCommandAdditionalProperty.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_command.additional_properties = additional_properties
|
||||
return config_command
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "ConfigCommandAdditionalProperty":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "ConfigCommandAdditionalProperty") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,97 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ConfigCommandAdditionalProperty")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigCommandAdditionalProperty:
|
||||
"""
|
||||
Attributes:
|
||||
template (str):
|
||||
description (Union[Unset, str]):
|
||||
agent (Union[Unset, str]):
|
||||
model (Union[Unset, str]):
|
||||
subtask (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
template: str
|
||||
description: Union[Unset, str] = UNSET
|
||||
agent: Union[Unset, str] = UNSET
|
||||
model: Union[Unset, str] = UNSET
|
||||
subtask: Union[Unset, bool] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
template = self.template
|
||||
|
||||
description = self.description
|
||||
|
||||
agent = self.agent
|
||||
|
||||
model = self.model
|
||||
|
||||
subtask = self.subtask
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"template": template,
|
||||
}
|
||||
)
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if agent is not UNSET:
|
||||
field_dict["agent"] = agent
|
||||
if model is not UNSET:
|
||||
field_dict["model"] = model
|
||||
if subtask is not UNSET:
|
||||
field_dict["subtask"] = subtask
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
template = d.pop("template")
|
||||
|
||||
description = d.pop("description", UNSET)
|
||||
|
||||
agent = d.pop("agent", UNSET)
|
||||
|
||||
model = d.pop("model", UNSET)
|
||||
|
||||
subtask = d.pop("subtask", UNSET)
|
||||
|
||||
config_command_additional_property = cls(
|
||||
template=template,
|
||||
description=description,
|
||||
agent=agent,
|
||||
model=model,
|
||||
subtask=subtask,
|
||||
)
|
||||
|
||||
config_command_additional_property.additional_properties = d
|
||||
return config_command_additional_property
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,81 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_experimental_hook import ConfigExperimentalHook
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimental")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimental:
|
||||
"""
|
||||
Attributes:
|
||||
hook (Union[Unset, ConfigExperimentalHook]):
|
||||
disable_paste_summary (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
hook: Union[Unset, "ConfigExperimentalHook"] = UNSET
|
||||
disable_paste_summary: Union[Unset, bool] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
hook: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.hook, Unset):
|
||||
hook = self.hook.to_dict()
|
||||
|
||||
disable_paste_summary = self.disable_paste_summary
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if hook is not UNSET:
|
||||
field_dict["hook"] = hook
|
||||
if disable_paste_summary is not UNSET:
|
||||
field_dict["disable_paste_summary"] = disable_paste_summary
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_experimental_hook import ConfigExperimentalHook
|
||||
|
||||
d = dict(src_dict)
|
||||
_hook = d.pop("hook", UNSET)
|
||||
hook: Union[Unset, ConfigExperimentalHook]
|
||||
if isinstance(_hook, Unset):
|
||||
hook = UNSET
|
||||
else:
|
||||
hook = ConfigExperimentalHook.from_dict(_hook)
|
||||
|
||||
disable_paste_summary = d.pop("disable_paste_summary", UNSET)
|
||||
|
||||
config_experimental = cls(
|
||||
hook=hook,
|
||||
disable_paste_summary=disable_paste_summary,
|
||||
)
|
||||
|
||||
config_experimental.additional_properties = d
|
||||
return config_experimental
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,93 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_experimental_hook_file_edited import ConfigExperimentalHookFileEdited
|
||||
from ..models.config_experimental_hook_session_completed_item import ConfigExperimentalHookSessionCompletedItem
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHook")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHook:
|
||||
"""
|
||||
Attributes:
|
||||
file_edited (Union[Unset, ConfigExperimentalHookFileEdited]):
|
||||
session_completed (Union[Unset, list['ConfigExperimentalHookSessionCompletedItem']]):
|
||||
"""
|
||||
|
||||
file_edited: Union[Unset, "ConfigExperimentalHookFileEdited"] = UNSET
|
||||
session_completed: Union[Unset, list["ConfigExperimentalHookSessionCompletedItem"]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
file_edited: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.file_edited, Unset):
|
||||
file_edited = self.file_edited.to_dict()
|
||||
|
||||
session_completed: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||
if not isinstance(self.session_completed, Unset):
|
||||
session_completed = []
|
||||
for session_completed_item_data in self.session_completed:
|
||||
session_completed_item = session_completed_item_data.to_dict()
|
||||
session_completed.append(session_completed_item)
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if file_edited is not UNSET:
|
||||
field_dict["file_edited"] = file_edited
|
||||
if session_completed is not UNSET:
|
||||
field_dict["session_completed"] = session_completed
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_experimental_hook_file_edited import ConfigExperimentalHookFileEdited
|
||||
from ..models.config_experimental_hook_session_completed_item import ConfigExperimentalHookSessionCompletedItem
|
||||
|
||||
d = dict(src_dict)
|
||||
_file_edited = d.pop("file_edited", UNSET)
|
||||
file_edited: Union[Unset, ConfigExperimentalHookFileEdited]
|
||||
if isinstance(_file_edited, Unset):
|
||||
file_edited = UNSET
|
||||
else:
|
||||
file_edited = ConfigExperimentalHookFileEdited.from_dict(_file_edited)
|
||||
|
||||
session_completed = []
|
||||
_session_completed = d.pop("session_completed", UNSET)
|
||||
for session_completed_item_data in _session_completed or []:
|
||||
session_completed_item = ConfigExperimentalHookSessionCompletedItem.from_dict(session_completed_item_data)
|
||||
|
||||
session_completed.append(session_completed_item)
|
||||
|
||||
config_experimental_hook = cls(
|
||||
file_edited=file_edited,
|
||||
session_completed=session_completed,
|
||||
)
|
||||
|
||||
config_experimental_hook.additional_properties = d
|
||||
return config_experimental_hook
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,73 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_experimental_hook_file_edited_additional_property_item import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItem,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHookFileEdited")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHookFileEdited:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, list["ConfigExperimentalHookFileEditedAdditionalPropertyItem"]] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = []
|
||||
for additional_property_item_data in prop:
|
||||
additional_property_item = additional_property_item_data.to_dict()
|
||||
field_dict[prop_name].append(additional_property_item)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_experimental_hook_file_edited_additional_property_item import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItem,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
config_experimental_hook_file_edited = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = []
|
||||
_additional_property = prop_dict
|
||||
for additional_property_item_data in _additional_property:
|
||||
additional_property_item = ConfigExperimentalHookFileEditedAdditionalPropertyItem.from_dict(
|
||||
additional_property_item_data
|
||||
)
|
||||
|
||||
additional_property.append(additional_property_item)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_experimental_hook_file_edited.additional_properties = additional_properties
|
||||
return config_experimental_hook_file_edited
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> list["ConfigExperimentalHookFileEditedAdditionalPropertyItem"]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: list["ConfigExperimentalHookFileEditedAdditionalPropertyItem"]) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,87 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_experimental_hook_file_edited_additional_property_item_environment import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHookFileEditedAdditionalPropertyItem")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHookFileEditedAdditionalPropertyItem:
|
||||
"""
|
||||
Attributes:
|
||||
command (list[str]):
|
||||
environment (Union[Unset, ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment]):
|
||||
"""
|
||||
|
||||
command: list[str]
|
||||
environment: Union[Unset, "ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
command = self.command
|
||||
|
||||
environment: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"command": command,
|
||||
}
|
||||
)
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_experimental_hook_file_edited_additional_property_item_environment import (
|
||||
ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
command = cast(list[str], d.pop("command"))
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment.from_dict(_environment)
|
||||
|
||||
config_experimental_hook_file_edited_additional_property_item = cls(
|
||||
command=command,
|
||||
environment=environment,
|
||||
)
|
||||
|
||||
config_experimental_hook_file_edited_additional_property_item.additional_properties = d
|
||||
return config_experimental_hook_file_edited_additional_property_item
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHookFileEditedAdditionalPropertyItemEnvironment:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_experimental_hook_file_edited_additional_property_item_environment = cls()
|
||||
|
||||
config_experimental_hook_file_edited_additional_property_item_environment.additional_properties = d
|
||||
return config_experimental_hook_file_edited_additional_property_item_environment
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: str) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,87 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_experimental_hook_session_completed_item_environment import (
|
||||
ConfigExperimentalHookSessionCompletedItemEnvironment,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHookSessionCompletedItem")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHookSessionCompletedItem:
|
||||
"""
|
||||
Attributes:
|
||||
command (list[str]):
|
||||
environment (Union[Unset, ConfigExperimentalHookSessionCompletedItemEnvironment]):
|
||||
"""
|
||||
|
||||
command: list[str]
|
||||
environment: Union[Unset, "ConfigExperimentalHookSessionCompletedItemEnvironment"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
command = self.command
|
||||
|
||||
environment: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"command": command,
|
||||
}
|
||||
)
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_experimental_hook_session_completed_item_environment import (
|
||||
ConfigExperimentalHookSessionCompletedItemEnvironment,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
command = cast(list[str], d.pop("command"))
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, ConfigExperimentalHookSessionCompletedItemEnvironment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = ConfigExperimentalHookSessionCompletedItemEnvironment.from_dict(_environment)
|
||||
|
||||
config_experimental_hook_session_completed_item = cls(
|
||||
command=command,
|
||||
environment=environment,
|
||||
)
|
||||
|
||||
config_experimental_hook_session_completed_item.additional_properties = d
|
||||
return config_experimental_hook_session_completed_item
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigExperimentalHookSessionCompletedItemEnvironment")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigExperimentalHookSessionCompletedItemEnvironment:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_experimental_hook_session_completed_item_environment = cls()
|
||||
|
||||
config_experimental_hook_session_completed_item_environment.additional_properties = d
|
||||
return config_experimental_hook_session_completed_item_environment
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: str) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,57 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_formatter_additional_property import ConfigFormatterAdditionalProperty
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigFormatter")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigFormatter:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, "ConfigFormatterAdditionalProperty"] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_formatter_additional_property import ConfigFormatterAdditionalProperty
|
||||
|
||||
d = dict(src_dict)
|
||||
config_formatter = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = ConfigFormatterAdditionalProperty.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_formatter.additional_properties = additional_properties
|
||||
return config_formatter
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "ConfigFormatterAdditionalProperty":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "ConfigFormatterAdditionalProperty") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,105 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_formatter_additional_property_environment import ConfigFormatterAdditionalPropertyEnvironment
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigFormatterAdditionalProperty")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigFormatterAdditionalProperty:
|
||||
"""
|
||||
Attributes:
|
||||
disabled (Union[Unset, bool]):
|
||||
command (Union[Unset, list[str]]):
|
||||
environment (Union[Unset, ConfigFormatterAdditionalPropertyEnvironment]):
|
||||
extensions (Union[Unset, list[str]]):
|
||||
"""
|
||||
|
||||
disabled: Union[Unset, bool] = UNSET
|
||||
command: Union[Unset, list[str]] = UNSET
|
||||
environment: Union[Unset, "ConfigFormatterAdditionalPropertyEnvironment"] = UNSET
|
||||
extensions: Union[Unset, list[str]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
disabled = self.disabled
|
||||
|
||||
command: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.command, Unset):
|
||||
command = self.command
|
||||
|
||||
environment: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.environment, Unset):
|
||||
environment = self.environment.to_dict()
|
||||
|
||||
extensions: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.extensions, Unset):
|
||||
extensions = self.extensions
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if disabled is not UNSET:
|
||||
field_dict["disabled"] = disabled
|
||||
if command is not UNSET:
|
||||
field_dict["command"] = command
|
||||
if environment is not UNSET:
|
||||
field_dict["environment"] = environment
|
||||
if extensions is not UNSET:
|
||||
field_dict["extensions"] = extensions
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_formatter_additional_property_environment import (
|
||||
ConfigFormatterAdditionalPropertyEnvironment,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
disabled = d.pop("disabled", UNSET)
|
||||
|
||||
command = cast(list[str], d.pop("command", UNSET))
|
||||
|
||||
_environment = d.pop("environment", UNSET)
|
||||
environment: Union[Unset, ConfigFormatterAdditionalPropertyEnvironment]
|
||||
if isinstance(_environment, Unset):
|
||||
environment = UNSET
|
||||
else:
|
||||
environment = ConfigFormatterAdditionalPropertyEnvironment.from_dict(_environment)
|
||||
|
||||
extensions = cast(list[str], d.pop("extensions", UNSET))
|
||||
|
||||
config_formatter_additional_property = cls(
|
||||
disabled=disabled,
|
||||
command=command,
|
||||
environment=environment,
|
||||
extensions=extensions,
|
||||
)
|
||||
|
||||
config_formatter_additional_property.additional_properties = d
|
||||
return config_formatter_additional_property
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigFormatterAdditionalPropertyEnvironment")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigFormatterAdditionalPropertyEnvironment:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_formatter_additional_property_environment = cls()
|
||||
|
||||
config_formatter_additional_property_environment.additional_properties = d
|
||||
return config_formatter_additional_property_environment
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: str) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
86
packages/sdk/python/src/opencode_ai/models/config_lsp.py
Normal file
86
packages/sdk/python/src/opencode_ai/models/config_lsp.py
Normal file
@@ -0,0 +1,86 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_lsp_additional_property_type_0 import ConfigLspAdditionalPropertyType0
|
||||
from ..models.config_lsp_additional_property_type_1 import ConfigLspAdditionalPropertyType1
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigLsp")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigLsp:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Union["ConfigLspAdditionalPropertyType0", "ConfigLspAdditionalPropertyType1"]] = (
|
||||
_attrs_field(init=False, factory=dict)
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.config_lsp_additional_property_type_0 import ConfigLspAdditionalPropertyType0
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
if isinstance(prop, ConfigLspAdditionalPropertyType0):
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
else:
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_lsp_additional_property_type_0 import ConfigLspAdditionalPropertyType0
|
||||
from ..models.config_lsp_additional_property_type_1 import ConfigLspAdditionalPropertyType1
|
||||
|
||||
d = dict(src_dict)
|
||||
config_lsp = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
|
||||
def _parse_additional_property(
|
||||
data: object,
|
||||
) -> Union["ConfigLspAdditionalPropertyType0", "ConfigLspAdditionalPropertyType1"]:
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
additional_property_type_0 = ConfigLspAdditionalPropertyType0.from_dict(data)
|
||||
|
||||
return additional_property_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
additional_property_type_1 = ConfigLspAdditionalPropertyType1.from_dict(data)
|
||||
|
||||
return additional_property_type_1
|
||||
|
||||
additional_property = _parse_additional_property(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_lsp.additional_properties = additional_properties
|
||||
return config_lsp
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Union["ConfigLspAdditionalPropertyType0", "ConfigLspAdditionalPropertyType1"]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(
|
||||
self, key: str, value: Union["ConfigLspAdditionalPropertyType0", "ConfigLspAdditionalPropertyType1"]
|
||||
) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,59 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigLspAdditionalPropertyType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigLspAdditionalPropertyType0:
|
||||
"""
|
||||
Attributes:
|
||||
disabled (bool):
|
||||
"""
|
||||
|
||||
disabled: bool
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
disabled = self.disabled
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"disabled": disabled,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
disabled = d.pop("disabled")
|
||||
|
||||
config_lsp_additional_property_type_0 = cls(
|
||||
disabled=disabled,
|
||||
)
|
||||
|
||||
config_lsp_additional_property_type_0.additional_properties = d
|
||||
return config_lsp_additional_property_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,125 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_lsp_additional_property_type_1_env import ConfigLspAdditionalPropertyType1Env
|
||||
from ..models.config_lsp_additional_property_type_1_initialization import (
|
||||
ConfigLspAdditionalPropertyType1Initialization,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigLspAdditionalPropertyType1")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigLspAdditionalPropertyType1:
|
||||
"""
|
||||
Attributes:
|
||||
command (list[str]):
|
||||
extensions (Union[Unset, list[str]]):
|
||||
disabled (Union[Unset, bool]):
|
||||
env (Union[Unset, ConfigLspAdditionalPropertyType1Env]):
|
||||
initialization (Union[Unset, ConfigLspAdditionalPropertyType1Initialization]):
|
||||
"""
|
||||
|
||||
command: list[str]
|
||||
extensions: Union[Unset, list[str]] = UNSET
|
||||
disabled: Union[Unset, bool] = UNSET
|
||||
env: Union[Unset, "ConfigLspAdditionalPropertyType1Env"] = UNSET
|
||||
initialization: Union[Unset, "ConfigLspAdditionalPropertyType1Initialization"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
command = self.command
|
||||
|
||||
extensions: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.extensions, Unset):
|
||||
extensions = self.extensions
|
||||
|
||||
disabled = self.disabled
|
||||
|
||||
env: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.env, Unset):
|
||||
env = self.env.to_dict()
|
||||
|
||||
initialization: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.initialization, Unset):
|
||||
initialization = self.initialization.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"command": command,
|
||||
}
|
||||
)
|
||||
if extensions is not UNSET:
|
||||
field_dict["extensions"] = extensions
|
||||
if disabled is not UNSET:
|
||||
field_dict["disabled"] = disabled
|
||||
if env is not UNSET:
|
||||
field_dict["env"] = env
|
||||
if initialization is not UNSET:
|
||||
field_dict["initialization"] = initialization
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_lsp_additional_property_type_1_env import ConfigLspAdditionalPropertyType1Env
|
||||
from ..models.config_lsp_additional_property_type_1_initialization import (
|
||||
ConfigLspAdditionalPropertyType1Initialization,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
command = cast(list[str], d.pop("command"))
|
||||
|
||||
extensions = cast(list[str], d.pop("extensions", UNSET))
|
||||
|
||||
disabled = d.pop("disabled", UNSET)
|
||||
|
||||
_env = d.pop("env", UNSET)
|
||||
env: Union[Unset, ConfigLspAdditionalPropertyType1Env]
|
||||
if isinstance(_env, Unset):
|
||||
env = UNSET
|
||||
else:
|
||||
env = ConfigLspAdditionalPropertyType1Env.from_dict(_env)
|
||||
|
||||
_initialization = d.pop("initialization", UNSET)
|
||||
initialization: Union[Unset, ConfigLspAdditionalPropertyType1Initialization]
|
||||
if isinstance(_initialization, Unset):
|
||||
initialization = UNSET
|
||||
else:
|
||||
initialization = ConfigLspAdditionalPropertyType1Initialization.from_dict(_initialization)
|
||||
|
||||
config_lsp_additional_property_type_1 = cls(
|
||||
command=command,
|
||||
extensions=extensions,
|
||||
disabled=disabled,
|
||||
env=env,
|
||||
initialization=initialization,
|
||||
)
|
||||
|
||||
config_lsp_additional_property_type_1.additional_properties = d
|
||||
return config_lsp_additional_property_type_1
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigLspAdditionalPropertyType1Env")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigLspAdditionalPropertyType1Env:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_lsp_additional_property_type_1_env = cls()
|
||||
|
||||
config_lsp_additional_property_type_1_env.additional_properties = d
|
||||
return config_lsp_additional_property_type_1_env
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: str) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigLspAdditionalPropertyType1Initialization")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigLspAdditionalPropertyType1Initialization:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_lsp_additional_property_type_1_initialization = cls()
|
||||
|
||||
config_lsp_additional_property_type_1_initialization.additional_properties = d
|
||||
return config_lsp_additional_property_type_1_initialization
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
82
packages/sdk/python/src/opencode_ai/models/config_mcp.py
Normal file
82
packages/sdk/python/src/opencode_ai/models/config_mcp.py
Normal file
@@ -0,0 +1,82 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.mcp_local_config import McpLocalConfig
|
||||
from ..models.mcp_remote_config import McpRemoteConfig
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigMcp")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigMcp:
|
||||
"""MCP (Model Context Protocol) server configurations"""
|
||||
|
||||
additional_properties: dict[str, Union["McpLocalConfig", "McpRemoteConfig"]] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.mcp_local_config import McpLocalConfig
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
if isinstance(prop, McpLocalConfig):
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
else:
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.mcp_local_config import McpLocalConfig
|
||||
from ..models.mcp_remote_config import McpRemoteConfig
|
||||
|
||||
d = dict(src_dict)
|
||||
config_mcp = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
|
||||
def _parse_additional_property(data: object) -> Union["McpLocalConfig", "McpRemoteConfig"]:
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
additional_property_type_0 = McpLocalConfig.from_dict(data)
|
||||
|
||||
return additional_property_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
additional_property_type_1 = McpRemoteConfig.from_dict(data)
|
||||
|
||||
return additional_property_type_1
|
||||
|
||||
additional_property = _parse_additional_property(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_mcp.additional_properties = additional_properties
|
||||
return config_mcp
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Union["McpLocalConfig", "McpRemoteConfig"]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Union["McpLocalConfig", "McpRemoteConfig"]) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
97
packages/sdk/python/src/opencode_ai/models/config_mode.py
Normal file
97
packages/sdk/python/src/opencode_ai/models/config_mode.py
Normal file
@@ -0,0 +1,97 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_config import AgentConfig
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigMode")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigMode:
|
||||
"""@deprecated Use `agent` field instead.
|
||||
|
||||
Attributes:
|
||||
build (Union[Unset, AgentConfig]):
|
||||
plan (Union[Unset, AgentConfig]):
|
||||
"""
|
||||
|
||||
build: Union[Unset, "AgentConfig"] = UNSET
|
||||
plan: Union[Unset, "AgentConfig"] = UNSET
|
||||
additional_properties: dict[str, "AgentConfig"] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
build: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.build, Unset):
|
||||
build = self.build.to_dict()
|
||||
|
||||
plan: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.plan, Unset):
|
||||
plan = self.plan.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
field_dict.update({})
|
||||
if build is not UNSET:
|
||||
field_dict["build"] = build
|
||||
if plan is not UNSET:
|
||||
field_dict["plan"] = plan
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_config import AgentConfig
|
||||
|
||||
d = dict(src_dict)
|
||||
_build = d.pop("build", UNSET)
|
||||
build: Union[Unset, AgentConfig]
|
||||
if isinstance(_build, Unset):
|
||||
build = UNSET
|
||||
else:
|
||||
build = AgentConfig.from_dict(_build)
|
||||
|
||||
_plan = d.pop("plan", UNSET)
|
||||
plan: Union[Unset, AgentConfig]
|
||||
if isinstance(_plan, Unset):
|
||||
plan = UNSET
|
||||
else:
|
||||
plan = AgentConfig.from_dict(_plan)
|
||||
|
||||
config_mode = cls(
|
||||
build=build,
|
||||
plan=plan,
|
||||
)
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = AgentConfig.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_mode.additional_properties = additional_properties
|
||||
return config_mode
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "AgentConfig":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "AgentConfig") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
155
packages/sdk/python/src/opencode_ai/models/config_permission.py
Normal file
155
packages/sdk/python/src/opencode_ai/models/config_permission.py
Normal file
@@ -0,0 +1,155 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_permission_bash_type_1 import ConfigPermissionBashType1
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigPermission")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigPermission:
|
||||
"""
|
||||
Attributes:
|
||||
edit (Union[Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
bash (Union['ConfigPermissionBashType1', Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
webfetch (Union[Literal['allow'], Literal['ask'], Literal['deny'], Unset]):
|
||||
"""
|
||||
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
bash: Union["ConfigPermissionBashType1", Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.config_permission_bash_type_1 import ConfigPermissionBashType1
|
||||
|
||||
edit: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]
|
||||
if isinstance(self.edit, Unset):
|
||||
edit = UNSET
|
||||
else:
|
||||
edit = self.edit
|
||||
|
||||
bash: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset, dict[str, Any]]
|
||||
if isinstance(self.bash, Unset):
|
||||
bash = UNSET
|
||||
elif isinstance(self.bash, ConfigPermissionBashType1):
|
||||
bash = self.bash.to_dict()
|
||||
else:
|
||||
bash = self.bash
|
||||
|
||||
webfetch: Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]
|
||||
if isinstance(self.webfetch, Unset):
|
||||
webfetch = UNSET
|
||||
else:
|
||||
webfetch = self.webfetch
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if edit is not UNSET:
|
||||
field_dict["edit"] = edit
|
||||
if bash is not UNSET:
|
||||
field_dict["bash"] = bash
|
||||
if webfetch is not UNSET:
|
||||
field_dict["webfetch"] = webfetch
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_permission_bash_type_1 import ConfigPermissionBashType1
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_edit(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
edit_type_0 = cast(Literal["ask"], data)
|
||||
if edit_type_0 != "ask":
|
||||
raise ValueError(f"edit_type_0 must match const 'ask', got '{edit_type_0}'")
|
||||
return edit_type_0
|
||||
edit_type_1 = cast(Literal["allow"], data)
|
||||
if edit_type_1 != "allow":
|
||||
raise ValueError(f"edit_type_1 must match const 'allow', got '{edit_type_1}'")
|
||||
return edit_type_1
|
||||
edit_type_2 = cast(Literal["deny"], data)
|
||||
if edit_type_2 != "deny":
|
||||
raise ValueError(f"edit_type_2 must match const 'deny', got '{edit_type_2}'")
|
||||
return edit_type_2
|
||||
|
||||
edit = _parse_edit(d.pop("edit", UNSET))
|
||||
|
||||
def _parse_bash(
|
||||
data: object,
|
||||
) -> Union["ConfigPermissionBashType1", Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
bash_type_0_type_0 = cast(Literal["ask"], data)
|
||||
if bash_type_0_type_0 != "ask":
|
||||
raise ValueError(f"bash_type_0_type_0 must match const 'ask', got '{bash_type_0_type_0}'")
|
||||
return bash_type_0_type_0
|
||||
bash_type_0_type_1 = cast(Literal["allow"], data)
|
||||
if bash_type_0_type_1 != "allow":
|
||||
raise ValueError(f"bash_type_0_type_1 must match const 'allow', got '{bash_type_0_type_1}'")
|
||||
return bash_type_0_type_1
|
||||
bash_type_0_type_2 = cast(Literal["deny"], data)
|
||||
if bash_type_0_type_2 != "deny":
|
||||
raise ValueError(f"bash_type_0_type_2 must match const 'deny', got '{bash_type_0_type_2}'")
|
||||
return bash_type_0_type_2
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
bash_type_1 = ConfigPermissionBashType1.from_dict(data)
|
||||
|
||||
return bash_type_1
|
||||
|
||||
bash = _parse_bash(d.pop("bash", UNSET))
|
||||
|
||||
def _parse_webfetch(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"], Unset]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
webfetch_type_0 = cast(Literal["ask"], data)
|
||||
if webfetch_type_0 != "ask":
|
||||
raise ValueError(f"webfetch_type_0 must match const 'ask', got '{webfetch_type_0}'")
|
||||
return webfetch_type_0
|
||||
webfetch_type_1 = cast(Literal["allow"], data)
|
||||
if webfetch_type_1 != "allow":
|
||||
raise ValueError(f"webfetch_type_1 must match const 'allow', got '{webfetch_type_1}'")
|
||||
return webfetch_type_1
|
||||
webfetch_type_2 = cast(Literal["deny"], data)
|
||||
if webfetch_type_2 != "deny":
|
||||
raise ValueError(f"webfetch_type_2 must match const 'deny', got '{webfetch_type_2}'")
|
||||
return webfetch_type_2
|
||||
|
||||
webfetch = _parse_webfetch(d.pop("webfetch", UNSET))
|
||||
|
||||
config_permission = cls(
|
||||
edit=edit,
|
||||
bash=bash,
|
||||
webfetch=webfetch,
|
||||
)
|
||||
|
||||
config_permission.additional_properties = d
|
||||
return config_permission
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,74 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigPermissionBashType1")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigPermissionBashType1:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Union[Literal["allow"], Literal["ask"], Literal["deny"]]] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_permission_bash_type_1 = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
|
||||
def _parse_additional_property(data: object) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
additional_property_type_0 = cast(Literal["ask"], data)
|
||||
if additional_property_type_0 != "ask":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_0 must match const 'ask', got '{additional_property_type_0}'"
|
||||
)
|
||||
return additional_property_type_0
|
||||
additional_property_type_1 = cast(Literal["allow"], data)
|
||||
if additional_property_type_1 != "allow":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_1 must match const 'allow', got '{additional_property_type_1}'"
|
||||
)
|
||||
return additional_property_type_1
|
||||
additional_property_type_2 = cast(Literal["deny"], data)
|
||||
if additional_property_type_2 != "deny":
|
||||
raise ValueError(
|
||||
f"AdditionalProperty_type_2 must match const 'deny', got '{additional_property_type_2}'"
|
||||
)
|
||||
return additional_property_type_2
|
||||
|
||||
additional_property = _parse_additional_property(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_permission_bash_type_1.additional_properties = additional_properties
|
||||
return config_permission_bash_type_1
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Union[Literal["allow"], Literal["ask"], Literal["deny"]]:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Union[Literal["allow"], Literal["ask"], Literal["deny"]]) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,57 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_provider_additional_property import ConfigProviderAdditionalProperty
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigProvider")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProvider:
|
||||
"""Custom provider configurations and model overrides"""
|
||||
|
||||
additional_properties: dict[str, "ConfigProviderAdditionalProperty"] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_provider_additional_property import ConfigProviderAdditionalProperty
|
||||
|
||||
d = dict(src_dict)
|
||||
config_provider = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = ConfigProviderAdditionalProperty.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_provider.additional_properties = additional_properties
|
||||
return config_provider
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "ConfigProviderAdditionalProperty":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "ConfigProviderAdditionalProperty") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,118 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_provider_additional_property_models import ConfigProviderAdditionalPropertyModels
|
||||
from ..models.config_provider_additional_property_options import ConfigProviderAdditionalPropertyOptions
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalProperty")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalProperty:
|
||||
"""
|
||||
Attributes:
|
||||
api (Union[Unset, str]):
|
||||
name (Union[Unset, str]):
|
||||
env (Union[Unset, list[str]]):
|
||||
id (Union[Unset, str]):
|
||||
npm (Union[Unset, str]):
|
||||
models (Union[Unset, ConfigProviderAdditionalPropertyModels]):
|
||||
options (Union[Unset, ConfigProviderAdditionalPropertyOptions]):
|
||||
"""
|
||||
|
||||
api: Union[Unset, str] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
env: Union[Unset, list[str]] = UNSET
|
||||
id: Union[Unset, str] = UNSET
|
||||
npm: Union[Unset, str] = UNSET
|
||||
models: Union[Unset, "ConfigProviderAdditionalPropertyModels"] = UNSET
|
||||
options: Union[Unset, "ConfigProviderAdditionalPropertyOptions"] = UNSET
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
api = self.api
|
||||
|
||||
name = self.name
|
||||
|
||||
env: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.env, Unset):
|
||||
env = self.env
|
||||
|
||||
id = self.id
|
||||
|
||||
npm = self.npm
|
||||
|
||||
models: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.models, Unset):
|
||||
models = self.models.to_dict()
|
||||
|
||||
options: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.options, Unset):
|
||||
options = self.options.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
|
||||
field_dict.update({})
|
||||
if api is not UNSET:
|
||||
field_dict["api"] = api
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if env is not UNSET:
|
||||
field_dict["env"] = env
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if npm is not UNSET:
|
||||
field_dict["npm"] = npm
|
||||
if models is not UNSET:
|
||||
field_dict["models"] = models
|
||||
if options is not UNSET:
|
||||
field_dict["options"] = options
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_provider_additional_property_models import ConfigProviderAdditionalPropertyModels
|
||||
from ..models.config_provider_additional_property_options import ConfigProviderAdditionalPropertyOptions
|
||||
|
||||
d = dict(src_dict)
|
||||
api = d.pop("api", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
env = cast(list[str], d.pop("env", UNSET))
|
||||
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
npm = d.pop("npm", UNSET)
|
||||
|
||||
_models = d.pop("models", UNSET)
|
||||
models: Union[Unset, ConfigProviderAdditionalPropertyModels]
|
||||
if isinstance(_models, Unset):
|
||||
models = UNSET
|
||||
else:
|
||||
models = ConfigProviderAdditionalPropertyModels.from_dict(_models)
|
||||
|
||||
_options = d.pop("options", UNSET)
|
||||
options: Union[Unset, ConfigProviderAdditionalPropertyOptions]
|
||||
if isinstance(_options, Unset):
|
||||
options = UNSET
|
||||
else:
|
||||
options = ConfigProviderAdditionalPropertyOptions.from_dict(_options)
|
||||
|
||||
config_provider_additional_property = cls(
|
||||
api=api,
|
||||
name=name,
|
||||
env=env,
|
||||
id=id,
|
||||
npm=npm,
|
||||
models=models,
|
||||
options=options,
|
||||
)
|
||||
|
||||
return config_provider_additional_property
|
||||
@@ -0,0 +1,63 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_provider_additional_property_models_additional_property import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalProperty,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModels")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModels:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, "ConfigProviderAdditionalPropertyModelsAdditionalProperty"] = _attrs_field(
|
||||
init=False, factory=dict
|
||||
)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
field_dict[prop_name] = prop.to_dict()
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_provider_additional_property_models_additional_property import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalProperty,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
config_provider_additional_property_models = cls()
|
||||
|
||||
additional_properties = {}
|
||||
for prop_name, prop_dict in d.items():
|
||||
additional_property = ConfigProviderAdditionalPropertyModelsAdditionalProperty.from_dict(prop_dict)
|
||||
|
||||
additional_properties[prop_name] = additional_property
|
||||
|
||||
config_provider_additional_property_models.additional_properties = additional_properties
|
||||
return config_provider_additional_property_models
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> "ConfigProviderAdditionalPropertyModelsAdditionalProperty":
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: "ConfigProviderAdditionalPropertyModelsAdditionalProperty") -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,214 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_provider_additional_property_models_additional_property_cost import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_limit import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_options import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_provider import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModelsAdditionalProperty")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModelsAdditionalProperty:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, str]):
|
||||
name (Union[Unset, str]):
|
||||
release_date (Union[Unset, str]):
|
||||
attachment (Union[Unset, bool]):
|
||||
reasoning (Union[Unset, bool]):
|
||||
temperature (Union[Unset, bool]):
|
||||
tool_call (Union[Unset, bool]):
|
||||
cost (Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost]):
|
||||
limit (Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit]):
|
||||
experimental (Union[Unset, bool]):
|
||||
options (Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions]):
|
||||
provider (Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, str] = UNSET
|
||||
name: Union[Unset, str] = UNSET
|
||||
release_date: Union[Unset, str] = UNSET
|
||||
attachment: Union[Unset, bool] = UNSET
|
||||
reasoning: Union[Unset, bool] = UNSET
|
||||
temperature: Union[Unset, bool] = UNSET
|
||||
tool_call: Union[Unset, bool] = UNSET
|
||||
cost: Union[Unset, "ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost"] = UNSET
|
||||
limit: Union[Unset, "ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit"] = UNSET
|
||||
experimental: Union[Unset, bool] = UNSET
|
||||
options: Union[Unset, "ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions"] = UNSET
|
||||
provider: Union[Unset, "ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider"] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
name = self.name
|
||||
|
||||
release_date = self.release_date
|
||||
|
||||
attachment = self.attachment
|
||||
|
||||
reasoning = self.reasoning
|
||||
|
||||
temperature = self.temperature
|
||||
|
||||
tool_call = self.tool_call
|
||||
|
||||
cost: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.cost, Unset):
|
||||
cost = self.cost.to_dict()
|
||||
|
||||
limit: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.limit, Unset):
|
||||
limit = self.limit.to_dict()
|
||||
|
||||
experimental = self.experimental
|
||||
|
||||
options: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.options, Unset):
|
||||
options = self.options.to_dict()
|
||||
|
||||
provider: Union[Unset, dict[str, Any]] = UNSET
|
||||
if not isinstance(self.provider, Unset):
|
||||
provider = self.provider.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if release_date is not UNSET:
|
||||
field_dict["release_date"] = release_date
|
||||
if attachment is not UNSET:
|
||||
field_dict["attachment"] = attachment
|
||||
if reasoning is not UNSET:
|
||||
field_dict["reasoning"] = reasoning
|
||||
if temperature is not UNSET:
|
||||
field_dict["temperature"] = temperature
|
||||
if tool_call is not UNSET:
|
||||
field_dict["tool_call"] = tool_call
|
||||
if cost is not UNSET:
|
||||
field_dict["cost"] = cost
|
||||
if limit is not UNSET:
|
||||
field_dict["limit"] = limit
|
||||
if experimental is not UNSET:
|
||||
field_dict["experimental"] = experimental
|
||||
if options is not UNSET:
|
||||
field_dict["options"] = options
|
||||
if provider is not UNSET:
|
||||
field_dict["provider"] = provider
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_provider_additional_property_models_additional_property_cost import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_limit import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_options import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions,
|
||||
)
|
||||
from ..models.config_provider_additional_property_models_additional_property_provider import (
|
||||
ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider,
|
||||
)
|
||||
|
||||
d = dict(src_dict)
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
name = d.pop("name", UNSET)
|
||||
|
||||
release_date = d.pop("release_date", UNSET)
|
||||
|
||||
attachment = d.pop("attachment", UNSET)
|
||||
|
||||
reasoning = d.pop("reasoning", UNSET)
|
||||
|
||||
temperature = d.pop("temperature", UNSET)
|
||||
|
||||
tool_call = d.pop("tool_call", UNSET)
|
||||
|
||||
_cost = d.pop("cost", UNSET)
|
||||
cost: Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost]
|
||||
if isinstance(_cost, Unset):
|
||||
cost = UNSET
|
||||
else:
|
||||
cost = ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost.from_dict(_cost)
|
||||
|
||||
_limit = d.pop("limit", UNSET)
|
||||
limit: Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit]
|
||||
if isinstance(_limit, Unset):
|
||||
limit = UNSET
|
||||
else:
|
||||
limit = ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit.from_dict(_limit)
|
||||
|
||||
experimental = d.pop("experimental", UNSET)
|
||||
|
||||
_options = d.pop("options", UNSET)
|
||||
options: Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions]
|
||||
if isinstance(_options, Unset):
|
||||
options = UNSET
|
||||
else:
|
||||
options = ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions.from_dict(_options)
|
||||
|
||||
_provider = d.pop("provider", UNSET)
|
||||
provider: Union[Unset, ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider]
|
||||
if isinstance(_provider, Unset):
|
||||
provider = UNSET
|
||||
else:
|
||||
provider = ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider.from_dict(_provider)
|
||||
|
||||
config_provider_additional_property_models_additional_property = cls(
|
||||
id=id,
|
||||
name=name,
|
||||
release_date=release_date,
|
||||
attachment=attachment,
|
||||
reasoning=reasoning,
|
||||
temperature=temperature,
|
||||
tool_call=tool_call,
|
||||
cost=cost,
|
||||
limit=limit,
|
||||
experimental=experimental,
|
||||
options=options,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
config_provider_additional_property_models_additional_property.additional_properties = d
|
||||
return config_provider_additional_property_models_additional_property
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,87 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModelsAdditionalPropertyCost:
|
||||
"""
|
||||
Attributes:
|
||||
input_ (float):
|
||||
output (float):
|
||||
cache_read (Union[Unset, float]):
|
||||
cache_write (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
input_: float
|
||||
output: float
|
||||
cache_read: Union[Unset, float] = UNSET
|
||||
cache_write: Union[Unset, float] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
input_ = self.input_
|
||||
|
||||
output = self.output
|
||||
|
||||
cache_read = self.cache_read
|
||||
|
||||
cache_write = self.cache_write
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"input": input_,
|
||||
"output": output,
|
||||
}
|
||||
)
|
||||
if cache_read is not UNSET:
|
||||
field_dict["cache_read"] = cache_read
|
||||
if cache_write is not UNSET:
|
||||
field_dict["cache_write"] = cache_write
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
input_ = d.pop("input")
|
||||
|
||||
output = d.pop("output")
|
||||
|
||||
cache_read = d.pop("cache_read", UNSET)
|
||||
|
||||
cache_write = d.pop("cache_write", UNSET)
|
||||
|
||||
config_provider_additional_property_models_additional_property_cost = cls(
|
||||
input_=input_,
|
||||
output=output,
|
||||
cache_read=cache_read,
|
||||
cache_write=cache_write,
|
||||
)
|
||||
|
||||
config_provider_additional_property_models_additional_property_cost.additional_properties = d
|
||||
return config_provider_additional_property_models_additional_property_cost
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,67 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModelsAdditionalPropertyLimit:
|
||||
"""
|
||||
Attributes:
|
||||
context (float):
|
||||
output (float):
|
||||
"""
|
||||
|
||||
context: float
|
||||
output: float
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
context = self.context
|
||||
|
||||
output = self.output
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"context": context,
|
||||
"output": output,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
context = d.pop("context")
|
||||
|
||||
output = d.pop("output")
|
||||
|
||||
config_provider_additional_property_models_additional_property_limit = cls(
|
||||
context=context,
|
||||
output=output,
|
||||
)
|
||||
|
||||
config_provider_additional_property_models_additional_property_limit.additional_properties = d
|
||||
return config_provider_additional_property_models_additional_property_limit
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModelsAdditionalPropertyOptions:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_provider_additional_property_models_additional_property_options = cls()
|
||||
|
||||
config_provider_additional_property_models_additional_property_options.additional_properties = d
|
||||
return config_provider_additional_property_models_additional_property_options
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,59 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyModelsAdditionalPropertyProvider:
|
||||
"""
|
||||
Attributes:
|
||||
npm (str):
|
||||
"""
|
||||
|
||||
npm: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
npm = self.npm
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"npm": npm,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
npm = d.pop("npm")
|
||||
|
||||
config_provider_additional_property_models_additional_property_provider = cls(
|
||||
npm=npm,
|
||||
)
|
||||
|
||||
config_provider_additional_property_models_additional_property_provider.additional_properties = d
|
||||
return config_provider_additional_property_models_additional_property_provider
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,87 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ConfigProviderAdditionalPropertyOptions")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProviderAdditionalPropertyOptions:
|
||||
"""
|
||||
Attributes:
|
||||
api_key (Union[Unset, str]):
|
||||
base_url (Union[Unset, str]):
|
||||
timeout (Union[Unset, bool, int]): Timeout in milliseconds for requests to this provider. Default is 300000 (5
|
||||
minutes). Set to false to disable timeout.
|
||||
"""
|
||||
|
||||
api_key: Union[Unset, str] = UNSET
|
||||
base_url: Union[Unset, str] = UNSET
|
||||
timeout: Union[Unset, bool, int] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
api_key = self.api_key
|
||||
|
||||
base_url = self.base_url
|
||||
|
||||
timeout: Union[Unset, bool, int]
|
||||
if isinstance(self.timeout, Unset):
|
||||
timeout = UNSET
|
||||
else:
|
||||
timeout = self.timeout
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if api_key is not UNSET:
|
||||
field_dict["apiKey"] = api_key
|
||||
if base_url is not UNSET:
|
||||
field_dict["baseURL"] = base_url
|
||||
if timeout is not UNSET:
|
||||
field_dict["timeout"] = timeout
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
api_key = d.pop("apiKey", UNSET)
|
||||
|
||||
base_url = d.pop("baseURL", UNSET)
|
||||
|
||||
def _parse_timeout(data: object) -> Union[Unset, bool, int]:
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[Unset, bool, int], data)
|
||||
|
||||
timeout = _parse_timeout(d.pop("timeout", UNSET))
|
||||
|
||||
config_provider_additional_property_options = cls(
|
||||
api_key=api_key,
|
||||
base_url=base_url,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
config_provider_additional_property_options.additional_properties = d
|
||||
return config_provider_additional_property_options
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,83 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.config_providers_response_200_default import ConfigProvidersResponse200Default
|
||||
from ..models.provider import Provider
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ConfigProvidersResponse200")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProvidersResponse200:
|
||||
"""
|
||||
Attributes:
|
||||
providers (list['Provider']):
|
||||
default (ConfigProvidersResponse200Default):
|
||||
"""
|
||||
|
||||
providers: list["Provider"]
|
||||
default: "ConfigProvidersResponse200Default"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
providers = []
|
||||
for providers_item_data in self.providers:
|
||||
providers_item = providers_item_data.to_dict()
|
||||
providers.append(providers_item)
|
||||
|
||||
default = self.default.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"providers": providers,
|
||||
"default": default,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.config_providers_response_200_default import ConfigProvidersResponse200Default
|
||||
from ..models.provider import Provider
|
||||
|
||||
d = dict(src_dict)
|
||||
providers = []
|
||||
_providers = d.pop("providers")
|
||||
for providers_item_data in _providers:
|
||||
providers_item = Provider.from_dict(providers_item_data)
|
||||
|
||||
providers.append(providers_item)
|
||||
|
||||
default = ConfigProvidersResponse200Default.from_dict(d.pop("default"))
|
||||
|
||||
config_providers_response_200 = cls(
|
||||
providers=providers,
|
||||
default=default,
|
||||
)
|
||||
|
||||
config_providers_response_200.additional_properties = d
|
||||
return config_providers_response_200
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigProvidersResponse200Default")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigProvidersResponse200Default:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_providers_response_200_default = cls()
|
||||
|
||||
config_providers_response_200_default.additional_properties = d
|
||||
return config_providers_response_200_default
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> str:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: str) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
10
packages/sdk/python/src/opencode_ai/models/config_share.py
Normal file
10
packages/sdk/python/src/opencode_ai/models/config_share.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ConfigShare(str, Enum):
|
||||
AUTO = "auto"
|
||||
DISABLED = "disabled"
|
||||
MANUAL = "manual"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
||||
44
packages/sdk/python/src/opencode_ai/models/config_tools.py
Normal file
44
packages/sdk/python/src/opencode_ai/models/config_tools.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ConfigTools")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigTools:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, bool] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
config_tools = cls()
|
||||
|
||||
config_tools.additional_properties = d
|
||||
return config_tools
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> bool:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: bool) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
60
packages/sdk/python/src/opencode_ai/models/config_tui.py
Normal file
60
packages/sdk/python/src/opencode_ai/models/config_tui.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ConfigTui")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigTui:
|
||||
"""TUI specific settings
|
||||
|
||||
Attributes:
|
||||
scroll_speed (Union[Unset, float]): TUI scroll speed Default: 2.0.
|
||||
"""
|
||||
|
||||
scroll_speed: Union[Unset, float] = 2.0
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
scroll_speed = self.scroll_speed
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if scroll_speed is not UNSET:
|
||||
field_dict["scroll_speed"] = scroll_speed
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
scroll_speed = d.pop("scroll_speed", UNSET)
|
||||
|
||||
config_tui = cls(
|
||||
scroll_speed=scroll_speed,
|
||||
)
|
||||
|
||||
config_tui.additional_properties = d
|
||||
return config_tui
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
61
packages/sdk/python/src/opencode_ai/models/config_watcher.py
Normal file
61
packages/sdk/python/src/opencode_ai/models/config_watcher.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ConfigWatcher")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ConfigWatcher:
|
||||
"""
|
||||
Attributes:
|
||||
ignore (Union[Unset, list[str]]):
|
||||
"""
|
||||
|
||||
ignore: Union[Unset, list[str]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
ignore: Union[Unset, list[str]] = UNSET
|
||||
if not isinstance(self.ignore, Unset):
|
||||
ignore = self.ignore
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if ignore is not UNSET:
|
||||
field_dict["ignore"] = ignore
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
ignore = cast(list[str], d.pop("ignore", UNSET))
|
||||
|
||||
config_watcher = cls(
|
||||
ignore=ignore,
|
||||
)
|
||||
|
||||
config_watcher.additional_properties = d
|
||||
return config_watcher
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
65
packages/sdk/python/src/opencode_ai/models/error.py
Normal file
65
packages/sdk/python/src/opencode_ai/models/error.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.error_data import ErrorData
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Error")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Error:
|
||||
"""
|
||||
Attributes:
|
||||
data (ErrorData):
|
||||
"""
|
||||
|
||||
data: "ErrorData"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
data = self.data.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"data": data,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.error_data import ErrorData
|
||||
|
||||
d = dict(src_dict)
|
||||
data = ErrorData.from_dict(d.pop("data"))
|
||||
|
||||
error = cls(
|
||||
data=data,
|
||||
)
|
||||
|
||||
error.additional_properties = d
|
||||
return error
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
44
packages/sdk/python/src/opencode_ai/models/error_data.py
Normal file
44
packages/sdk/python/src/opencode_ai/models/error_data.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ErrorData")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ErrorData:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
error_data = cls()
|
||||
|
||||
error_data.additional_properties = d
|
||||
return error_data
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_file_edited_properties import EventFileEditedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventFileEdited")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventFileEdited:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['file.edited']):
|
||||
properties (EventFileEditedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["file.edited"]
|
||||
properties: "EventFileEditedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_file_edited_properties import EventFileEditedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["file.edited"], d.pop("type"))
|
||||
if type_ != "file.edited":
|
||||
raise ValueError(f"type must match const 'file.edited', got '{type_}'")
|
||||
|
||||
properties = EventFileEditedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_file_edited = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_file_edited.additional_properties = d
|
||||
return event_file_edited
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,59 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventFileEditedProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventFileEditedProperties:
|
||||
"""
|
||||
Attributes:
|
||||
file (str):
|
||||
"""
|
||||
|
||||
file: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
file = self.file
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"file": file,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
file = d.pop("file")
|
||||
|
||||
event_file_edited_properties = cls(
|
||||
file=file,
|
||||
)
|
||||
|
||||
event_file_edited_properties.additional_properties = d
|
||||
return event_file_edited_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_file_watcher_updated_properties import EventFileWatcherUpdatedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventFileWatcherUpdated")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventFileWatcherUpdated:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['file.watcher.updated']):
|
||||
properties (EventFileWatcherUpdatedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["file.watcher.updated"]
|
||||
properties: "EventFileWatcherUpdatedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_file_watcher_updated_properties import EventFileWatcherUpdatedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["file.watcher.updated"], d.pop("type"))
|
||||
if type_ != "file.watcher.updated":
|
||||
raise ValueError(f"type must match const 'file.watcher.updated', got '{type_}'")
|
||||
|
||||
properties = EventFileWatcherUpdatedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_file_watcher_updated = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_file_watcher_updated.additional_properties = d
|
||||
return event_file_watcher_updated
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,82 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, Literal, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventFileWatcherUpdatedProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventFileWatcherUpdatedProperties:
|
||||
"""
|
||||
Attributes:
|
||||
file (str):
|
||||
event (Union[Literal['add'], Literal['change'], Literal['unlink']]):
|
||||
"""
|
||||
|
||||
file: str
|
||||
event: Union[Literal["add"], Literal["change"], Literal["unlink"]]
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
file = self.file
|
||||
|
||||
event: Union[Literal["add"], Literal["change"], Literal["unlink"]]
|
||||
event = self.event
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"file": file,
|
||||
"event": event,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
file = d.pop("file")
|
||||
|
||||
def _parse_event(data: object) -> Union[Literal["add"], Literal["change"], Literal["unlink"]]:
|
||||
event_type_0 = cast(Literal["add"], data)
|
||||
if event_type_0 != "add":
|
||||
raise ValueError(f"event_type_0 must match const 'add', got '{event_type_0}'")
|
||||
return event_type_0
|
||||
event_type_1 = cast(Literal["change"], data)
|
||||
if event_type_1 != "change":
|
||||
raise ValueError(f"event_type_1 must match const 'change', got '{event_type_1}'")
|
||||
return event_type_1
|
||||
event_type_2 = cast(Literal["unlink"], data)
|
||||
if event_type_2 != "unlink":
|
||||
raise ValueError(f"event_type_2 must match const 'unlink', got '{event_type_2}'")
|
||||
return event_type_2
|
||||
|
||||
event = _parse_event(d.pop("event"))
|
||||
|
||||
event_file_watcher_updated_properties = cls(
|
||||
file=file,
|
||||
event=event,
|
||||
)
|
||||
|
||||
event_file_watcher_updated_properties.additional_properties = d
|
||||
return event_file_watcher_updated_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_ide_installed_properties import EventIdeInstalledProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventIdeInstalled")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventIdeInstalled:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['ide.installed']):
|
||||
properties (EventIdeInstalledProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["ide.installed"]
|
||||
properties: "EventIdeInstalledProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_ide_installed_properties import EventIdeInstalledProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["ide.installed"], d.pop("type"))
|
||||
if type_ != "ide.installed":
|
||||
raise ValueError(f"type must match const 'ide.installed', got '{type_}'")
|
||||
|
||||
properties = EventIdeInstalledProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_ide_installed = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_ide_installed.additional_properties = d
|
||||
return event_ide_installed
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,59 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventIdeInstalledProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventIdeInstalledProperties:
|
||||
"""
|
||||
Attributes:
|
||||
ide (str):
|
||||
"""
|
||||
|
||||
ide: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
ide = self.ide
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"ide": ide,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
ide = d.pop("ide")
|
||||
|
||||
event_ide_installed_properties = cls(
|
||||
ide=ide,
|
||||
)
|
||||
|
||||
event_ide_installed_properties.additional_properties = d
|
||||
return event_ide_installed_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_installation_updated_properties import EventInstallationUpdatedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventInstallationUpdated")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventInstallationUpdated:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['installation.updated']):
|
||||
properties (EventInstallationUpdatedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["installation.updated"]
|
||||
properties: "EventInstallationUpdatedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_installation_updated_properties import EventInstallationUpdatedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["installation.updated"], d.pop("type"))
|
||||
if type_ != "installation.updated":
|
||||
raise ValueError(f"type must match const 'installation.updated', got '{type_}'")
|
||||
|
||||
properties = EventInstallationUpdatedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_installation_updated = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_installation_updated.additional_properties = d
|
||||
return event_installation_updated
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,59 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventInstallationUpdatedProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventInstallationUpdatedProperties:
|
||||
"""
|
||||
Attributes:
|
||||
version (str):
|
||||
"""
|
||||
|
||||
version: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
version = self.version
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"version": version,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
version = d.pop("version")
|
||||
|
||||
event_installation_updated_properties = cls(
|
||||
version=version,
|
||||
)
|
||||
|
||||
event_installation_updated_properties.additional_properties = d
|
||||
return event_installation_updated_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_lsp_client_diagnostics_properties import EventLspClientDiagnosticsProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventLspClientDiagnostics")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventLspClientDiagnostics:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['lsp.client.diagnostics']):
|
||||
properties (EventLspClientDiagnosticsProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["lsp.client.diagnostics"]
|
||||
properties: "EventLspClientDiagnosticsProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_lsp_client_diagnostics_properties import EventLspClientDiagnosticsProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["lsp.client.diagnostics"], d.pop("type"))
|
||||
if type_ != "lsp.client.diagnostics":
|
||||
raise ValueError(f"type must match const 'lsp.client.diagnostics', got '{type_}'")
|
||||
|
||||
properties = EventLspClientDiagnosticsProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_lsp_client_diagnostics = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_lsp_client_diagnostics.additional_properties = d
|
||||
return event_lsp_client_diagnostics
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,67 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventLspClientDiagnosticsProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventLspClientDiagnosticsProperties:
|
||||
"""
|
||||
Attributes:
|
||||
server_id (str):
|
||||
path (str):
|
||||
"""
|
||||
|
||||
server_id: str
|
||||
path: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
server_id = self.server_id
|
||||
|
||||
path = self.path
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"serverID": server_id,
|
||||
"path": path,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
server_id = d.pop("serverID")
|
||||
|
||||
path = d.pop("path")
|
||||
|
||||
event_lsp_client_diagnostics_properties = cls(
|
||||
server_id=server_id,
|
||||
path=path,
|
||||
)
|
||||
|
||||
event_lsp_client_diagnostics_properties.additional_properties = d
|
||||
return event_lsp_client_diagnostics_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_message_part_removed_properties import EventMessagePartRemovedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventMessagePartRemoved")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventMessagePartRemoved:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['message.part.removed']):
|
||||
properties (EventMessagePartRemovedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["message.part.removed"]
|
||||
properties: "EventMessagePartRemovedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_message_part_removed_properties import EventMessagePartRemovedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["message.part.removed"], d.pop("type"))
|
||||
if type_ != "message.part.removed":
|
||||
raise ValueError(f"type must match const 'message.part.removed', got '{type_}'")
|
||||
|
||||
properties = EventMessagePartRemovedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_message_part_removed = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_message_part_removed.additional_properties = d
|
||||
return event_message_part_removed
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="EventMessagePartRemovedProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventMessagePartRemovedProperties:
|
||||
"""
|
||||
Attributes:
|
||||
session_id (str):
|
||||
message_id (str):
|
||||
part_id (str):
|
||||
"""
|
||||
|
||||
session_id: str
|
||||
message_id: str
|
||||
part_id: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
session_id = self.session_id
|
||||
|
||||
message_id = self.message_id
|
||||
|
||||
part_id = self.part_id
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"sessionID": session_id,
|
||||
"messageID": message_id,
|
||||
"partID": part_id,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
session_id = d.pop("sessionID")
|
||||
|
||||
message_id = d.pop("messageID")
|
||||
|
||||
part_id = d.pop("partID")
|
||||
|
||||
event_message_part_removed_properties = cls(
|
||||
session_id=session_id,
|
||||
message_id=message_id,
|
||||
part_id=part_id,
|
||||
)
|
||||
|
||||
event_message_part_removed_properties.additional_properties = d
|
||||
return event_message_part_removed_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_message_part_updated_properties import EventMessagePartUpdatedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventMessagePartUpdated")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventMessagePartUpdated:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['message.part.updated']):
|
||||
properties (EventMessagePartUpdatedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["message.part.updated"]
|
||||
properties: "EventMessagePartUpdatedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_message_part_updated_properties import EventMessagePartUpdatedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["message.part.updated"], d.pop("type"))
|
||||
if type_ != "message.part.updated":
|
||||
raise ValueError(f"type must match const 'message.part.updated', got '{type_}'")
|
||||
|
||||
properties = EventMessagePartUpdatedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_message_part_updated = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_message_part_updated.additional_properties = d
|
||||
return event_message_part_updated
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,203 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.agent_part import AgentPart
|
||||
from ..models.file_part import FilePart
|
||||
from ..models.patch_part import PatchPart
|
||||
from ..models.reasoning_part import ReasoningPart
|
||||
from ..models.snapshot_part import SnapshotPart
|
||||
from ..models.step_finish_part import StepFinishPart
|
||||
from ..models.step_start_part import StepStartPart
|
||||
from ..models.text_part import TextPart
|
||||
from ..models.tool_part import ToolPart
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventMessagePartUpdatedProperties")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventMessagePartUpdatedProperties:
|
||||
"""
|
||||
Attributes:
|
||||
part (Union['AgentPart', 'FilePart', 'PatchPart', 'ReasoningPart', 'SnapshotPart', 'StepFinishPart',
|
||||
'StepStartPart', 'TextPart', 'ToolPart']):
|
||||
"""
|
||||
|
||||
part: Union[
|
||||
"AgentPart",
|
||||
"FilePart",
|
||||
"PatchPart",
|
||||
"ReasoningPart",
|
||||
"SnapshotPart",
|
||||
"StepFinishPart",
|
||||
"StepStartPart",
|
||||
"TextPart",
|
||||
"ToolPart",
|
||||
]
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.file_part import FilePart
|
||||
from ..models.patch_part import PatchPart
|
||||
from ..models.reasoning_part import ReasoningPart
|
||||
from ..models.snapshot_part import SnapshotPart
|
||||
from ..models.step_finish_part import StepFinishPart
|
||||
from ..models.step_start_part import StepStartPart
|
||||
from ..models.text_part import TextPart
|
||||
from ..models.tool_part import ToolPart
|
||||
|
||||
part: dict[str, Any]
|
||||
if isinstance(self.part, TextPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, ReasoningPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, FilePart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, ToolPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, StepStartPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, StepFinishPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, SnapshotPart):
|
||||
part = self.part.to_dict()
|
||||
elif isinstance(self.part, PatchPart):
|
||||
part = self.part.to_dict()
|
||||
else:
|
||||
part = self.part.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"part": part,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.agent_part import AgentPart
|
||||
from ..models.file_part import FilePart
|
||||
from ..models.patch_part import PatchPart
|
||||
from ..models.reasoning_part import ReasoningPart
|
||||
from ..models.snapshot_part import SnapshotPart
|
||||
from ..models.step_finish_part import StepFinishPart
|
||||
from ..models.step_start_part import StepStartPart
|
||||
from ..models.text_part import TextPart
|
||||
from ..models.tool_part import ToolPart
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_part(
|
||||
data: object,
|
||||
) -> Union[
|
||||
"AgentPart",
|
||||
"FilePart",
|
||||
"PatchPart",
|
||||
"ReasoningPart",
|
||||
"SnapshotPart",
|
||||
"StepFinishPart",
|
||||
"StepStartPart",
|
||||
"TextPart",
|
||||
"ToolPart",
|
||||
]:
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_0 = TextPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_1 = ReasoningPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_1
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_2 = FilePart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_2
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_3 = ToolPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_3
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_4 = StepStartPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_4
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_5 = StepFinishPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_5
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_6 = SnapshotPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_6
|
||||
except: # noqa: E722
|
||||
pass
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_7 = PatchPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_7
|
||||
except: # noqa: E722
|
||||
pass
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
componentsschemas_part_type_8 = AgentPart.from_dict(data)
|
||||
|
||||
return componentsschemas_part_type_8
|
||||
|
||||
part = _parse_part(d.pop("part"))
|
||||
|
||||
event_message_part_updated_properties = cls(
|
||||
part=part,
|
||||
)
|
||||
|
||||
event_message_part_updated_properties.additional_properties = d
|
||||
return event_message_part_updated_properties
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_message_removed_properties import EventMessageRemovedProperties
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventMessageRemoved")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventMessageRemoved:
|
||||
"""
|
||||
Attributes:
|
||||
type_ (Literal['message.removed']):
|
||||
properties (EventMessageRemovedProperties):
|
||||
"""
|
||||
|
||||
type_: Literal["message.removed"]
|
||||
properties: "EventMessageRemovedProperties"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
type_ = self.type_
|
||||
|
||||
properties = self.properties.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"type": type_,
|
||||
"properties": properties,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.event_message_removed_properties import EventMessageRemovedProperties
|
||||
|
||||
d = dict(src_dict)
|
||||
type_ = cast(Literal["message.removed"], d.pop("type"))
|
||||
if type_ != "message.removed":
|
||||
raise ValueError(f"type must match const 'message.removed', got '{type_}'")
|
||||
|
||||
properties = EventMessageRemovedProperties.from_dict(d.pop("properties"))
|
||||
|
||||
event_message_removed = cls(
|
||||
type_=type_,
|
||||
properties=properties,
|
||||
)
|
||||
|
||||
event_message_removed.additional_properties = d
|
||||
return event_message_removed
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user