mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(web,hub): cancel queued messages (#568)
This commit is contained in:
@@ -25,6 +25,7 @@ import type {
|
||||
SessionResponse,
|
||||
SessionsResponse
|
||||
} from '@/types/api'
|
||||
import type { CancelMessageResponse } from '@hapi/protocol/schemas'
|
||||
|
||||
type ApiClientOptions = {
|
||||
baseUrl?: string
|
||||
@@ -307,6 +308,14 @@ export class ApiClient {
|
||||
})
|
||||
}
|
||||
|
||||
async cancelMessage(sessionId: string, messageId: string): Promise<CancelMessageResponse> {
|
||||
const response = await this.request(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/messages/${encodeURIComponent(messageId)}`,
|
||||
{ method: 'DELETE' }
|
||||
)
|
||||
return response as CancelMessageResponse
|
||||
}
|
||||
|
||||
async abortSession(sessionId: string): Promise<void> {
|
||||
await this.request(`/api/sessions/${encodeURIComponent(sessionId)}/abort`, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user