Documentation
¶
Overview ¶
Package clever is a Go library for the Clever API: https://clever.com/developers/docs.
Usage
package main
import (
"golang.org/x/oauth2"
clevergo "gopkg.in/Clever/clever-go.v2"
"log"
)
func main() {
t := &oauth.Transport{
Source: oauth.StaticTokenSource(&oauth2.Token{AccessToken: "DEMO_TOKEN"}),
}
client := &http.client{Transport: t}
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 Contact
- type ContactResp
- type Credentials
- type District
- type DistrictAdmin
- type DistrictAdminResp
- type DistrictResp
- type Event
- type EventResp
- type Link
- type Location
- type Name
- type PagedResult
- type Paging
- type Principal
- type School
- type SchoolAdmin
- type SchoolAdminResp
- type SchoolResp
- type Section
- type SectionResp
- type Student
- type StudentResp
- type Teacher
- type TeacherResp
- type Term
- type TooManyRequestsError
Constants ¶
const Version = "1.4.0"
Version is the current Clever API version.
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 Contact ¶
type Contact struct {
ID string
Student string
Type string
Name string
Relationship string
Phone string
PhoneType string `json:"phone_type"`
Email string
District string
}
Contact corresponds to the Contact resource in the Clever data schema: clever.com/schema
type ContactResp ¶
ContactResp wraps the response given when the user queries for a Contact
type Credentials ¶
type Credentials struct {
DistrictUsername string `json:"district_username"`
}
Credentials corresponds to credentials for a Student or Teacher
type District ¶
District corresponds to the District resource in the Clever data schema: clever.com/schema
type DistrictAdmin ¶
DistrictAdmin corresponds to the DistrictAdmin resource in the Clever data schema: clever.com/schema
type DistrictAdminResp ¶
type DistrictAdminResp struct {
Links []Link
DistrictAdmin DistrictAdmin `json:"data"`
}
DistrictAdminResp wraps the response given when the user queries for a DistrictAdmin
type DistrictResp ¶
DistrictResp wraps the response given when the user queries for a District
type Event ¶ added in v1.4.0
type Event struct {
Type string
Created string
ID string
Data struct {
Object map[string]interface{}
}
}
Event represents a data change on an underlying collection. Example types include students.created and teachers.deleted.
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"`
MdrNumber string `json:"mdr_number"`
Principal Principal
}
School corresponds to the School resource in the Clever data schema: clever.com/schema
type SchoolAdmin ¶
type SchoolAdmin struct {
ID string
District string
Name Name
Title string
Email string
Schools []string
StaffID string `json:"staff_id"`
}
SchoolAdmin corresponds to the SchoolAdmin resource in the Clever data schema: clever.com/schema
type SchoolAdminResp ¶
type SchoolAdminResp struct {
Links []Link
SchoolAdmin SchoolAdmin `json:"data"`
}
SchoolAdminResp wraps the response given when the user queries for a SchoolAdmin
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 Term
Teachers []string
CourseDescription string `json:"course_description"`
Period string
SectionNumber string `json:"section_number"`
}
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"`
EllStatus string `json:"ell_status"`
Credentials Credentials
}
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
StateID string `json:"state_id"`
Credentials Credentials
}
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
