mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-29 18:14:23 +01:00
Add DittoEvent and DittoFilter dedicated interface modules
This commit is contained in:
24
src/interfaces/DittoEvent.ts
Normal file
24
src/interfaces/DittoEvent.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { type NostrEvent } from '@/deps.ts';
|
||||
|
||||
/** Ditto internal stats for the event's author. */
|
||||
export interface AuthorStats {
|
||||
followers_count: number;
|
||||
following_count: number;
|
||||
notes_count: number;
|
||||
}
|
||||
|
||||
/** Ditto internal stats for the event. */
|
||||
export interface EventStats {
|
||||
replies_count: number;
|
||||
reposts_count: number;
|
||||
reactions_count: number;
|
||||
}
|
||||
|
||||
/** Internal Event representation used by Ditto, including extra keys. */
|
||||
export interface DittoEvent extends NostrEvent {
|
||||
author?: DittoEvent;
|
||||
author_stats?: AuthorStats;
|
||||
event_stats?: EventStats;
|
||||
d_author?: DittoEvent;
|
||||
user?: DittoEvent;
|
||||
}
|
||||
14
src/interfaces/DittoFilter.ts
Normal file
14
src/interfaces/DittoFilter.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { type NostrEvent, type NostrFilter } from '@/deps.ts';
|
||||
|
||||
import { type DittoEvent } from './DittoEvent.ts';
|
||||
|
||||
/** Additional properties that may be added by Ditto to events. */
|
||||
export type DittoRelation = Exclude<keyof DittoEvent, keyof NostrEvent>;
|
||||
|
||||
/** Custom filter interface that extends Nostr filters with extra options for Ditto. */
|
||||
export interface DittoFilter extends NostrFilter {
|
||||
/** Whether the event was authored by a local user. */
|
||||
local?: boolean;
|
||||
/** Additional fields to add to the returned event. */
|
||||
relations?: DittoRelation[];
|
||||
}
|
||||
Reference in New Issue
Block a user