diff --git a/src/opencode_ai/__init__.py b/src/opencode_ai/__init__.py index 7d8c13c..7debe41 100644 --- a/src/opencode_ai/__init__.py +++ b/src/opencode_ai/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import ( Client, @@ -48,7 +48,9 @@ __all__ = [ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "OpencodeError", "APIError", "APIStatusError", diff --git a/src/opencode_ai/_base_client.py b/src/opencode_ai/_base_client.py index f7ce0f3..c8a1977 100644 --- a/src/opencode_ai/_base_client.py +++ b/src/opencode_ai/_base_client.py @@ -42,7 +42,6 @@ from . import _exceptions from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ from ._types import ( RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -145,9 +145,9 @@ class PageInfo: def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -595,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -825,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]): version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1356,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]): base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1818,8 +1818,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/opencode_ai/_client.py b/src/opencode_ai/_client.py index 133e1e5..3a34a0a 100644 --- a/src/opencode_ai/_client.py +++ b/src/opencode_ai/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Union, Mapping +from typing import Any, Mapping from typing_extensions import Self, override import httpx @@ -11,13 +11,13 @@ import httpx from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library from ._version import __version__ @@ -64,7 +64,7 @@ class Opencode(SyncAPIClient): self, *, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -133,9 +133,9 @@ class Opencode(SyncAPIClient): self, *, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -233,7 +233,7 @@ class AsyncOpencode(AsyncAPIClient): self, *, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -302,9 +302,9 @@ class AsyncOpencode(AsyncAPIClient): self, *, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/opencode_ai/_qs.py b/src/opencode_ai/_qs.py index 274320c..ada6fd3 100644 --- a/src/opencode_ai/_qs.py +++ b/src/opencode_ai/_qs.py @@ -4,7 +4,7 @@ from typing import Any, List, Tuple, Union, Mapping, TypeVar from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ class Querystring: self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ class Querystring: self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ class Options: self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/opencode_ai/_types.py b/src/opencode_ai/_types.py index 5dfb606..97c5da7 100644 --- a/src/opencode_ai/_types.py +++ b/src/opencode_ai/_types.py @@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -140,13 +143,14 @@ class NotGiven: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -156,8 +160,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -165,6 +169,9 @@ class Omit: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/opencode_ai/_utils/_transform.py b/src/opencode_ai/_utils/_transform.py index c19124f..5207549 100644 --- a/src/opencode_ai/_utils/_transform.py +++ b/src/opencode_ai/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/opencode_ai/_utils/_utils.py b/src/opencode_ai/_utils/_utils.py index f081859..50d5926 100644 --- a/src/opencode_ai/_utils/_utils.py +++ b/src/opencode_ai/_utils/_utils.py @@ -21,7 +21,7 @@ from typing_extensions import TypeGuard import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/opencode_ai/resources/agent.py b/src/opencode_ai/resources/agent.py index 084f87e..32bcfbf 100644 --- a/src/opencode_ai/resources/agent.py +++ b/src/opencode_ai/resources/agent.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import agent_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -44,13 +44,13 @@ class AgentResource(SyncAPIResource): def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgentListResponse: """ List all agents @@ -100,13 +100,13 @@ class AsyncAgentResource(AsyncAPIResource): async def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgentListResponse: """ List all agents diff --git a/src/opencode_ai/resources/app.py b/src/opencode_ai/resources/app.py index 60ff06e..2c139b2 100644 --- a/src/opencode_ai/resources/app.py +++ b/src/opencode_ai/resources/app.py @@ -8,7 +8,7 @@ from typing_extensions import Literal import httpx from ..types import app_log_params, app_providers_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -51,14 +51,14 @@ class AppResource(SyncAPIResource): level: Literal["debug", "info", "error", "warn"], message: str, service: str, - directory: str | NotGiven = NOT_GIVEN, - extra: Dict[str, object] | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + extra: Dict[str, object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppLogResponse: """ Write a log entry to the server logs @@ -104,13 +104,13 @@ class AppResource(SyncAPIResource): def providers( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppProvidersResponse: """ List all providers @@ -163,14 +163,14 @@ class AsyncAppResource(AsyncAPIResource): level: Literal["debug", "info", "error", "warn"], message: str, service: str, - directory: str | NotGiven = NOT_GIVEN, - extra: Dict[str, object] | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + extra: Dict[str, object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppLogResponse: """ Write a log entry to the server logs @@ -216,13 +216,13 @@ class AsyncAppResource(AsyncAPIResource): async def providers( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AppProvidersResponse: """ List all providers diff --git a/src/opencode_ai/resources/command.py b/src/opencode_ai/resources/command.py index 57cfbc1..e31c6b4 100644 --- a/src/opencode_ai/resources/command.py +++ b/src/opencode_ai/resources/command.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import command_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -44,13 +44,13 @@ class CommandResource(SyncAPIResource): def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CommandListResponse: """ List all commands @@ -100,13 +100,13 @@ class AsyncCommandResource(AsyncAPIResource): async def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CommandListResponse: """ List all commands diff --git a/src/opencode_ai/resources/config.py b/src/opencode_ai/resources/config.py index f460338..70c1c59 100644 --- a/src/opencode_ai/resources/config.py +++ b/src/opencode_ai/resources/config.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import config_get_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -44,13 +44,13 @@ class ConfigResource(SyncAPIResource): def get( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Config: """ Get config info @@ -100,13 +100,13 @@ class AsyncConfigResource(AsyncAPIResource): async def get( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Config: """ Get config info diff --git a/src/opencode_ai/resources/event.py b/src/opencode_ai/resources/event.py index 118c557..6c33d60 100644 --- a/src/opencode_ai/resources/event.py +++ b/src/opencode_ai/resources/event.py @@ -7,7 +7,7 @@ from typing import Any, cast import httpx from ..types import event_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ class EventResource(SyncAPIResource): def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream[EventListResponse]: """ Get events @@ -106,13 +106,13 @@ class AsyncEventResource(AsyncAPIResource): async def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncStream[EventListResponse]: """ Get events diff --git a/src/opencode_ai/resources/file.py b/src/opencode_ai/resources/file.py index 2e10468..711df13 100644 --- a/src/opencode_ai/resources/file.py +++ b/src/opencode_ai/resources/file.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import file_list_params, file_read_params, file_status_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ class FileResource(SyncAPIResource): self, *, path: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileListResponse: """ List files and directories @@ -89,13 +89,13 @@ class FileResource(SyncAPIResource): self, *, path: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileReadResponse: """ Read a file @@ -130,13 +130,13 @@ class FileResource(SyncAPIResource): def status( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileStatusResponse: """ Get file status @@ -187,13 +187,13 @@ class AsyncFileResource(AsyncAPIResource): self, *, path: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileListResponse: """ List files and directories @@ -229,13 +229,13 @@ class AsyncFileResource(AsyncAPIResource): self, *, path: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileReadResponse: """ Read a file @@ -270,13 +270,13 @@ class AsyncFileResource(AsyncAPIResource): async def status( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileStatusResponse: """ Get file status diff --git a/src/opencode_ai/resources/find.py b/src/opencode_ai/resources/find.py index 6d8476d..7374a04 100644 --- a/src/opencode_ai/resources/find.py +++ b/src/opencode_ai/resources/find.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import find_text_params, find_files_params, find_symbols_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -47,13 +47,13 @@ class FindResource(SyncAPIResource): self, *, query: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindFilesResponse: """ Find files @@ -89,13 +89,13 @@ class FindResource(SyncAPIResource): self, *, query: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindSymbolsResponse: """ Find workspace symbols @@ -131,13 +131,13 @@ class FindResource(SyncAPIResource): self, *, pattern: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindTextResponse: """ Find text in files @@ -194,13 +194,13 @@ class AsyncFindResource(AsyncAPIResource): self, *, query: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindFilesResponse: """ Find files @@ -236,13 +236,13 @@ class AsyncFindResource(AsyncAPIResource): self, *, query: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindSymbolsResponse: """ Find workspace symbols @@ -278,13 +278,13 @@ class AsyncFindResource(AsyncAPIResource): self, *, pattern: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FindTextResponse: """ Find text in files diff --git a/src/opencode_ai/resources/path.py b/src/opencode_ai/resources/path.py index 7231a7e..6afee36 100644 --- a/src/opencode_ai/resources/path.py +++ b/src/opencode_ai/resources/path.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import path_get_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -44,13 +44,13 @@ class PathResource(SyncAPIResource): def get( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Path: """ Get the current path @@ -100,13 +100,13 @@ class AsyncPathResource(AsyncAPIResource): async def get( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Path: """ Get the current path diff --git a/src/opencode_ai/resources/project.py b/src/opencode_ai/resources/project.py index 72b214d..e0b94b5 100644 --- a/src/opencode_ai/resources/project.py +++ b/src/opencode_ai/resources/project.py @@ -5,7 +5,7 @@ from __future__ import annotations import httpx from ..types import project_list_params, project_current_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -45,13 +45,13 @@ class ProjectResource(SyncAPIResource): def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectListResponse: """ List all projects @@ -80,13 +80,13 @@ class ProjectResource(SyncAPIResource): def current( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Get the current project @@ -136,13 +136,13 @@ class AsyncProjectResource(AsyncAPIResource): async def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectListResponse: """ List all projects @@ -171,13 +171,13 @@ class AsyncProjectResource(AsyncAPIResource): async def current( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Get the current project diff --git a/src/opencode_ai/resources/session/permissions.py b/src/opencode_ai/resources/session/permissions.py index 8b521bd..a4d9c23 100644 --- a/src/opencode_ai/resources/session/permissions.py +++ b/src/opencode_ai/resources/session/permissions.py @@ -6,7 +6,7 @@ from typing_extensions import Literal import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,13 +49,13 @@ class PermissionsResource(SyncAPIResource): *, id: str, response: Literal["once", "always", "reject"], - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PermissionRespondResponse: """ Respond to a permission request @@ -113,13 +113,13 @@ class AsyncPermissionsResource(AsyncAPIResource): *, id: str, response: Literal["once", "always", "reject"], - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PermissionRespondResponse: """ Respond to a permission request diff --git a/src/opencode_ai/resources/session/session.py b/src/opencode_ai/resources/session/session.py index 8e29247..950acf1 100644 --- a/src/opencode_ai/resources/session/session.py +++ b/src/opencode_ai/resources/session/session.py @@ -26,7 +26,7 @@ from ...types import ( session_unrevert_params, session_summarize_params, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -88,15 +88,15 @@ class SessionResource(SyncAPIResource): def create( self, *, - directory: str | NotGiven = NOT_GIVEN, - parent_id: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + parent_id: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Create a new session @@ -133,14 +133,14 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Update session properties @@ -172,13 +172,13 @@ class SessionResource(SyncAPIResource): def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionListResponse: """ List all sessions @@ -208,13 +208,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionDeleteResponse: """ Delete a session and all its data @@ -246,13 +246,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionAbortResponse: """ Abort a session @@ -284,13 +284,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionChildrenResponse: """ Get a session's children @@ -324,16 +324,16 @@ class SessionResource(SyncAPIResource): *, arguments: str, command: str, - directory: str | NotGiven = NOT_GIVEN, - agent: str | NotGiven = NOT_GIVEN, - message_id: str | NotGiven = NOT_GIVEN, - model: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + agent: str | Omit = omit, + message_id: str | Omit = omit, + model: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionCommandResponse: """ Send a new command to a session @@ -377,13 +377,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Get session @@ -418,13 +418,13 @@ class SessionResource(SyncAPIResource): message_id: str, model_id: str, provider_id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionInitResponse: """ Analyze the app and create an AGENTS.md file @@ -467,13 +467,13 @@ class SessionResource(SyncAPIResource): message_id: str, *, id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionMessageResponse: """ Get a message from a session @@ -511,13 +511,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionMessagesResponse: """ List messages for a session @@ -552,18 +552,18 @@ class SessionResource(SyncAPIResource): id: str, *, parts: Iterable[session_prompt_params.Part], - directory: str | NotGiven = NOT_GIVEN, - agent: str | NotGiven = NOT_GIVEN, - message_id: str | NotGiven = NOT_GIVEN, - model: session_prompt_params.Model | NotGiven = NOT_GIVEN, - system: str | NotGiven = NOT_GIVEN, - tools: Dict[str, bool] | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + agent: str | Omit = omit, + message_id: str | Omit = omit, + model: session_prompt_params.Model | Omit = omit, + system: str | Omit = omit, + tools: Dict[str, bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionPromptResponse: """ Create and send a new message to a session @@ -609,14 +609,14 @@ class SessionResource(SyncAPIResource): id: str, *, message_id: str, - directory: str | NotGiven = NOT_GIVEN, - part_id: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + part_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Revert a message @@ -655,13 +655,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Share a session @@ -695,13 +695,13 @@ class SessionResource(SyncAPIResource): *, agent: str, command: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AssistantMessage: """ Run a shell command @@ -744,13 +744,13 @@ class SessionResource(SyncAPIResource): *, model_id: str, provider_id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionSummarizeResponse: """ Summarize the session @@ -791,13 +791,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Restore all reverted messages @@ -829,13 +829,13 @@ class SessionResource(SyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Unshare the session @@ -891,15 +891,15 @@ class AsyncSessionResource(AsyncAPIResource): async def create( self, *, - directory: str | NotGiven = NOT_GIVEN, - parent_id: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + parent_id: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Create a new session @@ -936,14 +936,14 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Update session properties @@ -975,13 +975,13 @@ class AsyncSessionResource(AsyncAPIResource): async def list( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionListResponse: """ List all sessions @@ -1011,13 +1011,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionDeleteResponse: """ Delete a session and all its data @@ -1049,13 +1049,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionAbortResponse: """ Abort a session @@ -1087,13 +1087,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionChildrenResponse: """ Get a session's children @@ -1129,16 +1129,16 @@ class AsyncSessionResource(AsyncAPIResource): *, arguments: str, command: str, - directory: str | NotGiven = NOT_GIVEN, - agent: str | NotGiven = NOT_GIVEN, - message_id: str | NotGiven = NOT_GIVEN, - model: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + agent: str | Omit = omit, + message_id: str | Omit = omit, + model: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionCommandResponse: """ Send a new command to a session @@ -1184,13 +1184,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Get session @@ -1225,13 +1225,13 @@ class AsyncSessionResource(AsyncAPIResource): message_id: str, model_id: str, provider_id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionInitResponse: """ Analyze the app and create an AGENTS.md file @@ -1274,13 +1274,13 @@ class AsyncSessionResource(AsyncAPIResource): message_id: str, *, id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionMessageResponse: """ Get a message from a session @@ -1320,13 +1320,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionMessagesResponse: """ List messages for a session @@ -1363,18 +1363,18 @@ class AsyncSessionResource(AsyncAPIResource): id: str, *, parts: Iterable[session_prompt_params.Part], - directory: str | NotGiven = NOT_GIVEN, - agent: str | NotGiven = NOT_GIVEN, - message_id: str | NotGiven = NOT_GIVEN, - model: session_prompt_params.Model | NotGiven = NOT_GIVEN, - system: str | NotGiven = NOT_GIVEN, - tools: Dict[str, bool] | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + agent: str | Omit = omit, + message_id: str | Omit = omit, + model: session_prompt_params.Model | Omit = omit, + system: str | Omit = omit, + tools: Dict[str, bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionPromptResponse: """ Create and send a new message to a session @@ -1420,14 +1420,14 @@ class AsyncSessionResource(AsyncAPIResource): id: str, *, message_id: str, - directory: str | NotGiven = NOT_GIVEN, - part_id: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + part_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Revert a message @@ -1466,13 +1466,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Share a session @@ -1506,13 +1506,13 @@ class AsyncSessionResource(AsyncAPIResource): *, agent: str, command: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AssistantMessage: """ Run a shell command @@ -1555,13 +1555,13 @@ class AsyncSessionResource(AsyncAPIResource): *, model_id: str, provider_id: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SessionSummarizeResponse: """ Summarize the session @@ -1604,13 +1604,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Restore all reverted messages @@ -1644,13 +1644,13 @@ class AsyncSessionResource(AsyncAPIResource): self, id: str, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Session: """ Unshare the session diff --git a/src/opencode_ai/resources/tui.py b/src/opencode_ai/resources/tui.py index 0a13597..11ffd2d 100644 --- a/src/opencode_ai/resources/tui.py +++ b/src/opencode_ai/resources/tui.py @@ -17,7 +17,7 @@ from ..types import ( tui_submit_prompt_params, tui_execute_command_params, ) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -65,13 +65,13 @@ class TuiResource(SyncAPIResource): self, *, text: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiAppendPromptResponse: """ Append prompt to the TUI @@ -101,13 +101,13 @@ class TuiResource(SyncAPIResource): def clear_prompt( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiClearPromptResponse: """ Clear the prompt @@ -137,13 +137,13 @@ class TuiResource(SyncAPIResource): self, *, command: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiExecuteCommandResponse: """Execute a TUI command (e.g. @@ -174,13 +174,13 @@ class TuiResource(SyncAPIResource): def open_help( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenHelpResponse: """ Open the help dialog @@ -209,13 +209,13 @@ class TuiResource(SyncAPIResource): def open_models( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenModelsResponse: """ Open the model dialog @@ -244,13 +244,13 @@ class TuiResource(SyncAPIResource): def open_sessions( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenSessionsResponse: """ Open the session dialog @@ -279,13 +279,13 @@ class TuiResource(SyncAPIResource): def open_themes( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenThemesResponse: """ Open the theme dialog @@ -316,14 +316,14 @@ class TuiResource(SyncAPIResource): *, message: str, variant: Literal["info", "success", "warning", "error"], - directory: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiShowToastResponse: """ Show a toast notification in the TUI @@ -360,13 +360,13 @@ class TuiResource(SyncAPIResource): def submit_prompt( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiSubmitPromptResponse: """ Submit the prompt @@ -417,13 +417,13 @@ class AsyncTuiResource(AsyncAPIResource): self, *, text: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiAppendPromptResponse: """ Append prompt to the TUI @@ -455,13 +455,13 @@ class AsyncTuiResource(AsyncAPIResource): async def clear_prompt( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiClearPromptResponse: """ Clear the prompt @@ -493,13 +493,13 @@ class AsyncTuiResource(AsyncAPIResource): self, *, command: str, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiExecuteCommandResponse: """Execute a TUI command (e.g. @@ -532,13 +532,13 @@ class AsyncTuiResource(AsyncAPIResource): async def open_help( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenHelpResponse: """ Open the help dialog @@ -567,13 +567,13 @@ class AsyncTuiResource(AsyncAPIResource): async def open_models( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenModelsResponse: """ Open the model dialog @@ -602,13 +602,13 @@ class AsyncTuiResource(AsyncAPIResource): async def open_sessions( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenSessionsResponse: """ Open the session dialog @@ -639,13 +639,13 @@ class AsyncTuiResource(AsyncAPIResource): async def open_themes( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiOpenThemesResponse: """ Open the theme dialog @@ -676,14 +676,14 @@ class AsyncTuiResource(AsyncAPIResource): *, message: str, variant: Literal["info", "success", "warning", "error"], - directory: str | NotGiven = NOT_GIVEN, - title: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, + title: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiShowToastResponse: """ Show a toast notification in the TUI @@ -720,13 +720,13 @@ class AsyncTuiResource(AsyncAPIResource): async def submit_prompt( self, *, - directory: str | NotGiven = NOT_GIVEN, + directory: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TuiSubmitPromptResponse: """ Submit the prompt diff --git a/tests/test_transform.py b/tests/test_transform.py index 5ecdb1f..5adf5f4 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ from typing_extensions import Required, Annotated, TypedDict import pytest -from opencode_ai._types import NOT_GIVEN, Base64FileInput +from opencode_ai._types import Base64FileInput, omit, not_given from opencode_ai._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {}