export type CircuitBreakerNotificationCreate = {type: 'webhook' | 'slack' | 'pagerduty', url: string, secret?: string | undefined, tenant_id?: string | undefined, active?: boolean | undefined}; export type CreateApiApiV1CircuitBreakerNotificationsArgs = {Authorization: string, body: CircuitBreakerNotificationCreate}; export type CreateApiApiV1CircuitBreakerNotificationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create notification config * * POST /api/v1/circuit-breaker/notifications */ export const createApiApiV1CircuitBreakerNotifications = async (args: CreateApiApiV1CircuitBreakerNotificationsArgs, options?: CreateApiApiV1CircuitBreakerNotificationsOptions) => { const {baseUrl = "https://agent.getaxonflow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/circuit-breaker/notifications${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };