Skip to content

Commit ae4240b

Browse files
committed
Renamed studentId to personId (and all related methods)
1 parent c0c0171 commit ae4240b

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

src/org/bytedream/untis4j/Infos.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class Infos {
1919
private final String userAgent;
2020

2121
private final String sessionId;
22+
private final int personId;
2223
private final UntisUtils.ElementType personType;
2324
private final int classId;
2425

@@ -32,14 +33,15 @@ public class Infos {
3233
* @param userAgent the user agent used for the api
3334
* @since 1.0
3435
*/
35-
public Infos(String username, String password, String server, String schoolName, String userAgent, String sessionId, UntisUtils.ElementType personType, int classId) {
36+
public Infos(String username, String password, String server, String schoolName, String userAgent, String sessionId, int personId, UntisUtils.ElementType personType, int classId) {
3637
this.username = username;
3738
this.password = password;
3839
this.server = server;
3940
this.schoolName = schoolName;
4041
this.userAgent = userAgent;
4142

4243
this.sessionId = sessionId;
44+
this.personId = personId;
4345
this.personType = personType;
4446
this.classId = classId;
4547
}
@@ -104,6 +106,16 @@ public String getSessionId() {
104106
return sessionId;
105107
}
106108

109+
/**
110+
* Returns the person id of the user
111+
*
112+
* @return the person id of the user
113+
* @since 1.3
114+
*/
115+
public int getPersonId() {
116+
return personId;
117+
}
118+
107119
/**
108120
* Returns the server used for the api
109121
*

src/org/bytedream/untis4j/RequestManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static Infos generateUserInfosAndLogin(String username, String password,
9999

100100
UntisUtils.ElementType elementType = UntisUtils.ElementType.of(result.getInt("personType"));
101101

102-
return new Infos(username, password, server, schoolName, userAgent, result.getString("sessionId"), elementType, result.getInt("klasseId"));
102+
return new Infos(username, password, server, schoolName, userAgent, result.getString("sessionId"), result.getInt("personId"), elementType, result.getInt("klasseId"));
103103
}
104104

105105
/**

src/org/bytedream/untis4j/Session.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,13 @@ public Response getAllClassRegEventsFromRoomId(LocalDate start, LocalDate end, i
263263
}
264264

265265
/**
266-
* Get the Information about the ClassRegEvents for a specific time period and student id (<- from https://github.com/python-webuntis/python-webuntis).
266+
* Get the Information about the ClassRegEvents for a specific time period and person id (<- from https://github.com/python-webuntis/python-webuntis).
267267
*
268268
* @see Session#getClassRegEvents(LocalDate, LocalDate, UntisUtils.ElementType, Integer)
269269
* @since 1.0
270270
*/
271-
public Response getAllClassRegEventsFromStudentId(LocalDate start, LocalDate end, int id) throws IOException {
272-
return this.getClassRegEvents(start, end, UntisUtils.ElementType.STUDENT, id);
271+
public Response getAllClassRegEventsFromPersonId(LocalDate start, LocalDate end, int personId) throws IOException {
272+
return this.getClassRegEvents(start, end, UntisUtils.ElementType.PERSON, personId);
273273
}
274274

275275
/**
@@ -869,13 +869,13 @@ public Timetable getTimetableFromRoomId(LocalDate start, LocalDate end, int room
869869
}
870870

871871
/**
872-
* Returns the lessons / timetable for a specific time period and student id.
872+
* Returns the lessons / timetable for a specific time period and person id.
873873
*
874874
* @see Session#getTimetable(LocalDate, LocalDate, UntisUtils.ElementType, int)
875875
* @since 1.0
876876
*/
877-
public Timetable getTimetableFromStudentId(LocalDate start, LocalDate end, int studentId) throws IOException {
878-
return this.getTimetable(start, end, UntisUtils.ElementType.STUDENT, studentId);
877+
public Timetable getTimetableFromPersonId(LocalDate start, LocalDate end, int personId) throws IOException {
878+
return this.getTimetable(start, end, UntisUtils.ElementType.PERSON, personId);
879879
}
880880

881881
/**
@@ -957,13 +957,13 @@ public WeeklyTimetable getWeeklyTimetableFromRoomId(LocalDate anyDateOfWeek, int
957957
}
958958

959959
/**
960-
* Requests the timetable for a whole week and a student id
960+
* Requests the timetable for a whole week and a person id
961961
*
962962
* @see Session#getWeeklyTimetable(LocalDate, UntisUtils.ElementType, int)
963963
* @since 1.1
964964
*/
965-
public WeeklyTimetable getWeeklyTimetableFromStudentId(LocalDate anyDateOfWeek, int studentId) throws IOException {
966-
return this.getWeeklyTimetable(anyDateOfWeek, UntisUtils.ElementType.CLASS, studentId);
965+
public WeeklyTimetable getWeeklyTimetableFromPersonId(LocalDate anyDateOfWeek, int personId) throws IOException {
966+
return this.getWeeklyTimetable(anyDateOfWeek, UntisUtils.ElementType.PERSON, personId);
967967
}
968968

969969
/**

src/org/bytedream/untis4j/UntisUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public enum ElementType {
106106
TEACHER(2),
107107
SUBJECT(3),
108108
ROOM(4),
109-
STUDENT(5);
109+
PERSON(5);
110110

111111
private final int elementType;
112112

0 commit comments

Comments
 (0)