This commit is contained in:
2025-05-21 08:52:33 +03:00
parent e992d388fb
commit 4e5fca2402
68 changed files with 358 additions and 1398 deletions

View File

@@ -1,11 +1,7 @@
import axios from "../http-client";
import { messageSchema, type ChannelId, type Uuid } from "../types";
export async function paginatedMessages(
channelId: ChannelId,
limit: number,
before: ChannelId | undefined,
) {
export async function paginatedMessages(channelId: ChannelId, limit: number, before: ChannelId | undefined) {
const response = await axios.get(`/channels/${channelId}/messages`, {
params: {
limit,
@@ -13,16 +9,10 @@ export async function paginatedMessages(
},
});
return (response.data as any[]).map((value, _) =>
messageSchema.parse(value),
);
return (response.data as any[]).map((value, _) => messageSchema.parse(value));
}
export async function sendMessage(
channelId: ChannelId,
content: string,
attachments?: Uuid[],
) {
export async function sendMessage(channelId: ChannelId, content: string, attachments?: Uuid[]) {
const response = await axios.post(`/channels/${channelId}/messages`, {
content,
attachments,