assignment-remove-file.ts
1 import * as pronote from "../src"; 2 import { credentials } from "./_credentials"; 3 4 void async function main () { 5 const handle = pronote.createSessionHandle(); 6 await pronote.loginCredentials(handle, { 7 url: credentials.pronoteURL, 8 kind: pronote.AccountKind.STUDENT, 9 username: credentials.username, 10 password: credentials.password, 11 deviceUUID: credentials.deviceUUID 12 }); 13 14 // Grab all the assignments for week 1 through week 4. 15 const assignments = await pronote.assignmentsFromWeek(handle, 1, 4); 16 17 console.log("---"); 18 19 for (const assignment of assignments) { 20 console.log(assignment.subject.name, "to finish before the", assignment.deadline.toLocaleString()); 21 console.log("(description) =>", assignment.description); 22 23 if (assignment.return.uploaded) { 24 await pronote.assignmentRemoveFile(handle, assignment.id); 25 console.info("(upload) => successfully removed upload"); 26 } 27 28 console.log("---"); 29 } 30 }();