export type LessonCPLCategory = {institutionId?: number | undefined, levelId?: (number | null) | undefined, parentId?: (number | null) | undefined, categoryId?: (number | null) | undefined, lessonId?: number | undefined}; export type CreateApiLessonSetLessonCategoryArgs = {'X-Version'?: string | undefined, body: LessonCPLCategory}; export type CreateApiLessonSetLessonCategoryOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /Lesson/SetLessonCategory */ export const createApiLessonSetLessonCategory = async (args: CreateApiLessonSetLessonCategoryArgs, options: CreateApiLessonSetLessonCategoryOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Version'] != null) headers.set("X-Version", String(args['X-Version'])) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/Lesson/SetLessonCategory${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 };