Documentation ¶
Index ¶
- type Client
- type Course
- type CourseSearchOptions
- type CourseWrap
- type DateHours
- type DiningHallDaily
- type DiningHallWeekly
- type DiningService
- type DiningServiceOp
- type DiningWrap
- type DirectorySearchOptions
- type DirectoryService
- type DirectoryServiceOp
- type Meal
- type News
- type NewsSearchOptions
- type NewsService
- type NewsServiceOp
- type NewsWrap
- type Person
- type PersonWrap
- type RegistrarService
- type RegistrarServiceOp
- type ServiceMeta
- type Venue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL // Services for communicating with API Directory DirectoryService Registrar RegistrarService News NewsService // contains filtered or unexported fields }
Client manages communiction with the Penn OpenData API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred, If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.
type Course ¶
type Course struct { ActivitiesAndCredits []struct { Credit string `json:"credit"` ActivityCode string `json:"activity_code"` } `json:"activities_and_credits"` Corequisites string `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"` CourseNotes string `json:"course_notes"` CourseNumber string `json:"course_number"` CourseTitle string `json:"course_title"` Crosslistings []struct { CourseID string `json:"course_id"` SectioNID string `json:"section_id"` Subject string `json:"subject"` } `json:"crosslistings"` Department string `json:"department"` DepartmentOfRecord string `json:"department_of_record"` DistributionRequirement string `json:"distribution_requirement"` EasCreditFactorCode string `json:"eas_credit_factor_code"` // Instructors []interface{} `json:"instructors"` Prerequisites string `json:"prerequisites"` RegisterSubgroupOne string `json:"register_subgroup_one"` RegisterSubgroupTwo string `json:"register_subgroup_two"` RequirementsMet []interface{} `json:"requirements_met"` SchedulingPriority string `json:"scheduling_priority"` SchoolCode string `json:"school_code"` TermsOfferedCode string `json:"terms_offered_code"` TermsOfferedDescription string `json:"terms_offered_description"` }
Expected JSON structure for course from course catalog
type CourseSearchOptions ¶
type CourseSearchOptions struct { CourseID string `url:"course_id,omitempty"` Description string `url:"description,omitempty"` Instructor string `url:"instructor,omitempty"` }
Acceptable parameters for use with the course search endpoint. Still missing many values due to lack of enums
type CourseWrap ¶
type CourseWrap struct { Courses []Course `json:"result_data"` Meta ServiceMeta `json:"service_meta"` }
type DiningHallDaily ¶
type DiningHallDaily struct { }
type DiningHallWeekly ¶
type DiningHallWeekly struct { }
type DiningService ¶
type DiningServiceOp ¶
type DiningServiceOp struct {
// contains filtered or unexported fields
}
type DiningWrap ¶
type DiningWrap struct { Venues []Venue `json:"result_data.document.venue"` Meta ServiceMeta `json:"service_meta"` }
type DirectorySearchOptions ¶
type DirectorySearchOptions struct { FirstName string `url:"first_name,omitempty"` LastName string `url:"last_name,omitempty"` Email string `url:"email,omitempty"` Affiliation string `url:"affiliation,omitempty"` Organization string `url:"organization,omitempty"` }
Acceptable parameters for use with the directory search endpoint.
type DirectoryService ¶
type DirectoryServiceOp ¶
type DirectoryServiceOp struct {
// contains filtered or unexported fields
}
func (*DirectoryServiceOp) Search ¶
func (s *DirectoryServiceOp) Search(opt *DirectorySearchOptions) ([]Person, *http.Response, error)
type News ¶
type News struct { Author string `json:"author"` CommentsURL string `json:"comments_url"` ContentCategories []struct { Description string `json:"description"` ID int `json:"id"` Label string `json:"label"` ParentCategoryID int `json:"parent_category_id"` } `json:"content_categories"` ContentType string `json:"content_type"` Description string `json:"description"` GUID string `json:"guid"` ID int `json:"id"` Images []struct { Caption string `json:"caption"` ID int `json:"id"` Link string `json:"link"` Name string `json:"name"` } `json:"images"` Link string `json:"link"` Pubdate time.Time `json:"pubdate"` SourceURL string `json:"source_url"` Title string `json:"title"` }
Expected JSON structure for news articles
type NewsSearchOptions ¶
type NewsSearchOptions struct { Source string `url:"source,omitempty"` Description string `url:"description,omitempty"` }
Acceptable parameters for use with the news search endpoint.
type NewsServiceOp ¶
type NewsServiceOp struct {
// contains filtered or unexported fields
}
type NewsWrap ¶
type NewsWrap struct { News []News `json:"result_data"` Meta ServiceMeta `json:"service_meta"` }
type Person ¶
type Person struct { AdditionalData string `json:"additional_data_available"` Affiliation string `json:"list_affiliation"` Email string `json:"list_email"` Name string `json:"list_name"` Organization string `json:"list_organization"` Phone string `json:"list_phone"` PhoneType string `json:"list_phone_type"` Prefix string `json:"list_prefix"` TitleOrMajor string `json:"list_title_or_major"` Id string `json:"person_id"` }
Expected JSON structure from results from directory
type PersonWrap ¶
type PersonWrap struct { Persons []Person `json:"result_data"` Meta ServiceMeta `json:"service_meta"` }
type RegistrarService ¶
type RegistrarServiceOp ¶
type RegistrarServiceOp struct {
// contains filtered or unexported fields
}
func (*RegistrarServiceOp) GetDepartment ¶
func (*RegistrarServiceOp) Search ¶
func (s *RegistrarServiceOp) Search(opt *CourseSearchOptions) ([]Course, *http.Response, error)
type ServiceMeta ¶
type Venue ¶
type Venue struct { Id int `json:"id"` Name string `json:"name"` VenueType string `json:"venueType"` FacilityURL string `json:"facilityURL"` WeeklyMenuURL string `json:"weeklyMenuURL"` DailyMenuURL string `json:"dailyMenuURL"` DateHours []DateHours `json:"dateHours"` }
Expected JSON structure from results from venues