Skip to content

Commit

Permalink
add some missing data types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMoonThatRises committed Aug 17, 2024
1 parent 9698b56 commit f473ada
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
17 changes: 14 additions & 3 deletions Sources/StudentVue/SOAPApi/Models/Attendance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,18 @@ extension StudentVueApi {
}
}

public struct ConcurrentSchoolsList: XMLObjectDeserialization {
public var concurrentSchoolName: String
public var concurrentOrgYearGU: String

public static func deserialize(_ element: XMLIndexer) throws -> ConcurrentSchoolsList {
ConcurrentSchoolsList(concurrentSchoolName: try element.value(ofAttribute: "ConcurrentSchoolName"),
concurrentOrgYearGU: try element.value(ofAttribute: "ConcurrentOrgYearGU"))
}
}

public struct Attendance: XMLObjectDeserialization {
public var type: String // TODO: Find other types
public var type: String
public var startPeriod: Int
public var endPeriod: Int
public var periodCount: Int
Expand All @@ -77,7 +87,7 @@ extension StudentVueApi {
public var totalUnexcused: [AttendancePeriodTotal]
public var totalActivities: [AttendancePeriodTotal]
public var totalUnexcusedTardies: [AttendancePeriodTotal]
public var concurrentSchoolsLists: String? // TODO: Find data type/structure
public var concurrentSchoolsLists: [ConcurrentSchoolsList]

public static func deserialize(_ element: XMLIndexer) throws -> Attendance {
let attendance = element["Attendance"]
Expand All @@ -92,7 +102,8 @@ extension StudentVueApi {
totalTardies: try attendance["TotalTardies"]["PeriodTotal"].value(),
totalUnexcused: try attendance["TotalUnexcused"]["PeriodTotal"].value(),
totalActivities: try attendance["TotalActivities"]["PeriodTotal"].value(),
totalUnexcusedTardies: try attendance["TotalUnexcusedTardies"]["PeriodTotal"].value())
totalUnexcusedTardies: try attendance["TotalUnexcusedTardies"]["PeriodTotal"].value(),
concurrentSchoolsLists: try attendance["ConcurrentSchoolsLists"]["ConcurrentSchoolsList"].value())
}
}
}
Expand Down
53 changes: 50 additions & 3 deletions Sources/StudentVue/SOAPApi/Models/ClassSchedule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ extension StudentVueApi {
}
}

public struct AdditionalStaffInformationXML: XMLObjectDeserialization {

}

public struct ClassListSchedule: XMLObjectDeserialization {
public var period: Int
public var courseTitle: String
Expand All @@ -76,7 +80,7 @@ extension StudentVueApi {
public var teacherEmail: String
public var sectionGU: String
public var teacherGU: String
public var additionalStaffInformation: [String]? // TODO: Find data type/structure
public var additionalStaffInformationXMLs: [AdditionalStaffInformationXML]?

public static func deserialize(_ element: XMLIndexer) throws -> ClassListSchedule {
ClassListSchedule(period: try element.value(ofAttribute: "Period"),
Expand Down Expand Up @@ -117,6 +121,47 @@ extension StudentVueApi {
}
}

public struct ClassListing: XMLObjectDeserialization {
public var teacherEmail: String
public var excludePVUE: Bool
public var teacher: String
public var period: Int
public var courseTitle: String
public var teacherStaffGU: String
public var sectionGU: String
public var roomName: String
public var additionalStaffInformationXMLs: [AdditionalStaffInformationXML]?

public static func deserialize(_ element: XMLIndexer) throws -> ClassListing {
ClassListing(teacherEmail: try element.value(ofAttribute: "TeacherEmail"),
excludePVUE: try element.value(ofAttribute: "ExcludePVUE"),
teacher: try element.value(ofAttribute: "Teacher"),
period: try element.value(ofAttribute: "Period"),
courseTitle: try element.value(ofAttribute: "CourseTitle"),
teacherStaffGU: try element.value(ofAttribute: "TeacherStaffGU"),
sectionGU: try element.value(ofAttribute: "SectionGU"),
roomName: try element.value(ofAttribute: "RoomName"))
}
}

public struct ConcurrentSchoolStudentClassSchedule: XMLObjectDeserialization {
public var conSchTermIndexName: String
public var conSchOrgYearGU: String
public var conSchTermIndex: Int
public var schoolName: String
public var conSchErrorMessage: String
public var conSchClassLists: [ClassListing]

public static func deserialize(_ element: XMLIndexer) throws -> ConcurrentSchoolStudentClassSchedule {
ConcurrentSchoolStudentClassSchedule(conSchTermIndexName: try element.value(ofAttribute: "ConSchTermIndexName"),
conSchOrgYearGU: try element.value(ofAttribute: "ConSchOrgYearGU"),
conSchTermIndex: try element.value(ofAttribute: "ConSchTermIndex"),
schoolName: try element.value(ofAttribute: "SchoolName"),
conSchErrorMessage: try element.value(ofAttribute: "ConSchErrorMessage"),
conSchClassLists: try element["ConSchClassLists"].value())
}
}

public struct ClassSchedule: XMLObjectDeserialization {
public var termIndex: Int
public var termIndexName: String
Expand All @@ -125,7 +170,7 @@ extension StudentVueApi {
public var todayScheduleInfo: TodayScheduleInfo?
public var classLists: [ClassListSchedule]
public var termLists: [TermListSchedule]
public var concurrentSchoolStudentClassSchedules: [String]? // TODO: Find data type/structure
public var concurrentSchoolStudentClassSchedules: [ConcurrentSchoolStudentClassSchedule]

public static func deserialize(_ element: XMLIndexer) throws -> ClassSchedule {
let schedule = element["StudentClassSchedule"]
Expand All @@ -136,7 +181,9 @@ extension StudentVueApi {
includeAdditionaWhenEmailingTeachers: try schedule.value(ofAttribute: "IncludeAdditionalStaffWhenEmailingTeachers"),
todayScheduleInfo: try? schedule["TodayScheduleInfoData"].value(),
classLists: try schedule["ClassLists"]["ClassListing"].value(),
termLists: try schedule["TermLists"]["TermListing"].value())
termLists: try schedule["TermLists"]["TermListing"].value(),
concurrentSchoolStudentClassSchedules:
try schedule["ConcurrentSchoolStudentClassSchedules"]["ConcurrentSchoolStudentClassSchedule"].value())
}
}
}
Expand Down

0 comments on commit f473ada

Please sign in to comment.