mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-28 12:39:54 +00:00
feat(api): api update
This commit is contained in:
parent
45b4e60154
commit
145229a92b
7 changed files with 31 additions and 23 deletions
|
|
@ -3,10 +3,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import LogLevel, app_log_params
|
||||
from ..types import app_log_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
|
|
@ -19,7 +20,6 @@ from .._response import (
|
|||
)
|
||||
from ..types.app import App
|
||||
from .._base_client import make_request_options
|
||||
from ..types.log_level import LogLevel
|
||||
from ..types.app_log_response import AppLogResponse
|
||||
from ..types.app_init_response import AppInitResponse
|
||||
from ..types.app_modes_response import AppModesResponse
|
||||
|
|
@ -89,7 +89,7 @@ class AppResource(SyncAPIResource):
|
|||
def log(
|
||||
self,
|
||||
*,
|
||||
level: LogLevel,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
|
||||
|
|
@ -237,7 +237,7 @@ class AsyncAppResource(AsyncAPIResource):
|
|||
async def log(
|
||||
self,
|
||||
*,
|
||||
level: LogLevel,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ from .message import Message as Message
|
|||
from .session import Session as Session
|
||||
from .provider import Provider as Provider
|
||||
from .file_part import FilePart as FilePart
|
||||
from .log_level import LogLevel as LogLevel
|
||||
from .text_part import TextPart as TextPart
|
||||
from .tool_part import ToolPart as ToolPart
|
||||
from .file_source import FileSource as FileSource
|
||||
|
|
|
|||
|
|
@ -3,15 +3,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
from .log_level import LogLevel
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["AppLogParams"]
|
||||
|
||||
|
||||
class AppLogParams(TypedDict, total=False):
|
||||
level: Required[LogLevel]
|
||||
level: Required[Literal["debug", "info", "error", "warn"]]
|
||||
"""Log level"""
|
||||
|
||||
message: Required[str]
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
__all__ = ["LogLevel"]
|
||||
|
||||
LogLevel: TypeAlias = Literal["debug", "info", "error", "warn"]
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
from typing import List, Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .file_part import FilePart
|
||||
from .text_part import TextPart
|
||||
from .tool_part import ToolPart
|
||||
|
|
@ -11,8 +14,24 @@ from .snapshot_part import SnapshotPart
|
|||
from .step_start_part import StepStartPart
|
||||
from .step_finish_part import StepFinishPart
|
||||
|
||||
__all__ = ["Part"]
|
||||
__all__ = ["Part", "PatchPart"]
|
||||
|
||||
|
||||
class PatchPart(BaseModel):
|
||||
id: str
|
||||
|
||||
files: List[str]
|
||||
|
||||
hash: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["patch"]
|
||||
|
||||
|
||||
Part: TypeAlias = Annotated[
|
||||
Union[TextPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart], PropertyInfo(discriminator="type")
|
||||
Union[TextPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart, PatchPart],
|
||||
PropertyInfo(discriminator="type"),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue