export type CreateApiApiV10MenusMenuIdCheckpointsCheckpointIdRestoreArgs = {menuId: number, checkpointId: number}; export type CreateApiApiV10MenusMenuIdCheckpointsCheckpointIdRestoreOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Restore a Menu to a checkpoint * * POST /api/v1.0/menus/{menuId}/checkpoints/{checkpointId}/restore */ export const createApiApiV10MenusMenuIdCheckpointsCheckpointIdRestore = async (args: CreateApiApiV10MenusMenuIdCheckpointsCheckpointIdRestoreArgs, options?: CreateApiApiV10MenusMenuIdCheckpointsCheckpointIdRestoreOptions) => { const {baseUrl = "https://api.flipdish.co", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.0/menus/${encodeURIComponent(String(args.menuId))}/checkpoints/${encodeURIComponent(String(args.checkpointId))}/restore${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 };