diff options
| author | adamelmore <[email protected]> | 2026-01-27 08:53:48 -0600 |
|---|---|---|
| committer | adamelmore <[email protected]> | 2026-01-28 07:28:02 -0600 |
| commit | 2f35c40bb59e3b6628247801f9678f5023fd659c (patch) | |
| tree | e3c93afdb78575d6d22e1774c415321360028d8e /packages/sdk/js/src | |
| parent | 6650aa6f35885ce564eb003da0f3420b49e81cb3 (diff) | |
| download | opencode-2f35c40bb59e3b6628247801f9678f5023fd659c.tar.gz opencode-2f35c40bb59e3b6628247801f9678f5023fd659c.zip | |
chore(app): global config changes
Diffstat (limited to 'packages/sdk/js/src')
| -rw-r--r-- | packages/sdk/js/src/v2/gen/sdk.gen.ts | 58 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/types.gen.ts | 71 |
2 files changed, 108 insertions, 21 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index d39dd2b34..eee26ceb2 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -14,7 +14,7 @@ import type { AuthSetErrors, AuthSetResponses, CommandListResponses, - Config as Config2, + Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, @@ -34,6 +34,9 @@ import type { FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, + GlobalConfigGetResponses, + GlobalConfigUpdateErrors, + GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, @@ -215,6 +218,44 @@ class HeyApiRegistry<T> { } } +export class Config extends HeyApiClient { + /** + * Get global configuration + * + * Retrieve the current global OpenCode configuration settings and preferences. + */ + public get<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>) { + return (options?.client ?? this.client).get<GlobalConfigGetResponses, unknown, ThrowOnError>({ + url: "/global/config", + ...options, + }) + } + + /** + * Update global configuration + * + * Update global OpenCode configuration settings and preferences. + */ + public update<ThrowOnError extends boolean = false>( + parameters?: { + config?: Config3 + }, + options?: Options<never, ThrowOnError>, + ) { + const params = buildClientParams([parameters], [{ args: [{ key: "config", map: "body" }] }]) + return (options?.client ?? this.client).patch<GlobalConfigUpdateResponses, GlobalConfigUpdateErrors, ThrowOnError>({ + url: "/global/config", + ...options, + ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, + }) + } +} + export class Global extends HeyApiClient { /** * Get health @@ -251,6 +292,11 @@ export class Global extends HeyApiClient { ...options, }) } + + private _config?: Config + get config(): Config { + return (this._config ??= new Config({ client: this.client })) + } } export class Project extends HeyApiClient { @@ -541,7 +587,7 @@ export class Pty extends HeyApiClient { } } -export class Config extends HeyApiClient { +export class Config2 extends HeyApiClient { /** * Get configuration * @@ -569,7 +615,7 @@ export class Config extends HeyApiClient { public update<ThrowOnError extends boolean = false>( parameters?: { directory?: string - config?: Config2 + config?: Config3 }, options?: Options<never, ThrowOnError>, ) { @@ -3168,9 +3214,9 @@ export class OpencodeClient extends HeyApiClient { return (this._pty ??= new Pty({ client: this.client })) } - private _config?: Config - get config(): Config { - return (this._config ??= new Config({ client: this.client })) + private _config?: Config2 + get config(): Config2 { + return (this._config ??= new Config2({ client: this.client })) } private _tool?: Tool diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index 2a63d7212..cfb798806 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -930,21 +930,6 @@ export type GlobalEvent = { payload: Event } -export type BadRequestError = { - data: unknown - errors: Array<{ - [key: string]: unknown - }> - success: false -} - -export type NotFoundError = { - name: "NotFoundError" - data: { - message: string - } -} - /** * Custom keybind configurations */ @@ -1826,6 +1811,21 @@ export type Config = { } } +export type BadRequestError = { + data: unknown + errors: Array<{ + [key: string]: unknown + }> + success: false +} + +export type NotFoundError = { + name: "NotFoundError" + data: { + message: string + } +} + export type Model = { id: string providerID: string @@ -2199,6 +2199,47 @@ export type GlobalEventResponses = { export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses] +export type GlobalConfigGetData = { + body?: never + path?: never + query?: never + url: "/global/config" +} + +export type GlobalConfigGetResponses = { + /** + * Get global config info + */ + 200: Config +} + +export type GlobalConfigGetResponse = GlobalConfigGetResponses[keyof GlobalConfigGetResponses] + +export type GlobalConfigUpdateData = { + body?: Config + path?: never + query?: never + url: "/global/config" +} + +export type GlobalConfigUpdateErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type GlobalConfigUpdateError = GlobalConfigUpdateErrors[keyof GlobalConfigUpdateErrors] + +export type GlobalConfigUpdateResponses = { + /** + * Successfully updated global config + */ + 200: Config +} + +export type GlobalConfigUpdateResponse = GlobalConfigUpdateResponses[keyof GlobalConfigUpdateResponses] + export type GlobalDisposeData = { body?: never path?: never |
