export type UpdateKnowledgeBaseTopicBody = {name?: string | undefined, content?: string | undefined, actions?: string | undefined, exampleQueries?: {queries: Array} | undefined, isActive?: boolean | undefined}; export type PatchApiV1AgentsAgentIdBranchesBranchIdKnowledgeBaseTopicsTopicIdArgs = {body: UpdateKnowledgeBaseTopicBody}; export type PatchApiV1AgentsAgentIdBranchesBranchIdKnowledgeBaseTopicsTopicIdOptions = {baseUrl?: string | undefined, polyApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update knowledge base topic * * PATCH /v1/agents/{agentId}/branches/{branchId}/knowledge-base/topics/{topicId} */ export const patchApiV1AgentsAgentIdBranchesBranchIdKnowledgeBaseTopicsTopicId = async (args: PatchApiV1AgentsAgentIdBranchesBranchIdKnowledgeBaseTopicsTopicIdArgs, options?: PatchApiV1AgentsAgentIdBranchesBranchIdKnowledgeBaseTopicsTopicIdOptions) => { const {baseUrl = "https://api.us.poly.ai", fetch: fetchFn = fetch, polyApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (polyApiKey !== undefined) headers.set("X-API-KEY", polyApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/agents/${encodeURIComponent(String(args.agentId))}/branches/${encodeURIComponent(String(args.branchId))}/knowledge-base/topics/${encodeURIComponent(String(args.topicId))}${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 };