export type DeleteApiApiDynamicQrSlugArgs = {'If-Match': string, 'X-Dynamic-QR-Version'?: string | undefined}; export type DeleteApiApiDynamicQrSlugOptions = {baseUrl?: string | undefined, DynamicQrBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Permanently delete a dynamic QR record * * DELETE /api/dynamic-qr/{slug} */ export const deleteApiApiDynamicQrSlug = async (args: DeleteApiApiDynamicQrSlugArgs, options?: DeleteApiApiDynamicQrSlugOptions) => { const {baseUrl = "https://qrcodecrafter.com", fetch: fetchFn = fetch, DynamicQrBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['If-Match'] != null) headers.set("If-Match", String(args['If-Match'])) if (args['X-Dynamic-QR-Version'] != null) headers.set("X-Dynamic-QR-Version", String(args['X-Dynamic-QR-Version'])) if (DynamicQrBearer !== undefined) headers.set('authorization', `Bearer ${DynamicQrBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/dynamic-qr/${encodeURIComponent(String(args.slug))}${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 };