api

package
v0.0.0-...-7f9477d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DayOfWeekTable = []DayOfWeek{
	"monday",
	"tuesday",
	"wednesday",
	"thursday",
	"friday",
}

Functions

func AddAnnouncement

func AddAnnouncement(ctx context.Context, a *agent.Agent, announcement AddAnnouncementRequest) (*http.Response, error)

func AddClass

func AddClass(ctx context.Context, a *agent.Agent, courseID string, classRequest AddClassRequest) (*http.Response, error)

func AddCourse

func AddCourse(ctx context.Context, a *agent.Agent, courseRequest AddCourseRequest) (*http.Response, error)

func BrowserAccess

func BrowserAccess(ctx context.Context, a *agent.Agent, path string) (*http.Response, agent.Resources, error)

func DownloadSubmittedAssignments

func DownloadSubmittedAssignments(ctx context.Context, a *agent.Agent, courseID, classID string) (*http.Response, error)

func GetAnnouncementDetail

func GetAnnouncementDetail(ctx context.Context, a *agent.Agent, id string) (*http.Response, error)

func GetAnnouncementList

func GetAnnouncementList(ctx context.Context, a *agent.Agent, rawURL string, courseID string) (*http.Response, error)

func GetClasses

func GetClasses(ctx context.Context, a *agent.Agent, courseID string) (*http.Response, error)

func GetCourseDetail

func GetCourseDetail(ctx context.Context, a *agent.Agent, courseID string) (*http.Response, error)

func GetGrades

func GetGrades(ctx context.Context, a *agent.Agent) (*http.Response, error)

func GetMe

func GetMe(ctx context.Context, a *agent.Agent) (*http.Response, error)

func GetRegisteredCourses

func GetRegisteredCourses(ctx context.Context, a *agent.Agent) (*http.Response, error)

func Initialize

func Initialize(ctx context.Context, a *agent.Agent) (*http.Response, error)

func Login

func Login(ctx context.Context, a *agent.Agent, auth LoginRequest) (*http.Response, error)

func RegisterCourses

func RegisterCourses(ctx context.Context, a *agent.Agent, courses []RegisterCourseRequestContent) (*http.Response, error)

func RegisterScores

func RegisterScores(ctx context.Context, a *agent.Agent, courseID, classID string, scores []RegisterScoreRequestContent) (*http.Response, error)

func SearchCourse

func SearchCourse(ctx context.Context, a *agent.Agent, param *SearchCourseRequest) (*http.Response, error)

func SearchCourseWithNext

func SearchCourseWithNext(ctx context.Context, a *agent.Agent, pathParam string) (*http.Response, error)

func SetCourseStatus

func SetCourseStatus(ctx context.Context, a *agent.Agent, courseID string, status CourseStatus) (*http.Response, error)

func SubmitAssignment

func SubmitAssignment(ctx context.Context, a *agent.Agent, courseID, classID, fileName string, data []byte) (*http.Response, error)

Types

type AddAnnouncementRequest

type AddAnnouncementRequest struct {
	ID       string `json:"id"`
	CourseID string `json:"course_id"`
	Title    string `json:"title"`
	Message  string `json:"message"`
}

type AddClassRequest

type AddClassRequest struct {
	Part        uint8  `json:"part"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

type AddClassResponse

type AddClassResponse struct {
	ClassID string `json:"class_id"`
}

type AddCourseRequest

type AddCourseRequest struct {
	Code        string     `json:"code"`
	Type        CourseType `json:"type"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Credit      int        `json:"credit"`
	Period      int        `json:"period"`
	DayOfWeek   DayOfWeek  `json:"day_of_week"`
	Keywords    string     `json:"keywords"`
}

type AddCourseResponse

type AddCourseResponse struct {
	ID string `json:"id"`
}

type AnnouncementResponse

type AnnouncementResponse struct {
	ID         string `json:"id"`
	CourseID   string `json:"course_id"`
	CourseName string `json:"course_name"`
	Title      string `json:"title"`
	Unread     bool   `json:"unread"`
}

type ClassScore

type ClassScore struct {
	ClassID    string `json:"class_id"`
	Title      string `json:"title"`
	Part       uint8  `json:"part"`
	Score      *int   `json:"score"`      // 0~100点
	Submitters int    `json:"submitters"` // 提出した学生数
}

type CourseResult

