Skip to content

harrybrwn/go-canvas

Repository files navigation

go-canvas

An API client for Instructure's Canvas API.

Build Status GoDoc Go Report Card codecov TODOs

Download/Install

go get github.com/harrybrwn/go-canvas

Getting Started

  1. Get a token from your canvas account, this should help.
  2. Give the token to the library
    • Set $CANVAS_TOKEN environment variable
    • Call canvas.SetToken or canvas.New
  3. For more advance usage, viewing the canvas API docs and using the canvas.Option interface will be usful for more fine-tuned api use.

Concurrent Error Handling

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)
}

TODO

  • Groups
  • Outcome Groups
  • Favorites
  • Submissions
    • submiting assignments
    • file upload on assginments