https://github.com/harrybrwn/go-canvas
A client for Instructure's Canvas API
https://github.com/harrybrwn/go-canvas
api canvas canvas-lms instructure
Last synced: about 1 year ago
JSON representation
A client for Instructure's Canvas API
- Host: GitHub
- URL: https://github.com/harrybrwn/go-canvas
- Owner: harrybrwn
- License: apache-2.0
- Created: 2020-05-17T19:20:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T03:19:47.000Z (almost 6 years ago)
- Last Synced: 2025-05-09T00:54:03.174Z (about 1 year ago)
- Topics: api, canvas, canvas-lms, instructure
- Language: Go
- Homepage:
- Size: 306 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-canvas
An API client for Instructure's Canvas API.
[](https://travis-ci.com/harrybrwn/go-canvas)
[](https://pkg.go.dev/github.com/harrybrwn/go-canvas?tab=doc)
[](https://goreportcard.com/report/github.com/harrybrwn/go-canvas)
[](https://codecov.io/gh/harrybrwn/go-canvas)
[](https://www.tickgit.com/browse?repo=github.com/harrybrwn/go-canvas)
## Download/Install
```
go get github.com/harrybrwn/go-canvas
```
## Getting Started
1. Get a token from your canvas account, [this](https://community.canvaslms.com/docs/DOC-16005-42121018197) 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](https://canvas.instructure.com/doc/api/index.html) 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.
```go
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