An API client for Instructure's Canvas API.
go get github.com/harrybrwn/go-canvas
- Get a token from your canvas account, this should help.
- Give the token to the library
- Set
$CANVAS_TOKEN
environment variable - Call
canvas.SetToken
orcanvas.New
- Set
- For more advance usage, viewing the canvas API docs and using the
canvas.Option
interface will be usful for more fine-tuned api use.
Error handling for functions that return a channel and no error is done with a callback. This callback is called ConcurrentErrorHandler
and in some cases, a struct may have a SetErrorHandler
function.
canvas.ConcurrentErrorHandler = func(e error) error {
if canvas.IsRateLimit(e) {
fmt.Println("rate limit reached")
return nil
}
return e
}
for f := range canvas.Files() {
fmt.Println(f.Filename, f.ID)
}
- Groups
- Outcome Groups
- Favorites
- Submissions
- submiting assignments
- file upload on assginments