Documentation ¶
Index ¶
- type Course
- type CourseCatalogData
- type CourseInstructor
- type CourseSearchData
- type CourseSectionStatus
- type OpenData
- type PageIterator
- type Registrar
- func (r *Registrar) GetAcceptableSearchURLParametersMap() (map[string]string, error)
- func (r *Registrar) GetAllCourseStatus(term string) ([]CourseSectionStatus, error)
- func (r *Registrar) GetAvailableTermMap() (map[string]string, error)
- func (r *Registrar) GetCourseCatalog(department, section string) *PageIterator[CourseCatalogData]
- func (r *Registrar) GetCourseStatus(term string, course *Course) ([]CourseSectionStatus, error)
- func (r *Registrar) SearchCourseSection(parameters map[string]string) *PageIterator[CourseSearchData]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Course ¶
type Course struct {
// contains filtered or unexported fields
}
Course is a normalized struct for course and section ID.
func NewCourse ¶
NewCourse generates a new Course instance based on course subject, number, and section ID.
func ParseCourse ¶
ParseCourse generates a new Course instance based on course ID string using regex to match.
ParseCourse("MUSC0050003")
type CourseCatalogData ¶
type CourseCatalogData struct { Activities []struct { EffectiveTerm string `json:"effective_term"` ScheduleCode string `json:"schedule_code"` ScheduleDesc string `json:"schedule_desc"` Workload string `json:"workload"` } `json:"activities"` Attributes []struct { AttributeCode string `json:"attribute_code"` AttributeDesc string `json:"attribute_desc"` } `json:"attributes"` Corequisites []struct { CoreqCourseId string `json:"coreq_course_id"` } `json:"corequisites"` CourseCreditConnector string `json:"course_credit_connector"` CourseCreditType string `json:"course_credit_type"` CourseDescription string `json:"course_description"` CourseID string `json:"course_id"` CourseLevel string `json:"course_level"` CourseLevelDescription string `json:"course_level_description"` CourseNumber string `json:"course_number"` CourseTitle string `json:"course_title"` Crosslistings []struct { ActivityDate string `json:"activity_date"` EffectiveTerm string `json:"effective_term"` EndTerm string `json:"end_term"` StartTerm string `json:"start_term"` XlistCourseId string `json:"xlist_course_id"` XlistCourseNumber string `json:"xlist_course_number"` XlistSectionNumber string `json:"xlist_section_number"` XlistSubjectCode string `json:"xlist_subject_code"` } `json:"crosslistings"` Department string `json:"department"` EasCreditFactorCode string `json:"eas_credit_factor_code"` Prerequisites []struct { PrereqCourseId string `json:"prereq_course_id"` } `json:"prerequisites"` SchedulingPriority string `json:"scheduling_priority"` SchoolCode string `json:"school_code"` TermsOfferedCode string `json:"terms_offered_code"` TermsOfferedDescription string `json:"terms_offered_description"` }
CourseCatalogData is the data struct returned by Registrar.GetCourseCatalog.
type CourseInstructor ¶
type CourseSearchData ¶
type CourseSearchData struct { Activity string `json:"activity"` ActivityDescription string `json:"activity_description"` Attributes []struct { AttributeCode string `json:"attribute_code"` AttributeDesc string `json:"attribute_desc"` } `json:"attributes"` Cancelled bool `json:"cancelled"` Closed bool `json:"closed"` CorequisiteActivity string `json:"corequisite_activity"` CorequisiteActivityDescription string `json:"corequisite_activity_description"` CourseDepartment string `json:"course_department"` CourseDescription string `json:"course_description"` CourseLevel string `json:"course_level"` CourseLevelDesc string `json:"course_level_desc"` CourseNumber string `json:"course_number"` CourseTermsOffered string `json:"course_terms_offered"` CourseTitle string `json:"course_title"` CreditConnector string `json:"credit_connector"` CreditType string `json:"credit_type"` Credits string `json:"credits"` Crn string `json:"crn"` CrosslistPrimary string `json:"crosslist_primary"` Crosslistings []struct { ActivityDate string `json:"activity_date"` EffectiveTerm string `json:"effective_term"` EndTerm string `json:"end_term"` StartTerm string `json:"start_term"` XlistCourseId string `json:"xlist_course_id"` XlistCourseNumber string `json:"xlist_course_number"` XlistSectionNumber string `json:"xlist_section_number"` XlistSubjectCode string `json:"xlist_subject_code"` } `json:"crosslistings"` EndDate string `json:"end_date"` FirstMeetingDays string `json:"first_meeting_days"` GradeModes []struct { Code string `json:"code"` Description string `json:"description"` } `json:"grade_modes"` Instructors []CourseInstructor `json:"instructors"` IsCancelled bool `json:"is_cancelled"` IsClosed bool `json:"is_closed"` IsCrosslistPrimary bool `json:"is_crosslist_primary"` IsNotScheduled bool `json:"is_not_scheduled"` LinkedCourses []struct { CourseNumber string `json:"course_number"` ScheduleCode string `json:"schedule_code"` ScheduleDescription string `json:"schedule_description"` SectionId string `json:"section_id"` SectionNumber string `json:"section_number"` SubjectCode string `json:"subject_code"` } `json:"linked_courses"` MaxEnrollment string `json:"max_enrollment"` MaxEnrollmentCrosslist string `json:"max_enrollment_crosslist"` MaximumCredit string `json:"maximum_credit"` Meetings []struct { BeginTime string `json:"begin_time"` BeginTime24 string `json:"begin_time_24"` BuildingCode string `json:"building_code"` BuildingDesc string `json:"building_desc"` Days string `json:"days"` EndDate string `json:"end_date"` EndTime string `json:"end_time"` EndTime24 string `json:"end_time_24"` Friday string `json:"friday"` Monday string `json:"monday"` RoomCode string `json:"room_code"` Saturday string `json:"saturday"` StartDate string `json:"start_date"` Sunday string `json:"sunday"` Thursday string `json:"thursday"` Tuesday string `json:"tuesday"` Wednesday string `json:"wednesday"` } `json:"meetings"` MinimumCredit string `json:"minimum_credit"` NotScheduled bool `json:"notScheduled"` PrimaryInstructor string `json:"primary_instructor"` SectionId string `json:"section_id"` SectionNumber string `json:"section_number"` SectionTitle string `json:"section_title"` StartDate string `json:"start_date"` Subject string `json:"subject"` SyllabusUrl string `json:"syllabus_url"` Term string `json:"term"` TermSession string `json:"term_session"` XlistGroup string `json:"xlist_group"` }
CourseSearchData is the data struct returned by Registrar.SearchCourseSection.
type CourseSectionStatus ¶
type CourseSectionStatus struct { PreviousStatus string `json:"previous_status"` SectionID string `json:"section_id"` SectionIDNormalized string `json:"section_id_normalized"` Status string `json:"status"` StatusCodeNormalized string `json:"status_code_normalized"` Term string `json:"term"` }
CourseSectionStatus is the data struct returned by Course section status service.
type OpenData ¶
type OpenData struct {
// contains filtered or unexported fields
}
OpenData is a struct that stores OpenData API username and password.
func NewOpenDataAPI ¶
NewOpenDataAPI generates an instance of OpenData with specific username and password.
func (*OpenData) GetRegistrar ¶
GetRegistrar generates a Registrar instance using the current OpenData instance.
type PageIterator ¶
type PageIterator[T any] struct { // contains filtered or unexported fields }
PageIterator provides an iterator for paging function.
func (*PageIterator[T]) GetError ¶
func (i *PageIterator[T]) GetError() error
GetError gets the latest error generated.
func (*PageIterator[T]) GetPageSize ¶
func (i *PageIterator[T]) GetPageSize() int
GetPageSize gets the current size of the page.
func (*PageIterator[T]) GetRawData ¶
func (i *PageIterator[T]) GetRawData(index int) json.RawMessage
GetRawData get the raw json message with the given index
func (*PageIterator[T]) GetResult ¶
func (i *PageIterator[T]) GetResult(index int) (*T, error)
GetResult will unmarshal the raw json message with the given index into the container the user provided. Normally the container needs to be a struct with types provided by this package.
func (*PageIterator[T]) NextPage ¶
func (i *PageIterator[T]) NextPage() bool
NextPage gets the next page available. If the return value if true then a new page is successfully obtained, or an error has occurred. Otherwise, the end of the result is reached.
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
Registrar provides a wrapper for OpenData Registrar's API.
func (*Registrar) GetAcceptableSearchURLParametersMap ¶
GetAcceptableSearchURLParametersMap gets departments map provided by OpenData API.
func (*Registrar) GetAllCourseStatus ¶
func (r *Registrar) GetAllCourseStatus(term string) ([]CourseSectionStatus, error)
GetAllCourseStatus gets all courses' status in a given term at once. Term must be in the available term map. Call #Registrar.GetAvailableTermMap to get the map. See https://app.swaggerhub.com/apis-docs/UPennISC/open-data/prod#/Course%20section%20status%20service/getAllCourseSectionStatuses.
func (*Registrar) GetAvailableTermMap ¶
GetAvailableTermMap gets acceptable search url parameters map provided by OpenData API.
func (*Registrar) GetCourseCatalog ¶
func (r *Registrar) GetCourseCatalog(department, section string) *PageIterator[CourseCatalogData]
GetCourseCatalog allows the search of the course catalog using subjects and course numbers. See https://app.swaggerhub.com/apis-docs/UPennISC/open-data/prod#/Course%20search%20service.
func (*Registrar) GetCourseStatus ¶
func (r *Registrar) GetCourseStatus(term string, course *Course) ([]CourseSectionStatus, error)
GetCourseStatus gets the specific course's status in a given term. Term must be in the available term map. Call #Registrar.GetAvailableTermMap to get the map. See https://app.swaggerhub.com/apis-docs/UPennISC/open-data/prod#/Course%20section%20status%20service/getOneCourseSectionStatus.
func (*Registrar) SearchCourseSection ¶
func (r *Registrar) SearchCourseSection(parameters map[string]string) *PageIterator[CourseSearchData]
SearchCourseSection gets the searched results with given parameters on Path@Penn. The parameters map must have keys that are in acceptable search url parameters map. Call #Registrar.GetAcceptableSearchURLParametersMap to get the map. See https://app.swaggerhub.com/apis-docs/UPennISC/open-data/prod#/Course%20section%20search%20service/searchCourseSections.