export type SnowflakeType = unknown | number; export type DeleteApiChannelsChannelIdPinsMessageIdArgs = {channel_id: SnowflakeType, message_id: SnowflakeType}; export type DeleteApiChannelsChannelIdPinsMessageIdOptions = {baseUrl?: string | undefined, botToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Unpin a message * * DELETE /channels/{channel_id}/pins/{message_id} * * Also accepts auth: sessionToken */ export const deleteApiChannelsChannelIdPinsMessageId = async (args: DeleteApiChannelsChannelIdPinsMessageIdArgs, options?: DeleteApiChannelsChannelIdPinsMessageIdOptions) => { const {baseUrl = "https://web.fluxer.app/api/v1", fetch: fetchFn = fetch, botToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (botToken !== undefined) headers.set("Authorization", botToken) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_id))}/pins/${encodeURIComponent(String(args.message_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };