Przeglądaj źródła

Update documentation to include friends

Matt Coles 9 lat temu
rodzic
commit
66b261c5ee
1 zmienionych plików z 42 dodań i 0 usunięć
  1. 42 0
      README.md

+ 42 - 0
README.md

@@ -31,6 +31,9 @@ Server for Integrated Project, powered by Express.js and Redis, listens only on
31 31
         * [/events/pending/](#eventspending)
32 32
         * [/events/accept/:eventid](#eventsaccepteventid)
33 33
         * [/events/decline/:eventid](#eventsdeclineeventid)
34
+    * __Friends__
35
+        * [/friends/add/](#friendsadd)
36
+        * [/friends/remove/](#friendsremove)
34 37
 
35 38
 ### Installation
36 39
 Instructions are for OSX El Capitan at time of writing.
@@ -468,3 +471,42 @@ The response will then look like this:
468 471
 ```
469 472
 The error codes are as follows, `1` indicates an invalid auth code, `2`
470 473
 indicates the event could not be found and `3` indicates a malformed request.
474
+
475
+### /friends/add/
476
+To add a new friend, a `POST` request should be sent with the following data:
477
+```javascript
478
+{
479
+    "friend": "MyFriend",
480
+    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
481
+}
482
+```
483
+The response will then look like this:
484
+```javascript
485
+{
486
+    "success": 1,
487
+    "error": 0
488
+}
489
+```
490
+The error codes are as follows, `1` indicates an invalid auth code, `2`
491
+indicates that the user is already a friend, `3` indicates that the user you are
492
+trying to add does not exist and `4` indicates a malformed request.
493
+
494
+### /friends/remove/
495
+To remove a friend from the friends list, a `POST` request should be sent with
496
+the following data:
497
+```javascript
498
+{
499
+    "friend": "MyFriend",
500
+    "auth": "$2a$10$qjkvbcPZ4YC7/a/I0ZpTaeJp6auXjGrG9pgAdI3PP61u4CftQPSL2"
501
+}
502
+```
503
+The response will then look like this:
504
+```javascript
505
+{
506
+    "success": 1,
507
+    "error": 0
508
+}
509
+```
510
+The error codes are as follows, `1` indicates an invalid auth code, `2`
511
+indicates that the user you are trying to remove is not an existing friend
512
+and `3` indicates a malformed request.