Account (user, password)
Argument types
user: string,
password: string
Attributes
private static readonly STATES = {
DENIED: 1,
IDLE: 0,
LOGGED: 2,
};
public username: string;
public password: string;
public cookie: string = "";
public state: number = Account.STATES.IDLE;
public student: Student = new Student();
Methods
Public
State
public isLogged (): booleanpublic isDenied (): booleanpublic isIdle (): boolean
Authentication
public login(): Promise
This method will request SIGA for access and try to log in. This is no longer required, but is useful to catch if credentials are incorrect (or any other error in SIGA)
Scrapper
public getName(): Promise<string>
Will return the account's user name.
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getName().then(name => {})
Exemple of name value:
'FILIPE COSTA MENESES'
public getProfile (): Promise<any>
Will return your profile data, available at home and at exchange programs page
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getProfile().then(profile => {})
Exemple of profile value:
profile = {
"averageGrade": 8.82,
"birthday": "1970-01-01T03:00:00.000Z",
"code": "0000000000000",
"course": "Tecnologia em Análise e Desenvolvimento de Sistemas",
"cpf": "00000000000",
"email": "[email protected]",
"name": "FILIPE COSTA MENESES",
"period": "Manhã",
"progress": 42.85,
"unit": "Faculdade de Tecnologia de São José dos Campos - \"Professor Jessen Vidal\""
}
public getRegisteredEmails(): Promise<IRegisteredEmail[]>
Will return a list of registered emails and it's respective integrations:
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getRegisteredEmails().then(emails => {})
Exemple of emails value:
emails = [
{
"email": "[email protected]",
"integrations": [
"fatec"
]
},
...
]
public getPartialGrades (): Promise<object>
Will return a list of partial grades
"discipline"is a instance of Discipline
"evaluations"is a list of instances of Evaluation
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getPartialGrades().then(partialGrades => {})
Exemple of partialGrades value:
partialGrades = [
{
"discipline": Discipline {
"name": "Interação Humano Computador",
"code": "IHC001",
"classroomId": 1,
"frequency": 85,
"grade": 10,
"quitDate": "1970-01-01T00:00:00.000Z",
"periodId": 1,
"courseId": 24,
"state": "approved",
"teacherId": 171
},
"evaluations": [
Evaluation {
"applyDates": {
"applied": "1970-01-01T00:00:00.000Z",
"predicted": "1970-01-01T00:00:00.000Z",
"published": "1970-01-01T00:00:00.000Z"
},
"description": "Projeto contendo o desenvolvimento de interfaces com HTML5",
"grades": [
{
"date": "2017-12-04T00:00:00.000Z",
"score": 10
}
],
"code": "P1",
"title": "Projeto parte 1",
"weight": 1
},
Evaluation {
"applyDates": {
"applied": "1970-01-01T00:00:00.000Z",
"predicted": "1970-01-01T00:00:00.000Z",
"published": "1970-01-01T00:00:00.000Z"
},
"description": "Projeto parte 2",
"grades": [
{
"date": "2017-12-04T00:00:00.000Z",
"score": 10
}
],
"code": "P2",
"title": "Projeto parte 2",
"weight": 1
}
]
}
]
public getEnrolledDisciplines (): Promise<Discipline[]>
Will return the enrolled disciplines
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getEnrolledDisciplines().then(disciplines => {})
Exemple of disciplines value:
disciplines = [
Discipline {
"absenses": 10,
"name": "Programação Orientada a Objetos",
"code": "ILP007",
"classroomCode": "A",
"classroomId": 1,
"periodId": 1,
"presences": 66,
"courseId": 24,
"teacherName": "GERSON DA PENHA NETO",
"teacherId": 3131
},
...
]
public getSchedules (): Promise<Schedule[]>
Will return the schedules with weekday and periods
The day, month and year are relative to the current date. However, the hours and minutes remain the same.
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getSchedules().then((schedules) => {})
Exemple of schedules value:
schedules = [
Schedule {
"weekday": 3,
"periods": [
{
"discipline": Discipline {
"code": "ILP007",
"period": "A"
},
"endAt": Date "2017-12-20T10:50:00.000Z",
"startAt": Date "2017-12-20T10:00:00.000Z"
},
{
"discipline": Discipline {
"code": "ILP007",
"period": "A"
},
"endAt": Date "2017-12-20T10:00:00.000Z",
"startAt": Date "2017-12-20T09:10:00.000Z"
}
]
}
]
public getHistory (): Promise<History>
Will return a instance of History
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getHistory().then(history => {})
Exemple of history value:
history = History {
entries: [
{
"discipline": {
"absenses": 11,
"name": "Administração Geral",
"code": "AAG001",
"frequency": 86,
"grade": 9.5,
"period": "20162",
"state": "approved"
},
"observation": "Aprovado por Nota e Frequência"
},
...
]
}
public getSchoolGrade (): Promise<SchoolGrade>
Will return a instance of SchoolGrade
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getSchoolGrade().then(schoolGrade => {})
Exemple of schoolGrade value:
schoolGrade = SchoolGrade {
"semesters": [
{
"number": 1,
"disciplines": [
Discipline {
"name": "Administração Geral",
"code": "AAG001",
"grade": 9.5,
"quitDate": "1970-01-01T00:00:00.000Z",
"state": "approved"
},
]
},
...
]
}
public getAcademicCalendar (): Promise<Calendar>
Will return a instance of Calendar
const fatecApi = require('fatec-api')
const myAccount = new fatecApi.Account('LOGIN', 'PASSWORD')
myAccount.getAcademicCalendar().then(academicCalendar => {})
Exemple of academicCalendar value:
Calendar {
"months": [
{
"events": [
{
"date": "2017-01-01T02:00:00.000Z",
"name": "Feriado Nacional",
"reason": "CONFRATERNIZAÇÃO UNIVERSAL"
}
]
},
...
]
}