An API for CU Boulder students.
Find a file
2021-08-18 15:57:50 -06:00
.github/workflows chore: remove travis and add github action 2021-08-18 15:27:07 -06:00
src chore: add cli for testing changes 2021-08-18 15:53:01 -06:00
.gitignore chore: update file modes 2021-08-18 15:43:48 -06:00
.npmignore chore: update file modes 2021-08-18 15:43:48 -06:00
.prettierrc.js chore: update file modes 2021-08-18 15:43:48 -06:00
CHANGELOG.md chore(release): 4.0.0 [skip ci] 2021-08-18 21:56:11 +00:00
commitlint.config.js chore: update file modes 2021-08-18 15:43:48 -06:00
LICENSE chore: update file modes 2021-08-18 15:43:48 -06:00
package.json chore(release): 4.0.0 [skip ci] 2021-08-18 21:56:11 +00:00
pnpm-lock.yaml chore: add cli for testing changes 2021-08-18 15:53:01 -06:00
README.md docs: update to mention libsecret 2021-08-18 15:53:12 -06:00
renovate.json chore: update file modes 2021-08-18 15:43:48 -06:00
tsconfig.json chore: update file modes 2021-08-18 15:43:48 -06:00
tslint.json chore: update file modes 2021-08-18 15:43:48 -06:00

cu-api

npm
version Release

Disclaimer

This project was created by me (Kyle Pfromer) and has no endorsement by the University of Colorado.

Installation

npm install --save cu-api

yarn add cu-api

Usage

The api code is written with TypeScript, but also works with JavaScript (typings are included).

Create a session and login. Then get all the data you need with the session (the session acts as a logged in user, saving time).

ES6

import { CUSession } from 'cu-api';

(async function () {
  const session = new CUSession();
  await session.init('username', 'password');
  console.log(session.loggedIn);
  console.log(await session.userData());
  console.log(await session.termData());
  console.log(await session.GPA());
  console.log(await session.classTermData('2201'));
})();

ES5

const CUSession = require('cu-api').CUSession;

(async function () {
  const session = new CUSession();
  await session.init('username', 'password');
  console.log(session.loggedIn);
  console.log(await session.userData());
  console.log(await session.termData());
  console.log(await session.GPA());
  console.log(await session.classTermData('2201'));
})();

CLI

Make sure to install libsecret (https://github.com/atom/node-keytar).

How it Works

cu-api uses superagent a http request library to act like a user and login (the CU login process is really convoluted). When logged in it accesses the backend API used by the buffportal Angular application to grab the data you need. You have access to everything the buffportal has access to!

Requirements

You must have nodejs installed. This will not work on the browser since I had to self sign a certificate for buffportal.

License

cu-api is MIT licensed.