Add CalDAV outbox recovery UI
This commit is contained in:
@@ -191,6 +191,35 @@ export type CalendarSyncSourceSyncResponse = {
|
||||
|
||||
export type CalendarCalDavSyncResponse = CalendarSyncSourceSyncResponse;
|
||||
|
||||
export type CalendarOutboxActionAvailability = {
|
||||
allowed: boolean;
|
||||
reason?: string | null;
|
||||
};
|
||||
|
||||
export type CalendarOutboxOperation = {
|
||||
id: string;
|
||||
source_id: string;
|
||||
event_id?: string | null;
|
||||
operation_kind: "put" | "delete" | string;
|
||||
resource_href: string;
|
||||
status: string;
|
||||
attempt_count: number;
|
||||
max_attempts: number;
|
||||
available_at: string;
|
||||
last_attempt_at?: string | null;
|
||||
lease_expires_at?: string | null;
|
||||
completed_at?: string | null;
|
||||
reconciled_at?: string | null;
|
||||
last_error?: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
actions: Record<string, CalendarOutboxActionAvailability>;
|
||||
};
|
||||
|
||||
export type CalendarOutboxOperationListResponse = {
|
||||
operations: CalendarOutboxOperation[];
|
||||
};
|
||||
|
||||
export type CalendarCollectionCreatePayload = {
|
||||
name: string;
|
||||
slug?: string | null;
|
||||
@@ -345,6 +374,28 @@ export function syncCalDavSource(settings: ApiSettings, sourceId: string, payloa
|
||||
return apiFetch<CalendarCalDavSyncResponse>(settings, `/api/v1/calendar/caldav/sources/${sourceId}/sync`, { method: "POST", body: JSON.stringify(payload) });
|
||||
}
|
||||
|
||||
export function listCalendarOutbox(
|
||||
settings: ApiSettings,
|
||||
params: { source_id?: string; status?: string; limit?: number } = {},
|
||||
): Promise<CalendarOutboxOperationListResponse> {
|
||||
const search = new URLSearchParams();
|
||||
if (params.source_id) search.set("source_id", params.source_id);
|
||||
if (params.status) search.set("status", params.status);
|
||||
if (params.limit) search.set("limit", String(params.limit));
|
||||
const suffix = search.toString() ? `?${search.toString()}` : "";
|
||||
return apiFetch<CalendarOutboxOperationListResponse>(settings, `/api/v1/calendar/caldav/outbox${suffix}`);
|
||||
}
|
||||
|
||||
export function recoverCalendarOutboxOperation(
|
||||
settings: ApiSettings,
|
||||
operationId: string,
|
||||
action: "retry" | "reconcile" | "discard",
|
||||
): Promise<CalendarOutboxOperation> {
|
||||
return apiFetch<CalendarOutboxOperation>(settings, `/api/v1/calendar/caldav/outbox/${operationId}/${action}`, {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export function listCalendarEvents(
|
||||
settings: ApiSettings,
|
||||
params: { calendar_id?: string; start_at?: string; end_at?: string; expand_recurring?: boolean } = {}
|
||||
|
||||
Reference in New Issue
Block a user