cu-api-test
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

cu-api

npm version Build Status

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'));
})();

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.

Package Sidebar

Install

npm i cu-api-test

Weekly Downloads

1

Version

2.3.0

License

MIT

Unpacked Size

22.4 kB

Total Files

11

Last publish

Collaborators

  • kpfromer