add: add feature to schedule messages

This commit is contained in:
Matthias Hochmeister
2026-04-17 10:41:00 +02:00
parent 5811ac201e
commit b91cf88812
7 changed files with 177 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import type {
ScheduledMessagesListResponse,
ScheduledMessageDetailResponse,
RoomsResponse,
OneTimeMessage,
} from '../types/scheduledMessages.types';
export const scheduledMessagesApi = {
@@ -33,4 +34,18 @@ export const scheduledMessagesApi = {
trigger: (id: string) =>
api.post(`/scheduled-messages/${id}/trigger`).then(r => r.data),
getOneTimeMessages: () =>
api.get<{ data: OneTimeMessage[] }>('/scheduled-messages/one-time').then(r => r.data),
createOneTimeMessage: (data: {
message: string;
target_room_token: string;
target_room_name?: string;
send_at: string;
}) =>
api.post<{ data: OneTimeMessage }>('/scheduled-messages/one-time', data).then(r => r.data),
deleteOneTimeMessage: (id: string) =>
api.delete(`/scheduled-messages/one-time/${id}`).then(r => r.data),
};

View File

@@ -51,3 +51,13 @@ export interface RoomsResponse {
data?: NextcloudRoom[];
error?: string;
}
export interface OneTimeMessage {
id: string;
message: string;
target_room_token: string;
target_room_name: string | null;
send_at: string;
created_by: string | null;
created_at: string;
}