export type SnowflakeType = unknown | number; export type PasswordType = string; export type WebAuthnAuthenticationResponse = {id: string, rawId: string, type: 'public-key', authenticatorAttachment?: ('cross-platform' | 'platform') | undefined, clientExtensionResults: {appid?: boolean | undefined, credProps?: ({rk?: boolean | undefined} | {[key: string]: unknown}) | undefined, hmacCreateSecret?: boolean | undefined} | {[key: string]: unknown}, response: {clientDataJSON: string, authenticatorData: string, signature: string, userHandle?: string | undefined} | {[key: string]: unknown}} | {[key: string]: unknown}; export type SudoVerificationSchema = {password?: PasswordType | undefined, mfa_method?: ('totp' | 'webauthn' | 'email_code') | undefined, mfa_code?: string | undefined, email_code_ticket?: string | undefined, email_code?: string | undefined, webauthn_response?: WebAuthnAuthenticationResponse | undefined, webauthn_challenge?: string | undefined}; export type DeleteApiChannelsChannelIdRecipientsUserIdArgs = {channel_id: SnowflakeType, user_id: SnowflakeType, silent?: string | undefined, delete_messages?: string | undefined, body: SudoVerificationSchema}; export type DeleteApiChannelsChannelIdRecipientsUserIdOptions = {baseUrl?: string | undefined, botToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove recipient from group DM * * DELETE /channels/{channel_id}/recipients/{user_id} * * Also accepts auth: sessionToken */ export const deleteApiChannelsChannelIdRecipientsUserId = async (args: DeleteApiChannelsChannelIdRecipientsUserIdArgs, options?: DeleteApiChannelsChannelIdRecipientsUserIdOptions) => { 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 (args.silent != null) query.append("silent", String(args.silent)) if (args.delete_messages != null) query.append("delete_messages", String(args.delete_messages)) 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: "DELETE", 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 };