API Canvas

Who? What? How? Input? Output? Goal
Visitors Get statistics Use pre-set buttons to get statistics (ex: time-based, day-based, etc.) - Github username

API Contract

v1.0


# Stats

- Stats object

{ type: string morning: float, afternoon: float, evening: float, night: float, }


**GET /stats/:user_name/:repo_name/:timezone**

Returns all stats for the specified user name, repository name, and timezone

- **URL Params**

  _Required:_ `user_name=[string]`

  _Required:_ `repo_name=[string]`

  _Required:_ `timezone=[string] TZDB identifier`

- **Data Params**
  None
- **Headers**
  Content-Type: application/json
- **Success Response:**

  - **Code:** 200

    **Content:**

    ```
    {
    stats: [
            {<stats_object>}
            ]
    }
    ```

- **Error Response:**

  - **Code:** 404

    **Content:** `{ error : "Username and/or repo name do not exist in Github" }`

  - **Code:** 400

    **Content:** `{ error : "User name or repo name are not valid" }`

  - **Code:** 429

    **Content:** `{ error : "Too many requests sent to Github" }`

  - **Code:** 500

    **Content:** `{ error : "Could not fetch data from Github API" }`

v2.0