export type SnowflakeType = unknown | number; export type CreateApiChannelsChannelIdPinsAckArgs = {channel_id: SnowflakeType}; export type CreateApiChannelsChannelIdPinsAckOptions = {baseUrl?: string | undefined, botToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Acknowledge new pin notifications * * POST /channels/{channel_id}/pins/ack * * Also accepts auth: sessionToken */ export const createApiChannelsChannelIdPinsAck = async (args: CreateApiChannelsChannelIdPinsAckArgs, options?: CreateApiChannelsChannelIdPinsAckOptions) => { 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/ack${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };