mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-29 05:00:01 +00:00
feat(api): update via SDK Studio
This commit is contained in:
parent
3afcacf5f9
commit
ce2269062c
20 changed files with 925 additions and 60 deletions
|
|
@ -16,6 +16,14 @@ from .file import (
|
|||
FileResourceWithStreamingResponse,
|
||||
AsyncFileResourceWithStreamingResponse,
|
||||
)
|
||||
from .find import (
|
||||
FindResource,
|
||||
AsyncFindResource,
|
||||
FindResourceWithRawResponse,
|
||||
AsyncFindResourceWithRawResponse,
|
||||
FindResourceWithStreamingResponse,
|
||||
AsyncFindResourceWithStreamingResponse,
|
||||
)
|
||||
from .event import (
|
||||
EventResource,
|
||||
AsyncEventResource,
|
||||
|
|
@ -54,6 +62,12 @@ __all__ = [
|
|||
"AsyncAppResourceWithRawResponse",
|
||||
"AppResourceWithStreamingResponse",
|
||||
"AsyncAppResourceWithStreamingResponse",
|
||||
"FindResource",
|
||||
"AsyncFindResource",
|
||||
"FindResourceWithRawResponse",
|
||||
"AsyncFindResourceWithRawResponse",
|
||||
"FindResourceWithStreamingResponse",
|
||||
"AsyncFindResourceWithStreamingResponse",
|
||||
"FileResource",
|
||||
"AsyncFileResource",
|
||||
"FileResourceWithRawResponse",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
|
||||
import httpx
|
||||
|
||||
from ..types import file_search_params
|
||||
from ..types import file_read_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
|
|
@ -16,7 +16,8 @@ from .._response import (
|
|||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.file_search_response import FileSearchResponse
|
||||
from ..types.file_read_response import FileReadResponse
|
||||
from ..types.file_status_response import FileStatusResponse
|
||||
|
||||
__all__ = ["FileResource", "AsyncFileResource"]
|
||||
|
||||
|
|
@ -41,19 +42,19 @@ class FileResource(SyncAPIResource):
|
|||
"""
|
||||
return FileResourceWithStreamingResponse(self)
|
||||
|
||||
def search(
|
||||
def read(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
path: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileSearchResponse:
|
||||
) -> FileReadResponse:
|
||||
"""
|
||||
Search for files
|
||||
Read a file
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
|
@ -71,9 +72,28 @@ class FileResource(SyncAPIResource):
|
|||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, file_search_params.FileSearchParams),
|
||||
query=maybe_transform({"path": path}, file_read_params.FileReadParams),
|
||||
),
|
||||
cast_to=FileSearchResponse,
|
||||
cast_to=FileReadResponse,
|
||||
)
|
||||
|
||||
def status(
|
||||
self,
|
||||
*,
|
||||
# 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,
|
||||
) -> FileStatusResponse:
|
||||
"""Get file status"""
|
||||
return self._get(
|
||||
"/file/status",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=FileStatusResponse,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -97,19 +117,19 @@ class AsyncFileResource(AsyncAPIResource):
|
|||
"""
|
||||
return AsyncFileResourceWithStreamingResponse(self)
|
||||
|
||||
async def search(
|
||||
async def read(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
path: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FileSearchResponse:
|
||||
) -> FileReadResponse:
|
||||
"""
|
||||
Search for files
|
||||
Read a file
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
|
@ -127,9 +147,28 @@ class AsyncFileResource(AsyncAPIResource):
|
|||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, file_search_params.FileSearchParams),
|
||||
query=await async_maybe_transform({"path": path}, file_read_params.FileReadParams),
|
||||
),
|
||||
cast_to=FileSearchResponse,
|
||||
cast_to=FileReadResponse,
|
||||
)
|
||||
|
||||
async def status(
|
||||
self,
|
||||
*,
|
||||
# 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,
|
||||
) -> FileStatusResponse:
|
||||
"""Get file status"""
|
||||
return await self._get(
|
||||
"/file/status",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=FileStatusResponse,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -137,8 +176,11 @@ class FileResourceWithRawResponse:
|
|||
def __init__(self, file: FileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = to_raw_response_wrapper(
|
||||
file.search,
|
||||
self.read = to_raw_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = to_raw_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -146,8 +188,11 @@ class AsyncFileResourceWithRawResponse:
|
|||
def __init__(self, file: AsyncFileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = async_to_raw_response_wrapper(
|
||||
file.search,
|
||||
self.read = async_to_raw_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = async_to_raw_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -155,8 +200,11 @@ class FileResourceWithStreamingResponse:
|
|||
def __init__(self, file: FileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = to_streamed_response_wrapper(
|
||||
file.search,
|
||||
self.read = to_streamed_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = to_streamed_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -164,6 +212,9 @@ class AsyncFileResourceWithStreamingResponse:
|
|||
def __init__(self, file: AsyncFileResource) -> None:
|
||||
self._file = file
|
||||
|
||||
self.search = async_to_streamed_response_wrapper(
|
||||
file.search,
|
||||
self.read = async_to_streamed_response_wrapper(
|
||||
file.read,
|
||||
)
|
||||
self.status = async_to_streamed_response_wrapper(
|
||||
file.status,
|
||||
)
|
||||
|
|
|
|||
335
src/opencode_ai/resources/find.py
Normal file
335
src/opencode_ai/resources/find.py
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
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 .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
to_raw_response_wrapper,
|
||||
to_streamed_response_wrapper,
|
||||
async_to_raw_response_wrapper,
|
||||
async_to_streamed_response_wrapper,
|
||||
)
|
||||
from .._base_client import make_request_options
|
||||
from ..types.find_text_response import FindTextResponse
|
||||
from ..types.find_files_response import FindFilesResponse
|
||||
from ..types.find_symbols_response import FindSymbolsResponse
|
||||
|
||||
__all__ = ["FindResource", "AsyncFindResource"]
|
||||
|
||||
|
||||
class FindResource(SyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> FindResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return FindResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> FindResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return FindResourceWithStreamingResponse(self)
|
||||
|
||||
def files(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindFilesResponse:
|
||||
"""
|
||||
Find files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find/file",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, find_files_params.FindFilesParams),
|
||||
),
|
||||
cast_to=FindFilesResponse,
|
||||
)
|
||||
|
||||
def symbols(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindSymbolsResponse:
|
||||
"""
|
||||
Find workspace symbols
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find/symbol",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"query": query}, find_symbols_params.FindSymbolsParams),
|
||||
),
|
||||
cast_to=FindSymbolsResponse,
|
||||
)
|
||||
|
||||
def text(
|
||||
self,
|
||||
*,
|
||||
pattern: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindTextResponse:
|
||||
"""
|
||||
Find text in files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._get(
|
||||
"/find",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=maybe_transform({"pattern": pattern}, find_text_params.FindTextParams),
|
||||
),
|
||||
cast_to=FindTextResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
def with_raw_response(self) -> AsyncFindResourceWithRawResponse:
|
||||
"""
|
||||
This property can be used as a prefix for any HTTP method call to return
|
||||
the raw response object instead of the parsed content.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#accessing-raw-response-data-eg-headers
|
||||
"""
|
||||
return AsyncFindResourceWithRawResponse(self)
|
||||
|
||||
@cached_property
|
||||
def with_streaming_response(self) -> AsyncFindResourceWithStreamingResponse:
|
||||
"""
|
||||
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
||||
|
||||
For more information, see https://www.github.com/sst/opencode-sdk-python#with_streaming_response
|
||||
"""
|
||||
return AsyncFindResourceWithStreamingResponse(self)
|
||||
|
||||
async def files(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindFilesResponse:
|
||||
"""
|
||||
Find files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find/file",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, find_files_params.FindFilesParams),
|
||||
),
|
||||
cast_to=FindFilesResponse,
|
||||
)
|
||||
|
||||
async def symbols(
|
||||
self,
|
||||
*,
|
||||
query: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindSymbolsResponse:
|
||||
"""
|
||||
Find workspace symbols
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find/symbol",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"query": query}, find_symbols_params.FindSymbolsParams),
|
||||
),
|
||||
cast_to=FindSymbolsResponse,
|
||||
)
|
||||
|
||||
async def text(
|
||||
self,
|
||||
*,
|
||||
pattern: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> FindTextResponse:
|
||||
"""
|
||||
Find text in files
|
||||
|
||||
Args:
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._get(
|
||||
"/find",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers,
|
||||
extra_query=extra_query,
|
||||
extra_body=extra_body,
|
||||
timeout=timeout,
|
||||
query=await async_maybe_transform({"pattern": pattern}, find_text_params.FindTextParams),
|
||||
),
|
||||
cast_to=FindTextResponse,
|
||||
)
|
||||
|
||||
|
||||
class FindResourceWithRawResponse:
|
||||
def __init__(self, find: FindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = to_raw_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = to_raw_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = to_raw_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResourceWithRawResponse:
|
||||
def __init__(self, find: AsyncFindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = async_to_raw_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = async_to_raw_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = async_to_raw_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class FindResourceWithStreamingResponse:
|
||||
def __init__(self, find: FindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = to_streamed_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = to_streamed_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = to_streamed_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
|
||||
|
||||
class AsyncFindResourceWithStreamingResponse:
|
||||
def __init__(self, find: AsyncFindResource) -> None:
|
||||
self._find = find
|
||||
|
||||
self.files = async_to_streamed_response_wrapper(
|
||||
find.files,
|
||||
)
|
||||
self.symbols = async_to_streamed_response_wrapper(
|
||||
find.symbols,
|
||||
)
|
||||
self.text = async_to_streamed_response_wrapper(
|
||||
find.text,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue