export type DeleteApiWebhooksOrgOrgNameWebhookIDArgs = {orgName: string, webhookID: string}; export type DeleteApiWebhooksOrgOrgNameWebhookIDOptions = {baseUrl: string, ApiKeyId?: string | undefined, ApiKeySecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete organization's webhook * * DELETE /webhooks/org/{orgName}/{webhookID} */ export const deleteApiWebhooksOrgOrgNameWebhookID = async (args: DeleteApiWebhooksOrgOrgNameWebhookIDArgs, options: DeleteApiWebhooksOrgOrgNameWebhookIDOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyId, ApiKeySecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyId !== undefined) headers.set("X-API-KEY-ID", ApiKeyId) if (ApiKeySecret !== undefined) headers.set("X-API-KEY-SECRET", ApiKeySecret) const url = `${baseUrl.replace(/\/+$/, '')}/webhooks/org/${encodeURIComponent(String(args.orgName))}/${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 };