export type PlanningDto = {id?: (string | null) | undefined, name?: (string | null) | undefined, start?: (string | null) | undefined, end?: (string | null) | undefined, frequency?: boolean | undefined, dayOff?: (0 | 1 | 2 | 4 | 8 | 16 | 32 | 64) | undefined, commandId?: (string | null) | undefined, deviceModelId?: (string | null) | undefined}; export type CreateApiApiPlanningArgs = {body: PlanningDto}; export type CreateApiApiPlanningOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Creates the planning. * * POST /api/planning */ export const createApiApiPlanning = async (args: CreateApiApiPlanningArgs, options: CreateApiApiPlanningOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/planning${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 };