Skip to content
This repository has been archived by the owner on Mar 24, 2019. It is now read-only.

Latest commit

 

History

History
180 lines (131 loc) · 4.95 KB

README.md

File metadata and controls

180 lines (131 loc) · 4.95 KB

Archive Notice

Due to changes to the UW Quest authentication API, and my lack of personal use of this repository, I am deprecating this client library—it will no longer be maintained.

uwquest

A Golang client for the UWaterloo Quest API.

GoDoc: Documentation Tags Travis: Build Codecov: Coverage Go Report Card

Why?

I wanted to programmatically check my grades, and other stuff like that. Maybe get my grades emailed to me when they come out? But I didn't find any good Quest clients that could let me build those kinds of things.

So that's why I built this, with the hope that a time will come where anybody can build programs that use information from Quest.

Features

  • Quest login and authentication.
  • Fetching grades data from Quest.
  • Fetching class schedule information.
  • Unofficial transcripts?
  • Course add / drop / shopping carts?
  • ??? other stuff ???

Open an issue to request a new feature that you want to see added to uwquest!

Usage

To use the uwquest package as a library, just open up your Golang project directory, and run:

go get -u github.com/stevenxie/uwquest

Then, start coding!

For example, here's a program that will fetch your grades for the Fall 2018 term:

package main

import (
	"fmt"
	"log"

	"github.com/stevenxie/uwquest"
)

func main() {
	// Create a Quest client.
	quest, _ := uwquest.NewClient()

	// Login to Quest.
	if err := quest.Login("fhamphalladur", "mrgoose2018"); err != nil {
		log.Fatalf("Failed to login to Quest: %v", err)
	}

	// Fetch all study terms.
	terms, err := quest.Terms()
	if err != nil {
		log.Fatalf("Failed to fetch terms: %v", err)
	}

	// Find the term that's named "Fall 2018".
	var target *uwquest.Term
	for _, term := range terms {
		if term.Name == "Fall 2018" {
			target = term
		}
	}
	if target == nil {
		fmt.Println("No such term with the name 'Fall 2018' 😓")
	}

	// Fetch grade for the target term.
	grades, err := quest.Grades(target.ID)
	if err != nil {
		log.Fatalf("Failed to fetch grades: %v", err)
	}

	// Print grades.
	fmt.Println("Found grades for the Fall 2018 term:")
	for _, grade := range grades {
		fmt.Printf(" • %v\n", grade)
	}
}

This program will output something like:

Found grades for the Fall 2018 term:
 • CourseGrade{ID: 0, Name: CS 245, Description: Logic and Computation, GradingBasis: Numeric Grading Basis, Units: 0.500000, Grade: DNW, GradePoints: 16.000000}
 • CourseGrade{ID: 1, Name: CS 246, Description: Object-Oriented Software Devel, GradingBasis: Numeric Grading Basis, Units: 0.500000, Grade: 71, GradePoints: 35.500000}
 • CourseGrade{ID: 2, Name: MATH 128, Description: Calculus 2 for the Sciences, GradingBasis: Numeric Grading Basis, Units: 0.500000, Grade: 62, GradePoints: 31.000000}
 • CourseGrade{ID: 3, Name: MATH 136, Description: Linear Algebra 1 (Hon Math), GradingBasis: Numeric Grading Basis, Units: 0.500000, Grade: 60, GradePoints: 30.000000}

Example Programs

Check out the examples/ directory for example programs, like gradecheck. Some of these programs might be useful to you on their own, but if anything they'll be a good way to understand how to make something with this library.

gradecheck lists your grades.

It will check for the environment variables QUEST_USER and QUEST_PASS, and if they don't exist it will ask you for those missing values.

Installation:

Make sure you have Go installed.

## Download and install into $GOBIN:
$ go get github.com/stevenxie/uwquest/examples/gradecheck

## Run:
$ gradecheck

Contributing

Want to help develop this? Just clone this repository (or a fork of it):

git clone git@github.com:stevenxie/uwquest

Make sure to set up git-hooks and other dependencies with:

make setup

Disclaimer

Maybe you're looking at this and you're an employer. And... you think my grades are really bad.

Um.

Whoops?

I'll try harder next term, I promise.

Please... please still consider hiring me...