BlueSky & more on desktop lazurite.stormlightlabs.org/
tauri rust typescript bluesky appview atproto solid
at main 27 lines 769 B view raw
1import type { Draft, DraftInput } from "$/lib/types"; 2import { invoke } from "@tauri-apps/api/core"; 3 4function listDrafts(accountDid: string): Promise<Draft[]> { 5 return invoke("list_drafts", { accountDid }); 6} 7 8function getDraft(id: string): Promise<Draft> { 9 return invoke("get_draft", { id }); 10} 11 12function saveDraft(input: DraftInput): Promise<Draft> { 13 return invoke("save_draft", { input }); 14} 15 16function deleteDraft(id: string): Promise<void> { 17 return invoke("delete_draft", { id }); 18} 19 20/** 21 * Controller for managing drafts, providing methods to list, get, save, and delete drafts. 22 * 23 * Note: this is a new-ish pattern I'm trying out. 24 * @author Owais 25 * @date 2026/04/07 26 */ 27export const DraftController = { listDrafts, getDraft, saveDraft, deleteDraft };