export type DeleteApiV1WebhooksEndpointsEndpointIdArgs = {'X-API-Key'?: string | undefined, endpointId: string}; export type DeleteApiV1WebhooksEndpointsEndpointIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a webhook endpoint * * DELETE /v1/webhooks/endpoints/{endpointId} */ export const deleteApiV1WebhooksEndpointsEndpointId = async (args: DeleteApiV1WebhooksEndpointsEndpointIdArgs, options?: DeleteApiV1WebhooksEndpointsEndpointIdOptions) => { const {baseUrl = "https://sandbox.api.infinite.dev", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/webhooks/endpoints/${encodeURIComponent(String(args.endpointId))}${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 };