mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Support nested thread replies in desktop (#50)
This commit is contained in:
@@ -19,6 +19,7 @@ import type {
|
||||
RelayEvent,
|
||||
SearchMessagesInput,
|
||||
SearchMessagesResponse,
|
||||
SendChannelMessageResult,
|
||||
SetPresenceResult,
|
||||
SetChannelPurposeInput,
|
||||
SetChannelTopicInput,
|
||||
@@ -152,6 +153,14 @@ type RawSearchResponse = {
|
||||
found: number;
|
||||
};
|
||||
|
||||
type RawSendChannelMessageResult = {
|
||||
event_id: string;
|
||||
parent_event_id: string | null;
|
||||
root_event_id: string | null;
|
||||
depth: number;
|
||||
created_at: number;
|
||||
};
|
||||
|
||||
type RawToken = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -501,6 +510,29 @@ export async function getEventById(eventId: string): Promise<RelayEvent> {
|
||||
return JSON.parse(eventJson) as RelayEvent;
|
||||
}
|
||||
|
||||
export async function sendChannelMessage(
|
||||
channelId: string,
|
||||
content: string,
|
||||
parentEventId?: string | null,
|
||||
): Promise<SendChannelMessageResult> {
|
||||
const response = await invokeTauri<RawSendChannelMessageResult>(
|
||||
"send_channel_message",
|
||||
{
|
||||
channelId,
|
||||
content,
|
||||
parentEventId,
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
eventId: response.event_id,
|
||||
parentEventId: response.parent_event_id,
|
||||
rootEventId: response.root_event_id,
|
||||
depth: response.depth,
|
||||
createdAt: response.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
export async function signRelayEvent(input: {
|
||||
kind: number;
|
||||
content: string;
|
||||
|
||||
@@ -126,6 +126,14 @@ export type RelayEvent = {
|
||||
pending?: boolean;
|
||||
};
|
||||
|
||||
export type SendChannelMessageResult = {
|
||||
eventId: string;
|
||||
parentEventId: string | null;
|
||||
rootEventId: string | null;
|
||||
depth: number;
|
||||
createdAt: number;
|
||||
};
|
||||
|
||||
export type FeedItemCategory =
|
||||
| "mention"
|
||||
| "needs_action"
|
||||
|
||||
Reference in New Issue
Block a user