type CourseResult struct {
	Name             string       `json:"name"`
	Code             string       `json:"code"`
	TotalScore       int          `json:"total_score"`
	TotalScoreTScore float64      `json:"total_score_t_score"` // 偏差値
	TotalScoreAvg    float64      `json:"total_score_avg"`     // 平均値
	TotalScoreMax    int          `json:"total_score_max"`     // 最大値
	TotalScoreMin    int          `json:"total_score_min"`     // 最小値
	ClassScores      []ClassScore `json:"class_scores"`
}

type CourseStatus

type CourseStatus string
const (
	StatusRegistration CourseStatus = "registration"
	StatusInProgress   CourseStatus = "in-progress"
	StatusClosed       CourseStatus = "closed"
)

type CourseType

type CourseType string
const (
	CourseTypeLiberalArts   CourseType = "liberal-arts"
	CourseTypeMajorSubjects CourseType = "major-subjects"
)

type DayOfWeek

type DayOfWeek string

type GetAnnouncementDetailResponse

type GetAnnouncementDetailResponse struct {
	ID         string `json:"id"`
	CourseID   string `json:"course_id"`
	CourseName string `json:"course_name"`
	Title      string `json:"title"`
	Message    string `json:"message"`
	Unread     bool   `json:"unread"`
}

type GetAnnouncementsResponse

type GetAnnouncementsResponse struct {
	UnreadCount   int                    `json:"unread_count"`
	Announcements []AnnouncementResponse `json:"announcements"`
}

type GetClassResponse

type GetClassResponse struct {
	ID               string `json:"id"`
	Part             uint8  `json:"part"`
	Title            string `json:"title"`
	Description      string `json:"description"`
	SubmissionClosed bool   `json:"submission_closed"`
	Submitted        bool   `json:"submitted"`
}

type GetCourseDetailResponse

type GetCourseDetailResponse struct {
	ID          string       `json:"id"`
	Code        string       `json:"code"`
	Type        CourseType   `json:"type"`
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Credit      uint8        `json:"credit"`
	Period      uint8        `json:"period"`
	DayOfWeek   DayOfWeek    `json:"day_of_week"`
	Teacher     string       `json:"teacher"`
	Status      CourseStatus `json:"status"`
	Keywords    string       `json:"keywords"`
}

type GetGradeResponse

type GetGradeResponse struct {
	Summary       Summary        `json:"summary"`
	CourseResults []CourseResult `json:"courses"`
}

type GetMeResponse

type GetMeResponse struct {
	Code    string `json:"code"`
	Name    string `json:"name"`
	IsAdmin bool   `json:"is_admin"`
}

type GetRegisteredCourseResponseContent

type GetRegisteredCourseResponseContent struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Teacher   string    `json:"teacher"`
	Period    uint8     `json:"period"`
	DayOfWeek DayOfWeek `json:"day_of_week"`
}

type InitializeResponse

type InitializeResponse struct {
	Language string `json:"language"`
}

type LoginRequest

type LoginRequest struct {
	Code     string `json:"code"`
	Password string `json:"password"`
}

type RegisterCourseRequestContent

type RegisterCourseRequestContent struct {
	ID string `json:"id"`
}

type RegisterCoursesErrorResponse

type RegisterCoursesErrorResponse struct {
	CourseNotFound       []string `json:"course_not_found"`
	NotRegistrableStatus []string `json:"not_registrable_status"`
	ScheduleConflict     []string `json:"schedule_conflict"`
}

type RegisterScoreRequestContent

type RegisterScoreRequestContent struct {
	UserCode string `json:"user_code"`
	Score    int    `json:"score"`
}

type SearchCourseRequest

type SearchCourseRequest struct {
	Type      CourseType
	Credit    uint8
	Teacher   string
	Period    uint8
	DayOfWeek DayOfWeek
	Keywords  string
	Status    CourseStatus
}

type SetCourseStatusRequest

type SetCourseStatusRequest struct {
	Status CourseStatus `json:"status"`
}

type Summary

type Summary struct {
	Credits   int     `json:"credits"`
	GPA       float64 `json:"gpa"`
	GpaTScore float64 `json:"gpa_t_score"` // 偏差値
	GpaAvg    float64 `json:"gpa_avg"`     // 平均値
	GpaMax    float64 `json:"gpa_max"`     // 最大値
	GpaMin    float64 `json:"gpa_min"`     // 最小値
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL