npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uoft-canvas-api

v1.1.0

Published

Canvas LMS API for Node

Downloads

4

Readme

npm version JavaScript Style Guide tested with jest

Canvas LMS API for Node.js

Canvas API functions bundled as a NPM package for Node.js.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for use with your own API tokens and Canvas domains.

Prerequisites

  1. Install Node 8.0.0 or greater.

Installation

To use with node:

$ npm install uoft-canvas-api

Then, in wherever you want to use this package:

const canvasAPI = require('uoft-canvas-api')

Rename the sample.env file to .env and add your institution's domain and API access token.

For UofT:

CANVAS_API_TOKEN={YOUR_TOKEN_FROM_QUERCUS}
CANVAS_API_DOMAIN=https://q.utoronto.ca/api/v1

Attached to the canvasAPI are a bunch of functions. Run the attached functions!

Example Usage

Get information about self:

const canvasAPI = require('uoft-canvas-api')

canvasAPI.getSelf()
  .then(self => console.log(self))

Get students in a course:

const { getUsersInCourse, getOptions } = require('uoft-canvas-api')

getUsersInCourse(12345, getOptions.users.enrollmentType.student) // first argument is Canvas course ID
  .then(students => console.log(students))

Contribute

Contributions are welcome and greatly appreciated!

How to contribute

  1. Create an issue describing what contribution you are planning to make.
  2. Fork the repo.
  3. Add your contributions to the source directory (and not the src directory. This directory is generated by Rollup during the build phase, and is what gets published to npm.)
  4. If you add a file to source, please add the file to the existing index.js inside source, so that during the build your contribution will be included in src.
  5. Test your code by creating a file in the root of the project directory, importing your code addition from src, and running it.
  6. Once you're happy with your contribution, open an pull request and I'll take a look.

Hypothetical scenario for adding new feature

  1. Add new file to source folder (say that the new file you want to add is getUsersWithGradeThreshold.js)
  2. In the source folder, there’s an index.js file that lists all of the files you want exported to src. There you will add: export { default as getUsersWithGradeThreshold } from './getUsersWithGradeThreshold'
  3. Run npm run build, which will build the project and output your new function into src.
  4. In the index.js at the root of the project that you create (this is not the index.js that’s in the source folder), import your new file from src like this: const getUsersWithGradeThreshold = require('.src/getUsersWithGradeThreshold') and test by running the code: node index.js.
  5. Once you’re happy that it works, create a PR.

Authors

License

This project is licensed under the MIT License.