export type CreateApiExternalDuplicateLessonArgs = {'X-Version'?: string | undefined}; export type CreateApiExternalDuplicateLessonOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Duplicates lessons by copying files between folders in an institution, 10 copies per execution. Deletes the duplicates from the source folder. * * POST /External/DuplicateLesson */ export const createApiExternalDuplicateLesson = async (args: CreateApiExternalDuplicateLessonArgs, options: CreateApiExternalDuplicateLessonOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() 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(/\/+$/, '')}/External/DuplicateLesson${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };