Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kpfromer/cu-api
An API for CU Boulder students.
https://github.com/kpfromer/cu-api
api colorado cu cu-boulder javascript typescript university university-of-colorado
Last synced: about 1 month ago
JSON representation
An API for CU Boulder students.
- Host: GitHub
- URL: https://github.com/kpfromer/cu-api
- Owner: kpfromer
- License: mit
- Created: 2020-04-13T19:12:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T05:10:17.000Z (7 months ago)
- Last Synced: 2024-04-23T09:06:53.990Z (7 months ago)
- Topics: api, colorado, cu, cu-boulder, javascript, typescript, university, university-of-colorado
- Language: TypeScript
- Size: 151 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cu-api
[![npm
version](https://badge.fury.io/js/cu-api.svg)](https://badge.fury.io/js/cu-api)
[![Release](https://github.com/kpfromer/cu-api/actions/workflows/release.yaml/badge.svg?branch=master)](https://github.com/kpfromer/cu-api/actions/workflows/release.yaml)## 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
```javascript
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
```javascript
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](LICENSE).