export type CreateApiApiSocialChatIdMarkReadOptions = {baseUrl?: string | undefined, Basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Marquer tous les messages d'un ami comme lus (PK = User ID de l'ami). * * POST /api/social/chat/{id}/mark_read/ */ export const createApiApiSocialChatIdMarkRead = async (options?: CreateApiApiSocialChatIdMarkReadOptions) => { const {baseUrl = "https://api.jeuxcracks.fr", fetch: fetchFn = fetch, Basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Basic !== undefined) headers.set('authorization', `Basic ${btoa(`${Basic.username}:${Basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/social/chat/${encodeURIComponent(String(args.id))}/mark_read/${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 };