export type DeleteApiV1NotificationsWebhooksWebhookIdArgs = {webhook_id: string}; export type DeleteApiV1NotificationsWebhooksWebhookIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete webhook * * DELETE /v1/notifications/webhooks/{webhook_id} */ export const deleteApiV1NotificationsWebhooksWebhookId = async (args: DeleteApiV1NotificationsWebhooksWebhookIdArgs, options?: DeleteApiV1NotificationsWebhooksWebhookIdOptions) => { const {baseUrl = "https://api-m.paypal.com", 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(/\/+$/, '')}/v1/notifications/webhooks/${encodeURIComponent(String(args.webhook_id))}${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 };