Categorygithub.com/mercedtime/api
module
0.0.0-20210214190621-52ed2a879018
Repository: https://github.com/mercedtime/api.git
Documentation: pkg.go.dev

# README

MercedTime's REST API

methodendpointdescriptionprotected
GET/lecturesList lectures
GET/labsList labs
GET/examsList exams
GET/discussionsList discussions
GET/instructorsList instructors
GET/coursesGet a list of courses
GET/lecture/:crnGet a lecture
DELETE/lecture/:crnDelete a lecture✔️
GET/lecture/:crn/examGet a lecture's exam
GET/lecture/:crn/labsGet a lecture's lab sections
GET/lecture/:crn/instructorGet a lecture's list of instructors
GET/user/:idGet a user✔️
POST/userCreate a user✔️
DELETE/user/:idDelete a user✔️
POST/loginGet login credentials
GET/catalog/:year/:termGet the full course catalog for one semester
GET/catalog/:year/:term/coursesGet a list of courses

TODO: Coding Shit

  • PUT /user For updating a user
  • GET /subject Get a subject code, description, and id
  • GET /refresh For getting a refresh token
  • Add a sign in with email option (probably just changing the request body for /login).
  • GET /lecture/:crn/enrollment For getting the historic enrollment stats
  • GET /standalone
  • Add a "last notified" field to the user table. If we want to do notifications in the future we will probably need to do date comparisons with recently updated courses
  • To control which year and term for which the data is returned, write a "State" struct that contains this global route state to be accessed globally be the api. (maybe make a new internal package routes with "routes.State")

TODO: Thinking Shit

  • Need to build a prerequisites tree.
  • The instructor id system is a horrible hack, use a SERIAL type instead
  • To make this useful for different terms, we cannot rely on crn as our only primary key, need to start making my own course ids

POST /login

Get access to protected resources by giving the login endpoint your credentials.

Example Request Body:

{
    "username": "my username",
    "password": "*R(Py*(P*F$JIjF:EJ"
}

Responses with a JSON Web Token (JWT)

GET /lectures

  • limit=<limit> int Limit the number of results to <limit>
  • offset=<offset> int Offset the response list by some offset number
  • subject=<code> string Only return the lectures for the subject that matches <code>
Example Response
{}

GET /labs

  • limit=<limit> int Limit the number of results to <limit>
  • offset=<offset> int Offset the response list by some offset number
Example Response
{}

GET /exams

  • limit=<limit> int Limit the number of results to <limit>
  • offset=<offset> int Offset the response list by some offset number
Example Response
{}

GET /discussions

  • limit=<limit> int Limit the number of results to <limit>
  • offset=<offset> int Offset the response list by some offset number
Example Response
{}

GET /instructors

  • limit=<limit> int Limit the number of results to <limit>
  • offset=<offset> int Offset the response list by some offset number
Example Response
{}


Errors

Most of the endpoints will respond with the same error type that looks something like this.

{
    "error": "you did a bad thing",
    "status": 400
}

Configuration

# mt.yml
host: 0.0.0.0
port: 8080
secret: 'some long string'
in_memory_rate_store: true

tls: true
cert: ./mercedtime.com+4.pem
key: ./mercedtime.com+4-key.pem

db:
  driver: 'postgres'
  password: 'database password here'
  name: 'database name'
  port: 5432
  user: 'database user'
  ssl: 'disable'

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author