export type PatchApiV20FlowsFlowIdIntentsIntentIdArgs = {Accept?: ('application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv') | undefined, flowId: string, intentId: string, body: {name?: string | undefined, description?: string | undefined, condition?: string | undefined, rules?: Array | undefined, isRejectIntent?: boolean | undefined, isDisabled?: boolean | undefined, tags?: Array | undefined, confirmationSentences?: Array | undefined, disambiguationSentence?: string | undefined, data?: Record | undefined, localeReference?: string | undefined, childFeatures?: (boolean | Array) | undefined, biasTowardsParentOrChildIntents?: ('parents' | 'children') | undefined, parentIntentId?: string | undefined, analyticsLabel?: string | undefined, overrideIntentDefaultRepliesAsExamples?: ('on' | 'off' | 'useFlowSettings') | undefined}}; export type PatchApiV20FlowsFlowIdIntentsIntentIdOptions = {baseUrl?: string | undefined, APIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an Intent * * PATCH /v2.0/flows/{flowId}/intents/{intentId} * * Also accepts auth: APIKeyQueryParam, CXoneTokenHeader, OAuth2 */ export const patchApiV20FlowsFlowIdIntentsIntentId = async (args: PatchApiV20FlowsFlowIdIntentsIntentIdArgs, options?: PatchApiV20FlowsFlowIdIntentsIntentIdOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, APIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (APIKeyHeader !== undefined) headers.set("X-API-Key", APIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v2.0/flows/${encodeURIComponent(String(args.flowId))}/intents/${encodeURIComponent(String(args.intentId))}${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 };