feat(reactions): add message reactions API and web quick reactions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { http } from "./http";
|
||||
import type { Chat, ChatDetail, ChatMember, ChatMemberRole, ChatType, DiscoverChat, Message, MessageType } from "../chat/types";
|
||||
import type { Chat, ChatDetail, ChatMember, ChatMemberRole, ChatType, DiscoverChat, Message, MessageReaction, MessageType } from "../chat/types";
|
||||
import axios from "axios";
|
||||
|
||||
export interface ChatNotificationSettings {
|
||||
@@ -160,6 +160,16 @@ export async function forwardMessage(messageId: number, targetChatId: number): P
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function listMessageReactions(messageId: number): Promise<MessageReaction[]> {
|
||||
const { data } = await http.get<MessageReaction[]>(`/messages/${messageId}/reactions`);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function toggleMessageReaction(messageId: number, emoji: string): Promise<MessageReaction[]> {
|
||||
const { data } = await http.post<MessageReaction[]>(`/messages/${messageId}/reactions/toggle`, { emoji });
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function pinMessage(chatId: number, messageId: number | null): Promise<Chat> {
|
||||
const { data } = await http.post<Chat>(`/chats/${chatId}/pin`, {
|
||||
message_id: messageId
|
||||
|
||||
Reference in New Issue
Block a user