feat(dashboard): run paired inbox actions (#34)
This commit is contained in:
@@ -101,6 +101,7 @@ export interface DashboardTask {
|
||||
}
|
||||
|
||||
export type DashboardTaskAction = 'pause' | 'resume' | 'cancel';
|
||||
export type DashboardInboxAction = 'run';
|
||||
|
||||
async function fetchJson<T>(path: string): Promise<T> {
|
||||
const response = await fetch(path, {
|
||||
@@ -162,6 +163,21 @@ export async function runScheduledTaskAction(
|
||||
});
|
||||
}
|
||||
|
||||
export async function runInboxAction(
|
||||
inboxId: string,
|
||||
action: DashboardInboxAction,
|
||||
): Promise<{
|
||||
ok: true;
|
||||
id: string;
|
||||
taskId: string;
|
||||
intentKind: string;
|
||||
queued: boolean;
|
||||
}> {
|
||||
return postJson(`/api/inbox/${encodeURIComponent(inboxId)}/actions`, {
|
||||
action,
|
||||
});
|
||||
}
|
||||
|
||||
export async function sendRoomMessage(
|
||||
roomJid: string,
|
||||
text: string,
|
||||
|
||||
Reference in New Issue
Block a user