/** This file has been automatically generated at 2024-12-17T08:30:56.009Z Name: Jutge API Version: 2.0.0 Description: Jutge API */ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-inner-declarations */ var jutge_api_client = { // // default value for the Jutge API URL JUTGE_API_URL: 'https://api.jutge.org/api', // global variable to store the meta information meta: undefined, // exceptions UnauthorizedError: class extends Error { name = 'UnauthorizedError' constructor(message = 'Unauthorized') { super(message) } }, InfoError: class extends Error { name = 'InfoError' constructor(message) { super(message) } }, NotFoundError: class extends Error { name = 'NotFoundError' constructor(message) { super(message) } }, InputError: class extends Error { name = 'InputError' constructor(message) { super(message) } }, ProtocolError: class extends Error { name = 'ProtocolError' constructor(message) { super(message) } }, /** Function that sends a request to the API and returns the response **/ execute: async function (func, input, ifiles = []) { // prepare form const iform = new FormData() const idata = { func, input, meta: jutge_api_client.meta } iform.append('data', JSON.stringify(idata)) for (const index in ifiles) iform.append(`file_${index}`, ifiles[index]) // send request const response = await fetch(jutge_api_client.JUTGE_API_URL, { method: 'POST', body: iform, }) // process response const contentType = response.headers.get('content-type')?.split(';')[0].toLowerCase() if (contentType !== 'multipart/form-data') { throw new jutge_api_client.ProtocolError('The content type is not multipart/form-data') } const oform = await response.formData() const odata = oform.get('data') const { output, error, duration, operation_id, time } = JSON.parse(odata) if (error) { jutge_api_client.throwError(error, operation_id) } // extract ofiles const ofiles = [] for (const [key, value] of oform.entries()) { if (value instanceof File) { ofiles.push({ content: new Uint8Array(await value.arrayBuffer()), name: value.name, type: value.type, }) } } return [output, ofiles] }, throwError: function (error, operation_id) { const message = error.message || 'Unknown error' if (error.name === 'UnauthorizedError') { throw new jutge_api_client.UnauthorizedError(message) } else if (error.name === 'InfoError') { throw new jutge_api_client.InfoError(message) } else if (error.name === 'NotFoundError') { throw new jutge_api_client.NotFoundError(message) } else if (error.name === 'InputError') { throw new jutge_api_client.InputError(message) } else { throw new Error(message) } }, } jutge_api_client = { ...jutge_api_client, auth: { login: async function (data) { /** Login: Get an access token **/ const [output, ofiles] = await jutge_api_client.execute('auth.login', data) return output }, logout: async function () { /** Logout: Discard access token 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('auth.logout', null) return output }, }, misc: { getFortune: async function () { /** Get a fortune message **/ const [output, ofiles] = await jutge_api_client.execute('misc.getFortune', null) return output }, getTime: async function () { /** Get server time **/ const [output, ofiles] = await jutge_api_client.execute('misc.getTime', null) return output }, getHomepageStats: async function () { /** Get homepage stats **/ const [output, ofiles] = await jutge_api_client.execute('misc.getHomepageStats', null) return output }, getLogo: async function () { /** Get Jutge.org logo as a PNG file **/ const [output, ofiles] = await jutge_api_client.execute('misc.getLogo', null) return ofiles[0] }, }, tables: { getLanguages: async function () { /** Returns all languages Returns all languages as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getLanguages', null) return output }, getCountries: async function () { /** Returns all countries Returns all countries as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getCountries', null) return output }, getCompilers: async function () { /** Returns all compilers Returns all compilers as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getCompilers', null) return output }, getDrivers: async function () { /** Returns all drivers Returns all drivers as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getDrivers', null) return output }, getVerdicts: async function () { /** Returns all verdicts Returns all verdicts as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getVerdicts', null) return output }, getProglangs: async function () { /** Returns all proglangs Returns all proglangs as a dictionary of objects, indexed by id. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getProglangs', null) return output }, getAll: async function () { /** Returns all tables Returns all compilers, countries, drivers, languages, proglangs, and verdicts in a single request. This data does not change often, so you should only request it once per session. **/ const [output, ofiles] = await jutge_api_client.execute('tables.getAll', null) return output }, }, problems: { getAllAbstractProblems: async function () { /** Get all available abstract problems 🔐 Authenticated Includes problems. **/ const [output, ofiles] = await jutge_api_client.execute('problems.getAllAbstractProblems', null) return output }, getAbstractProblems: async function (problem_nms) { /** Get available abstract problems whose keys are in `problem_nms` (comma separated list) 🔐 Authenticated Includes problems. **/ const [output, ofiles] = await jutge_api_client.execute('problems.getAbstractProblems', problem_nms) return output }, getAbstractProblemsInList: async function (list_key) { /** Get available abstract problems that belong to a list 🔐 Authenticated Includes problems. **/ const [output, ofiles] = await jutge_api_client.execute('problems.getAbstractProblemsInList', list_key) return output }, getAbstractProblem: async function (problem_nm) { /** Get an abstract problem 🔐 Authenticated Includes owner and problems **/ const [output, ofiles] = await jutge_api_client.execute('problems.getAbstractProblem', problem_nm) return output }, getAbstractProblemExtras: async function (problem_nm) { /** Get extras of an abstract problem 🔐 Authenticated Includes accepted compilers and accepted proglangs **/ const [output, ofiles] = await jutge_api_client.execute('problems.getAbstractProblemExtras', problem_nm) return output }, getProblem: async function (problem_id) { /** Get a problem 🔐 Authenticated Includes abstract problem, which includes owner **/ const [output, ofiles] = await jutge_api_client.execute('problems.getProblem', problem_id) return output }, getProblemExtras: async function (problem_id) { /** Get extras of a problem. 🔐 Authenticated Includes accepted compilers, accepted proglangs, official solutions checks and handler specifications **/ const [output, ofiles] = await jutge_api_client.execute('problems.getProblemExtras', problem_id) return output }, getSampleTestcases: async function (problem_id) { /** Get sample testcases of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('problems.getSampleTestcases', problem_id) return output }, getPublicTestcases: async function (problem_id) { /** Get public testcases of a problem. 🔐 Authenticated Public testcases are like sample testcases, but are not meant to be show in the problem statatement, because of their long length. **/ const [output, ofiles] = await jutge_api_client.execute('problems.getPublicTestcases', problem_id) return output }, getHtmlStatement: async function (problem_id) { /** Get Html statement of a problem. 🔐 Authenticated Currently, this is suboptimal, but I already know how to improve it. **/ const [output, ofiles] = await jutge_api_client.execute('problems.getHtmlStatement', problem_id) return output }, getTextStatement: async function (problem_id) { /** Get Text statement of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('problems.getTextStatement', problem_id) return output }, getMarkdownStatement: async function (problem_id) { /** Get Markdown statement of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('problems.getMarkdownStatement', problem_id) return output }, getPdfStatement: async function (problem_id) { /** Get PDF statement of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('problems.getPdfStatement', problem_id) return ofiles[0] }, getZipStatement: async function (problem_id) { /** Get ZIP archive of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('problems.getZipStatement', problem_id) return ofiles[0] }, }, student: { keys: { getAll: async function () { /** Get problem, courses (enrolled and available) and list keys. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.keys.getAll', null) return output }, getProblems: async function () { /** Get problem keys. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.keys.getProblems', null) return output }, getEnrolledCourses: async function () { /** Get enrolled course keys. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.keys.getEnrolledCourses', null) return output }, getAvailableCourses: async function () { /** Get available course keys. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.keys.getAvailableCourses', null) return output }, getLists: async function () { /** Get list keys. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.keys.getLists', null) return output }, }, profile: { get: async function () { /** Get the profile. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.profile.get', null) return output }, update: async function (data) { /** Update the profile 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.profile.update', data) return output }, getAvatar: async function () { /** Returns the avatar as a PNG file. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.profile.getAvatar', null) return ofiles[0] }, setAvatar: async function (ifile) { /** Set a PNG file as avatar 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.profile.setAvatar', null, [ifile]) return output }, changePassword: async function (data) { /** Change password 🔐 Authenticated Receives the old password and the new one, and changes the password if the old one is correct **/ const [output, ofiles] = await jutge_api_client.execute('student.profile.changePassword', data) return output }, }, dashboard: { getAllDistributions: async function () { /** Get all distributions 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getAllDistributions', null) return output }, getCompilersDistribution: async function () { /** Get compilers distribution 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getCompilersDistribution', null) return output }, getDashboard: async function () { /** Get dashboard 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getDashboard', null) return output }, getHeatmapCalendar: async function () { /** Get heatmap calendar of submissions 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getHeatmapCalendar', null) return output }, getProglangsDistribution: async function () { /** Get programming languages distribution 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getProglangsDistribution', null) return output }, getStats: async function () { /** Get dashboard stats 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getStats', null) return output }, getSubmissionsByHour: async function () { /** Get submissions by hour distribution 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getSubmissionsByHour', null) return output }, getSubmissionsByWeekDay: async function () { /** Get submissions by weekday distribution 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getSubmissionsByWeekDay', null) return output }, getVerdictsDistribution: async function () { /** Get verdicts distribution 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.dashboard.getVerdictsDistribution', null) return output }, }, submissions: { getAll: async function () { /** Get all submissions. 🔐 Authenticated Flat array of submissions in chronological order. **/ const [output, ofiles] = await jutge_api_client.execute('student.submissions.getAll', null) return output }, getForAbstractProblem: async function (problem_nm) { /** Get all submissions for an abstract problem. 🔐 Authenticated Grouped by problem. **/ const [output, ofiles] = await jutge_api_client.execute('student.submissions.getForAbstractProblem', problem_nm) return output }, getForProblem: async function (problem_id) { /** Get all submissions for a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.submissions.getForProblem', problem_id) return output }, get: async function (data) { /** Get a submission. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.submissions.get', data) return output }, submit: async function (data, ifile) { /** Perform a submission. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.submissions.submit', data, [ifile]) return output }, }, courses: { getAllAvailable: async function () { /** Get all available courses. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.getAllAvailable', null) return output }, getAllEnrolled: async function () { /** Get all enrolled courses. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.getAllEnrolled', null) return output }, getAvailable: async function (course_key) { /** Get an available course. 🔐 Authenticated Includes owner and lists. **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.getAvailable', course_key) return output }, getEnrolled: async function (course_key) { /** Get an enrolled course. 🔐 Authenticated Includes owner and lists. **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.getEnrolled', course_key) return output }, enroll: async function (course_key) { /** Enroll in an available course. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.enroll', course_key) return output }, unenroll: async function (course_key) { /** Unenroll from an enrolled course. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.courses.unenroll', course_key) return output }, }, lists: { getAll: async function () { /** Get all lists. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.lists.getAll', null) return output }, get: async function (list_key) { /** Get a list. 🔐 Authenticated Includes items, owner. **/ const [output, ofiles] = await jutge_api_client.execute('student.lists.get', list_key) return output }, }, statuses: { getAll: async function () { /** Get statuses for all problems. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.statuses.getAll', null) return output }, getForAbstractProblem: async function (problem_nm) { /** Get status for an abstract problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.statuses.getForAbstractProblem', problem_nm) return output }, getForProblem: async function (problem_id) { /** Get status for a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.statuses.getForProblem', problem_id) return output }, }, awards: { getAll: async function () { /** Get all awards. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.awards.getAll', null) return output }, get: async function (award_id) { /** Get an award. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('student.awards.get', award_id) return output }, }, }, instructor: { tags: { getAll: async function () { /** Get all tags 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.tags.getAll', null) return output }, getDict: async function () { /** Get all tags with their problems 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.tags.getDict', null) return output }, get: async function (tag) { /** Get all problems with a given tag 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.tags.get', tag) return output }, }, documents: { index: async function () { /** Get index of all documents 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.index', null) return output }, get: async function (document_nm) { /** Get a document (without PDF) 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.get', document_nm) return output }, getPdf: async function (document_nm) { /** Get PDF of a document 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.getPdf', document_nm) return ofiles[0] }, create: async function (data, ifile) { /** Create a new document 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.create', data, [ifile]) return output }, update: async function (data) { /** Update a document (without PDF) 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.update', data) return output }, updatePdf: async function (document_nm, ifile) { /** Update PDF of a document 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.updatePdf', document_nm, [ifile]) return output }, remove: async function (document_nm) { /** Remove a document (including PDF) 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.documents.remove', document_nm) return output }, }, lists: { index: async function () { /** Get index of all lists 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.index', null) return output }, get: async function (list_nm) { /** Get a list with its items 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.get', list_nm) return output }, getItems: async function (list_nm) { /** Get the items of a list 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.getItems', list_nm) return output }, create: async function (data) { /** Create a new list 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.create', data) return output }, update: async function (data) { /** Update an existing list 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.update', data) return output }, remove: async function (list_nm) { /** Delete an existing list 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.remove', list_nm) return output }, setItems: async function (data) { /** Set the items of a list 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.lists.setItems', data) return output }, }, courses: { index: async function () { /** Get index of all courses 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.index', null) return output }, get: async function (course_nm) { /** Get a course with its items (lists, courses and tutors) 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.get', course_nm) return output }, getLists: async function (course_nm) { /** Get lists of a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.getLists', course_nm) return output }, getStudents: async function (course_nm) { /** Get students of a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.getStudents', course_nm) return output }, getTutors: async function (course_nm) { /** Get tutors of a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.getTutors', course_nm) return output }, create: async function (data) { /** Create a new course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.create', data) return output }, update: async function (data) { /** Update an existing course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.update', data) return output }, remove: async function (course_nm) { /** Delete an existing course 🔐 Authenticated Note: A course should not be deleted. Ask a system administrator to remove it. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.remove', course_nm) return output }, setLists: async function (data) { /** Set lists of a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.set_lists', data) return output }, inviteStudents: async function (data) { /** Invite students to a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.invite_students', data) return output }, inviteTutors: async function (data) { /** Invite tutors to a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.invite_tutors', data) return output }, removeStudents: async function (data) { /** Remove students from a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.remove_students', data) return output }, removeTutors: async function (data) { /** Remove tutors from a course 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.courses.remove_tutors', data) return output }, }, exams: { index: async function () { /** Get index of all exams 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.index', null) return output }, get: async function (exam_nm) { /** Get an exam with its items (course, problems, documents, students) 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.get', exam_nm) return output }, create: async function (data) { /** Create a new exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.create', data) return output }, update: async function (data) { /** Update an existing exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.update', data) return output }, remove: async function (exam_nm) { /** Delete an existing exam 🔐 Authenticated Note: An exam can only be deleted if it has not started. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.remove', exam_nm) return output }, getDocuments: async function (exam_nm) { /** Get documents of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getDocuments', exam_nm) return output }, getCourse: async function (exam_nm) { /** Get course of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getCourse', exam_nm) return output }, getProblems: async function (exam_nm) { /** Get problems of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getProblems', exam_nm) return output }, getStudents: async function (exam_nm) { /** Get students of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getStudents', exam_nm) return output }, getStudent: async function (data) { /** Get an student of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getStudent', data) return output }, getSubmissions: async function (data) { /** Get submissions of an exam 🔐 Authenticated This endpoint prepares a ZIP file to download the submissions of an exam. Preparing the ZIP file takes some time, an href link to the ZIP will be returned. This ZIP file will be available for download for a limited time. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.getSubmissions', data) return output }, setDocuments: async function (data) { /** Set documents of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.setDocuments', data) return output }, setProblems: async function (data) { /** Set problems of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.setProblems', data) return output }, setStudents: async function (data) { /** Set students of an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.setStudents', data) return output }, addStudents: async function (data) { /** Add students to an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.addStudents', data) return output }, removeStudents: async function (data) { /** Remove students from an exam 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.exams.removeStudents', data) return output }, }, queries: { ricard01: async function (data) { /** The old and venerable ricard01 query. 😀 🔐 Authenticated Returns a list of submissions for a given problem for all students of a given course. Each submission includes the email, time, problem name, problem id, verdict, and IP address. The list is ordered by email and time. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.queries.ricard01', data) return output }, ricard02: async function (data) { /** The old and venerable ricard02 query. 😀 🔐 Authenticated Returns a list of submissions for all problems in a given list for all students of a given course. Each submission includes the email, time, problem name, problem id, verdict, and IP address. The list is ordered by email, problem id and time. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.queries.ricard02', data) return output }, }, problems: { getPasscode: async function (problem_nm) { /** Get the passcode of a problem. 🔐 Authenticated Returns an empty string if the problem has no passcode. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.getPasscode', problem_nm) return output }, setPasscode: async function (data) { /** Set or update the passcode of a problem. 🔐 Authenticated The passcode must be at least 8 characters long and contain only alphanumeric characters. The passcode will be stored in the database in plain text. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.setPasscode', data) return output }, removePasscode: async function (problem_nm) { /** Remove passcode of a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.removePasscode', problem_nm) return output }, deprecate: async function (data) { /** Deprecate a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.deprecate', data) return output }, undeprecate: async function (problem_nm) { /** Undeprecate a problem. 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.undeprecate', problem_nm) return output }, download: async function (problem_nm) { /** Download a problem. 🔐 Authenticated Quick and dirty implementation, should be improved. Returns a zip file with the abstract problem and all its problems. **/ const [output, ofiles] = await jutge_api_client.execute('instructor.problems.download', problem_nm) return ofiles[0] }, }, }, admin: { users: { count: async function () { /** Count users 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.users.count', null) return output }, create: async function (data) { /** Create a user 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.users.create', data) return output }, remove: async function (email) { /** Remove a user 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.users.remove', email) return output }, setPassword: async function (data) { /** Set a password for a user 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.users.setPassword', data) return output }, }, tasks: { purgeAuthTokens: async function () { /** Purge expired access tokens 🔐 Authenticated Purge expired access tokens (call it from time to time, it does not hurt) **/ const [output, ofiles] = await jutge_api_client.execute('admin.tasks.purge-auth-tokens', null) return output }, clearCaches: async function () { /** Clear all memoization caches 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.tasks.clear-caches', null) return output }, }, stats: { getCounters: async function () { /** Get counters 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getCounters', null) return output }, getDistributionOfVerdicts: async function () { /** Get distribution of verdicts 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfVerdicts', null) return output }, getDistributionOfVerdictsByYear: async function () { /** Get distribution of verdicts by year 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfVerdictsByYear', null) return output }, getDistributionOfCompilers: async function () { /** Get distribution of compilers 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfCompilers', null) return output }, getDistributionOfProglangs: async function () { /** Get distribution of proglangs 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfProglangs', null) return output }, getDistributionOfUsersByYear: async function () { /** Get distribution of registered users by year 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfUsersByYear', null) return output }, getDistributionOfUsersByCountry: async function () { /** Get distribution of registered users by country 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfUsersByCountry', null) return output }, getDistributionOfUsersBySubmissions: async function (data) { /** Get distribution of registered users by submissions using a custom bucket size 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfUsersBySubmissions', data) return output }, getRankingOfUsers: async function (data) { /** Get ranking of users 🔐 Authenticated ❌ Warning: Input type is not correct **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getRankingOfUsers', data) return output }, getDistributionOfSubmissionsByHour: async function () { /** Get distribution of submissions by hour 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByHour', null) return output }, getDistributionOfSubmissionsByProglang: async function () { /** Get distribution of submissions by proglang 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByProglang', null) return output }, getDistributionOfSubmissionsByCompiler: async function () { /** Get distribution of submissions by compiler 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByCompiler', null) return output }, getDistributionOfSubmissionsByWeekday: async function () { /** Get distribution of submissions by weekday 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByWeekday', null) return output }, getDistributionOfSubmissionsByYear: async function () { /** Get distribution of submissions by year 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByYear', null) return output }, getDistributionOfSubmissionsByYearForProglang: async function (proglang) { /** Get distribution of submissions by year for a proglang 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByYearForProglang', proglang) return output }, getDistributionOfSubmissionsByDay: async function () { /** Get distribution of submissions by day 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getDistributionOfSubmissionsByDay', null) return output }, getHeatmapCalendarOfSubmissions: async function () { /** Get heatmap calendar of submissions 🔐 Authenticated Data is provided as required by https://cal-heatmap.com **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getHeatmapCalendarOfSubmissions', null) return output }, getUpcomingExams: async function () { /** Get upcoming exams 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('admin.stats.getUpcomingExams', null) return output }, }, problems: { getProblemSolution: async function (data) { /** Get official solution for a problem for a proglang 🔐 Authenticated ❌ Warning: TODO **/ const [output, ofiles] = await jutge_api_client.execute('admin.problems.getProblemSolution', data) return output }, }, }, check: { checkUser: async function () { /** Checks that query actor is a user 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('check.checkUser', null) return output }, checkInstructor: async function () { /** Checks that query actor is an instructor 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('check.checkInstructor', null) return output }, checkAdmin: async function () { /** Checks that query actor is an admin 🔐 Authenticated **/ const [output, ofiles] = await jutge_api_client.execute('check.checkAdmin', null) return output }, throwError: async function (exception) { /** Throw an exception of the given type **/ const [output, ofiles] = await jutge_api_client.execute('check.throwError', exception) return output }, }, playground: { upload: async function (data, ifile) { /** Upload a file **/ const [output, ofiles] = await jutge_api_client.execute('playground.upload', data, [ifile]) return output }, negate: async function (ifile) { /** Get negative of an image **/ const [output, ofiles] = await jutge_api_client.execute('playground.negate', null, [ifile]) return ofiles[0] }, download: async function (data) { /** Download a file **/ const [output, ofiles] = await jutge_api_client.execute('playground.download', data) return ofiles[0] }, download2: async function (data) { /** Download a file with a string **/ const [output, ofiles] = await jutge_api_client.execute('playground.download2', data) return [output, ofiles[0]] }, ping: async function () { /** Ping the server to get a pong string **/ const [output, ofiles] = await jutge_api_client.execute('playground.ping', null) return output }, toUpperCase: async function (s) { /** Returns the given string in uppercase **/ const [output, ofiles] = await jutge_api_client.execute('playground.toUpperCase', s) return output }, add2i: async function (data) { /** Returns the sum of two integers **/ const [output, ofiles] = await jutge_api_client.execute('playground.add2i', data) return output }, add2f: async function (data) { /** Returns the sum of two floats **/ const [output, ofiles] = await jutge_api_client.execute('playground.add2f', data) return output }, inc: async function (data) { /** increment two numbers **/ const [output, ofiles] = await jutge_api_client.execute('playground.inc', data) return output }, add3i: async function (data) { /** Returns the sum of three integers **/ const [output, ofiles] = await jutge_api_client.execute('playground.add3i', data) return output }, }, }