feat: /tui/show-toast api

This commit is contained in:
adamdotdevin
2025-08-15 08:39:58 -05:00
parent 6e0e87fb2a
commit 9609c1803e
10 changed files with 169 additions and 5 deletions

View File

@@ -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 {

View File

@@ -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: {