export type DeleteApiWebhooksSubscriptionIdArgs = {subscriptionId: string, version: string}; export type DeleteApiWebhooksSubscriptionIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a subscription * * DELETE /webhooks/{subscriptionId} */ export const deleteApiWebhooksSubscriptionId = async (args: DeleteApiWebhooksSubscriptionIdArgs, options?: DeleteApiWebhooksSubscriptionIdOptions) => { const {baseUrl = "https://api.dojo.tech", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.version != null) headers.set("version", String(args.version)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/webhooks/${encodeURIComponent(String(args.subscriptionId))}${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 };