export type CreateApiApiV1ProjectAddSectionArgs = {body: {sectionName: string, projectId: number, parentId?: (number | null) | undefined}}; export type CreateApiApiV1ProjectAddSectionOptions = {baseUrl?: string | undefined, cookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add section * * POST /api/v1/project/add-section * * Also accepts auth: bearerAuth */ export const createApiApiV1ProjectAddSection = async (args: CreateApiApiV1ProjectAddSectionArgs, options?: CreateApiApiV1ProjectAddSectionOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, cookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (cookieAuth !== undefined) cookies.push("user_session=" + encodeURIComponent(cookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/project/add-section${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 };