export type DeleteApiUsersMeComparisonsPollNameUidAUidBArgs = {poll_name: string, uid_a: string, uid_b: string}; export type DeleteApiUsersMeComparisonsPollNameUidAUidBOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a comparison made by the logged user, in the given poll * * DELETE /users/me/comparisons/{poll_name}/{uid_a}/{uid_b}/ */ export const deleteApiUsersMeComparisonsPollNameUidAUidB = async (args: DeleteApiUsersMeComparisonsPollNameUidAUidBArgs, options: DeleteApiUsersMeComparisonsPollNameUidAUidBOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/users/me/comparisons/${encodeURIComponent(String(args.poll_name))}/${encodeURIComponent(String(args.uid_a))}/${encodeURIComponent(String(args.uid_b))}/${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 };