export type SnowflakeType = unknown | number; export type UpdateApiChannelsChannelIdRecipientsUserIdArgs = {channel_id: SnowflakeType, user_id: SnowflakeType}; export type UpdateApiChannelsChannelIdRecipientsUserIdOptions = {baseUrl?: string | undefined, botToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add recipient to group DM * * PUT /channels/{channel_id}/recipients/{user_id} * * Also accepts auth: sessionToken */ export const updateApiChannelsChannelIdRecipientsUserId = async (args: UpdateApiChannelsChannelIdRecipientsUserIdArgs, options?: UpdateApiChannelsChannelIdRecipientsUserIdOptions) => { 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))}/recipients/${encodeURIComponent(String(args.user_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };