Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add api contract for users/discord-sync #120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ number and email address.

## **Requests**

| Route | Description |
| :-------------------------------------------------: | :----------------------------------: |
| [GET /users](#get-users) | Returns all users in the system |
| [GET /users/self](#get-usersSelf) | Returns the logged in user's details |
| [GET /users/userId/:userId](#get-usersuseriduserid) | Returns user with given userId |
| [GET /users/:username](#get-usersusername) | Returns user with given username |
| [GET /users/:userId/badges](#get-usersidbadges) | Returns badges assigned to the user |
| [POST /users](#post-users) | Creates a new User |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |
| Route | Description |
| :--------------------------------------------------: | :----------------------------------: |
| [GET /users](#get-users) | Returns all users in the system |
| [GET /users/self](#get-usersSelf) | Returns the logged in user's details |
| [GET /users/userId/:userId](#get-usersuseriduserid) | Returns user with given userId |
| [GET /users/:username](#get-usersusername) | Returns user with given username |
| [GET /users/:userId/badges](#get-usersidbadges) | Returns badges assigned to the user |
| [POST /users](#post-users) | Creates a new User |
| [POST /users/discord-sync](#post-users-discord-sync) | Syncs RDS users with Discord members |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |

## **GET /users**

Expand Down Expand Up @@ -236,6 +237,31 @@ Creates a new User.
- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`

## **POST /users/discord-sync**

Sync RDS users with Discord server members using an `inDiscord` flag.

- **Params**
None
- **Query**
None
- **Headers**
Content-Type: application/json
- **Cookie**
rds-session: `<JWT>`
- **Body**
None
- **Success Response:**
- **Code:** 200
- **Content:** `{ markedTrue : <number>, markedFalse: <number>, unchanged: <number> }`
- **Error Response:**
- **Code:** 401
- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
- **Code:** 503
- **Content:**
`{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }`

## **PATCH /users/self**

Updates data of the User.
Expand Down