Skip to content

Commit c428ecf

Browse files
feat(api): api update
1 parent c59a5a3 commit c428ecf

6 files changed

Lines changed: 48 additions & 6 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 22
1+
configured_endpoints: 23
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-69b99aaffe10dd5247638b6a34d6c0b3c1cf5300853d12c947151fd946e7fcdb.yml
33
openapi_spec_hash: e2c746cf689d71f04c6e9b1bd92e6356
4-
config_hash: e64b350ea4abbb4d56d49b0adebacb02
4+
config_hash: d779331eb3dabf2d99f2a20be154d1c9

api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,11 @@ Methods:
126126
- <code title="delete /session/{id}/share">client.session.<a href="./src/resources/session.ts">unshare</a>(id) -> Session</code>
127127

128128
# Tui
129+
130+
Types:
131+
132+
- <code><a href="./src/resources/tui.ts">TuiPromptResponse</a></code>
133+
134+
Methods:
135+
136+
- <code title="post /tui/prompt">client.tui.<a href="./src/resources/tui.ts">prompt</a>() -> TuiPromptResponse</code>

src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import {
8282
ToolStateRunning,
8383
UserMessage,
8484
} from './resources/session';
85-
import { Tui } from './resources/tui';
85+
import { Tui, TuiPromptResponse } from './resources/tui';
8686
import { type Fetch } from './internal/builtin-types';
8787
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
8888
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -849,7 +849,7 @@ export declare namespace Opencode {
849849
type SessionSummarizeParams as SessionSummarizeParams,
850850
};
851851

852-
export { Tui as Tui };
852+
export { Tui as Tui, type TuiPromptResponse as TuiPromptResponse };
853853

854854
export type MessageAbortedError = API.MessageAbortedError;
855855
export type ProviderAuthError = API.ProviderAuthError;

src/resources/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ export {
7373
type SessionInitParams,
7474
type SessionSummarizeParams,
7575
} from './session';
76-
export { Tui } from './tui';
76+
export { Tui, type TuiPromptResponse } from './tui';

src/resources/tui.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../core/resource';
4+
import { APIPromise } from '../core/api-promise';
5+
import { RequestOptions } from '../internal/request-options';
46

5-
export class Tui extends APIResource {}
7+
export class Tui extends APIResource {
8+
/**
9+
* Send a prompt to the TUI
10+
*/
11+
prompt(options?: RequestOptions): APIPromise<TuiPromptResponse> {
12+
return this._client.post('/tui/prompt', options);
13+
}
14+
}
15+
16+
export type TuiPromptResponse = boolean;
17+
18+
export declare namespace Tui {
19+
export { type TuiPromptResponse as TuiPromptResponse };
20+
}

tests/api-resources/tui.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import Opencode from '@opencode-ai/sdk';
4+
5+
const client = new Opencode({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
6+
7+
describe('resource tui', () => {
8+
// skipped: tests are disabled for the time being
9+
test.skip('prompt', async () => {
10+
const responsePromise = client.tui.prompt();
11+
const rawResponse = await responsePromise.asResponse();
12+
expect(rawResponse).toBeInstanceOf(Response);
13+
const response = await responsePromise;
14+
expect(response).not.toBeInstanceOf(Response);
15+
const dataAndResponse = await responsePromise.withResponse();
16+
expect(dataAndResponse.data).toBe(response);
17+
expect(dataAndResponse.response).toBe(rawResponse);
18+
});
19+
});

0 commit comments

Comments
 (0)