mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-11 11:18:34 +00:00
feat: interactive update flow for non-patch releases (#18662)
This commit is contained in:
@@ -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
|
||||
public upgrade<ThrowOnError extends boolean = false>(
|
||||
parameters?: {
|
||||
target?: 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}",
|
||||
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 }))
|
||||
|
||||
@@ -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
|
||||
export type GlobalUpgradeData = {
|
||||
body?: {
|
||||
target?: string
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
url: "/auth/{providerID}"
|
||||
url: "/global/upgrade"
|
||||
}
|
||||
|
||||
export type AuthRemoveErrors = {
|
||||
export type GlobalUpgradeErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
400: BadRequestError
|
||||
}
|
||||
|
||||
export type AuthRemoveError = AuthRemoveErrors[keyof AuthRemoveErrors]
|
||||
export type GlobalUpgradeError = GlobalUpgradeErrors[keyof GlobalUpgradeErrors]
|
||||
|
||||
export type AuthRemoveResponses = {
|
||||
export type GlobalUpgradeResponses = {
|
||||
/**
|
||||
* Successfully removed authentication credentials
|
||||
* Upgrade result
|
||||
*/
|
||||
200: boolean
|
||||
200:
|
||||
| {
|
||||
success: true
|
||||
version: string
|
||||
}
|
||||
| {
|
||||
success: false
|
||||
error: string
|
||||
}
|
||||
}
|
||||
|
||||
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 GlobalUpgradeResponse = GlobalUpgradeResponses[keyof GlobalUpgradeResponses]
|
||||
|
||||
export type ProjectListData = {
|
||||
body?: never
|
||||
|
||||
Reference in New Issue
Block a user