import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse } from "~/types/interfaces"; export const useApi = () => { async function fetchGuilds(): Promise { return await fetchWithApi(`/guilds`); } async function fetchGuild(guildId: string): Promise { return await fetchWithApi(`/guilds/${guildId}`); } async function fetchChannels(guildId: string): Promise { return await fetchWithApi(`/guilds/${guildId}/channels`); } async function fetchChannel(channelId: string): Promise { return await fetchWithApi(`/channels/${channelId}`) } async function fetchMembers(guildId: string): Promise { return await fetchWithApi(`/guilds/${guildId}/members`); } async function fetchMember(guildId: string, memberId: string): Promise { return await fetchWithApi(`/guilds/${guildId}/members/${memberId}`); } async function fetchUsers() { return await fetchWithApi(`/users`); } async function fetchUser(userId: string) { return await fetchWithApi(`/users/${userId}`); } async function fetchMessages(channelId: string): Promise { return await fetchWithApi(`/channels/${channelId}/messages`); } async function fetchMessage(channelId: string, messageId: string): Promise { return await fetchWithApi(`/channels/${channelId}/messages/${messageId}`); } return { fetchGuilds, fetchGuild, fetchChannels, fetchChannel, fetchMembers, fetchMember, fetchUsers, fetchUser, fetchMessages, fetchMessage } }