185 lines
4.3 KiB
C#
185 lines
4.3 KiB
C#
using System.Text.Json;
|
|
|
|
namespace LehrerApp.WebUntis;
|
|
|
|
public sealed class WebUntisOptions
|
|
{
|
|
public string School { get; set; } = "";
|
|
public string Host { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string Password { get; set; } = "";
|
|
public string Client { get; set; } = "LehrerApp";
|
|
public int SessionIdleTimeoutMinutes { get; set; } = 10;
|
|
}
|
|
|
|
public sealed record UntisSchoolYear(int UntisId, string Name, int StartDate, int EndDate);
|
|
|
|
public sealed record UntisClass(
|
|
int UntisId,
|
|
string Name,
|
|
string? LongName,
|
|
string? ForeColor,
|
|
string? BackColor,
|
|
int? DepartmentUntisId,
|
|
int? Teacher1UntisId,
|
|
int? Teacher2UntisId);
|
|
|
|
public sealed record UntisTeacher(
|
|
int UntisId,
|
|
string Name,
|
|
string? ForeName,
|
|
string? LongName,
|
|
string? Title,
|
|
bool Active,
|
|
IReadOnlyList<int> DepartmentUntisIds);
|
|
|
|
public sealed record UntisStudentAddress(
|
|
string? Email,
|
|
string? Mobile,
|
|
string? Phone,
|
|
string? City,
|
|
string? PostCode,
|
|
string? Street);
|
|
|
|
public sealed record UntisStudent(
|
|
int UntisId,
|
|
int ExternKey,
|
|
string ClassName,
|
|
string? Name,
|
|
string? LongName,
|
|
string? ForeName,
|
|
string DisplayName,
|
|
string? Gender,
|
|
int? BirthDate,
|
|
string? BirthDateRaw,
|
|
int? EntryDate,
|
|
string? EntryDateRaw,
|
|
int? ExitDate,
|
|
string? ExitDateRaw,
|
|
string? Text,
|
|
string? MedicalReportDuty,
|
|
string? Schulpflicht,
|
|
string? Majority,
|
|
UntisStudentAddress Address,
|
|
string? AttributeIL);
|
|
|
|
public sealed record UntisStudentReport(
|
|
int Count,
|
|
string? ClassNameFilter,
|
|
IReadOnlyList<UntisStudent> Students);
|
|
|
|
public sealed record UntisTimeUnit(string Name, int StartTime, int EndTime);
|
|
|
|
public sealed record UntisTimeGridDay(
|
|
int Day,
|
|
IReadOnlyList<UntisTimeUnit> TimeUnits,
|
|
JsonElement Raw);
|
|
|
|
public sealed record UntisHoliday(
|
|
int UntisId,
|
|
string Name,
|
|
string? LongName,
|
|
int StartDate,
|
|
int EndDate);
|
|
|
|
public sealed record UntisEntity(
|
|
int Id,
|
|
string Name,
|
|
int? OriginalId,
|
|
string? OriginalName,
|
|
string? ExternalKey);
|
|
|
|
public sealed record UntisReschedule(int Date, int StartTime, int EndTime);
|
|
|
|
public sealed record UntisSubstitution(
|
|
string Type,
|
|
int? LessonId,
|
|
string? LessonType,
|
|
int Date,
|
|
int StartTime,
|
|
int EndTime,
|
|
string? Text,
|
|
IReadOnlyList<UntisEntity> Classes,
|
|
IReadOnlyList<UntisEntity> Teachers,
|
|
IReadOnlyList<UntisEntity> Subjects,
|
|
IReadOnlyList<UntisEntity> Rooms,
|
|
UntisReschedule? Reschedule,
|
|
JsonElement Raw);
|
|
|
|
public enum UntisTimetableElementType
|
|
{
|
|
Class = 1,
|
|
Teacher = 2,
|
|
Subject = 3,
|
|
Room = 4,
|
|
Student = 5,
|
|
}
|
|
|
|
public sealed record UntisTimetablePeriod(
|
|
int Id,
|
|
int Date,
|
|
int StartTime,
|
|
int EndTime,
|
|
string? Code,
|
|
string? ActivityType,
|
|
string? Info,
|
|
string? LessonText,
|
|
string? SubstitutionText,
|
|
string? StudentGroup,
|
|
IReadOnlyList<UntisEntity> Classes,
|
|
IReadOnlyList<UntisEntity> Teachers,
|
|
IReadOnlyList<UntisEntity> Subjects,
|
|
IReadOnlyList<UntisEntity> Rooms,
|
|
JsonElement Raw);
|
|
|
|
public sealed record UntisStudentAbsence(
|
|
int StudentKey,
|
|
int Date,
|
|
int StartTime,
|
|
int EndTime,
|
|
int AbsentMinutes,
|
|
bool Checked,
|
|
string? AbsenceReason,
|
|
string? ExcuseStatus,
|
|
int? SubjectId,
|
|
IReadOnlyList<int> TeacherIds,
|
|
string? StudentGroup,
|
|
JsonElement Raw);
|
|
|
|
public sealed record UntisStudentAbsenceReport(
|
|
int StudentKey,
|
|
int StartDate,
|
|
int EndDate,
|
|
int EntryCount,
|
|
int AbsentMinutes,
|
|
IReadOnlyList<UntisStudentAbsence> Absences);
|
|
|
|
public sealed record UntisClassRegisterEntry(
|
|
int? StudentKey,
|
|
string? Surname,
|
|
string? ForeName,
|
|
string DisplayName,
|
|
int Date,
|
|
string? Subject,
|
|
int? CategoryId,
|
|
string? Reason,
|
|
string? Text,
|
|
JsonElement Raw);
|
|
|
|
public sealed record UntisClassRegisterCategory(
|
|
int Id,
|
|
string Name,
|
|
string? LongName,
|
|
int? GroupId,
|
|
JsonElement Raw);
|
|
|
|
public sealed record UntisClassRegisterCategoryGroup(
|
|
int Id,
|
|
string Name,
|
|
JsonElement Raw);
|
|
|
|
public sealed class WebUntisException(string message, Exception? innerException = null)
|
|
: Exception(message, innerException);
|
|
|
|
public sealed class WebUntisConfigurationException(string message) : Exception(message);
|