Make run.js touch all endpoints implemented so far

This commit is contained in:
Emil Lindqvist 2021-11-05 10:50:45 +01:00 committed by Viktor Sarström
parent 88e22df77d
commit b8bdffa033
2 changed files with 9 additions and 2 deletions

View File

@ -207,6 +207,7 @@ export class ApiHjarntorget extends EventEmitter implements Api {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getClassmates(_child: EtjanstChild): Promise<Classmate[]> {
// TODO: We could get this from the events a child is associated with...
if (!this.isLoggedIn) {
throw new Error('Not logged in...')
}

View File

@ -86,11 +86,17 @@ function requestLogger(httpModule) {
api.on('login', async () => {
console.log("Loged in!")
await api.getUser()
const children = await api.getChildren()
console.table(children)
const seb = children.filter(c => c.name.startsWith('Seb'))[0];
const resp = await api.getCalendar(seb)
const news = await api.getNews()
await api.getNewsDetails(seb, news[0])
await api.getNotifications(seb)
const now = DateTime.fromJSDate(new Date)
await api.getSchedule(seb, now, now.plus({days: 7}))
await api.getTimetable(seb, 44, 2021, 'ignored')
console.table(resp);
// const news = await api.getNews()
// //console.table(news.map(n => ({ id: n.id, author: n.author, published: n.published})))