Documentation
¶
Index ¶
- func CurrentOTP(raw string, now time.Time) (string, error)
- func IsNoLessonData(err error) bool
- func SetDebugLogger(fn func(format string, args ...any))
- func SortCurriculum(items []CurriculumItem)
- func SortExams(items []ExamItem)
- func SortHomework(items []HomeworkItem)
- func SortScores(items []ScoreItem)
- type Client
- func (c *Client) FetchCurriculum(ctx context.Context, semesterID int) (Semester, []CurriculumItem, error)
- func (c *Client) FetchExams(ctx context.Context, semesterIDs ...int) ([]ExamItem, error)
- func (c *Client) FetchHomework(ctx context.Context) ([]HomeworkItem, error)
- func (c *Client) FetchScores(ctx context.Context) (ScoreReport, error)
- func (c *Client) FetchSemesters(ctx context.Context) ([]Semester, error)
- type Credentials
- type CurriculumItem
- type ExamItem
- type HomeworkItem
- type Program
- type ScoreItem
- type ScoreReport
- type Semester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNoLessonData ¶
func SetDebugLogger ¶
func SortCurriculum ¶
func SortCurriculum(items []CurriculumItem)
func SortHomework ¶
func SortHomework(items []HomeworkItem)
func SortScores ¶
func SortScores(items []ScoreItem)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(creds Credentials, programs ...Program) *Client
func (*Client) FetchCurriculum ¶
func (*Client) FetchExams ¶
func (*Client) FetchHomework ¶
func (c *Client) FetchHomework(ctx context.Context) ([]HomeworkItem, error)
func (*Client) FetchScores ¶
func (c *Client) FetchScores(ctx context.Context) (ScoreReport, error)
type Credentials ¶
func ResolveCredentials ¶
func ResolveCredentials(username, password, totp string) (Credentials, error)
func ResolveCredentialsForProgram ¶
func ResolveCredentialsForProgram(program Program, username, password, totp string) (Credentials, error)
type CurriculumItem ¶
type CurriculumItem struct {
SemesterID int `json:"semesterId"`
LessonID int `json:"lessonId,omitempty"`
LessonCode string `json:"lessonCode,omitempty"`
CourseCode string `json:"courseCode,omitempty"`
CourseName string `json:"courseName,omitempty"`
Credits float64 `json:"credits,omitempty"`
Teachers []string `json:"teachers,omitempty"`
Schedule string `json:"schedule,omitempty"`
}
func (CurriculumItem) TeacherList ¶
func (i CurriculumItem) TeacherList() string
type ExamItem ¶
type ExamItem struct {
CourseName string `json:"courseName,omitempty"`
LessonCode string `json:"lessonCode,omitempty"`
ExamType string `json:"examType,omitempty"`
DateTime string `json:"dateTime,omitempty"`
Location string `json:"location,omitempty"`
Seat string `json:"seat,omitempty"`
Status string `json:"status,omitempty"`
}
type HomeworkItem ¶
type HomeworkItem struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
CourseName string `json:"courseName,omitempty"`
LessonCode string `json:"lessonCode,omitempty"`
SemesterCode string `json:"semesterCode,omitempty"`
ExternalItemID string `json:"externalItemId,omitempty"`
StartAt string `json:"startAt,omitempty"`
EndAt string `json:"endAt,omitempty"`
Status string `json:"status,omitempty"`
}
type Program ¶
type Program string
func DetectCredentialPrograms ¶
func DetectCredentialPrograms() []Program
func (Program) IsGraduate ¶
type ScoreItem ¶
type ScoreItem struct {
SemesterID int `json:"semesterId"`
SemesterName string `json:"semesterName,omitempty"`
CourseName string `json:"courseName,omitempty"`
LessonCode string `json:"lessonCode,omitempty"`
CourseCode string `json:"courseCode,omitempty"`
Credits float64 `json:"credits,omitempty"`
GradePoint float64 `json:"gradePoint,omitempty"`
Score string `json:"score,omitempty"`
GradeText string `json:"gradeText,omitempty"`
}
type ScoreReport ¶
type ScoreReport struct {
Summary json.RawMessage `json:"summary,omitempty"`
Items []ScoreItem `json:"items"`
}
type Semester ¶
type Semester struct {
ID int `json:"id"`
Code string `json:"code,omitempty"`
SemesterCn string `json:"semesterCn,omitempty"`
SemesterEn string `json:"semesterEn,omitempty"`
StartDate string `json:"startDate,omitempty"`
EndDate string `json:"endDate,omitempty"`
IsLast bool `json:"isLast,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.