export type DeleteApiApiV1WebhooksWebhookIdArgs = {webhookId: string, 'Client-ID': string, Authorization: string}; export type DeleteApiApiV1WebhooksWebhookIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a webhook * * DELETE /api/v1/webhooks/{webhookId} */ export const deleteApiApiV1WebhooksWebhookId = async (args: DeleteApiApiV1WebhooksWebhookIdArgs, options?: DeleteApiApiV1WebhooksWebhookIdOptions) => { const {baseUrl = "https://merchant-api.accruesavings.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Client-ID'] != null) headers.set("Client-ID", String(args['Client-ID'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/webhooks/${encodeURIComponent(String(args.webhookId))}${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 };