Skip to content

Commit 50c887c

Browse files
feat(api): api update
1 parent c75c963 commit 50c887c

File tree

6 files changed

+121
-5
lines changed

6 files changed

+121
-5
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-04eaffcca7fcec3eba3c34ba4e91ba830867173c552015a0abfd65e25084d9b5.yml
3-
openapi_spec_hash: 4dfbcc2ce25451592f610e372ecad0cb
1+
configured_endpoints: 24
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-d10809ab68e48a338167e5504d69db2a0a80739adf6ecd3f065644a4139bc374.yml
3+
openapi_spec_hash: 4875565ef8df3446dbab11f450e04c51
44
config_hash: 0032a76356d31c6b4c218b39fff635bb

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ Methods:
140140
Types:
141141

142142
```python
143-
from opencode_ai.types import TuiPromptResponse
143+
from opencode_ai.types import TuiOpenHelpResponse, TuiPromptResponse
144144
```
145145

146146
Methods:
147147

148+
- <code title="post /tui/open-help">client.tui.<a href="./src/opencode_ai/resources/tui.py">open_help</a>() -> <a href="./src/opencode_ai/types/tui_open_help_response.py">TuiOpenHelpResponse</a></code>
148149
- <code title="post /tui/prompt">client.tui.<a href="./src/opencode_ai/resources/tui.py">prompt</a>(\*\*<a href="src/opencode_ai/types/tui_prompt_params.py">params</a>) -> <a href="./src/opencode_ai/types/tui_prompt_response.py">TuiPromptResponse</a></code>

src/opencode_ai/resources/tui.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .._base_client import make_request_options
2121
from ..types.part_param import PartParam
2222
from ..types.tui_prompt_response import TuiPromptResponse
23+
from ..types.tui_open_help_response import TuiOpenHelpResponse
2324

2425
__all__ = ["TuiResource", "AsyncTuiResource"]
2526

@@ -44,6 +45,25 @@ def with_streaming_response(self) -> TuiResourceWithStreamingResponse:
4445
"""
4546
return TuiResourceWithStreamingResponse(self)
4647

48+
def open_help(
49+
self,
50+
*,
51+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52+
# The extra values given here take precedence over values defined on the client or passed to this method.
53+
extra_headers: Headers | None = None,
54+
extra_query: Query | None = None,
55+
extra_body: Body | None = None,
56+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
57+
) -> TuiOpenHelpResponse:
58+
"""Open the help dialog"""
59+
return self._post(
60+
"/tui/open-help",
61+
options=make_request_options(
62+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
63+
),
64+
cast_to=TuiOpenHelpResponse,
65+
)
66+
4767
def prompt(
4868
self,
4969
*,
@@ -104,6 +124,25 @@ def with_streaming_response(self) -> AsyncTuiResourceWithStreamingResponse:
104124
"""
105125
return AsyncTuiResourceWithStreamingResponse(self)
106126

