Skip to content

Commit 14be1cd

Browse files
meldunnkrubenok
andcommitted
automatically generate postman collections
uses apidoc-postman to generate api collection from api docs Co-Authored-By: Kyle Rubenok <[email protected]>
1 parent 40b6988 commit 14be1cd

9 files changed

+12752
-5652
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Please delete options that are not relevant.
1515
- [ ] New feature (non-breaking change which adds functionality)
1616
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1717
- [ ] New release
18-
- [ ] This change requires a documentation update
18+
- [ ] This change requires a documentation update (run `npm run docs` and `npm run docs-postman` after changes)
1919

2020
### How has this been tested?
2121

@@ -24,12 +24,6 @@ Please describe the tests that you ran to verify your changes. Provide instructi
2424
- [ ] Test A
2525
- [ ] Test B
2626

27-
**Test Configuration**:
28-
29-
**Firmware version:**
30-
**Hardware:**
31-
**Toolchain:**
32-
**SDK:**
3327

3428
### Questions for code reviewers?
3529

docs/api/api_data.js

+25-25
Large diffs are not rendered by default.

docs/api/api_data.json

+25-25
Large diffs are not rendered by default.

docs/api/api_project.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
define({ "name": "hackerAPI", "version": "0.0.8", "description": "Documentation for the API used for mchacks", "defaultVersion": "0.0.8", "title": "hackerAPI documentation", "url": "https://api.mchacks.ca/api", "sampleUrl": "https://api.mchacks.ca/api", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-11-01T22:01:33.009Z", "url": "http://apidocjs.com", "version": "0.17.7" }});
1+
define({
2+
"name": "hackerAPI",
3+
"version": "0.0.8",
4+
"description": "Documentation for the API used for mchacks",
5+
"defaultVersion": "0.0.8",
6+
"title": "hackerAPI documentation",
7+
"url": "https://api.mchacks.ca/api",
8+
"sampleUrl": "https://api.mchacks.ca/api",
9+
"apidoc": "0.3.0",
10+
"generator": {
11+
"name": "apidoc",
12+
"time": "2021-06-15T03:37:22.945Z",
13+
"url": "http://apidocjs.com",
14+
"version": "0.17.7"
15+
}
16+
});

docs/api/api_project.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
{ "name": "hackerAPI", "version": "0.0.8", "description": "Documentation for the API used for mchacks", "defaultVersion": "0.0.8", "title": "hackerAPI documentation", "url": "https://api.mchacks.ca/api", "sampleUrl": "https://api.mchacks.ca/api", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-11-01T22:01:33.009Z", "url": "http://apidocjs.com", "version": "0.17.7" }}
1+
{
2+
"name": "hackerAPI",
3+
"version": "0.0.8",
4+
"description": "Documentation for the API used for mchacks",
5+
"defaultVersion": "0.0.8",
6+
"title": "hackerAPI documentation",
7+
"url": "https://api.mchacks.ca/api",
8+
"sampleUrl": "https://api.mchacks.ca/api",
9+
"apidoc": "0.3.0",
10+
"generator": {
11+
"name": "apidoc",
12+
"time": "2021-06-15T03:37:22.945Z",
13+
"url": "http://apidocjs.com",
14+
"version": "0.17.7"
15+
}
16+
}

docs/api/postman.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"info":{"name":"hackerAPI","description":"Documentation for the API used for mchacks","version":"0.0.8","schema":"https://schema.getpostman.com/json/collection/v2.1.0/"},"item":[{"name":"Account","item":[{"name":"gets information from an account with mongoid ':id'","request":{"auth":null,"method":"GET","url":"{{base_url}}/account/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"Get all of the invites.","request":{"auth":null,"method":"GET","url":"{{base_url}}/account/invite","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get information about own account","request":{"auth":null,"method":"GET","url":"{{base_url}}/account/self","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new account","request":{"auth":null,"method":"POST","url":"{{base_url}}/account/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"invites a user to create an account with the specified accountType","request":{"auth":null,"method":"POST","url":"{{base_url}}/account/invite","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update an account's information","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/account/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Authentication","item":[{"name":"retrieve rolebindings for a user given by their user id :id","request":{"auth":null,"method":"GET","url":"{{base_url}}/auth/rolebindings/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get roles","request":{"auth":null,"method":"GET","url":"{{base_url}}/auth/roles","header":[],"body":{"mode":"raw","raw":""}}},{"name":"logout of service","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: public_token}}","type":"string"}]},"method":"GET","url":"{{base_url}}/auth/logout","header":[],"body":{"mode":"raw","raw":""}}},{"name":"resend confirmation token","request":{"auth":null,"method":"GET","url":"{{base_url}}/auth/confirm/resend","header":[],"body":{"mode":"raw","raw":""}}},{"name":"confirm account using the JWT in :token","request":{"auth":null,"method":"POST","url":"{{base_url}}/auth/confirm/:token","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"forgot password route","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: public_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/auth/password/forgot","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"login to the service","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: public_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/auth/login","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"reset password","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: must have authentication token_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/auth/password/reset","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"change password for logged in user","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: Must be logged in_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/auth/password/change","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Hacker","item":[{"name":"get a hacker's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/hacker/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get a hacker's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/hacker/email/:email","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get the resume for a hacker.","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Must be logged in, and the account id must be linked to the hacker._token}}","type":"string"}]},"method":"GET","url":"{{base_url}}/hacker/resume:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"Gets the stats of all of the hackers who have applied.","request":{"auth":null,"method":"GET","url":"{{base_url}}/hacker/stats","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get information about logged in sponsor","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{: Sponsor_token}}","type":"string"}]},"method":"GET","url":"{{base_url}}/sponsor/self","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get information about own hacker","request":{"auth":null,"method":"GET","url":"{{base_url}}/hacker/self","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new hacker","request":{"auth":null,"method":"POST","url":"{{base_url}}/hacker/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"upload or update resume for a hacker.","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Must be logged in, and the account id must be linked to the hacker._token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/hacker/resume/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/hacker/email/dayOf/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/hacker/email/weekOf/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"POST","url":"{{base_url}}/hacker/email/weekOf/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"accept array of Hackers","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/batchAccept/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"accept a Hacker","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/accept/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"accept a Hacker by email","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/acceptEmail/:email","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a hacker's status to be 'Checked-in'. Note that the Hacker must eitehr be Accepted or Confirmed.","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/checkin/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a hacker's information.","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/hacker/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"Allows confirmation of hacker attendence if they are accepted. Also allows change from 'confirmed' to 'withdrawn'.","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/confirmation/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a hacker's status","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/hacker/status/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Index","item":[{"name":"version","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{public_token}}","type":"string"}]},"method":"GET","url":"{{base_url}}/","header":[],"body":{"mode":"raw","raw":""}}}]},{"name":"Role","item":[{"name":"create a new role","request":{"auth":null,"method":"POST","url":"{{base_url}}/api/role/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Search","item":[{"name":"provide a specific query for any defined model","request":{"auth":null,"method":"GET","url":"{{base_url}}/search/","header":[],"body":{"mode":"raw","raw":""}}}]},{"name":"Settings","item":[{"name":"Get the settings for the current hackathon","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{public_token}}","type":"string"}]},"method":"GET","url":"{{base_url}}/settings/","header":[],"body":{"mode":"raw","raw":""}}},{"name":"Patch the settings for the current hackathon","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrators_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/settings/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Sponsor","item":[{"name":"get a sponsor's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/sponsor/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new sponsor","request":{"auth":null,"method":"POST","url":"{{base_url}}/sponsor/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a sponsor","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/sponsor/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Team","item":[{"name":"get a team's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/team/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new team consisting of only the logged in user","request":{"auth":null,"method":"POST","url":"{{base_url}}/team/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"Allows a logged in hacker to leave current team","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/team/leave/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"Allows a logged in hacker to join a team by name","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/team/join/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"Update a team's information. The team is specified by the hacker belonging to it.","request":{"auth":null,"method":"PATCH","url":"{{base_url}}/team/:hackerId","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Travel","item":[{"name":"get a traveler's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/travel/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get a travel's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/travel/email/:email","header":[],"body":{"mode":"raw","raw":""}}},{"name":"get information about own hacker's travel","request":{"auth":null,"method":"GET","url":"{{base_url}}/travel/self","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new travel","request":{"auth":null,"method":"POST","url":"{{base_url}}/travel/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a traveler's offer","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/travel/offer/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}},{"name":"update a traveler's status","request":{"auth":{"type":"bearer","basic":[],"bearer":[{"key":"token","value":"{{Administrator_token}}","type":"string"}]},"method":"PATCH","url":"{{base_url}}/travel/status/:id","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]},{"name":"Volunteer","item":[{"name":"get a volunteer's information","request":{"auth":null,"method":"GET","url":"{{base_url}}/volunteer/:id","header":[],"body":{"mode":"raw","raw":""}}},{"name":"create a new volunteer","request":{"auth":null,"method":"POST","url":"{{base_url}}/volunteer/","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":""}}}]}]}

docs/getting-started.md

+17-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
2. `mongodb`: <https://docs.mongodb.com/manual/installation/>
1515
1. Make sure you also have the `/data/db` directory.
1616
2. To test the installation, run `mongod`.
17-
3. `node`: <https://nodejs.org/en/download/>
17+
3. `node`: <https://nodejs.org/en/download/> (Validated Node version is specified in [`.nvmrc`](../../hackerAPI/.nvmrc) )
1818
4. `npm`: <https://www.npmjs.com/get-npm>.
1919
5. `Postman`: <https://www.getpostman.com/downloads/>. We use this for testing the API locally.
20-
3. Make sure you have the following (only if you are going to be publishing this as a kubernetes cluster on google cloud):
21-
1. `kubectl`: <https://kubernetes.io/docs/tasks/tools/install-kubectl/>
22-
2. `gcloud`: <https://cloud.google.com/sdk/install>
23-
4. Create a `.env` file in the root directory, and populate the fields as per `.env.example`.
24-
5. run `npm install`
20+
3. Create a `.env` file in the root directory, and populate the fields as per `.env.example`.
21+
4. run `npm install`
2522

2623
## Setting up the database
2724

@@ -31,4 +28,17 @@
3128

3229
## Testing the API
3330

34-
In order to test that you have set up the API properly, run `npm run test`.
31+
### Automated Testing
32+
33+
In order to test that you have set up the API properly, run `npm run test`.
34+
35+
### Testing with Postman
36+
37+
1. Import Postman Collection from [`postman.json`](./api/postman.json)
38+
2. [Create a new Environment](https://learning.postman.com/docs/sending-requests/managing-environments/) in Postman with **Variables** for `base_url`. Typical values for these might look like this. You may or may not have the same credentials in your Dev Environment as the Production Database.
39+
40+
| | Local Dev Environment | Production Environment |
41+
|----------------|-----------------------|------------------------|
42+
| base_url | http://localhost:3000 | https://api.mchacks.ca |
43+
44+
API parameters are not currently automatically imported by the Postman generation script. A change to a different API Doc generation tool in future could make this a more supported use case by Postman.

0 commit comments

Comments
 (0)