From f473ada81d7cf489563e196909f4a44e9a6b8fd5 Mon Sep 17 00:00:00 2001 From: TheMoonThatRises <58153205+TheMoonThatRises@users.noreply.github.com> Date: Sat, 17 Aug 2024 00:58:51 -0600 Subject: [PATCH] add some missing data types --- .../SOAPApi/Models/Attendance.swift | 17 ++++-- .../SOAPApi/Models/ClassSchedule.swift | 53 +++++++++++++++++-- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/Sources/StudentVue/SOAPApi/Models/Attendance.swift b/Sources/StudentVue/SOAPApi/Models/Attendance.swift index 1c3dcd2..d09496f 100644 --- a/Sources/StudentVue/SOAPApi/Models/Attendance.swift +++ b/Sources/StudentVue/SOAPApi/Models/Attendance.swift @@ -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 @@ -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"] @@ -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()) } } } diff --git a/Sources/StudentVue/SOAPApi/Models/ClassSchedule.swift b/Sources/StudentVue/SOAPApi/Models/ClassSchedule.swift index 44ee299..da7d17d 100644 --- a/Sources/StudentVue/SOAPApi/Models/ClassSchedule.swift +++ b/Sources/StudentVue/SOAPApi/Models/ClassSchedule.swift @@ -68,6 +68,10 @@ extension StudentVueApi { } } + public struct AdditionalStaffInformationXML: XMLObjectDeserialization { + + } + public struct ClassListSchedule: XMLObjectDeserialization { public var period: Int public var courseTitle: String @@ -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"), @@ -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 @@ -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"] @@ -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()) } } }