export type CreateOverrideRequest = {action_override?: ('block' | 'require_approval' | 'redact' | 'warn' | 'log') | undefined, enabled_override?: boolean | undefined, override_reason: string, expires_at?: string | undefined}; export type CreateApiApiV1StaticPoliciesIdOverrideArgs = {id: string, Authorization?: string | undefined, 'X-User-ID'?: string | undefined, body: CreateOverrideRequest}; export type CreateApiApiV1StaticPoliciesIdOverrideOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create policy override * * POST /api/v1/static-policies/{id}/override */ export const createApiApiV1StaticPoliciesIdOverride = async (args: CreateApiApiV1StaticPoliciesIdOverrideArgs, options?: CreateApiApiV1StaticPoliciesIdOverrideOptions) => { 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)) if (args['X-User-ID'] != null) headers.set("X-User-ID", String(args['X-User-ID'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/static-policies/${encodeURIComponent(String(args.id))}/override${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 };