48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { apiFetch } from "./auth";
|
|
|
|
export interface DataExportRequest {
|
|
id: string;
|
|
status: "PENDING" | "PROCESSING" | "READY" | "FAILED" | "EXPIRED";
|
|
downloadUrl: string | null;
|
|
expiresAt: string | null;
|
|
completedAt: string | null;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface AccountDeletionRequest {
|
|
id: string;
|
|
status: "PENDING" | "SCHEDULED" | "COMPLETED" | "CANCELLED";
|
|
scheduledFor: string;
|
|
completedAt: string | null;
|
|
createdAt: string;
|
|
}
|
|
|
|
export async function requestDataExport(): Promise<DataExportRequest> {
|
|
return apiFetch<DataExportRequest>("/account/compliance/export", {
|
|
method: "POST",
|
|
});
|
|
}
|
|
|
|
export async function listDataExports(): Promise<{ exports: DataExportRequest[] }> {
|
|
return apiFetch("/account/compliance/export");
|
|
}
|
|
|
|
export async function requestAccountDeletion(
|
|
confirmEmail: string,
|
|
): Promise<AccountDeletionRequest> {
|
|
return apiFetch<AccountDeletionRequest>("/account/compliance/deletion", {
|
|
method: "POST",
|
|
body: JSON.stringify({ confirmEmail }),
|
|
});
|
|
}
|
|
|
|
export async function getAccountDeletionStatus(): Promise<AccountDeletionRequest | null> {
|
|
return apiFetch<AccountDeletionRequest | null>("/account/compliance/deletion");
|
|
}
|
|
|
|
export async function cancelAccountDeletion(): Promise<AccountDeletionRequest> {
|
|
return apiFetch<AccountDeletionRequest>("/account/compliance/deletion", {
|
|
method: "DELETE",
|
|
});
|
|
}
|