mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-06 08:22:07 +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
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 16
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-384a94f70b48c84af9eddcac72bbe12952c3ae3bd7fededfa1c63b203d12d828.yml
|
||||
openapi_spec_hash: e47ad28d646736d5d79d2dd1086d517d
|
||||
config_hash: e2d21e779cfc4e26a99b9e4e75de3f50
|
||||
configured_endpoints: 20
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-e2f67adede4455c3fe4507ac6f0b2ed1a91ee951ab30e01179555c18765750d4.yml
|
||||
openapi_spec_hash: 6005bcfff58c025d61739be42030a339
|
||||
config_hash: 6c8822d278ba83456e5eed6d774ca230
|
||||
|
|
|
|||
19
api.md
19
api.md
|
|
@ -29,17 +29,32 @@ Methods:
|
|||
- <code title="get /app">client.app.<a href="./src/opencode_ai/resources/app.py">get</a>() -> <a href="./src/opencode_ai/types/app.py">App</a></code>
|
||||
- <code title="post /app/init">client.app.<a href="./src/opencode_ai/resources/app.py">init</a>() -> <a href="./src/opencode_ai/types/app_init_response.py">AppInitResponse</a></code>
|
||||
|
||||
# Find
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import FindFilesResponse, FindSymbolsResponse, FindTextResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /find/file">client.find.<a href="./src/opencode_ai/resources/find.py">files</a>(\*\*<a href="src/opencode_ai/types/find_files_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_files_response.py">FindFilesResponse</a></code>
|
||||
- <code title="get /find/symbol">client.find.<a href="./src/opencode_ai/resources/find.py">symbols</a>(\*\*<a href="src/opencode_ai/types/find_symbols_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_symbols_response.py">FindSymbolsResponse</a></code>
|
||||
- <code title="get /find">client.find.<a href="./src/opencode_ai/resources/find.py">text</a>(\*\*<a href="src/opencode_ai/types/find_text_params.py">params</a>) -> <a href="./src/opencode_ai/types/find_text_response.py">FindTextResponse</a></code>
|
||||
|
||||
# File
|
||||
|
||||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import FileSearchResponse
|
||||
from opencode_ai.types import FileReadResponse, FileStatusResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
||||
- <code title="get /file">client.file.<a href="./src/opencode_ai/resources/file.py">search</a>(\*\*<a href="src/opencode_ai/types/file_search_params.py">params</a>) -> <a href="./src/opencode_ai/types/file_search_response.py">FileSearchResponse</a></code>
|
||||
- <code title="get /file">client.file.<a href="./src/opencode_ai/resources/file.py">read</a>(\*\*<a href="src/opencode_ai/types/file_read_params.py">params</a>) -> <a href="./src/opencode_ai/types/file_read_response.py">FileReadResponse</a></code>
|
||||
- <code title="get /file/status">client.file.<a href="./src/opencode_ai/resources/file.py">status</a>() -> <a href="./src/opencode_ai/types/file_status_response.py">FileStatusResponse</a></code>
|
||||
|
||||
# Config
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ from ._types import (
|
|||
)
|
||||
from ._utils import is_given, get_async_library
|
||||
from ._version import __version__
|
||||
from .resources import app, file, event, config, session
|
||||
from .resources import app, file, find, event, config, session
|
||||
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
||||
from ._exceptions import APIStatusError
|
||||
from ._base_client import (
|
||||
|
|
@ -45,6 +45,7 @@ __all__ = [
|
|||
class Opencode(SyncAPIClient):
|
||||
event: event.EventResource
|
||||
app: app.AppResource
|
||||
find: find.FindResource
|
||||
file: file.FileResource
|
||||
config: config.ConfigResource
|
||||
session: session.SessionResource
|
||||
|
|
@ -96,6 +97,7 @@ class Opencode(SyncAPIClient):
|
|||
|
||||
self.event = event.EventResource(self)
|
||||
self.app = app.AppResource(self)
|
||||
self.find = find.FindResource(self)
|
||||
self.file = file.FileResource(self)
|
||||
self.config = config.ConfigResource(self)
|
||||
self.session = session.SessionResource(self)
|
||||
|
|
@ -202,6 +204,7 @@ class Opencode(SyncAPIClient):
|
|||
class AsyncOpencode(AsyncAPIClient):
|
||||
event: event.AsyncEventResource
|
||||
app: app.AsyncAppResource
|
||||
find: find.AsyncFindResource
|
||||
file: file.AsyncFileResource
|
||||
config: config.AsyncConfigResource
|
||||
session: session.AsyncSessionResource
|
||||
|
|
@ -253,6 +256,7 @@ class AsyncOpencode(AsyncAPIClient):
|
|||
|
||||
self.event = event.AsyncEventResource(self)
|
||||
self.app = app.AsyncAppResource(self)
|
||||
self.find = find.AsyncFindResource(self)
|
||||
self.file = file.AsyncFileResource(self)
|
||||
self.config = config.AsyncConfigResource(self)
|
||||
self.session = session.AsyncSessionResource(self)
|
||||
|
|
@ -360,6 +364,7 @@ class OpencodeWithRawResponse:
|
|||
def __init__(self, client: Opencode) -> None:
|
||||
self.event = event.EventResourceWithRawResponse(client.event)
|
||||
self.app = app.AppResourceWithRawResponse(client.app)
|
||||
self.find = find.FindResourceWithRawResponse(client.find)
|
||||
self.file = file.FileResourceWithRawResponse(client.file)
|
||||
self.config = config.ConfigResourceWithRawResponse(client.config)
|
||||
self.session = session.SessionResourceWithRawResponse(client.session)
|
||||
|
|
@ -369,6 +374,7 @@ class AsyncOpencodeWithRawResponse:
|
|||
def __init__(self, client: AsyncOpencode) -> None:
|
||||
self.event = event.AsyncEventResourceWithRawResponse(client.event)
|
||||
self.app = app.AsyncAppResourceWithRawResponse(client.app)
|
||||
self.find = find.AsyncFindResourceWithRawResponse(client.find)
|
||||
self.file = file.AsyncFileResourceWithRawResponse(client.file)
|
||||
self.config = config.AsyncConfigResourceWithRawResponse(client.config)
|
||||
self.session = session.AsyncSessionResourceWithRawResponse(client.session)
|
||||
|
|
@ -378,6 +384,7 @@ class OpencodeWithStreamedResponse:
|
|||
def __init__(self, client: Opencode) -> None:
|
||||
self.event = event.EventResourceWithStreamingResponse(client.event)
|
||||
self.app = app.AppResourceWithStreamingResponse(client.app)
|
||||
self.find = find.FindResourceWithStreamingResponse(client.find)
|
||||
self.file = file.FileResourceWithStreamingResponse(client.file)
|
||||
self.config = config.ConfigResourceWithStreamingResponse(client.config)
|
||||
self.session = session.SessionResourceWithStreamingResponse(client.session)
|
||||
|
|
@ -387,6 +394,7 @@ class AsyncOpencodeWithStreamedResponse:
|
|||
def __init__(self, client: AsyncOpencode) -> None:
|
||||
self.event = event.AsyncEventResourceWithStreamingResponse(client.event)
|
||||
self.app = app.AsyncAppResourceWithStreamingResponse(client.app)
|
||||
self.find = find.AsyncFindResourceWithStreamingResponse(client.find)
|
||||
self.file = file.AsyncFileResourceWithStreamingResponse(client.file)
|
||||
self.config = config.AsyncConfigResourceWithStreamingResponse(client.config)
|
||||
self.session = session.AsyncSessionResourceWithStreamingResponse(client.session)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
@ -23,17 +23,24 @@ from .source_url_part import SourceURLPart as SourceURLPart
|
|||
from .step_start_part import StepStartPart as StepStartPart
|
||||
from .text_part_param import TextPartParam as TextPartParam
|
||||
from .tool_call_param import ToolCallParam as ToolCallParam
|
||||
from .file_read_params import FileReadParams as FileReadParams
|
||||
from .find_text_params import FindTextParams as FindTextParams
|
||||
from .app_init_response import AppInitResponse as AppInitResponse
|
||||
from .find_files_params import FindFilesParams as FindFilesParams
|
||||
from .tool_partial_call import ToolPartialCall as ToolPartialCall
|
||||
from .tool_result_param import ToolResultParam as ToolResultParam
|
||||
from .file_search_params import FileSearchParams as FileSearchParams
|
||||
from .file_read_response import FileReadResponse as FileReadResponse
|
||||
from .find_text_response import FindTextResponse as FindTextResponse
|
||||
from .message_part_param import MessagePartParam as MessagePartParam
|
||||
from .event_list_response import EventListResponse as EventListResponse
|
||||
from .find_files_response import FindFilesResponse as FindFilesResponse
|
||||
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
||||
from .session_chat_params import SessionChatParams as SessionChatParams
|
||||
from .session_init_params import SessionInitParams as SessionInitParams
|
||||
from .file_search_response import FileSearchResponse as FileSearchResponse
|
||||
from .file_status_response import FileStatusResponse as FileStatusResponse
|
||||
from .reasoning_part_param import ReasoningPartParam as ReasoningPartParam
|
||||
from .tool_invocation_part import ToolInvocationPart as ToolInvocationPart
|
||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||
from .session_list_response import SessionListResponse as SessionListResponse
|
||||
from .source_url_part_param import SourceURLPartParam as SourceURLPartParam
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ __all__ = [
|
|||
"EventSessionErrorProperties",
|
||||
"EventSessionErrorPropertiesError",
|
||||
"EventSessionErrorPropertiesErrorMessageOutputLengthError",
|
||||
"EventFileWatcherUpdated",
|
||||
"EventFileWatcherUpdatedProperties",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -185,6 +187,18 @@ class EventSessionError(BaseModel):
|
|||
type: Literal["session.error"]
|
||||
|
||||
|
||||
class EventFileWatcherUpdatedProperties(BaseModel):
|
||||
event: Literal["rename", "change"]
|
||||
|
||||
file: str
|
||||
|
||||
|
||||
class EventFileWatcherUpdated(BaseModel):
|
||||
properties: EventFileWatcherUpdatedProperties
|
||||
|
||||
type: Literal["file.watcher.updated"]
|
||||
|
||||
|
||||
EventListResponse: TypeAlias = Annotated[
|
||||
Union[
|
||||
EventLspClientDiagnostics,
|
||||
|
|
@ -198,6 +212,7 @@ EventListResponse: TypeAlias = Annotated[
|
|||
EventSessionDeleted,
|
||||
EventSessionIdle,
|
||||
EventSessionError,
|
||||
EventFileWatcherUpdated,
|
||||
],
|
||||
PropertyInfo(discriminator="type"),
|
||||
]
|
||||
|
|
|
|||
11
src/opencode_ai/types/file_read_params.py
Normal file
11
src/opencode_ai/types/file_read_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FileReadParams"]
|
||||
|
||||
|
||||
class FileReadParams(TypedDict, total=False):
|
||||
path: Required[str]
|
||||
13
src/opencode_ai/types/file_read_response.py
Normal file
13
src/opencode_ai/types/file_read_response.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FileReadResponse"]
|
||||
|
||||
|
||||
class FileReadResponse(BaseModel):
|
||||
content: str
|
||||
|
||||
type: Literal["raw", "patch"]
|
||||
21
src/opencode_ai/types/file_status_response.py
Normal file
21
src/opencode_ai/types/file_status_response.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FileStatusResponse", "FileStatusResponseItem"]
|
||||
|
||||
|
||||
class FileStatusResponseItem(BaseModel):
|
||||
added: float
|
||||
|
||||
file: str
|
||||
|
||||
removed: float
|
||||
|
||||
status: Literal["added", "deleted", "modified"]
|
||||
|
||||
|
||||
FileStatusResponse: TypeAlias = List[FileStatusResponseItem]
|
||||
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FileSearchParams"]
|
||||
__all__ = ["FindFilesParams"]
|
||||
|
||||
|
||||
class FileSearchParams(TypedDict, total=False):
|
||||
class FindFilesParams(TypedDict, total=False):
|
||||
query: Required[str]
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["FileSearchResponse"]
|
||||
__all__ = ["FindFilesResponse"]
|
||||
|
||||
FileSearchResponse: TypeAlias = List[str]
|
||||
FindFilesResponse: TypeAlias = List[str]
|
||||
11
src/opencode_ai/types/find_symbols_params.py
Normal file
11
src/opencode_ai/types/find_symbols_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FindSymbolsParams"]
|
||||
|
||||
|
||||
class FindSymbolsParams(TypedDict, total=False):
|
||||
query: Required[str]
|
||||
8
src/opencode_ai/types/find_symbols_response.py
Normal file
8
src/opencode_ai/types/find_symbols_response.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["FindSymbolsResponse"]
|
||||
|
||||
FindSymbolsResponse: TypeAlias = List[object]
|
||||
11
src/opencode_ai/types/find_text_params.py
Normal file
11
src/opencode_ai/types/find_text_params.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FindTextParams"]
|
||||
|
||||
|
||||
class FindTextParams(TypedDict, total=False):
|
||||
pattern: Required[str]
|
||||
50
src/opencode_ai/types/find_text_response.py
Normal file
50
src/opencode_ai/types/find_text_response.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = [
|
||||
"FindTextResponse",
|
||||
"FindTextResponseItem",
|
||||
"FindTextResponseItemLines",
|
||||
"FindTextResponseItemPath",
|
||||
"FindTextResponseItemSubmatch",
|
||||
"FindTextResponseItemSubmatchMatch",
|
||||
]
|
||||
|
||||
|
||||
class FindTextResponseItemLines(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemPath(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemSubmatchMatch(BaseModel):
|
||||
text: str
|
||||
|
||||
|
||||
class FindTextResponseItemSubmatch(BaseModel):
|
||||
end: float
|
||||
|
||||
match: FindTextResponseItemSubmatchMatch
|
||||
|
||||
start: float
|
||||
|
||||
|
||||
class FindTextResponseItem(BaseModel):
|
||||
absolute_offset: float
|
||||
|
||||
line_number: float
|
||||
|
||||
lines: FindTextResponseItemLines
|
||||
|
||||
path: FindTextResponseItemPath
|
||||
|
||||
submatches: List[FindTextResponseItemSubmatch]
|
||||
|
||||
|
||||
FindTextResponse: TypeAlias = List[FindTextResponseItem]
|
||||
|
|
@ -23,6 +23,7 @@ __all__ = [
|
|||
"MetadataAssistantTokensCache",
|
||||
"MetadataError",
|
||||
"MetadataErrorMessageOutputLengthError",
|
||||
"MetadataUser",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -99,6 +100,10 @@ MetadataError: TypeAlias = Annotated[
|
|||
]
|
||||
|
||||
|
||||
class MetadataUser(BaseModel):
|
||||
snapshot: Optional[str] = None
|
||||
|
||||
|
||||
class Metadata(BaseModel):
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
|
|
@ -110,6 +115,8 @@ class Metadata(BaseModel):
|
|||
|
||||
error: Optional[MetadataError] = None
|
||||
|
||||
user: Optional[MetadataUser] = None
|
||||
|
||||
|
||||
class Message(BaseModel):
|
||||
id: str
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import pytest
|
|||
|
||||
from opencode_ai import Opencode, AsyncOpencode
|
||||
from tests.utils import assert_matches_type
|
||||
from opencode_ai.types import FileSearchResponse
|
||||
from opencode_ai.types import FileReadResponse, FileStatusResponse
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
|
@ -19,35 +19,63 @@ class TestFile:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_search(self, client: Opencode) -> None:
|
||||
file = client.file.search(
|
||||
query="query",
|
||||
def test_method_read(self, client: Opencode) -> None:
|
||||
file = client.file.read(
|
||||
path="path",
|
||||
)
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_search(self, client: Opencode) -> None:
|
||||
response = client.file.with_raw_response.search(
|
||||
query="query",
|
||||
def test_raw_response_read(self, client: Opencode) -> None:
|
||||
response = client.file.with_raw_response.read(
|
||||
path="path",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
file = response.parse()
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_search(self, client: Opencode) -> None:
|
||||
with client.file.with_streaming_response.search(
|
||||
query="query",
|
||||
def test_streaming_response_read(self, client: Opencode) -> None:
|
||||
with client.file.with_streaming_response.read(
|
||||
path="path",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
file = response.parse()
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_status(self, client: Opencode) -> None:
|
||||
file = client.file.status()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_status(self, client: Opencode) -> None:
|
||||
response = client.file.with_raw_response.status()
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
file = response.parse()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_status(self, client: Opencode) -> None:
|
||||
with client.file.with_streaming_response.status() as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
file = response.parse()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
|
|
@ -59,34 +87,62 @@ class TestAsyncFile:
|
|||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_search(self, async_client: AsyncOpencode) -> None:
|
||||
file = await async_client.file.search(
|
||||
query="query",
|
||||
async def test_method_read(self, async_client: AsyncOpencode) -> None:
|
||||
file = await async_client.file.read(
|
||||
path="path",
|
||||
)
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_search(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.file.with_raw_response.search(
|
||||
query="query",
|
||||
async def test_raw_response_read(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.file.with_raw_response.read(
|
||||
path="path",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
file = await response.parse()
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_search(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.file.with_streaming_response.search(
|
||||
query="query",
|
||||
async def test_streaming_response_read(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.file.with_streaming_response.read(
|
||||
path="path",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
file = await response.parse()
|
||||
assert_matches_type(FileSearchResponse, file, path=["response"])
|
||||
assert_matches_type(FileReadResponse, file, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_status(self, async_client: AsyncOpencode) -> None:
|
||||
file = await async_client.file.status()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_status(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.file.with_raw_response.status()
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
file = await response.parse()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_status(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.file.with_streaming_response.status() as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
file = await response.parse()
|
||||
assert_matches_type(FileStatusResponse, file, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
|
|
|||
232
tests/api_resources/test_find.py
Normal file
232
tests/api_resources/test_find.py
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from opencode_ai import Opencode, AsyncOpencode
|
||||
from tests.utils import assert_matches_type
|
||||
from opencode_ai.types import (
|
||||
FindTextResponse,
|
||||
FindFilesResponse,
|
||||
FindSymbolsResponse,
|
||||
)
|
||||
|
||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||
|
||||
|
||||
class TestFind:
|
||||
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_files(self, client: Opencode) -> None:
|
||||
find = client.find.files(
|
||||
query="query",
|
||||
)
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_files(self, client: Opencode) -> None:
|
||||
response = client.find.with_raw_response.files(
|
||||
query="query",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = response.parse()
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_files(self, client: Opencode) -> None:
|
||||
with client.find.with_streaming_response.files(
|
||||
query="query",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = response.parse()
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_symbols(self, client: Opencode) -> None:
|
||||
find = client.find.symbols(
|
||||
query="query",
|
||||
)
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_symbols(self, client: Opencode) -> None:
|
||||
response = client.find.with_raw_response.symbols(
|
||||
query="query",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = response.parse()
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_symbols(self, client: Opencode) -> None:
|
||||
with client.find.with_streaming_response.symbols(
|
||||
query="query",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = response.parse()
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_method_text(self, client: Opencode) -> None:
|
||||
find = client.find.text(
|
||||
pattern="pattern",
|
||||
)
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_raw_response_text(self, client: Opencode) -> None:
|
||||
response = client.find.with_raw_response.text(
|
||||
pattern="pattern",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = response.parse()
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
def test_streaming_response_text(self, client: Opencode) -> None:
|
||||
with client.find.with_streaming_response.text(
|
||||
pattern="pattern",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = response.parse()
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
|
||||
class TestAsyncFind:
|
||||
parametrize = pytest.mark.parametrize(
|
||||
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
|
||||
)
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_files(self, async_client: AsyncOpencode) -> None:
|
||||
find = await async_client.find.files(
|
||||
query="query",
|
||||
)
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_files(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.find.with_raw_response.files(
|
||||
query="query",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_files(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.find.with_streaming_response.files(
|
||||
query="query",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindFilesResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_symbols(self, async_client: AsyncOpencode) -> None:
|
||||
find = await async_client.find.symbols(
|
||||
query="query",
|
||||
)
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_symbols(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.find.with_raw_response.symbols(
|
||||
query="query",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_symbols(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.find.with_streaming_response.symbols(
|
||||
query="query",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindSymbolsResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_method_text(self, async_client: AsyncOpencode) -> None:
|
||||
find = await async_client.find.text(
|
||||
pattern="pattern",
|
||||
)
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_raw_response_text(self, async_client: AsyncOpencode) -> None:
|
||||
response = await async_client.find.with_raw_response.text(
|
||||
pattern="pattern",
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
@pytest.mark.skip()
|
||||
@parametrize
|
||||
async def test_streaming_response_text(self, async_client: AsyncOpencode) -> None:
|
||||
async with async_client.find.with_streaming_response.text(
|
||||
pattern="pattern",
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
||||
find = await response.parse()
|
||||
assert_matches_type(FindTextResponse, find, path=["response"])
|
||||
|
||||
assert cast(Any, response.is_closed) is True
|
||||
Loading…
Add table
Add a link
Reference in a new issue