BlueSky & more on desktop
lazurite.stormlightlabs.org/
tauri
rust
typescript
bluesky
appview
atproto
solid
1import type { ModerationLabel, ProfileUnavailableReason } from "$/lib/types";
2import { invoke } from "@tauri-apps/api/core";
3
4type TProfile = {
5 did?: string | null;
6 handle?: string | null;
7 displayName?: string | null;
8 avatar?: string | null;
9 labels?: ModerationLabel[] | null;
10};
11
12type TAvailability = "available" | "unavailable";
13
14export type DiagnosticList = {
15 avatar?: string | null;
16 description?: string | null;
17 memberCount?: number | null;
18 purpose?: string | null;
19 listItemCount?: number | null;
20 name?: string | null;
21 title?: string | null;
22 uri?: string | null;
23 creator?: TProfile | null;
24};
25
26export type DiagnosticLabel = {
27 src?: string | null;
28 uri?: string | null;
29 val?: string | null;
30 neg?: boolean | null;
31 cts?: string[] | null;
32 exp?: string | null;
33 sig?: string | null;
34};
35
36export type DiagnosticDidProfile = {
37 availability: TAvailability;
38 did: string;
39 profile?: (TProfile & { description?: string | null }) | null;
40 unavailableReason?: ProfileUnavailableReason | null;
41 unavailableMessage?: string | null;
42};
43
44export type DiagnosticBlockItem = {
45 availability: TAvailability;
46 cid?: string | null;
47 createdAt?: string | null;
48 profile?: (TProfile & { description?: string | null }) | null;
49 subjectDid?: string | null;
50 unavailableReason?: ProfileUnavailableReason | null;
51 unavailableMessage?: string | null;
52 uri?: string | null;
53 value?: Record<string, unknown> | null;
54};
55
56export type DiagnosticStarterPack = {
57 avatar?: string | null;
58 cid?: string | null;
59 creator?: (TProfile & { description?: string | null }) | null;
60 description?: string | null;
61 indexedAt?: string | null;
62 listItemCount?: number | null;
63 name?: string | null;
64 record?: {
65 description?: string | null;
66 listItemsSample?: Array<{ subject?: string | null }> | null;
67 name?: string | null;
68 } | null;
69 title?: string | null;
70 uri?: string | null;
71};
72
73export type DiagnosticBacklinkItem = {
74 did?: string | null;
75 collection?: string | null;
76 rkey?: string | null;
77 profile?: (TProfile & { description?: string | null }) | null;
78 uri?: string | null;
79 value?: Record<string, unknown> | null;
80};
81
82export type DiagnosticBacklinkGroup = {
83 cursor?: string | null;
84 records: DiagnosticBacklinkItem[];
85 total?: number | null;
86};
87
88type AccountListsResult = { lists: DiagnosticList[]; total: number; truncated: boolean };
89
90type AccountLabelsResult = {
91 labels: DiagnosticLabel[];
92 sourceProfiles: Record<string, unknown>;
93 cursor: string | null;
94};
95type AccountBlockedByResult = { items: DiagnosticDidProfile[]; total: number; cursor: string | null };
96
97type AccountBlockingItem = DiagnosticBlockItem;
98
99type AccountBlockingResult = { items: AccountBlockingItem[]; cursor: string | null };
100
101type AccountStarterPacksResult = { starterPacks: DiagnosticStarterPack[]; total: number; truncated: boolean };
102
103type RecordBacklinksResult = {
104 likes: DiagnosticBacklinkGroup;
105 reposts: DiagnosticBacklinkGroup;
106 replies: DiagnosticBacklinkGroup;
107 quotes: DiagnosticBacklinkGroup;
108};
109
110function getAccountLists(did: string): Promise<AccountListsResult> {
111 return invoke("get_account_lists", { did });
112}
113
114function getAccountLabels(did: string): Promise<AccountLabelsResult> {
115 return invoke("get_account_labels", { did });
116}
117
118function getAccountBlockedBy(
119 did: string,
120 limit?: number | null,
121 cursor?: string | null,
122): Promise<AccountBlockedByResult> {
123 return invoke("get_account_blocked_by", { did, limit: limit ?? null, cursor: cursor ?? null });
124}
125
126function getAccountBlocking(did: string, cursor?: string | null): Promise<AccountBlockingResult> {
127 return invoke("get_account_blocking", { did, cursor: cursor ?? null });
128}
129
130function getAccountStarterPacks(did: string): Promise<AccountStarterPacksResult> {
131 return invoke("get_account_starter_packs", { did });
132}
133
134function getRecordBacklinks(uri: string): Promise<RecordBacklinksResult> {
135 return invoke("get_record_backlinks", { uri });
136}
137
138export const DiagnosticsController = {
139 getAccountLists,
140 getAccountLabels,
141 getAccountBlockedBy,
142 getAccountBlocking,
143 getAccountStarterPacks,
144 getRecordBacklinks,
145};