export type SnowflakeType = unknown | number; export type BulkDeleteMessagesRequest = {message_ids?: Array | undefined, messages?: Array | undefined}; export type CreateApiChannelsChannelIdMessagesBulkDeleteArgs = {channel_id: SnowflakeType, body: BulkDeleteMessagesRequest}; export type CreateApiChannelsChannelIdMessagesBulkDeleteOptions = {baseUrl?: string | undefined, botToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk delete messages * * POST /channels/{channel_id}/messages/bulk-delete * * Also accepts auth: sessionToken */ export const createApiChannelsChannelIdMessagesBulkDelete = async (args: CreateApiChannelsChannelIdMessagesBulkDeleteArgs, options?: CreateApiChannelsChannelIdMessagesBulkDeleteOptions) => { const {baseUrl = "https://web.fluxer.app/api/v1", fetch: fetchFn = fetch, botToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (botToken !== undefined) headers.set("Authorization", botToken) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_id))}/messages/bulk-delete${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };