export type CreateApiApiV1ProjectsProjectIdChildrenArgs = {projectId: number, body: {projectIds?: Array | undefined}}; export type CreateApiApiV1ProjectsProjectIdChildrenOptions = {baseUrl?: string | undefined, BearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign child agents. * * POST /api/v1/projects/{projectId}/children */ export const createApiApiV1ProjectsProjectIdChildren = async (args: CreateApiApiV1ProjectsProjectIdChildrenArgs, options?: CreateApiApiV1ProjectsProjectIdChildrenOptions) => { const {baseUrl = "https://app.customgpt.ai", fetch: fetchFn = fetch, BearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerToken !== undefined) headers.set('authorization', `Bearer ${BearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.projectId))}/children${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 };