sync
This commit is contained in:
@@ -1045,7 +1045,7 @@ function UserMessage(props: {
|
||||
</box>
|
||||
</Show>
|
||||
<text fg={theme.textMuted}>
|
||||
{ctx.usernameVisible() ? `${sync.data.config.username ?? "You"}` : "You"}
|
||||
{ctx.usernameVisible() ? `${sync.data.config.username ?? "You "}` : "You "}
|
||||
<Show
|
||||
when={queued()}
|
||||
fallback={
|
||||
|
||||
@@ -12,31 +12,6 @@ await $`bun dev generate > ${dir}/openapi.json`.cwd(path.resolve(dir, "../../ope
|
||||
|
||||
await $`rm -rf src/gen`
|
||||
|
||||
await createClient({
|
||||
input: "./openapi.json",
|
||||
output: {
|
||||
path: "./src/gen",
|
||||
tsConfigPath: path.join(dir, "tsconfig.json"),
|
||||
clean: true,
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
name: "@hey-api/typescript",
|
||||
exportFromIndex: false,
|
||||
},
|
||||
{
|
||||
name: "@hey-api/sdk",
|
||||
instance: "OpencodeClient",
|
||||
exportFromIndex: false,
|
||||
auth: false,
|
||||
},
|
||||
{
|
||||
name: "@hey-api/client-fetch",
|
||||
exportFromIndex: false,
|
||||
baseUrl: "http://localhost:4096",
|
||||
},
|
||||
],
|
||||
})
|
||||
await createClient({
|
||||
input: "./openapi.json",
|
||||
output: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { type ClientOptions, type Config, createClient, createConfig } from "./client/index.js"
|
||||
import type { ClientOptions as ClientOptions2 } from "./types.gen.js"
|
||||
import type { ClientOptions } from "./types.gen.js"
|
||||
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from "./client/index.js"
|
||||
|
||||
/**
|
||||
* The `createClientConfig()` function will be called on client initialization
|
||||
@@ -11,8 +11,12 @@ import type { ClientOptions as ClientOptions2 } from "./types.gen.js"
|
||||
* `setConfig()`. This is useful for example if you're using Next.js
|
||||
* to ensure your client always has the correct values.
|
||||
*/
|
||||
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
|
||||
override?: Config<ClientOptions & T>,
|
||||
) => Config<Required<ClientOptions> & T>
|
||||
export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (
|
||||
override?: Config<DefaultClientOptions & T>,
|
||||
) => Config<Required<DefaultClientOptions> & T>
|
||||
|
||||
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: "http://localhost:4096" }))
|
||||
export const client = createClient(
|
||||
createConfig<ClientOptions>({
|
||||
baseUrl: "http://localhost:4096",
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { createSseClient } from "../core/serverSentEvents.gen.js"
|
||||
import type { HttpMethod } from "../core/types.gen.js"
|
||||
import { getValidRequestBody } from "../core/utils.gen.js"
|
||||
import type { Client, Config, RequestOptions, ResolvedRequestOptions } from "./types.gen.js"
|
||||
import {
|
||||
buildUrl,
|
||||
@@ -51,12 +49,12 @@ export const createClient = (config: Config = {}): Client => {
|
||||
await opts.requestValidator(opts)
|
||||
}
|
||||
|
||||
if (opts.body !== undefined && opts.bodySerializer) {
|
||||
if (opts.body && opts.bodySerializer) {
|
||||
opts.serializedBody = opts.bodySerializer(opts.body)
|
||||
}
|
||||
|
||||
// remove Content-Type header if body is empty to avoid sending invalid requests
|
||||
if (opts.body === undefined || opts.serializedBody === "") {
|
||||
if (opts.serializedBody === undefined || opts.serializedBody === "") {
|
||||
opts.headers.delete("Content-Type")
|
||||
}
|
||||
|
||||
@@ -71,12 +69,12 @@ export const createClient = (config: Config = {}): Client => {
|
||||
const requestInit: ReqInit = {
|
||||
redirect: "follow",
|
||||
...opts,
|
||||
body: getValidRequestBody(opts),
|
||||
body: opts.serializedBody,
|
||||
}
|
||||
|
||||
let request = new Request(url, requestInit)
|
||||
|
||||
for (const fn of interceptors.request.fns) {
|
||||
for (const fn of interceptors.request._fns) {
|
||||
if (fn) {
|
||||
request = await fn(request, opts)
|
||||
}
|
||||
@@ -85,37 +83,9 @@ export const createClient = (config: Config = {}): Client => {
|
||||
// fetch must be assigned here, otherwise it would throw the error:
|
||||
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
||||
const _fetch = opts.fetch!
|
||||
let response: Response
|
||||
let response = await _fetch(request)
|
||||
|
||||
try {
|
||||
response = await _fetch(request)
|
||||
} catch (error) {
|
||||
// Handle fetch exceptions (AbortError, network errors, etc.)
|
||||
let finalError = error
|
||||
|
||||
for (const fn of interceptors.error.fns) {
|
||||
if (fn) {
|
||||
finalError = (await fn(error, undefined as any, request, opts)) as unknown
|
||||
}
|
||||
}
|
||||
|
||||
finalError = finalError || ({} as unknown)
|
||||
|
||||
if (opts.throwOnError) {
|
||||
throw finalError
|
||||
}
|
||||
|
||||
// Return error response
|
||||
return opts.responseStyle === "data"
|
||||
? undefined
|
||||
: {
|
||||
error: finalError,
|
||||
request,
|
||||
response: undefined as any,
|
||||
}
|
||||
}
|
||||
|
||||
for (const fn of interceptors.response.fns) {
|
||||
for (const fn of interceptors.response._fns) {
|
||||
if (fn) {
|
||||
response = await fn(response, request, opts)
|
||||
}
|
||||
@@ -127,36 +97,18 @@ export const createClient = (config: Config = {}): Client => {
|
||||
}
|
||||
|
||||
if (response.ok) {
|
||||
const parseAs =
|
||||
(opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json"
|
||||
|
||||
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
||||
let emptyData: any
|
||||
switch (parseAs) {
|
||||
case "arrayBuffer":
|
||||
case "blob":
|
||||
case "text":
|
||||
emptyData = await response[parseAs]()
|
||||
break
|
||||
case "formData":
|
||||
emptyData = new FormData()
|
||||
break
|
||||
case "stream":
|
||||
emptyData = response.body
|
||||
break
|
||||
case "json":
|
||||
default:
|
||||
emptyData = {}
|
||||
break
|
||||
}
|
||||
return opts.responseStyle === "data"
|
||||
? emptyData
|
||||
? {}
|
||||
: {
|
||||
data: emptyData,
|
||||
data: {},
|
||||
...result,
|
||||
}
|
||||
}
|
||||
|
||||
const parseAs =
|
||||
(opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json"
|
||||
|
||||
let data: any
|
||||
switch (parseAs) {
|
||||
case "arrayBuffer":
|
||||
@@ -205,7 +157,7 @@ export const createClient = (config: Config = {}): Client => {
|
||||
const error = jsonError ?? textError
|
||||
let finalError = error
|
||||
|
||||
for (const fn of interceptors.error.fns) {
|
||||
for (const fn of interceptors.error._fns) {
|
||||
if (fn) {
|
||||
finalError = (await fn(error, response, request, opts)) as string
|
||||
}
|
||||
@@ -226,53 +178,35 @@ export const createClient = (config: Config = {}): Client => {
|
||||
}
|
||||
}
|
||||
|
||||
const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) => request({ ...options, method })
|
||||
|
||||
const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
|
||||
const { opts, url } = await beforeRequest(options)
|
||||
return createSseClient({
|
||||
...opts,
|
||||
body: opts.body as BodyInit | null | undefined,
|
||||
headers: opts.headers as unknown as Record<string, string>,
|
||||
method,
|
||||
onRequest: async (url, init) => {
|
||||
let request = new Request(url, init)
|
||||
for (const fn of interceptors.request.fns) {
|
||||
if (fn) {
|
||||
request = await fn(request, opts)
|
||||
}
|
||||
}
|
||||
return request
|
||||
},
|
||||
url,
|
||||
})
|
||||
const makeMethod = (method: Required<Config>["method"]) => {
|
||||
const fn = (options: RequestOptions) => request({ ...options, method })
|
||||
fn.sse = async (options: RequestOptions) => {
|
||||
const { opts, url } = await beforeRequest(options)
|
||||
return createSseClient({
|
||||
...opts,
|
||||
body: opts.body as BodyInit | null | undefined,
|
||||
headers: opts.headers as unknown as Record<string, string>,
|
||||
method,
|
||||
url,
|
||||
})
|
||||
}
|
||||
return fn
|
||||
}
|
||||
|
||||
return {
|
||||
buildUrl,
|
||||
connect: makeMethodFn("CONNECT"),
|
||||
delete: makeMethodFn("DELETE"),
|
||||
get: makeMethodFn("GET"),
|
||||
connect: makeMethod("CONNECT"),
|
||||
delete: makeMethod("DELETE"),
|
||||
get: makeMethod("GET"),
|
||||
getConfig,
|
||||
head: makeMethodFn("HEAD"),
|
||||
head: makeMethod("HEAD"),
|
||||
interceptors,
|
||||
options: makeMethodFn("OPTIONS"),
|
||||
patch: makeMethodFn("PATCH"),
|
||||
post: makeMethodFn("POST"),
|
||||
put: makeMethodFn("PUT"),
|
||||
options: makeMethod("OPTIONS"),
|
||||
patch: makeMethod("PATCH"),
|
||||
post: makeMethod("POST"),
|
||||
put: makeMethod("PUT"),
|
||||
request,
|
||||
setConfig,
|
||||
sse: {
|
||||
connect: makeSseFn("CONNECT"),
|
||||
delete: makeSseFn("DELETE"),
|
||||
get: makeSseFn("GET"),
|
||||
head: makeSseFn("HEAD"),
|
||||
options: makeSseFn("OPTIONS"),
|
||||
patch: makeSseFn("PATCH"),
|
||||
post: makeSseFn("POST"),
|
||||
put: makeSseFn("PUT"),
|
||||
trace: makeSseFn("TRACE"),
|
||||
},
|
||||
trace: makeMethodFn("TRACE"),
|
||||
trace: makeMethod("TRACE"),
|
||||
} as Client
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ export {
|
||||
urlSearchParamsBodySerializer,
|
||||
} from "../core/bodySerializer.gen.js"
|
||||
export { buildClientParams } from "../core/params.gen.js"
|
||||
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.js"
|
||||
export { createClient } from "./client.gen.js"
|
||||
export type {
|
||||
Client,
|
||||
@@ -16,6 +15,7 @@ export type {
|
||||
Config,
|
||||
CreateClientConfig,
|
||||
Options,
|
||||
OptionsLegacyParser,
|
||||
RequestOptions,
|
||||
RequestResult,
|
||||
ResolvedRequestOptions,
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
||||
*
|
||||
* @default globalThis.fetch
|
||||
*/
|
||||
fetch?: typeof fetch
|
||||
fetch?: (request: Request) => ReturnType<typeof fetch>
|
||||
/**
|
||||
* Please don't use the Fetch client for Next.js applications. The `next`
|
||||
* options won't have any effect.
|
||||
@@ -128,7 +128,7 @@ export interface ClientOptions {
|
||||
throwOnError?: boolean
|
||||
}
|
||||
|
||||
type MethodFn = <
|
||||
type MethodFnBase = <
|
||||
TData = unknown,
|
||||
TError = unknown,
|
||||
ThrowOnError extends boolean = false,
|
||||
@@ -137,7 +137,7 @@ type MethodFn = <
|
||||
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">,
|
||||
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>
|
||||
|
||||
type SseFn = <
|
||||
type MethodFnServerSentEvents = <
|
||||
TData = unknown,
|
||||
TError = unknown,
|
||||
ThrowOnError extends boolean = false,
|
||||
@@ -146,6 +146,10 @@ type SseFn = <
|
||||
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">,
|
||||
) => Promise<ServerSentEventsResult<TData, TError>>
|
||||
|
||||
type MethodFn = MethodFnBase & {
|
||||
sse: MethodFnServerSentEvents
|
||||
}
|
||||
|
||||
type RequestFn = <
|
||||
TData = unknown,
|
||||
TError = unknown,
|
||||
@@ -164,10 +168,10 @@ type BuildUrlFn = <
|
||||
url: string
|
||||
},
|
||||
>(
|
||||
options: TData & Options<TData>,
|
||||
options: Pick<TData, "url"> & Options<TData>,
|
||||
) => string
|
||||
|
||||
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
||||
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
||||
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>
|
||||
}
|
||||
|
||||
@@ -199,4 +203,20 @@ export type Options<
|
||||
TResponse = unknown,
|
||||
TResponseStyle extends ResponseStyle = "fields",
|
||||
> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> &
|
||||
([TData] extends [never] ? unknown : Omit<TData, "url">)
|
||||
Omit<TData, "url">
|
||||
|
||||
export type OptionsLegacyParser<
|
||||
TData = unknown,
|
||||
ThrowOnError extends boolean = boolean,
|
||||
TResponseStyle extends ResponseStyle = "fields",
|
||||
> = TData extends { body?: any }
|
||||
? TData extends { headers?: any }
|
||||
? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "headers" | "url"> & TData
|
||||
: OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body" | "url"> &
|
||||
TData &
|
||||
Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers">
|
||||
: TData extends { headers?: any }
|
||||
? OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "headers" | "url"> &
|
||||
TData &
|
||||
Pick<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "body">
|
||||
: OmitKeys<RequestOptions<unknown, TResponseStyle, ThrowOnError>, "url"> & TData
|
||||
|
||||
@@ -7,7 +7,7 @@ import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } fr
|
||||
import { getUrl } from "../core/utils.gen.js"
|
||||
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js"
|
||||
|
||||
export const createQuerySerializer = <T = unknown>({ parameters = {}, ...args }: QuerySerializerOptions = {}) => {
|
||||
export const createQuerySerializer = <T = unknown>({ allowReserved, array, object }: QuerySerializerOptions = {}) => {
|
||||
const querySerializer = (queryParams: T) => {
|
||||
const search: string[] = []
|
||||
if (queryParams && typeof queryParams === "object") {
|
||||
@@ -18,31 +18,29 @@ export const createQuerySerializer = <T = unknown>({ parameters = {}, ...args }:
|
||||
continue
|
||||
}
|
||||
|
||||
const options = parameters[name] || args
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
const serializedArray = serializeArrayParam({
|
||||
allowReserved: options.allowReserved,
|
||||
allowReserved,
|
||||
explode: true,
|
||||
name,
|
||||
style: "form",
|
||||
value,
|
||||
...options.array,
|
||||
...array,
|
||||
})
|
||||
if (serializedArray) search.push(serializedArray)
|
||||
} else if (typeof value === "object") {
|
||||
const serializedObject = serializeObjectParam({
|
||||
allowReserved: options.allowReserved,
|
||||
allowReserved,
|
||||
explode: true,
|
||||
name,
|
||||
style: "deepObject",
|
||||
value: value as Record<string, unknown>,
|
||||
...options.object,
|
||||
...object,
|
||||
})
|
||||
if (serializedObject) search.push(serializedObject)
|
||||
} else {
|
||||
const serializedPrimitive = serializePrimitiveParam({
|
||||
allowReserved: options.allowReserved,
|
||||
allowReserved,
|
||||
name,
|
||||
value: value as string,
|
||||
})
|
||||
@@ -164,22 +162,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => {
|
||||
return config
|
||||
}
|
||||
|
||||
const headersEntries = (headers: Headers): Array<[string, string]> => {
|
||||
const entries: Array<[string, string]> = []
|
||||
headers.forEach((value, key) => {
|
||||
entries.push([key, value])
|
||||
})
|
||||
return entries
|
||||
}
|
||||
|
||||
export const mergeHeaders = (...headers: Array<Required<Config>["headers"] | undefined>): Headers => {
|
||||
const mergedHeaders = new Headers()
|
||||
for (const header of headers) {
|
||||
if (!header) {
|
||||
if (!header || typeof header !== "object") {
|
||||
continue
|
||||
}
|
||||
|
||||
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header)
|
||||
const iterator = header instanceof Headers ? header.entries() : Object.entries(header)
|
||||
|
||||
for (const [key, value] of iterator) {
|
||||
if (value === null) {
|
||||
@@ -210,53 +200,61 @@ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Pr
|
||||
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>
|
||||
|
||||
class Interceptors<Interceptor> {
|
||||
fns: Array<Interceptor | null> = []
|
||||
_fns: (Interceptor | null)[]
|
||||
|
||||
clear(): void {
|
||||
this.fns = []
|
||||
constructor() {
|
||||
this._fns = []
|
||||
}
|
||||
|
||||
eject(id: number | Interceptor): void {
|
||||
const index = this.getInterceptorIndex(id)
|
||||
if (this.fns[index]) {
|
||||
this.fns[index] = null
|
||||
}
|
||||
}
|
||||
|
||||
exists(id: number | Interceptor): boolean {
|
||||
const index = this.getInterceptorIndex(id)
|
||||
return Boolean(this.fns[index])
|
||||
clear() {
|
||||
this._fns = []
|
||||
}
|
||||
|
||||
getInterceptorIndex(id: number | Interceptor): number {
|
||||
if (typeof id === "number") {
|
||||
return this.fns[id] ? id : -1
|
||||
return this._fns[id] ? id : -1
|
||||
} else {
|
||||
return this._fns.indexOf(id)
|
||||
}
|
||||
return this.fns.indexOf(id)
|
||||
}
|
||||
|
||||
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {
|
||||
exists(id: number | Interceptor) {
|
||||
const index = this.getInterceptorIndex(id)
|
||||
if (this.fns[index]) {
|
||||
this.fns[index] = fn
|
||||
return id
|
||||
return !!this._fns[index]
|
||||
}
|
||||
|
||||
eject(id: number | Interceptor) {
|
||||
const index = this.getInterceptorIndex(id)
|
||||
if (this._fns[index]) {
|
||||
this._fns[index] = null
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
use(fn: Interceptor): number {
|
||||
this.fns.push(fn)
|
||||
return this.fns.length - 1
|
||||
update(id: number | Interceptor, fn: Interceptor) {
|
||||
const index = this.getInterceptorIndex(id)
|
||||
if (this._fns[index]) {
|
||||
this._fns[index] = fn
|
||||
return id
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
use(fn: Interceptor) {
|
||||
this._fns = [...this._fns, fn]
|
||||
return this._fns.length - 1
|
||||
}
|
||||
}
|
||||
|
||||
// `createInterceptors()` response, meant for external use as it does not
|
||||
// expose internals
|
||||
export interface Middleware<Req, Res, Err, Options> {
|
||||
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>
|
||||
request: Interceptors<ReqInterceptor<Req, Options>>
|
||||
response: Interceptors<ResInterceptor<Res, Req, Options>>
|
||||
error: Pick<Interceptors<ErrInterceptor<Err, Res, Req, Options>>, "eject" | "use">
|
||||
request: Pick<Interceptors<ReqInterceptor<Req, Options>>, "eject" | "use">
|
||||
response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, "eject" | "use">
|
||||
}
|
||||
|
||||
export const createInterceptors = <Req, Res, Err, Options>(): Middleware<Req, Res, Err, Options> => ({
|
||||
// do not add `Middleware` as return type so we can use _fns internally
|
||||
export const createInterceptors = <Req, Res, Err, Options>() => ({
|
||||
error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
|
||||
request: new Interceptors<ReqInterceptor<Req, Options>>(),
|
||||
response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
|
||||
|
||||
@@ -6,18 +6,10 @@ export type QuerySerializer = (query: Record<string, unknown>) => string
|
||||
|
||||
export type BodySerializer = (body: any) => any
|
||||
|
||||
type QuerySerializerOptionsObject = {
|
||||
export interface QuerySerializerOptions {
|
||||
allowReserved?: boolean
|
||||
array?: Partial<SerializerOptions<ArrayStyle>>
|
||||
object?: Partial<SerializerOptions<ObjectStyle>>
|
||||
}
|
||||
|
||||
export type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
||||
/**
|
||||
* Per-parameter serialization overrides. When provided, these settings
|
||||
* override the global array/object settings for specific parameter names.
|
||||
*/
|
||||
parameters?: Record<string, QuerySerializerOptionsObject>
|
||||
array?: SerializerOptions<ArrayStyle>
|
||||
object?: SerializerOptions<ObjectStyle>
|
||||
}
|
||||
|
||||
const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {
|
||||
|
||||
@@ -23,17 +23,6 @@ export type Field =
|
||||
key?: string
|
||||
map?: string
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Field name. This is the name we want the user to see and use.
|
||||
*/
|
||||
key: string
|
||||
/**
|
||||
* Field mapped name. This is the name we want to use in the request.
|
||||
* If `in` is omitted, `map` aliases `key` to the transport layer.
|
||||
*/
|
||||
map: Slot
|
||||
}
|
||||
|
||||
export interface Fields {
|
||||
allowExtra?: Partial<Record<Slot, boolean>>
|
||||
@@ -52,14 +41,10 @@ const extraPrefixes = Object.entries(extraPrefixesMap)
|
||||
|
||||
type KeyMap = Map<
|
||||
string,
|
||||
| {
|
||||
in: Slot
|
||||
map?: string
|
||||
}
|
||||
| {
|
||||
in?: never
|
||||
map: Slot
|
||||
}
|
||||
{
|
||||
in: Slot
|
||||
map?: string
|
||||
}
|
||||
>
|
||||
|
||||
const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
||||
@@ -75,10 +60,6 @@ const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {
|
||||
map: config.map,
|
||||
})
|
||||
}
|
||||
} else if ("key" in config) {
|
||||
map.set(config.key, {
|
||||
map: config.map,
|
||||
})
|
||||
} else if (config.args) {
|
||||
buildKeyMap(config.args, map)
|
||||
}
|
||||
@@ -127,9 +108,7 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
|
||||
if (config.key) {
|
||||
const field = map.get(config.key)!
|
||||
const name = field.map || config.key
|
||||
if (field.in) {
|
||||
;(params[field.in] as Record<string, unknown>)[name] = arg
|
||||
}
|
||||
;(params[field.in] as Record<string, unknown>)[name] = arg
|
||||
} else {
|
||||
params.body = arg
|
||||
}
|
||||
@@ -138,20 +117,16 @@ export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsCo
|
||||
const field = map.get(key)
|
||||
|
||||
if (field) {
|
||||
if (field.in) {
|
||||
const name = field.map || key
|
||||
;(params[field.in] as Record<string, unknown>)[name] = value
|
||||
} else {
|
||||
params[field.map] = value
|
||||
}
|
||||
const name = field.map || key
|
||||
;(params[field.in] as Record<string, unknown>)[name] = value
|
||||
} else {
|
||||
const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix))
|
||||
|
||||
if (extra) {
|
||||
const [prefix, slot] = extra
|
||||
;(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value
|
||||
} else if ("allowExtra" in config && config.allowExtra) {
|
||||
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
||||
} else {
|
||||
for (const [slot, allowed] of Object.entries(config.allowExtra ?? {})) {
|
||||
if (allowed) {
|
||||
;(params[slot as Slot] as Record<string, unknown>)[key] = value
|
||||
break
|
||||
|
||||
@@ -4,17 +4,6 @@ import type { Config } from "./types.gen.js"
|
||||
|
||||
export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method"> &
|
||||
Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
|
||||
/**
|
||||
* Fetch API implementation. You can use this option to provide a custom
|
||||
* fetch instance.
|
||||
*
|
||||
* @default globalThis.fetch
|
||||
*/
|
||||
fetch?: typeof fetch
|
||||
/**
|
||||
* Implementing clients can call request interceptors inside this hook.
|
||||
*/
|
||||
onRequest?: (url: string, init: RequestInit) => Promise<Request>
|
||||
/**
|
||||
* Callback invoked when a network or parsing error occurs during streaming.
|
||||
*
|
||||
@@ -32,7 +21,6 @@ export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method
|
||||
* @returns Nothing (void).
|
||||
*/
|
||||
onSseEvent?: (event: StreamEvent<TData>) => void
|
||||
serializedBody?: RequestInit["body"]
|
||||
/**
|
||||
* Default retry delay in milliseconds.
|
||||
*
|
||||
@@ -76,7 +64,6 @@ export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unkn
|
||||
}
|
||||
|
||||
export const createSseClient = <TData = unknown>({
|
||||
onRequest,
|
||||
onSseError,
|
||||
onSseEvent,
|
||||
responseTransformer,
|
||||
@@ -112,21 +99,7 @@ export const createSseClient = <TData = unknown>({
|
||||
}
|
||||
|
||||
try {
|
||||
const requestInit: RequestInit = {
|
||||
redirect: "follow",
|
||||
...options,
|
||||
body: options.serializedBody,
|
||||
headers,
|
||||
signal,
|
||||
}
|
||||
let request = new Request(url, requestInit)
|
||||
if (onRequest) {
|
||||
request = await onRequest(url, requestInit)
|
||||
}
|
||||
// fetch must be assigned here, otherwise it would throw the error:
|
||||
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
||||
const _fetch = options.fetch ?? globalThis.fetch
|
||||
const response = await _fetch(request)
|
||||
const response = await fetch(url, { ...options, headers, signal })
|
||||
|
||||
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`)
|
||||
|
||||
|
||||
@@ -3,19 +3,24 @@
|
||||
import type { Auth, AuthToken } from "./auth.gen.js"
|
||||
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js"
|
||||
|
||||
export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"
|
||||
|
||||
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
||||
export interface Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
|
||||
/**
|
||||
* Returns the final request URL.
|
||||
*/
|
||||
buildUrl: BuildUrlFn
|
||||
connect: MethodFn
|
||||
delete: MethodFn
|
||||
get: MethodFn
|
||||
getConfig: () => Config
|
||||
head: MethodFn
|
||||
options: MethodFn
|
||||
patch: MethodFn
|
||||
post: MethodFn
|
||||
put: MethodFn
|
||||
request: RequestFn
|
||||
setConfig: (config: Config) => Config
|
||||
} & {
|
||||
[K in HttpMethod]: MethodFn
|
||||
} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } })
|
||||
trace: MethodFn
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
/**
|
||||
@@ -42,7 +47,7 @@ export interface Config {
|
||||
*
|
||||
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
||||
*/
|
||||
method?: Uppercase<HttpMethod>
|
||||
method?: "CONNECT" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT" | "TRACE"
|
||||
/**
|
||||
* A function for serializing request query parameters. By default, arrays
|
||||
* will be exploded in form style, objects will be exploded in deepObject
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen.js"
|
||||
import type { QuerySerializer } from "./bodySerializer.gen.js"
|
||||
import {
|
||||
type ArraySeparatorStyle,
|
||||
serializeArrayParam,
|
||||
@@ -107,31 +107,3 @@ export const getUrl = ({
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
export function getValidRequestBody(options: {
|
||||
body?: unknown
|
||||
bodySerializer?: BodySerializer | null
|
||||
serializedBody?: unknown
|
||||
}) {
|
||||
const hasBody = options.body !== undefined
|
||||
const isSerializedBody = hasBody && options.bodySerializer
|
||||
|
||||
if (isSerializedBody) {
|
||||
if ("serializedBody" in options) {
|
||||
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== ""
|
||||
|
||||
return hasSerializedBody ? options.serializedBody : null
|
||||
}
|
||||
|
||||
// not all clients implement a serializedBody property (i.e. client-axios)
|
||||
return options.body !== "" ? options.body : null
|
||||
}
|
||||
|
||||
// plain/text body
|
||||
if (hasBody) {
|
||||
return options.body
|
||||
}
|
||||
|
||||
// no body was provided
|
||||
return undefined
|
||||
}
|
||||
|
||||
+371
-392
@@ -1,205 +1,205 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { client } from "./client.gen.js"
|
||||
import type { Client, Options as Options2, TDataShape } from "./client/index.js"
|
||||
import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js"
|
||||
import type {
|
||||
AppAgentsData,
|
||||
AppAgentsResponses,
|
||||
AppLogData,
|
||||
AppLogErrors,
|
||||
AppLogResponses,
|
||||
AuthSetData,
|
||||
AuthSetErrors,
|
||||
AuthSetResponses,
|
||||
CommandListData,
|
||||
CommandListResponses,
|
||||
GlobalEventData,
|
||||
GlobalEventResponses,
|
||||
ProjectListData,
|
||||
ProjectListResponses,
|
||||
ProjectCurrentData,
|
||||
ProjectCurrentResponses,
|
||||
PtyListData,
|
||||
PtyListResponses,
|
||||
PtyCreateData,
|
||||
PtyCreateResponses,
|
||||
PtyCreateErrors,
|
||||
PtyRemoveData,
|
||||
PtyRemoveResponses,
|
||||
PtyRemoveErrors,
|
||||
PtyGetData,
|
||||
PtyGetResponses,
|
||||
PtyGetErrors,
|
||||
PtyUpdateData,
|
||||
PtyUpdateResponses,
|
||||
PtyUpdateErrors,
|
||||
PtyConnectData,
|
||||
PtyConnectResponses,
|
||||
PtyConnectErrors,
|
||||
ConfigGetData,
|
||||
ConfigGetResponses,
|
||||
ConfigUpdateData,
|
||||
ConfigUpdateResponses,
|
||||
ConfigUpdateErrors,
|
||||
ToolIdsData,
|
||||
ToolIdsResponses,
|
||||
ToolIdsErrors,
|
||||
ToolListData,
|
||||
ToolListResponses,
|
||||
ToolListErrors,
|
||||
InstanceDisposeData,
|
||||
InstanceDisposeResponses,
|
||||
PathGetData,
|
||||
PathGetResponses,
|
||||
VcsGetData,
|
||||
VcsGetResponses,
|
||||
SessionListData,
|
||||
SessionListResponses,
|
||||
SessionCreateData,
|
||||
SessionCreateResponses,
|
||||
SessionCreateErrors,
|
||||
SessionStatusData,
|
||||
SessionStatusResponses,
|
||||
SessionStatusErrors,
|
||||
SessionDeleteData,
|
||||
SessionDeleteResponses,
|
||||
SessionDeleteErrors,
|
||||
SessionGetData,
|
||||
SessionGetResponses,
|
||||
SessionGetErrors,
|
||||
SessionUpdateData,
|
||||
SessionUpdateResponses,
|
||||
SessionUpdateErrors,
|
||||
SessionChildrenData,
|
||||
SessionChildrenResponses,
|
||||
SessionChildrenErrors,
|
||||
SessionTodoData,
|
||||
SessionTodoResponses,
|
||||
SessionTodoErrors,
|
||||
SessionInitData,
|
||||
SessionInitResponses,
|
||||
SessionInitErrors,
|
||||
SessionForkData,
|
||||
SessionForkResponses,
|
||||
SessionAbortData,
|
||||
SessionAbortResponses,
|
||||
SessionAbortErrors,
|
||||
SessionUnshareData,
|
||||
SessionUnshareResponses,
|
||||
SessionUnshareErrors,
|
||||
SessionShareData,
|
||||
SessionShareResponses,
|
||||
SessionShareErrors,
|
||||
SessionDiffData,
|
||||
SessionDiffResponses,
|
||||
SessionDiffErrors,
|
||||
SessionSummarizeData,
|
||||
SessionSummarizeResponses,
|
||||
SessionSummarizeErrors,
|
||||
SessionMessagesData,
|
||||
SessionMessagesResponses,
|
||||
SessionMessagesErrors,
|
||||
SessionPromptData,
|
||||
SessionPromptResponses,
|
||||
SessionPromptErrors,
|
||||
SessionMessageData,
|
||||
SessionMessageResponses,
|
||||
SessionMessageErrors,
|
||||
SessionPromptAsyncData,
|
||||
SessionPromptAsyncResponses,
|
||||
SessionPromptAsyncErrors,
|
||||
SessionCommandData,
|
||||
SessionCommandResponses,
|
||||
SessionCommandErrors,
|
||||
SessionShellData,
|
||||
SessionShellResponses,
|
||||
SessionShellErrors,
|
||||
SessionRevertData,
|
||||
SessionRevertResponses,
|
||||
SessionRevertErrors,
|
||||
SessionUnrevertData,
|
||||
SessionUnrevertResponses,
|
||||
SessionUnrevertErrors,
|
||||
PostSessionIdPermissionsPermissionIdData,
|
||||
PostSessionIdPermissionsPermissionIdResponses,
|
||||
PostSessionIdPermissionsPermissionIdErrors,
|
||||
CommandListData,
|
||||
CommandListResponses,
|
||||
ConfigProvidersData,
|
||||
ConfigProvidersResponses,
|
||||
ConfigUpdateData,
|
||||
ConfigUpdateErrors,
|
||||
ConfigUpdateResponses,
|
||||
EventSubscribeData,
|
||||
EventSubscribeResponses,
|
||||
ProviderListData,
|
||||
ProviderListResponses,
|
||||
ProviderAuthData,
|
||||
ProviderAuthResponses,
|
||||
ProviderOauthAuthorizeData,
|
||||
ProviderOauthAuthorizeResponses,
|
||||
ProviderOauthAuthorizeErrors,
|
||||
ProviderOauthCallbackData,
|
||||
ProviderOauthCallbackResponses,
|
||||
ProviderOauthCallbackErrors,
|
||||
FindTextData,
|
||||
FindTextResponses,
|
||||
FindFilesData,
|
||||
FindFilesResponses,
|
||||
FindSymbolsData,
|
||||
FindSymbolsResponses,
|
||||
FileListData,
|
||||
FileListResponses,
|
||||
FileReadData,
|
||||
FileReadResponses,
|
||||
FileStatusData,
|
||||
FileStatusResponses,
|
||||
FindFilesData,
|
||||
FindFilesResponses,
|
||||
FindSymbolsData,
|
||||
FindSymbolsResponses,
|
||||
FindTextData,
|
||||
FindTextResponses,
|
||||
FormatterStatusData,
|
||||
FormatterStatusResponses,
|
||||
GlobalEventData,
|
||||
GlobalEventResponses,
|
||||
InstanceDisposeData,
|
||||
InstanceDisposeResponses,
|
||||
LspStatusData,
|
||||
LspStatusResponses,
|
||||
McpAddData,
|
||||
McpAddErrors,
|
||||
McpAddResponses,
|
||||
McpAuthAuthenticateData,
|
||||
McpAuthAuthenticateErrors,
|
||||
McpAuthAuthenticateResponses,
|
||||
McpAuthCallbackData,
|
||||
McpAuthCallbackErrors,
|
||||
McpAuthCallbackResponses,
|
||||
McpAuthRemoveData,
|
||||
McpAuthRemoveErrors,
|
||||
McpAuthRemoveResponses,
|
||||
McpAuthStartData,
|
||||
McpAuthStartErrors,
|
||||
McpAuthStartResponses,
|
||||
AppLogData,
|
||||
AppLogResponses,
|
||||
AppLogErrors,
|
||||
AppAgentsData,
|
||||
AppAgentsResponses,
|
||||
McpStatusData,
|
||||
McpStatusResponses,
|
||||
PathGetData,
|
||||
PathGetResponses,
|
||||
PermissionRespondData,
|
||||
PermissionRespondErrors,
|
||||
PermissionRespondResponses,
|
||||
ProjectCurrentData,
|
||||
ProjectCurrentResponses,
|
||||
ProjectListData,
|
||||
ProjectListResponses,
|
||||
ProviderAuthData,
|
||||
ProviderAuthResponses,
|
||||
ProviderListData,
|
||||
ProviderListResponses,
|
||||
ProviderOauthAuthorizeData,
|
||||
ProviderOauthAuthorizeErrors,
|
||||
ProviderOauthAuthorizeResponses,
|
||||
ProviderOauthCallbackData,
|
||||
ProviderOauthCallbackErrors,
|
||||
ProviderOauthCallbackResponses,
|
||||
PtyConnectData,
|
||||
PtyConnectErrors,
|
||||
PtyConnectResponses,
|
||||
PtyCreateData,
|
||||
PtyCreateErrors,
|
||||
PtyCreateResponses,
|
||||
PtyGetData,
|
||||
PtyGetErrors,
|
||||
PtyGetResponses,
|
||||
PtyListData,
|
||||
PtyListResponses,
|
||||
PtyRemoveData,
|
||||
PtyRemoveErrors,
|
||||
PtyRemoveResponses,
|
||||
PtyUpdateData,
|
||||
PtyUpdateErrors,
|
||||
PtyUpdateResponses,
|
||||
SessionAbortData,
|
||||
SessionAbortErrors,
|
||||
SessionAbortResponses,
|
||||
SessionChildrenData,
|
||||
SessionChildrenErrors,
|
||||
SessionChildrenResponses,
|
||||
SessionCommandData,
|
||||
SessionCommandErrors,
|
||||
SessionCommandResponses,
|
||||
SessionCreateData,
|
||||
SessionCreateErrors,
|
||||
SessionCreateResponses,
|
||||
SessionDeleteData,
|
||||
SessionDeleteErrors,
|
||||
SessionDeleteResponses,
|
||||
SessionDiffData,
|
||||
SessionDiffErrors,
|
||||
SessionDiffResponses,
|
||||
SessionForkData,
|
||||
SessionForkResponses,
|
||||
SessionGetData,
|
||||
SessionGetErrors,
|
||||
SessionGetResponses,
|
||||
SessionInitData,
|
||||
SessionInitErrors,
|
||||
SessionInitResponses,
|
||||
SessionListData,
|
||||
SessionListResponses,
|
||||
SessionMessageData,
|
||||
SessionMessageErrors,
|
||||
SessionMessageResponses,
|
||||
SessionMessagesData,
|
||||
SessionMessagesErrors,
|
||||
SessionMessagesResponses,
|
||||
SessionPromptAsyncData,
|
||||
SessionPromptAsyncErrors,
|
||||
SessionPromptAsyncResponses,
|
||||
SessionPromptData,
|
||||
SessionPromptErrors,
|
||||
SessionPromptResponses,
|
||||
SessionRevertData,
|
||||
SessionRevertErrors,
|
||||
SessionRevertResponses,
|
||||
SessionShareData,
|
||||
SessionShareErrors,
|
||||
SessionShareResponses,
|
||||
SessionShellData,
|
||||
SessionShellErrors,
|
||||
SessionShellResponses,
|
||||
SessionStatusData,
|
||||
SessionStatusErrors,
|
||||
SessionStatusResponses,
|
||||
SessionSummarizeData,
|
||||
SessionSummarizeErrors,
|
||||
SessionSummarizeResponses,
|
||||
SessionTodoData,
|
||||
SessionTodoErrors,
|
||||
SessionTodoResponses,
|
||||
SessionUnrevertData,
|
||||
SessionUnrevertErrors,
|
||||
SessionUnrevertResponses,
|
||||
SessionUnshareData,
|
||||
SessionUnshareErrors,
|
||||
SessionUnshareResponses,
|
||||
SessionUpdateData,
|
||||
SessionUpdateErrors,
|
||||
SessionUpdateResponses,
|
||||
ToolIdsData,
|
||||
ToolIdsErrors,
|
||||
ToolIdsResponses,
|
||||
ToolListData,
|
||||
ToolListErrors,
|
||||
ToolListResponses,
|
||||
McpAddData,
|
||||
McpAddResponses,
|
||||
McpAddErrors,
|
||||
McpAuthRemoveData,
|
||||
McpAuthRemoveResponses,
|
||||
McpAuthRemoveErrors,
|
||||
McpAuthStartData,
|
||||
McpAuthStartResponses,
|
||||
McpAuthStartErrors,
|
||||
McpAuthCallbackData,
|
||||
McpAuthCallbackResponses,
|
||||
McpAuthCallbackErrors,
|
||||
McpAuthAuthenticateData,
|
||||
McpAuthAuthenticateResponses,
|
||||
McpAuthAuthenticateErrors,
|
||||
LspStatusData,
|
||||
LspStatusResponses,
|
||||
FormatterStatusData,
|
||||
FormatterStatusResponses,
|
||||
TuiAppendPromptData,
|
||||
TuiAppendPromptErrors,
|
||||
TuiAppendPromptResponses,
|
||||
TuiClearPromptData,
|
||||
TuiClearPromptResponses,
|
||||
TuiControlNextData,
|
||||
TuiControlNextResponses,
|
||||
TuiControlResponseData,
|
||||
TuiControlResponseResponses,
|
||||
TuiExecuteCommandData,
|
||||
TuiExecuteCommandErrors,
|
||||
TuiExecuteCommandResponses,
|
||||
TuiAppendPromptErrors,
|
||||
TuiOpenHelpData,
|
||||
TuiOpenHelpResponses,
|
||||
TuiOpenModelsData,
|
||||
TuiOpenModelsResponses,
|
||||
TuiOpenSessionsData,
|
||||
TuiOpenSessionsResponses,
|
||||
TuiOpenThemesData,
|
||||
TuiOpenThemesResponses,
|
||||
TuiPublishData,
|
||||
TuiPublishErrors,
|
||||
TuiPublishResponses,
|
||||
TuiShowToastData,
|
||||
TuiShowToastResponses,
|
||||
TuiOpenModelsData,
|
||||
TuiOpenModelsResponses,
|
||||
TuiSubmitPromptData,
|
||||
TuiSubmitPromptResponses,
|
||||
VcsGetData,
|
||||
VcsGetResponses,
|
||||
TuiClearPromptData,
|
||||
TuiClearPromptResponses,
|
||||
TuiExecuteCommandData,
|
||||
TuiExecuteCommandResponses,
|
||||
TuiExecuteCommandErrors,
|
||||
TuiShowToastData,
|
||||
TuiShowToastResponses,
|
||||
TuiPublishData,
|
||||
TuiPublishResponses,
|
||||
TuiPublishErrors,
|
||||
TuiControlNextData,
|
||||
TuiControlNextResponses,
|
||||
TuiControlResponseData,
|
||||
TuiControlResponseResponses,
|
||||
AuthSetData,
|
||||
AuthSetResponses,
|
||||
AuthSetErrors,
|
||||
EventSubscribeData,
|
||||
EventSubscribeResponses,
|
||||
} from "./types.gen.js"
|
||||
import { client as _heyApiClient } from "./client.gen.js"
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
|
||||
TData,
|
||||
ThrowOnError
|
||||
> & {
|
||||
@@ -216,50 +216,34 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
||||
meta?: Record<string, unknown>
|
||||
}
|
||||
|
||||
class HeyApiClient {
|
||||
protected client: Client
|
||||
class _HeyApiClient {
|
||||
protected _client: Client = _heyApiClient
|
||||
|
||||
constructor(args?: { client?: Client }) {
|
||||
this.client = args?.client ?? client
|
||||
}
|
||||
}
|
||||
|
||||
class HeyApiRegistry<T> {
|
||||
private readonly defaultKey = "default"
|
||||
|
||||
private readonly instances: Map<string, T> = new Map()
|
||||
|
||||
get(key?: string): T {
|
||||
const instance = this.instances.get(key ?? this.defaultKey)
|
||||
if (!instance) {
|
||||
throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`)
|
||||
if (args?.client) {
|
||||
this._client = args.client
|
||||
}
|
||||
return instance
|
||||
}
|
||||
|
||||
set(value: T, key?: string): void {
|
||||
this.instances.set(key ?? this.defaultKey, value)
|
||||
}
|
||||
}
|
||||
|
||||
export class Global extends HeyApiClient {
|
||||
class Global extends _HeyApiClient {
|
||||
/**
|
||||
* Get events
|
||||
*/
|
||||
public event<ThrowOnError extends boolean = false>(options?: Options<GlobalEventData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).sse.get<GlobalEventResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get.sse<GlobalEventResponses, unknown, ThrowOnError>({
|
||||
url: "/global/event",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Project extends HeyApiClient {
|
||||
class Project extends _HeyApiClient {
|
||||
/**
|
||||
* List all projects
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options?: Options<ProjectListData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ProjectListResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ProjectListResponses, unknown, ThrowOnError>({
|
||||
url: "/project",
|
||||
...options,
|
||||
})
|
||||
@@ -269,26 +253,29 @@ export class Project extends HeyApiClient {
|
||||
* Get the current project
|
||||
*/
|
||||
public current<ThrowOnError extends boolean = false>(options?: Options<ProjectCurrentData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ProjectCurrentResponses, unknown, ThrowOnError>({
|
||||
url: "/project/current",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Pty extends HeyApiClient {
|
||||
class Pty extends _HeyApiClient {
|
||||
/**
|
||||
* List all PTY sessions
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options?: Options<PtyListData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<PtyListResponses, unknown, ThrowOnError>({ url: "/pty", ...options })
|
||||
return (options?.client ?? this._client).get<PtyListResponses, unknown, ThrowOnError>({
|
||||
url: "/pty",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new PTY session
|
||||
*/
|
||||
public create<ThrowOnError extends boolean = false>(options?: Options<PtyCreateData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<PtyCreateResponses, PtyCreateErrors, ThrowOnError>({
|
||||
url: "/pty",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -302,8 +289,8 @@ export class Pty extends HeyApiClient {
|
||||
* Remove a PTY session
|
||||
*/
|
||||
public remove<ThrowOnError extends boolean = false>(options: Options<PtyRemoveData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).delete<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({
|
||||
url: "/pty/{ptyID}",
|
||||
return (options.client ?? this._client).delete<PtyRemoveResponses, PtyRemoveErrors, ThrowOnError>({
|
||||
url: "/pty/{id}",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -312,8 +299,8 @@ export class Pty extends HeyApiClient {
|
||||
* Get PTY session info
|
||||
*/
|
||||
public get<ThrowOnError extends boolean = false>(options: Options<PtyGetData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<PtyGetResponses, PtyGetErrors, ThrowOnError>({
|
||||
url: "/pty/{ptyID}",
|
||||
return (options.client ?? this._client).get<PtyGetResponses, PtyGetErrors, ThrowOnError>({
|
||||
url: "/pty/{id}",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -322,8 +309,8 @@ export class Pty extends HeyApiClient {
|
||||
* Update PTY session
|
||||
*/
|
||||
public update<ThrowOnError extends boolean = false>(options: Options<PtyUpdateData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).put<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({
|
||||
url: "/pty/{ptyID}",
|
||||
return (options.client ?? this._client).put<PtyUpdateResponses, PtyUpdateErrors, ThrowOnError>({
|
||||
url: "/pty/{id}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -336,19 +323,19 @@ export class Pty extends HeyApiClient {
|
||||
* Connect to a PTY session
|
||||
*/
|
||||
public connect<ThrowOnError extends boolean = false>(options: Options<PtyConnectData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({
|
||||
url: "/pty/{ptyID}/connect",
|
||||
return (options.client ?? this._client).get<PtyConnectResponses, PtyConnectErrors, ThrowOnError>({
|
||||
url: "/pty/{id}/connect",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Config extends HeyApiClient {
|
||||
class Config extends _HeyApiClient {
|
||||
/**
|
||||
* Get config info
|
||||
*/
|
||||
public get<ThrowOnError extends boolean = false>(options?: Options<ConfigGetData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ConfigGetResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ConfigGetResponses, unknown, ThrowOnError>({
|
||||
url: "/config",
|
||||
...options,
|
||||
})
|
||||
@@ -358,7 +345,7 @@ export class Config extends HeyApiClient {
|
||||
* Update config
|
||||
*/
|
||||
public update<ThrowOnError extends boolean = false>(options?: Options<ConfigUpdateData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).patch<ConfigUpdateResponses, ConfigUpdateErrors, ThrowOnError>({
|
||||
url: "/config",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -372,19 +359,19 @@ export class Config extends HeyApiClient {
|
||||
* List all providers
|
||||
*/
|
||||
public providers<ThrowOnError extends boolean = false>(options?: Options<ConfigProvidersData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ConfigProvidersResponses, unknown, ThrowOnError>({
|
||||
url: "/config/providers",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Tool extends HeyApiClient {
|
||||
class Tool extends _HeyApiClient {
|
||||
/**
|
||||
* List all tool IDs (including built-in and dynamically registered)
|
||||
*/
|
||||
public ids<ThrowOnError extends boolean = false>(options?: Options<ToolIdsData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ToolIdsResponses, ToolIdsErrors, ThrowOnError>({
|
||||
url: "/experimental/tool/ids",
|
||||
...options,
|
||||
})
|
||||
@@ -394,49 +381,55 @@ export class Tool extends HeyApiClient {
|
||||
* List tools with JSON schema parameters for a provider/model
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options: Options<ToolListData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<ToolListResponses, ToolListErrors, ThrowOnError>({
|
||||
return (options.client ?? this._client).get<ToolListResponses, ToolListErrors, ThrowOnError>({
|
||||
url: "/experimental/tool",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Instance extends HeyApiClient {
|
||||
class Instance extends _HeyApiClient {
|
||||
/**
|
||||
* Dispose the current instance
|
||||
*/
|
||||
public dispose<ThrowOnError extends boolean = false>(options?: Options<InstanceDisposeData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<InstanceDisposeResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<InstanceDisposeResponses, unknown, ThrowOnError>({
|
||||
url: "/instance/dispose",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Path extends HeyApiClient {
|
||||
class Path extends _HeyApiClient {
|
||||
/**
|
||||
* Get the current path
|
||||
*/
|
||||
public get<ThrowOnError extends boolean = false>(options?: Options<PathGetData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<PathGetResponses, unknown, ThrowOnError>({ url: "/path", ...options })
|
||||
return (options?.client ?? this._client).get<PathGetResponses, unknown, ThrowOnError>({
|
||||
url: "/path",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Vcs extends HeyApiClient {
|
||||
class Vcs extends _HeyApiClient {
|
||||
/**
|
||||
* Get VCS info for the current instance
|
||||
*/
|
||||
public get<ThrowOnError extends boolean = false>(options?: Options<VcsGetData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<VcsGetResponses, unknown, ThrowOnError>({ url: "/vcs", ...options })
|
||||
return (options?.client ?? this._client).get<VcsGetResponses, unknown, ThrowOnError>({
|
||||
url: "/vcs",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Session extends HeyApiClient {
|
||||
class Session extends _HeyApiClient {
|
||||
/**
|
||||
* List all sessions
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options?: Options<SessionListData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<SessionListResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<SessionListResponses, unknown, ThrowOnError>({
|
||||
url: "/session",
|
||||
...options,
|
||||
})
|
||||
@@ -446,7 +439,7 @@ export class Session extends HeyApiClient {
|
||||
* Create a new session
|
||||
*/
|
||||
public create<ThrowOnError extends boolean = false>(options?: Options<SessionCreateData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<SessionCreateResponses, SessionCreateErrors, ThrowOnError>({
|
||||
url: "/session",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -460,7 +453,7 @@ export class Session extends HeyApiClient {
|
||||
* Get session status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(options?: Options<SessionStatusData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<SessionStatusResponses, SessionStatusErrors, ThrowOnError>({
|
||||
url: "/session/status",
|
||||
...options,
|
||||
})
|
||||
@@ -470,8 +463,8 @@ export class Session extends HeyApiClient {
|
||||
* Delete a session and all its data
|
||||
*/
|
||||
public delete<ThrowOnError extends boolean = false>(options: Options<SessionDeleteData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).delete<SessionDeleteResponses, SessionDeleteErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}",
|
||||
return (options.client ?? this._client).delete<SessionDeleteResponses, SessionDeleteErrors, ThrowOnError>({
|
||||
url: "/session/{id}",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -480,8 +473,8 @@ export class Session extends HeyApiClient {
|
||||
* Get session
|
||||
*/
|
||||
public get<ThrowOnError extends boolean = false>(options: Options<SessionGetData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionGetResponses, SessionGetErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}",
|
||||
return (options.client ?? this._client).get<SessionGetResponses, SessionGetErrors, ThrowOnError>({
|
||||
url: "/session/{id}",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -490,8 +483,8 @@ export class Session extends HeyApiClient {
|
||||
* Update session properties
|
||||
*/
|
||||
public update<ThrowOnError extends boolean = false>(options: Options<SessionUpdateData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).patch<SessionUpdateResponses, SessionUpdateErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}",
|
||||
return (options.client ?? this._client).patch<SessionUpdateResponses, SessionUpdateErrors, ThrowOnError>({
|
||||
url: "/session/{id}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -504,8 +497,8 @@ export class Session extends HeyApiClient {
|
||||
* Get a session's children
|
||||
*/
|
||||
public children<ThrowOnError extends boolean = false>(options: Options<SessionChildrenData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionChildrenResponses, SessionChildrenErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/children",
|
||||
return (options.client ?? this._client).get<SessionChildrenResponses, SessionChildrenErrors, ThrowOnError>({
|
||||
url: "/session/{id}/children",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -514,8 +507,8 @@ export class Session extends HeyApiClient {
|
||||
* Get the todo list for a session
|
||||
*/
|
||||
public todo<ThrowOnError extends boolean = false>(options: Options<SessionTodoData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionTodoResponses, SessionTodoErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/todo",
|
||||
return (options.client ?? this._client).get<SessionTodoResponses, SessionTodoErrors, ThrowOnError>({
|
||||
url: "/session/{id}/todo",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -524,8 +517,8 @@ export class Session extends HeyApiClient {
|
||||
* Analyze the app and create an AGENTS.md file
|
||||
*/
|
||||
public init<ThrowOnError extends boolean = false>(options: Options<SessionInitData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionInitResponses, SessionInitErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/init",
|
||||
return (options.client ?? this._client).post<SessionInitResponses, SessionInitErrors, ThrowOnError>({
|
||||
url: "/session/{id}/init",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -538,8 +531,8 @@ export class Session extends HeyApiClient {
|
||||
* Fork an existing session at a specific message
|
||||
*/
|
||||
public fork<ThrowOnError extends boolean = false>(options: Options<SessionForkData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionForkResponses, unknown, ThrowOnError>({
|
||||
url: "/session/{sessionID}/fork",
|
||||
return (options.client ?? this._client).post<SessionForkResponses, unknown, ThrowOnError>({
|
||||
url: "/session/{id}/fork",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -552,8 +545,8 @@ export class Session extends HeyApiClient {
|
||||
* Abort a session
|
||||
*/
|
||||
public abort<ThrowOnError extends boolean = false>(options: Options<SessionAbortData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionAbortResponses, SessionAbortErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/abort",
|
||||
return (options.client ?? this._client).post<SessionAbortResponses, SessionAbortErrors, ThrowOnError>({
|
||||
url: "/session/{id}/abort",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -562,8 +555,8 @@ export class Session extends HeyApiClient {
|
||||
* Unshare the session
|
||||
*/
|
||||
public unshare<ThrowOnError extends boolean = false>(options: Options<SessionUnshareData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).delete<SessionUnshareResponses, SessionUnshareErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/share",
|
||||
return (options.client ?? this._client).delete<SessionUnshareResponses, SessionUnshareErrors, ThrowOnError>({
|
||||
url: "/session/{id}/share",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -572,8 +565,8 @@ export class Session extends HeyApiClient {
|
||||
* Share a session
|
||||
*/
|
||||
public share<ThrowOnError extends boolean = false>(options: Options<SessionShareData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionShareResponses, SessionShareErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/share",
|
||||
return (options.client ?? this._client).post<SessionShareResponses, SessionShareErrors, ThrowOnError>({
|
||||
url: "/session/{id}/share",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -582,8 +575,8 @@ export class Session extends HeyApiClient {
|
||||
* Get the diff for this session
|
||||
*/
|
||||
public diff<ThrowOnError extends boolean = false>(options: Options<SessionDiffData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/diff",
|
||||
return (options.client ?? this._client).get<SessionDiffResponses, SessionDiffErrors, ThrowOnError>({
|
||||
url: "/session/{id}/diff",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -592,8 +585,8 @@ export class Session extends HeyApiClient {
|
||||
* Summarize the session
|
||||
*/
|
||||
public summarize<ThrowOnError extends boolean = false>(options: Options<SessionSummarizeData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/summarize",
|
||||
return (options.client ?? this._client).post<SessionSummarizeResponses, SessionSummarizeErrors, ThrowOnError>({
|
||||
url: "/session/{id}/summarize",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -606,8 +599,8 @@ export class Session extends HeyApiClient {
|
||||
* List messages for a session
|
||||
*/
|
||||
public messages<ThrowOnError extends boolean = false>(options: Options<SessionMessagesData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionMessagesResponses, SessionMessagesErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/message",
|
||||
return (options.client ?? this._client).get<SessionMessagesResponses, SessionMessagesErrors, ThrowOnError>({
|
||||
url: "/session/{id}/message",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -616,8 +609,8 @@ export class Session extends HeyApiClient {
|
||||
* Create and send a new message to a session
|
||||
*/
|
||||
public prompt<ThrowOnError extends boolean = false>(options: Options<SessionPromptData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionPromptResponses, SessionPromptErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/message",
|
||||
return (options.client ?? this._client).post<SessionPromptResponses, SessionPromptErrors, ThrowOnError>({
|
||||
url: "/session/{id}/message",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -630,8 +623,8 @@ export class Session extends HeyApiClient {
|
||||
* Get a message from a session
|
||||
*/
|
||||
public message<ThrowOnError extends boolean = false>(options: Options<SessionMessageData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<SessionMessageResponses, SessionMessageErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/message/{messageID}",
|
||||
return (options.client ?? this._client).get<SessionMessageResponses, SessionMessageErrors, ThrowOnError>({
|
||||
url: "/session/{id}/message/{messageID}",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
@@ -640,8 +633,8 @@ export class Session extends HeyApiClient {
|
||||
* Create and send a new message to a session, start if needed and return immediately
|
||||
*/
|
||||
public promptAsync<ThrowOnError extends boolean = false>(options: Options<SessionPromptAsyncData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionPromptAsyncResponses, SessionPromptAsyncErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/prompt_async",
|
||||
return (options.client ?? this._client).post<SessionPromptAsyncResponses, SessionPromptAsyncErrors, ThrowOnError>({
|
||||
url: "/session/{id}/prompt_async",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -654,8 +647,8 @@ export class Session extends HeyApiClient {
|
||||
* Send a new command to a session
|
||||
*/
|
||||
public command<ThrowOnError extends boolean = false>(options: Options<SessionCommandData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionCommandResponses, SessionCommandErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/command",
|
||||
return (options.client ?? this._client).post<SessionCommandResponses, SessionCommandErrors, ThrowOnError>({
|
||||
url: "/session/{id}/command",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -668,8 +661,8 @@ export class Session extends HeyApiClient {
|
||||
* Run a shell command
|
||||
*/
|
||||
public shell<ThrowOnError extends boolean = false>(options: Options<SessionShellData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionShellResponses, SessionShellErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/shell",
|
||||
return (options.client ?? this._client).post<SessionShellResponses, SessionShellErrors, ThrowOnError>({
|
||||
url: "/session/{id}/shell",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -682,8 +675,8 @@ export class Session extends HeyApiClient {
|
||||
* Revert a message
|
||||
*/
|
||||
public revert<ThrowOnError extends boolean = false>(options: Options<SessionRevertData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionRevertResponses, SessionRevertErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/revert",
|
||||
return (options.client ?? this._client).post<SessionRevertResponses, SessionRevertErrors, ThrowOnError>({
|
||||
url: "/session/{id}/revert",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -696,52 +689,36 @@ export class Session extends HeyApiClient {
|
||||
* Restore all reverted messages
|
||||
*/
|
||||
public unrevert<ThrowOnError extends boolean = false>(options: Options<SessionUnrevertData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<SessionUnrevertResponses, SessionUnrevertErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/unrevert",
|
||||
return (options.client ?? this._client).post<SessionUnrevertResponses, SessionUnrevertErrors, ThrowOnError>({
|
||||
url: "/session/{id}/unrevert",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Permission extends HeyApiClient {
|
||||
/**
|
||||
* Respond to a permission request
|
||||
*/
|
||||
public respond<ThrowOnError extends boolean = false>(options: Options<PermissionRespondData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<PermissionRespondResponses, PermissionRespondErrors, ThrowOnError>({
|
||||
url: "/session/{sessionID}/permissions/{permissionID}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Command extends HeyApiClient {
|
||||
class Command extends _HeyApiClient {
|
||||
/**
|
||||
* List all commands
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options?: Options<CommandListData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<CommandListResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<CommandListResponses, unknown, ThrowOnError>({
|
||||
url: "/command",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Oauth extends HeyApiClient {
|
||||
class Oauth extends _HeyApiClient {
|
||||
/**
|
||||
* Authorize a provider using OAuth
|
||||
*/
|
||||
public authorize<ThrowOnError extends boolean = false>(options: Options<ProviderOauthAuthorizeData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<
|
||||
return (options.client ?? this._client).post<
|
||||
ProviderOauthAuthorizeResponses,
|
||||
ProviderOauthAuthorizeErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/provider/{providerID}/oauth/authorize",
|
||||
url: "/provider/{id}/oauth/authorize",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -754,12 +731,12 @@ export class Oauth extends HeyApiClient {
|
||||
* Handle OAuth callback for a provider
|
||||
*/
|
||||
public callback<ThrowOnError extends boolean = false>(options: Options<ProviderOauthCallbackData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<
|
||||
return (options.client ?? this._client).post<
|
||||
ProviderOauthCallbackResponses,
|
||||
ProviderOauthCallbackErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/provider/{providerID}/oauth/callback",
|
||||
url: "/provider/{id}/oauth/callback",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -769,12 +746,12 @@ export class Oauth extends HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export class Provider extends HeyApiClient {
|
||||
class Provider extends _HeyApiClient {
|
||||
/**
|
||||
* List all providers
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options?: Options<ProviderListData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ProviderListResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ProviderListResponses, unknown, ThrowOnError>({
|
||||
url: "/provider",
|
||||
...options,
|
||||
})
|
||||
@@ -784,28 +761,30 @@ export class Provider extends HeyApiClient {
|
||||
* Get provider authentication methods
|
||||
*/
|
||||
public auth<ThrowOnError extends boolean = false>(options?: Options<ProviderAuthData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<ProviderAuthResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<ProviderAuthResponses, unknown, ThrowOnError>({
|
||||
url: "/provider/auth",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
oauth = new Oauth({ client: this.client })
|
||||
oauth = new Oauth({ client: this._client })
|
||||
}
|
||||
|
||||
export class Find extends HeyApiClient {
|
||||
class Find extends _HeyApiClient {
|
||||
/**
|
||||
* Find text in files
|
||||
*/
|
||||
public text<ThrowOnError extends boolean = false>(options: Options<FindTextData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<FindTextResponses, unknown, ThrowOnError>({ url: "/find", ...options })
|
||||
return (options.client ?? this._client).get<FindTextResponses, unknown, ThrowOnError>({
|
||||
url: "/find",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Find files
|
||||
*/
|
||||
public files<ThrowOnError extends boolean = false>(options: Options<FindFilesData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<FindFilesResponses, unknown, ThrowOnError>({
|
||||
return (options.client ?? this._client).get<FindFilesResponses, unknown, ThrowOnError>({
|
||||
url: "/find/file",
|
||||
...options,
|
||||
})
|
||||
@@ -815,26 +794,29 @@ export class Find extends HeyApiClient {
|
||||
* Find workspace symbols
|
||||
*/
|
||||
public symbols<ThrowOnError extends boolean = false>(options: Options<FindSymbolsData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<FindSymbolsResponses, unknown, ThrowOnError>({
|
||||
return (options.client ?? this._client).get<FindSymbolsResponses, unknown, ThrowOnError>({
|
||||
url: "/find/symbol",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class File extends HeyApiClient {
|
||||
class File extends _HeyApiClient {
|
||||
/**
|
||||
* List files and directories
|
||||
*/
|
||||
public list<ThrowOnError extends boolean = false>(options: Options<FileListData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<FileListResponses, unknown, ThrowOnError>({ url: "/file", ...options })
|
||||
return (options.client ?? this._client).get<FileListResponses, unknown, ThrowOnError>({
|
||||
url: "/file",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a file
|
||||
*/
|
||||
public read<ThrowOnError extends boolean = false>(options: Options<FileReadData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).get<FileReadResponses, unknown, ThrowOnError>({
|
||||
return (options.client ?? this._client).get<FileReadResponses, unknown, ThrowOnError>({
|
||||
url: "/file/content",
|
||||
...options,
|
||||
})
|
||||
@@ -844,19 +826,19 @@ export class File extends HeyApiClient {
|
||||
* Get file status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(options?: Options<FileStatusData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<FileStatusResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<FileStatusResponses, unknown, ThrowOnError>({
|
||||
url: "/file/status",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class App extends HeyApiClient {
|
||||
class App extends _HeyApiClient {
|
||||
/**
|
||||
* Write a log entry to the server logs
|
||||
*/
|
||||
public log<ThrowOnError extends boolean = false>(options?: Options<AppLogData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<AppLogResponses, AppLogErrors, ThrowOnError>({
|
||||
url: "/log",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -870,19 +852,19 @@ export class App extends HeyApiClient {
|
||||
* List all agents
|
||||
*/
|
||||
public agents<ThrowOnError extends boolean = false>(options?: Options<AppAgentsData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<AppAgentsResponses, unknown, ThrowOnError>({
|
||||
url: "/agent",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Auth extends HeyApiClient {
|
||||
class Auth extends _HeyApiClient {
|
||||
/**
|
||||
* Remove OAuth credentials for an MCP server
|
||||
*/
|
||||
public remove<ThrowOnError extends boolean = false>(options: Options<McpAuthRemoveData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).delete<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError>({
|
||||
return (options.client ?? this._client).delete<McpAuthRemoveResponses, McpAuthRemoveErrors, ThrowOnError>({
|
||||
url: "/mcp/{name}/auth",
|
||||
...options,
|
||||
})
|
||||
@@ -892,7 +874,7 @@ export class Auth extends HeyApiClient {
|
||||
* Start OAuth authentication flow for an MCP server
|
||||
*/
|
||||
public start<ThrowOnError extends boolean = false>(options: Options<McpAuthStartData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError>({
|
||||
return (options.client ?? this._client).post<McpAuthStartResponses, McpAuthStartErrors, ThrowOnError>({
|
||||
url: "/mcp/{name}/auth",
|
||||
...options,
|
||||
})
|
||||
@@ -902,7 +884,7 @@ export class Auth extends HeyApiClient {
|
||||
* Complete OAuth authentication with authorization code
|
||||
*/
|
||||
public callback<ThrowOnError extends boolean = false>(options: Options<McpAuthCallbackData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError>({
|
||||
return (options.client ?? this._client).post<McpAuthCallbackResponses, McpAuthCallbackErrors, ThrowOnError>({
|
||||
url: "/mcp/{name}/auth/callback",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -916,18 +898,20 @@ export class Auth extends HeyApiClient {
|
||||
* Start OAuth flow and wait for callback (opens browser)
|
||||
*/
|
||||
public authenticate<ThrowOnError extends boolean = false>(options: Options<McpAuthAuthenticateData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).post<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError>({
|
||||
url: "/mcp/{name}/auth/authenticate",
|
||||
...options,
|
||||
})
|
||||
return (options.client ?? this._client).post<McpAuthAuthenticateResponses, McpAuthAuthenticateErrors, ThrowOnError>(
|
||||
{
|
||||
url: "/mcp/{name}/auth/authenticate",
|
||||
...options,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set authentication credentials
|
||||
*/
|
||||
public set<ThrowOnError extends boolean = false>(options: Options<AuthSetData, ThrowOnError>) {
|
||||
return (options.client ?? this.client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({
|
||||
url: "/auth/{providerID}",
|
||||
return (options.client ?? this._client).put<AuthSetResponses, AuthSetErrors, ThrowOnError>({
|
||||
url: "/auth/{id}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -937,19 +921,22 @@ export class Auth extends HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export class Mcp extends HeyApiClient {
|
||||
class Mcp extends _HeyApiClient {
|
||||
/**
|
||||
* Get MCP server status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(options?: Options<McpStatusData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<McpStatusResponses, unknown, ThrowOnError>({ url: "/mcp", ...options })
|
||||
return (options?.client ?? this._client).get<McpStatusResponses, unknown, ThrowOnError>({
|
||||
url: "/mcp",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Add MCP server dynamically
|
||||
*/
|
||||
public add<ThrowOnError extends boolean = false>(options?: Options<McpAddData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<McpAddResponses, McpAddErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<McpAddResponses, McpAddErrors, ThrowOnError>({
|
||||
url: "/mcp",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -958,37 +945,39 @@ export class Mcp extends HeyApiClient {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
auth = new Auth({ client: this.client })
|
||||
auth = new Auth({ client: this._client })
|
||||
}
|
||||
|
||||
export class Lsp extends HeyApiClient {
|
||||
class Lsp extends _HeyApiClient {
|
||||
/**
|
||||
* Get LSP server status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(options?: Options<LspStatusData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<LspStatusResponses, unknown, ThrowOnError>({ url: "/lsp", ...options })
|
||||
return (options?.client ?? this._client).get<LspStatusResponses, unknown, ThrowOnError>({
|
||||
url: "/lsp",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Formatter extends HeyApiClient {
|
||||
class Formatter extends _HeyApiClient {
|
||||
/**
|
||||
* Get formatter status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(options?: Options<FormatterStatusData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
||||
url: "/formatter",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Control extends HeyApiClient {
|
||||
class Control extends _HeyApiClient {
|
||||
/**
|
||||
* Get the next TUI request from the queue
|
||||
*/
|
||||
public next<ThrowOnError extends boolean = false>(options?: Options<TuiControlNextData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).get<TuiControlNextResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get<TuiControlNextResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/control/next",
|
||||
...options,
|
||||
})
|
||||
@@ -998,7 +987,7 @@ export class Control extends HeyApiClient {
|
||||
* Submit a response to the TUI request queue
|
||||
*/
|
||||
public response<ThrowOnError extends boolean = false>(options?: Options<TuiControlResponseData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiControlResponseResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiControlResponseResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/control/response",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -1009,12 +998,12 @@ export class Control extends HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
export class Tui extends HeyApiClient {
|
||||
class Tui extends _HeyApiClient {
|
||||
/**
|
||||
* Append prompt to the TUI
|
||||
*/
|
||||
public appendPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiAppendPromptData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiAppendPromptResponses, TuiAppendPromptErrors, ThrowOnError>({
|
||||
url: "/tui/append-prompt",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -1028,7 +1017,7 @@ export class Tui extends HeyApiClient {
|
||||
* Open the help dialog
|
||||
*/
|
||||
public openHelp<ThrowOnError extends boolean = false>(options?: Options<TuiOpenHelpData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiOpenHelpResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/open-help",
|
||||
...options,
|
||||
})
|
||||
@@ -1038,7 +1027,7 @@ export class Tui extends HeyApiClient {
|
||||
* Open the session dialog
|
||||
*/
|
||||
public openSessions<ThrowOnError extends boolean = false>(options?: Options<TuiOpenSessionsData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiOpenSessionsResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/open-sessions",
|
||||
...options,
|
||||
})
|
||||
@@ -1048,7 +1037,7 @@ export class Tui extends HeyApiClient {
|
||||
* Open the theme dialog
|
||||
*/
|
||||
public openThemes<ThrowOnError extends boolean = false>(options?: Options<TuiOpenThemesData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiOpenThemesResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/open-themes",
|
||||
...options,
|
||||
})
|
||||
@@ -1058,7 +1047,7 @@ export class Tui extends HeyApiClient {
|
||||
* Open the model dialog
|
||||
*/
|
||||
public openModels<ThrowOnError extends boolean = false>(options?: Options<TuiOpenModelsData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiOpenModelsResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/open-models",
|
||||
...options,
|
||||
})
|
||||
@@ -1068,7 +1057,7 @@ export class Tui extends HeyApiClient {
|
||||
* Submit the prompt
|
||||
*/
|
||||
public submitPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiSubmitPromptData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiSubmitPromptResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/submit-prompt",
|
||||
...options,
|
||||
})
|
||||
@@ -1078,7 +1067,7 @@ export class Tui extends HeyApiClient {
|
||||
* Clear the prompt
|
||||
*/
|
||||
public clearPrompt<ThrowOnError extends boolean = false>(options?: Options<TuiClearPromptData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiClearPromptResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiClearPromptResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/clear-prompt",
|
||||
...options,
|
||||
})
|
||||
@@ -1088,7 +1077,7 @@ export class Tui extends HeyApiClient {
|
||||
* Execute a TUI command (e.g. agent_cycle)
|
||||
*/
|
||||
public executeCommand<ThrowOnError extends boolean = false>(options?: Options<TuiExecuteCommandData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiExecuteCommandResponses, TuiExecuteCommandErrors, ThrowOnError>({
|
||||
url: "/tui/execute-command",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -1102,7 +1091,7 @@ export class Tui extends HeyApiClient {
|
||||
* Show a toast notification in the TUI
|
||||
*/
|
||||
public showToast<ThrowOnError extends boolean = false>(options?: Options<TuiShowToastData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiShowToastResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiShowToastResponses, unknown, ThrowOnError>({
|
||||
url: "/tui/show-toast",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -1116,7 +1105,7 @@ export class Tui extends HeyApiClient {
|
||||
* Publish a TUI event
|
||||
*/
|
||||
public publish<ThrowOnError extends boolean = false>(options?: Options<TuiPublishData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).post<TuiPublishResponses, TuiPublishErrors, ThrowOnError>({
|
||||
return (options?.client ?? this._client).post<TuiPublishResponses, TuiPublishErrors, ThrowOnError>({
|
||||
url: "/tui/publish",
|
||||
...options,
|
||||
headers: {
|
||||
@@ -1125,69 +1114,59 @@ export class Tui extends HeyApiClient {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
control = new Control({ client: this.client })
|
||||
control = new Control({ client: this._client })
|
||||
}
|
||||
|
||||
export class Event extends HeyApiClient {
|
||||
class Event extends _HeyApiClient {
|
||||
/**
|
||||
* Get events
|
||||
*/
|
||||
public subscribe<ThrowOnError extends boolean = false>(options?: Options<EventSubscribeData, ThrowOnError>) {
|
||||
return (options?.client ?? this.client).sse.get<EventSubscribeResponses, unknown, ThrowOnError>({
|
||||
return (options?.client ?? this._client).get.sse<EventSubscribeResponses, unknown, ThrowOnError>({
|
||||
url: "/event",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class OpencodeClient extends HeyApiClient {
|
||||
public static readonly __registry = new HeyApiRegistry<OpencodeClient>()
|
||||
|
||||
constructor(args?: { client?: Client; key?: string }) {
|
||||
super(args)
|
||||
OpencodeClient.__registry.set(this, args?.key)
|
||||
export class OpencodeClient extends _HeyApiClient {
|
||||
/**
|
||||
* Respond to a permission request
|
||||
*/
|
||||
public postSessionIdPermissionsPermissionId<ThrowOnError extends boolean = false>(
|
||||
options: Options<PostSessionIdPermissionsPermissionIdData, ThrowOnError>,
|
||||
) {
|
||||
return (options.client ?? this._client).post<
|
||||
PostSessionIdPermissionsPermissionIdResponses,
|
||||
PostSessionIdPermissionsPermissionIdErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
url: "/session/{id}/permissions/{permissionID}",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
global = new Global({ client: this.client })
|
||||
|
||||
project = new Project({ client: this.client })
|
||||
|
||||
pty = new Pty({ client: this.client })
|
||||
|
||||
config = new Config({ client: this.client })
|
||||
|
||||
tool = new Tool({ client: this.client })
|
||||
|
||||
instance = new Instance({ client: this.client })
|
||||
|
||||
path = new Path({ client: this.client })
|
||||
|
||||
vcs = new Vcs({ client: this.client })
|
||||
|
||||
session = new Session({ client: this.client })
|
||||
|
||||
permission = new Permission({ client: this.client })
|
||||
|
||||
command = new Command({ client: this.client })
|
||||
|
||||
provider = new Provider({ client: this.client })
|
||||
|
||||
find = new Find({ client: this.client })
|
||||
|
||||
file = new File({ client: this.client })
|
||||
|
||||
app = new App({ client: this.client })
|
||||
|
||||
mcp = new Mcp({ client: this.client })
|
||||
|
||||
lsp = new Lsp({ client: this.client })
|
||||
|
||||
formatter = new Formatter({ client: this.client })
|
||||
|
||||
tui = new Tui({ client: this.client })
|
||||
|
||||
auth = new Auth({ client: this.client })
|
||||
|
||||
event = new Event({ client: this.client })
|
||||
global = new Global({ client: this._client })
|
||||
project = new Project({ client: this._client })
|
||||
pty = new Pty({ client: this._client })
|
||||
config = new Config({ client: this._client })
|
||||
tool = new Tool({ client: this._client })
|
||||
instance = new Instance({ client: this._client })
|
||||
path = new Path({ client: this._client })
|
||||
vcs = new Vcs({ client: this._client })
|
||||
session = new Session({ client: this._client })
|
||||
command = new Command({ client: this._client })
|
||||
provider = new Provider({ client: this._client })
|
||||
find = new Find({ client: this._client })
|
||||
file = new File({ client: this._client })
|
||||
app = new App({ client: this._client })
|
||||
mcp = new Mcp({ client: this._client })
|
||||
lsp = new Lsp({ client: this._client })
|
||||
formatter = new Formatter({ client: this._client })
|
||||
tui = new Tui({ client: this._client })
|
||||
auth = new Auth({ client: this._client })
|
||||
event = new Event({ client: this._client })
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}` | (string & {})
|
||||
}
|
||||
|
||||
export type EventServerInstanceDisposed = {
|
||||
type: "server.instance.disposed"
|
||||
properties: {
|
||||
@@ -626,20 +622,22 @@ export type EventTuiCommandExecute = {
|
||||
type: "tui.command.execute"
|
||||
properties: {
|
||||
command:
|
||||
| "session.list"
|
||||
| "session.new"
|
||||
| "session.share"
|
||||
| "session.interrupt"
|
||||
| "session.compact"
|
||||
| "session.page.up"
|
||||
| "session.page.down"
|
||||
| "session.half.page.up"
|
||||
| "session.half.page.down"
|
||||
| "session.first"
|
||||
| "session.last"
|
||||
| "prompt.clear"
|
||||
| "prompt.submit"
|
||||
| "agent.cycle"
|
||||
| (
|
||||
| "session.list"
|
||||
| "session.new"
|
||||
| "session.share"
|
||||
| "session.interrupt"
|
||||
| "session.compact"
|
||||
| "session.page.up"
|
||||
| "session.page.down"
|
||||
| "session.half.page.up"
|
||||
| "session.half.page.down"
|
||||
| "session.first"
|
||||
| "session.last"
|
||||
| "prompt.clear"
|
||||
| "prompt.submit"
|
||||
| "agent.cycle"
|
||||
)
|
||||
| string
|
||||
}
|
||||
}
|
||||
@@ -979,9 +977,7 @@ export type AgentConfig = {
|
||||
permission?: {
|
||||
edit?: "ask" | "allow" | "deny"
|
||||
bash?:
|
||||
| "ask"
|
||||
| "allow"
|
||||
| "deny"
|
||||
| ("ask" | "allow" | "deny")
|
||||
| {
|
||||
[key: string]: "ask" | "allow" | "deny"
|
||||
}
|
||||
@@ -997,17 +993,12 @@ export type AgentConfig = {
|
||||
[key: string]: boolean
|
||||
}
|
||||
| boolean
|
||||
| "subagent"
|
||||
| "primary"
|
||||
| "all"
|
||||
| string
|
||||
| ("subagent" | "primary" | "all")
|
||||
| number
|
||||
| {
|
||||
edit?: "ask" | "allow" | "deny"
|
||||
bash?:
|
||||
| "ask"
|
||||
| "allow"
|
||||
| "deny"
|
||||
| ("ask" | "allow" | "deny")
|
||||
| {
|
||||
[key: string]: "ask" | "allow" | "deny"
|
||||
}
|
||||
@@ -1083,7 +1074,7 @@ export type ProviderConfig = {
|
||||
* Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
|
||||
*/
|
||||
timeout?: number | false
|
||||
[key: string]: unknown | string | boolean | number | false | undefined
|
||||
[key: string]: unknown | string | boolean | (number | false) | undefined
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1311,9 +1302,7 @@ export type Config = {
|
||||
permission?: {
|
||||
edit?: "ask" | "allow" | "deny"
|
||||
bash?:
|
||||
| "ask"
|
||||
| "allow"
|
||||
| "deny"
|
||||
| ("ask" | "allow" | "deny")
|
||||
| {
|
||||
[key: string]: "ask" | "allow" | "deny"
|
||||
}
|
||||
@@ -1771,12 +1760,12 @@ export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses]
|
||||
export type PtyRemoveData = {
|
||||
body?: never
|
||||
path: {
|
||||
ptyID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/pty/{ptyID}"
|
||||
url: "/pty/{id}"
|
||||
}
|
||||
|
||||
export type PtyRemoveErrors = {
|
||||
@@ -1800,12 +1789,12 @@ export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses]
|
||||
export type PtyGetData = {
|
||||
body?: never
|
||||
path: {
|
||||
ptyID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/pty/{ptyID}"
|
||||
url: "/pty/{id}"
|
||||
}
|
||||
|
||||
export type PtyGetErrors = {
|
||||
@@ -1835,12 +1824,12 @@ export type PtyUpdateData = {
|
||||
}
|
||||
}
|
||||
path: {
|
||||
ptyID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/pty/{ptyID}"
|
||||
url: "/pty/{id}"
|
||||
}
|
||||
|
||||
export type PtyUpdateErrors = {
|
||||
@@ -1864,12 +1853,12 @@ export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses]
|
||||
export type PtyConnectData = {
|
||||
body?: never
|
||||
path: {
|
||||
ptyID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/pty/{ptyID}/connect"
|
||||
url: "/pty/{id}/connect"
|
||||
}
|
||||
|
||||
export type PtyConnectErrors = {
|
||||
@@ -2125,12 +2114,12 @@ export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusRe
|
||||
export type SessionDeleteData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}"
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
export type SessionDeleteErrors = {
|
||||
@@ -2158,12 +2147,12 @@ export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteRe
|
||||
export type SessionGetData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}"
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
export type SessionGetErrors = {
|
||||
@@ -2193,12 +2182,12 @@ export type SessionUpdateData = {
|
||||
title?: string
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}"
|
||||
url: "/session/{id}"
|
||||
}
|
||||
|
||||
export type SessionUpdateErrors = {
|
||||
@@ -2226,12 +2215,12 @@ export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateRe
|
||||
export type SessionChildrenData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/children"
|
||||
url: "/session/{id}/children"
|
||||
}
|
||||
|
||||
export type SessionChildrenErrors = {
|
||||
@@ -2262,12 +2251,12 @@ export type SessionTodoData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/todo"
|
||||
url: "/session/{id}/todo"
|
||||
}
|
||||
|
||||
export type SessionTodoErrors = {
|
||||
@@ -2302,12 +2291,12 @@ export type SessionInitData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/init"
|
||||
url: "/session/{id}/init"
|
||||
}
|
||||
|
||||
export type SessionInitErrors = {
|
||||
@@ -2337,12 +2326,12 @@ export type SessionForkData = {
|
||||
messageID?: string
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/fork"
|
||||
url: "/session/{id}/fork"
|
||||
}
|
||||
|
||||
export type SessionForkResponses = {
|
||||
@@ -2357,12 +2346,12 @@ export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponse
|
||||
export type SessionAbortData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/abort"
|
||||
url: "/session/{id}/abort"
|
||||
}
|
||||
|
||||
export type SessionAbortErrors = {
|
||||
@@ -2390,12 +2379,12 @@ export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortRespo
|
||||
export type SessionUnshareData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/share"
|
||||
url: "/session/{id}/share"
|
||||
}
|
||||
|
||||
export type SessionUnshareErrors = {
|
||||
@@ -2423,12 +2412,12 @@ export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshar
|
||||
export type SessionShareData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/share"
|
||||
url: "/session/{id}/share"
|
||||
}
|
||||
|
||||
export type SessionShareErrors = {
|
||||
@@ -2459,13 +2448,13 @@ export type SessionDiffData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
messageID?: string
|
||||
}
|
||||
url: "/session/{sessionID}/diff"
|
||||
url: "/session/{id}/diff"
|
||||
}
|
||||
|
||||
export type SessionDiffErrors = {
|
||||
@@ -2499,12 +2488,12 @@ export type SessionSummarizeData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/summarize"
|
||||
url: "/session/{id}/summarize"
|
||||
}
|
||||
|
||||
export type SessionSummarizeErrors = {
|
||||
@@ -2535,13 +2524,13 @@ export type SessionMessagesData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
limit?: number
|
||||
}
|
||||
url: "/session/{sessionID}/message"
|
||||
url: "/session/{id}/message"
|
||||
}
|
||||
|
||||
export type SessionMessagesErrors = {
|
||||
@@ -2588,12 +2577,12 @@ export type SessionPromptData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/message"
|
||||
url: "/session/{id}/message"
|
||||
}
|
||||
|
||||
export type SessionPromptErrors = {
|
||||
@@ -2627,7 +2616,7 @@ export type SessionMessageData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
/**
|
||||
* Message ID
|
||||
*/
|
||||
@@ -2636,7 +2625,7 @@ export type SessionMessageData = {
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/message/{messageID}"
|
||||
url: "/session/{id}/message/{messageID}"
|
||||
}
|
||||
|
||||
export type SessionMessageErrors = {
|
||||
@@ -2683,12 +2672,12 @@ export type SessionPromptAsyncData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/prompt_async"
|
||||
url: "/session/{id}/prompt_async"
|
||||
}
|
||||
|
||||
export type SessionPromptAsyncErrors = {
|
||||
@@ -2725,12 +2714,12 @@ export type SessionCommandData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/command"
|
||||
url: "/session/{id}/command"
|
||||
}
|
||||
|
||||
export type SessionCommandErrors = {
|
||||
@@ -2771,12 +2760,12 @@ export type SessionShellData = {
|
||||
/**
|
||||
* Session ID
|
||||
*/
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/shell"
|
||||
url: "/session/{id}/shell"
|
||||
}
|
||||
|
||||
export type SessionShellErrors = {
|
||||
@@ -2807,12 +2796,12 @@ export type SessionRevertData = {
|
||||
partID?: string
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/revert"
|
||||
url: "/session/{id}/revert"
|
||||
}
|
||||
|
||||
export type SessionRevertErrors = {
|
||||
@@ -2840,12 +2829,12 @@ export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertRe
|
||||
export type SessionUnrevertData = {
|
||||
body?: never
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/unrevert"
|
||||
url: "/session/{id}/unrevert"
|
||||
}
|
||||
|
||||
export type SessionUnrevertErrors = {
|
||||
@@ -2870,21 +2859,21 @@ export type SessionUnrevertResponses = {
|
||||
|
||||
export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]
|
||||
|
||||
export type PermissionRespondData = {
|
||||
export type PostSessionIdPermissionsPermissionIdData = {
|
||||
body?: {
|
||||
response: "once" | "always" | "reject"
|
||||
}
|
||||
path: {
|
||||
sessionID: string
|
||||
id: string
|
||||
permissionID: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/session/{sessionID}/permissions/{permissionID}"
|
||||
url: "/session/{id}/permissions/{permissionID}"
|
||||
}
|
||||
|
||||
export type PermissionRespondErrors = {
|
||||
export type PostSessionIdPermissionsPermissionIdErrors = {
|
||||
/**
|
||||
* Bad request
|
||||
*/
|
||||
@@ -2895,16 +2884,18 @@ export type PermissionRespondErrors = {
|
||||
404: NotFoundError
|
||||
}
|
||||
|
||||
export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]
|
||||
export type PostSessionIdPermissionsPermissionIdError =
|
||||
PostSessionIdPermissionsPermissionIdErrors[keyof PostSessionIdPermissionsPermissionIdErrors]
|
||||
|
||||
export type PermissionRespondResponses = {
|
||||
export type PostSessionIdPermissionsPermissionIdResponses = {
|
||||
/**
|
||||
* Permission processed successfully
|
||||
*/
|
||||
200: boolean
|
||||
}
|
||||
|
||||
export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]
|
||||
export type PostSessionIdPermissionsPermissionIdResponse =
|
||||
PostSessionIdPermissionsPermissionIdResponses[keyof PostSessionIdPermissionsPermissionIdResponses]
|
||||
|
||||
export type CommandListData = {
|
||||
body?: never
|
||||
@@ -3050,12 +3041,12 @@ export type ProviderOauthAuthorizeData = {
|
||||
/**
|
||||
* Provider ID
|
||||
*/
|
||||
providerID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/provider/{providerID}/oauth/authorize"
|
||||
url: "/provider/{id}/oauth/authorize"
|
||||
}
|
||||
|
||||
export type ProviderOauthAuthorizeErrors = {
|
||||
@@ -3091,12 +3082,12 @@ export type ProviderOauthCallbackData = {
|
||||
/**
|
||||
* Provider ID
|
||||
*/
|
||||
providerID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/provider/{providerID}/oauth/callback"
|
||||
url: "/provider/{id}/oauth/callback"
|
||||
}
|
||||
|
||||
export type ProviderOauthCallbackErrors = {
|
||||
@@ -3800,12 +3791,12 @@ export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiCo
|
||||
export type AuthSetData = {
|
||||
body?: Auth
|
||||
path: {
|
||||
providerID: string
|
||||
id: string
|
||||
}
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/auth/{providerID}"
|
||||
url: "/auth/{id}"
|
||||
}
|
||||
|
||||
export type AuthSetErrors = {
|
||||
@@ -3843,3 +3834,7 @@ export type EventSubscribeResponses = {
|
||||
}
|
||||
|
||||
export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}` | (string & {})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user