export type ProjectIntentAnswerRequest = {value: string, label: string}; export type CreateApiApiV1ProjectsProjectIdIngestIntentArgs = {project_id: string, body: ProjectIntentAnswerRequest}; export type CreateApiApiV1ProjectsProjectIdIngestIntentOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Answer Project Ingest Intent * * POST /api/v1/projects/{project_id}/ingest-intent */ export const createApiApiV1ProjectsProjectIdIngestIntent = async (args: CreateApiApiV1ProjectsProjectIdIngestIntentArgs, options: CreateApiApiV1ProjectsProjectIdIngestIntentOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.project_id))}/ingest-intent${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 };