127+
async def open_help(
128+
self,
129+
*,
130+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
131+
# The extra values given here take precedence over values defined on the client or passed to this method.
132+
extra_headers: Headers | None = None,
133+
extra_query: Query | None = None,
134+
extra_body: Body | None = None,
135+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
136+
) -> TuiOpenHelpResponse:
137+
"""Open the help dialog"""
138+
return await self._post(
139+
"/tui/open-help",
140+
options=make_request_options(
141+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
142+
),
143+
cast_to=TuiOpenHelpResponse,
144+
)
145+
107146
async def prompt(
108147
self,
109148
*,
@@ -148,6 +187,9 @@ class TuiResourceWithRawResponse:
148187
def __init__(self, tui: TuiResource) -> None:
149188
self._tui = tui
150189

190+
self.open_help = to_raw_response_wrapper(
191+
tui.open_help,
192+
)
151193
self.prompt = to_raw_response_wrapper(
152194
tui.prompt,
153195
)
@@ -157,6 +199,9 @@ class AsyncTuiResourceWithRawResponse:
157199
def __init__(self, tui: AsyncTuiResource) -> None:
158200
self._tui = tui
159201

202+
self.open_help = async_to_raw_response_wrapper(
203+
tui.open_help,
204+
)
160205
self.prompt = async_to_raw_response_wrapper(
161206
tui.prompt,
162207
)
@@ -166,6 +211,9 @@ class TuiResourceWithStreamingResponse:
166211
def __init__(self, tui: TuiResource) -> None:
167212
self._tui = tui
168213

214+
self.open_help = to_streamed_response_wrapper(
215+
tui.open_help,
216+
)
169217
self.prompt = to_streamed_response_wrapper(
170218
tui.prompt,
171219
)
@@ -175,6 +223,9 @@ class AsyncTuiResourceWithStreamingResponse:
175223
def __init__(self, tui: AsyncTuiResource) -> None:
176224
self._tui = tui
177225

226+
self.open_help = async_to_streamed_response_wrapper(
227+
tui.open_help,
228+
)
178229
self.prompt = async_to_streamed_response_wrapper(
179230
tui.prompt,
180231
)

src/opencode_ai/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
7474
from .step_finish_part_param import StepFinishPartParam as StepFinishPartParam
7575
from .tool_state_error_param import ToolStateErrorParam as ToolStateErrorParam
76+
from .tui_open_help_response import TuiOpenHelpResponse as TuiOpenHelpResponse
7677
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
7778
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
7879
from .tool_state_pending_param import ToolStatePendingParam as ToolStatePendingParam
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import TypeAlias
4+
5+
__all__ = ["TuiOpenHelpResponse"]
6+
7+
TuiOpenHelpResponse: TypeAlias = bool

tests/api_resources/test_tui.py

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,42 @@
99

1010
from opencode_ai import Opencode, AsyncOpencode
1111
from tests.utils import assert_matches_type
12-
from opencode_ai.types import TuiPromptResponse
12+
from opencode_ai.types import TuiPromptResponse, TuiOpenHelpResponse
1313

1414
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1515

1616

1717
class TestTui:
1818
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
1919

20+
@pytest.mark.skip()
21+
@parametrize
22+
def test_method_open_help(self, client: Opencode) -> None:
23+
tui = client.tui.open_help()
24+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
25+
26+
@pytest.mark.skip()
27+
@parametrize
28+
def test_raw_response_open_help(self, client: Opencode) -> None:
29+
response = client.tui.with_raw_response.open_help()
30+
31+
assert response.is_closed is True
32+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
33+
tui = response.parse()
34+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
35+
36+
@pytest.mark.skip()
37+
@parametrize
38+
def test_streaming_response_open_help(self, client: Opencode) -> None:
39+
with client.tui.with_streaming_response.open_help() as response:
40+
assert not response.is_closed
41+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
42+
43+
tui = response.parse()
44+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
45+
46+
assert cast(Any, response.is_closed) is True
47+
2048
@pytest.mark.skip()
2149
@parametrize
2250
def test_method_prompt(self, client: Opencode) -> None:
@@ -84,6 +112,34 @@ class TestAsyncTui:
84112
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
85113
)
86114

115+
@pytest.mark.skip()
116+
@parametrize
117+
async def test_method_open_help(self, async_client: AsyncOpencode) -> None:
118+
tui = await async_client.tui.open_help()
119+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
120+
121+
@pytest.mark.skip()
122+
@parametrize
123+
async def test_raw_response_open_help(self, async_client: AsyncOpencode) -> None:
124+
response = await async_client.tui.with_raw_response.open_help()
125+
126+
assert response.is_closed is True
127+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
128+
tui = await response.parse()
129+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
130+
131+
@pytest.mark.skip()
132+
@parametrize
133+
async def test_streaming_response_open_help(self, async_client: AsyncOpencode) -> None:
134+
async with async_client.tui.with_streaming_response.open_help() as response:
135+
assert not response.is_closed
136+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
137+
138+
tui = await response.parse()
139+
assert_matches_type(TuiOpenHelpResponse, tui, path=["response"])
140+
141+
assert cast(Any, response.is_closed) is True
142+
87143
@pytest.mark.skip()
88144
@parametrize
89145
async def test_method_prompt(self, async_client: AsyncOpencode) -> None:

0 commit comments

Comments
 (0)