feat(invites): add group/channel invite links and join by token
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { http } from "./http";
|
||||
import type { Chat, ChatDetail, ChatMember, ChatMemberRole, ChatType, DiscoverChat, Message, MessageReaction, MessageType } from "../chat/types";
|
||||
import type { Chat, ChatDetail, ChatInviteLink, ChatMember, ChatMemberRole, ChatType, DiscoverChat, Message, MessageReaction, MessageType } from "../chat/types";
|
||||
import axios from "axios";
|
||||
|
||||
export interface ChatNotificationSettings {
|
||||
@@ -215,6 +215,16 @@ export async function unpinChat(chatId: number): Promise<Chat> {
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function createInviteLink(chatId: number): Promise<ChatInviteLink> {
|
||||
const { data } = await http.post<ChatInviteLink>(`/chats/${chatId}/invite-link`);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function joinByInvite(token: string): Promise<Chat> {
|
||||
const { data } = await http.post<Chat>("/chats/join-by-invite", { token });
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function deleteMessage(messageId: number, forAll = false): Promise<void> {
|
||||
await http.delete(`/messages/${messageId}`, { params: { for_all: forAll } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user