export type AiChatApproveToolRequest = {toolUseIds: Array}; export type CreateApiV1OrgOrgIdAiChatChatIdApproveToolArgs = {orgId: string, chatId: string, body: AiChatApproveToolRequest}; export type CreateApiV1OrgOrgIdAiChatChatIdApproveToolOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve pending tool calls in an AI chat * * POST /v1/org/{orgId}/ai/chat/{chatId}/approve-tool */ export const createApiV1OrgOrgIdAiChatChatIdApproveTool = async (args: CreateApiV1OrgOrgIdAiChatChatIdApproveToolArgs, options?: CreateApiV1OrgOrgIdAiChatChatIdApproveToolOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/org/${encodeURIComponent(String(args.orgId))}/ai/chat/${encodeURIComponent(String(args.chatId))}/approve-tool${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 };