Documentation ¶
Overview ¶
Package clever is a Go library for the Clever API: https://clever.com/developers/docs.
Usage
package main import ( "code.google.com/p/goauth2/oauth" clevergo "gopkg.in/Clever/clever-go.v1" "log" ) func main() { t := &oauth.Transport{ Token: &oauth.Token{AccessToken: "DEMO_TOKEN"}, } client := t.Client() clever := clevergo.New(client, "https://api.clever.com") paged := clever.QueryAll("/v1.1/districts", nil) for paged.Next() { var district clevergo.District if err := paged.Scan(&district); err != nil { log.Fatal(err) } log.Println(district) } if err := paged.Error(); err != nil { log.Fatal(err) } }
Index ¶
- Constants
- type BasicAuthTransport
- type Clever
- type CleverError
- type District
- type DistrictResp
- type Link
- type Location
- type Name
- type PagedResult
- type Paging
- type School
- type SchoolResp
- type Section
- type SectionResp
- type Student
- type StudentResp
- type Teacher
- type TeacherResp
- type Term
- type TooManyRequestsError
Constants ¶
const Version = "1.3.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuthTransport ¶
BasicAuthTransport is an http.Transport that performs HTTP Basic Auth.
func (*BasicAuthTransport) Client ¶
func (bat *BasicAuthTransport) Client() *http.Client
Client returns a new Client object for the specified BasicAuthTransport
type Clever ¶
type Clever struct {
// contains filtered or unexported fields
}
Clever wraps the Clever API at the specified URL e.g. "https://api.clever.com"
func New ¶
New returns a new Clever object to make requests with. URL must be a valid base url, e.g. "https://api.clever.com"
type CleverError ¶
CleverError contains an error that occurred within the Clever API
func (*CleverError) Error ¶
func (err *CleverError) Error() string
Error returns a string representation of a CleverError
type District ¶
District corresponds to the District resource in the Clever data schema: clever.com/schema
type DistrictResp ¶
DistrictResp wraps the response given when the user queries for a District
type Location ¶
Location represents a complete address for use with the Student and School resources
type PagedResult ¶
type PagedResult struct {
// contains filtered or unexported fields
}
PagedResult wraps a response. It allows for paged reading of a response in conjunction with QueryAll() and Next()
func (*PagedResult) Error ¶
func (r *PagedResult) Error() error
Error returns the error in a response, if there is one
func (*PagedResult) Next ¶
func (r *PagedResult) Next() bool
Next returns true if a PagedResult contains additional data and false if the cursor has reached the end of the available data for this response.
func (*PagedResult) Scan ¶
func (r *PagedResult) Scan(result interface{}) error
Scan parses the next page of results in a PagedResult r into result. Scan throws an error if r is invalid JSON.
type School ¶
type School struct { Created string District string HighGrade string `json:"high_grade"` Id string LastModified string `json:"last_modified"` Location Location LowGrade string `json:"low_grade"` Name string NcesId string `json:"nces_id"` Phone string SchoolNumber string `json:"school_number"` SisId string `json:"sis_id"` StateId string `json:"state_id"` }
School corresponds to the School resource in the Clever data schema: clever.com/schema
type SchoolResp ¶
SchoolResp wraps the response given when the user queries for a School
type Section ¶
type Section struct { CourseName string `json:"course_name"` CourseNumber string `json:"course_number"` Created string District string Grade string Id string LastModified string `json:"last_modified"` Name string School string SisId string `json:"sis_id"` Students []string Subject string Teacher string Term }
Section corresponds to the Section resource in the Clever data schema: clever.com/schema
type SectionResp ¶
SectionResp wraps the response given when the user queries for a Section
type Student ¶
type Student struct { Created string District string Dob string Email string FrlStatus string `json:"frl_status"` Gender string Grade string HispanicEthnicity string `json:"hispanic_ethnicity"` Id string LastModified string `json:"last_modified"` Location Location Name Name Race string School string SisId string `json:"sis_id"` StateId string `json:"state_id"` StudentNumber string `json:"student_number"` }
Student corresponds to the Student resource in the Clever data schema: clever.com/schema
type StudentResp ¶
StudentResp wraps the response given when the user queries for a Student
type Teacher ¶
type Teacher struct { Created string District string Email string Id string LastModified string `json:"last_modified"` Name Name School string SisId string `json:"sis_id"` TeacherNumber string `json:"teacher_number"` Title string }
Teacher corresponds to the Teacher resource in the Clever data schema: clever.com/schema
type TeacherResp ¶
TeacherResp wraps the response given when the user queries for a Teacher
type Term ¶
type Term struct { Name string StartDate string `json:"start_date"` EndDate string `json:"end_date"` }
Term holds information about the duration of a school term
type TooManyRequestsError ¶
TooManyRequestsError indicates the number of requests has exceeded the rate limit
func (*TooManyRequestsError) Error ¶
func (err *TooManyRequestsError) Error() string
TooManyRequestsError creates a TooManyRequestsError