export type PatchApiApiV1ContextWebhookManageArgs = {body: {webhookId: string, name?: string | undefined, url?: string | undefined, events?: (Array<'context.add' | 'context.search' | 'context.steer' | 'context.delete' | 'context.view' | 'context.memory.add' | 'context.memory.delete' | 'context.memory.update'>) | undefined, enabled?: boolean | undefined, secret?: string | undefined, headers?: (Array<{name?: string | undefined, value?: string | undefined}>) | undefined}}; export type PatchApiApiV1ContextWebhookManageOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a webhook's URL, event subscriptions, enabled state or signing secret * * PATCH /api/v1/context/webhook/manage */ export const patchApiApiV1ContextWebhookManage = async (args: PatchApiApiV1ContextWebhookManageArgs, options?: PatchApiApiV1ContextWebhookManageOptions) => { const {baseUrl = "https://platform-backend.getalchemystai.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/context/webhook/manage${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };