export type DeleteApiApiPersonsPersonIdMessagesReceivedArgs = {availableToDestination?: boolean | undefined, messageType?: ('ASSOCIATION_REQUEST' | 'CREDENTIAL' | 'INVITATION' | 'NOTICE' | 'PERSON_NOTIFICATION') | undefined, personId: string}; export type DeleteApiApiPersonsPersonIdMessagesReceivedOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete the current messages for this person * * DELETE /api/persons/{personId}/messages/received */ export const deleteApiApiPersonsPersonIdMessagesReceived = async (args: DeleteApiApiPersonsPersonIdMessagesReceivedArgs, options: DeleteApiApiPersonsPersonIdMessagesReceivedOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.availableToDestination != null) query.append("availableToDestination", String(args.availableToDestination)) if (args.messageType != null) query.append("messageType", String(args.messageType)) const url = `${baseUrl.replace(/\/+$/, '')}/api/persons/${encodeURIComponent(String(args.personId))}/messages/received${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 };