mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-19 16:54:22 +01:00
feat: /tui/show-toast api
This commit is contained in:
@@ -77,6 +77,8 @@ import type {
|
||||
TuiClearPromptResponses,
|
||||
TuiExecuteCommandData,
|
||||
TuiExecuteCommandResponses,
|
||||
TuiShowToastData,
|
||||
TuiShowToastResponses,
|
||||
AuthSetData,
|
||||
AuthSetResponses,
|
||||
AuthSetErrors,
|
||||
@@ -518,6 +520,20 @@ 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>({
|
||||
url: "/tui/show-toast",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class Auth extends _HeyApiClient {
|
||||
|
||||
@@ -1911,6 +1911,26 @@ export type TuiExecuteCommandResponses = {
|
||||
|
||||
export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses]
|
||||
|
||||
export type TuiShowToastData = {
|
||||
body?: {
|
||||
title?: string
|
||||
message: string
|
||||
variant: "info" | "success" | "warning" | "error"
|
||||
}
|
||||
path?: never
|
||||
query?: never
|
||||
url: "/tui/show-toast"
|
||||
}
|
||||
|
||||
export type TuiShowToastResponses = {
|
||||
/**
|
||||
* Toast notification shown successfully
|
||||
*/
|
||||
200: boolean
|
||||
}
|
||||
|
||||
export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]
|
||||
|
||||
export type AuthSetData = {
|
||||
body?: Auth
|
||||
path: {
|
||||
|
||||
Reference in New Issue
Block a user