chore(app): global config changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user