Files
lume/src/utils/types.d.ts
2023-09-06 14:30:57 +07:00

114 lines
2.0 KiB
TypeScript

import { NDKEvent, NDKUserProfile } from '@nostr-dev-kit/ndk';
import { Response } from '@tauri-apps/api/http';
export interface RichContent {
parsed: string;
images: string[];
videos: string[];
links: string[];
notes: string[];
}
export interface DBEvent {
id: string;
account_id: number;
event: string | NDKEvent;
author: string;
kind: number;
root_id: string;
reply_id: string;
created_at: number;
richContent?: RichContent;
}
export interface Account extends NDKUserProfile {
id: number;
npub: string;
pubkey: string;
follows: null | string[];
network: null | string[];
is_active: number;
privkey?: string; // deprecated
last_login_at: number;
}
export interface Profile extends NDKUserProfile {
ident?: string;
pubkey?: string;
}
export interface WidgetGroup {
title: string;
data: WidgetGroupItem[];
}
export interface WidgetGroupItem {
title: string;
description: string;
kind: number;
icon?: string;
}
export interface Widget {
id?: string;
account_id?: number;
kind: number;
title: string;
content: string;
}
export interface Chats {
id: string;
event_id?: string;
receiver_pubkey: string;
sender_pubkey: string;
content: string;
tags: string[][];
created_at: number;
new_messages?: number;
}
export interface Settings {
id: string;
key: string;
value: string;
}
export interface Relays {
id?: string;
account_id?: number;
relay: string;
purpose?: string;
}
export interface Opengraph {
url: string;
title?: string;
description?: string;
image?: string;
}
export interface NDKEventWithReplies extends NDKEvent {
replies: Array<NDKEvent>;
}
export interface NostrBuildResponse extends Response {
ok: boolean;
data: {
message: string;
status: string;
data: Array<{
blurhash: string;
dimensions: {
width: number;
height: number;
};
mime: string;
name: string;
sha256: string;
size: number;
url: string;
}>;
};
}