diff options
| author | Dax <[email protected]> | 2026-03-22 19:12:40 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-22 23:12:40 +0000 |
| commit | e2d03ce38c9bae484bc1592238e0c88e8ffd90bb (patch) | |
| tree | 76d0a8273e6dad00552cec368edc2d55fb69e8b4 /packages/sdk | |
| parent | 32f9dc6383aa4ae55c78979ecbff2d9404b623da (diff) | |
| download | opencode-e2d03ce38c9bae484bc1592238e0c88e8ffd90bb.tar.gz opencode-e2d03ce38c9bae484bc1592238e0c88e8ffd90bb.zip | |
feat: interactive update flow for non-patch releases (#18662)
Diffstat (limited to 'packages/sdk')
| -rw-r--r-- | packages/sdk/js/src/v2/gen/sdk.gen.ts | 126 | ||||
| -rw-r--r-- | packages/sdk/js/src/v2/gen/types.gen.ts | 171 |
2 files changed, 179 insertions, 118 deletions
diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index b6821322e..f5e22ebfb 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -46,6 +46,8 @@ import type { GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, + GlobalUpgradeErrors, + GlobalUpgradeResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, @@ -228,6 +230,62 @@ class HeyApiRegistry<T> { } } +export class Auth extends HeyApiClient { + /** + * Remove auth credentials + * + * Remove authentication credentials + */ + public remove<ThrowOnError extends boolean = false>( + parameters: { + providerID: string + }, + options?: Options<never, ThrowOnError>, + ) { + const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]) + return (options?.client ?? this.client).delete<AuthRemoveResponses, AuthRemoveErrors, ThrowOnError>({ + url: "/auth/{providerID}", + ...options, + ...params, + }) + } + + /** + * Set auth credentials + * + * Set authentication credentials + */ + public set<ThrowOnError extends boolean = false>( + parameters: { + providerID: string + auth?: Auth3 + }, + options?: Options<never, ThrowOnError>, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "path", key: "providerID" }, + { key: "auth", map: "body" }, + ], + }, + ], + ) + return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ + url: "/auth/{providerID}", + ...options, + ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, + }) + } +} + export class Config extends HeyApiClient { /** * Get global configuration @@ -303,57 +361,20 @@ export class Global extends HeyApiClient { }) } - private _config?: Config - get config(): Config { - return (this._config ??= new Config({ client: this.client })) - } -} - -export class Auth extends HeyApiClient { /** - * Remove auth credentials + * Upgrade opencode * - * Remove authentication credentials + * Upgrade opencode to the specified version or latest if not specified. */ - public remove<ThrowOnError extends boolean = false>( - parameters: { - providerID: string - }, - options?: Options<never, ThrowOnError>, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "path", key: "providerID" }] }]) - return (options?.client ?? this.client).delete<AuthRemoveResponses, AuthRemoveErrors, ThrowOnError>({ - url: "/auth/{providerID}", - ...options, - ...params, - }) - } - - /** - * Set auth credentials - * - * Set authentication credentials - */ - public set<ThrowOnError extends boolean = false>( - parameters: { - providerID: string - auth?: Auth3 + public upgrade<ThrowOnError extends boolean = false>( + parameters?: { + target?: string }, options?: Options<never, ThrowOnError>, ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "providerID" }, - { key: "auth", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({ - url: "/auth/{providerID}", + const params = buildClientParams([parameters], [{ args: [{ in: "body", key: "target" }] }]) + return (options?.client ?? this.client).post<GlobalUpgradeResponses, GlobalUpgradeErrors, ThrowOnError>({ + url: "/global/upgrade", ...options, ...params, headers: { @@ -363,6 +384,11 @@ export class Auth extends HeyApiClient { }, }) } + + private _config?: Config + get config(): Config { + return (this._config ??= new Config({ client: this.client })) + } } export class Project extends HeyApiClient { @@ -3906,16 +3932,16 @@ export class OpencodeClient extends HeyApiClient { OpencodeClient.__registry.set(this, args?.key) } - private _global?: Global - get global(): Global { - return (this._global ??= new Global({ client: this.client })) - } - private _auth?: Auth get auth(): Auth { return (this._auth ??= new Auth({ client: this.client })) } + private _global?: Global + get global(): Global { + return (this._global ??= new Global({ client: this.client })) + } + private _project?: Project get project(): Project { return (this._project ??= new Project({ client: this.client })) diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index f7aab687e..d284234cc 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -4,6 +4,36 @@ export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}) } +export type BadRequestError = { + data: unknown + errors: Array<{ + [key: string]: unknown + }> + success: false +} + +export type OAuth = { + type: "oauth" + refresh: string + access: string + expires: number + accountId?: string + enterpriseUrl?: string +} + +export type ApiAuth = { + type: "api" + key: string +} + +export type WellKnownAuth = { + type: "wellknown" + key: string + token: string +} + +export type Auth = OAuth | ApiAuth | WellKnownAuth + export type EventInstallationUpdated = { type: "installation.updated" properties: { @@ -1506,36 +1536,6 @@ export type Config = { } } -export type BadRequestError = { - data: unknown - errors: Array<{ - [key: string]: unknown - }> - success: false -} - -export type OAuth = { - type: "oauth" - refresh: string - access: string - expires: number - accountId?: string - enterpriseUrl?: string -} - -export type ApiAuth = { - type: "api" - key: string -} - -export type WellKnownAuth = { - type: "wellknown" - key: string - token: string -} - -export type Auth = OAuth | ApiAuth | WellKnownAuth - export type NotFoundError = { name: "NotFoundError" data: { @@ -1938,6 +1938,60 @@ export type FormatterStatus = { enabled: boolean } +export type AuthRemoveData = { + body?: never + path: { + providerID: string + } + query?: never + url: "/auth/{providerID}" +} + +export type AuthRemoveErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type AuthRemoveError = AuthRemoveErrors[keyof AuthRemoveErrors] + +export type AuthRemoveResponses = { + /** + * Successfully removed authentication credentials + */ + 200: boolean +} + +export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses] + +export type AuthSetData = { + body?: Auth + path: { + providerID: string + } + query?: never + url: "/auth/{providerID}" +} + +export type AuthSetErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type AuthSetError = AuthSetErrors[keyof AuthSetErrors] + +export type AuthSetResponses = { + /** + * Successfully set authentication credentials + */ + 200: boolean +} + +export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses] + export type GlobalHealthData = { body?: never path?: never @@ -2030,59 +2084,40 @@ export type GlobalDisposeResponses = { export type GlobalDisposeResponse = GlobalDisposeResponses[keyof GlobalDisposeResponses] -export type AuthRemoveData = { - body?: never - path: { - providerID: string - } - query?: never - url: "/auth/{providerID}" -} - -export type AuthRemoveErrors = { - /** - * Bad request - */ - 400: BadRequestError -} - -export type AuthRemoveError = AuthRemoveErrors[keyof AuthRemoveErrors] - -export type AuthRemoveResponses = { - /** - * Successfully removed authentication credentials - */ - 200: boolean -} - -export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses] - -export type AuthSetData = { - body?: Auth - path: { - providerID: string +export type GlobalUpgradeData = { + body?: { + target?: string } + path?: never query?: never - url: "/auth/{providerID}" + url: "/global/upgrade" } -export type AuthSetErrors = { +export type GlobalUpgradeErrors = { /** * Bad request */ 400: BadRequestError } -export type AuthSetError = AuthSetErrors[keyof AuthSetErrors] +export type GlobalUpgradeError = GlobalUpgradeErrors[keyof GlobalUpgradeErrors] -export type AuthSetResponses = { +export type GlobalUpgradeResponses = { /** - * Successfully set authentication credentials + * Upgrade result */ - 200: boolean + 200: + | { + success: true + version: string + } + | { + success: false + error: string + } } -export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses] +export type GlobalUpgradeResponse = GlobalUpgradeResponses[keyof GlobalUpgradeResponses] export type ProjectListData = { body?: never |
