generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from Real-Dev-Squad/api-contract/discord-invite
API contract for discord API
- Loading branch information
Showing
1 changed file
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# discord-actions | ||
|
||
## **Requests** | ||
|
||
| Route | Description | | ||
| :-----------------------------------------------------: | :------------------------------: | | ||
| [GET /discord-actions/invites](#get-discord-actions-invites) | return all the invites generated | | ||
| [POST /discord-actions/invites](#post-discord-actions-invites) | generates a invite for a user | | ||
|
||
--- | ||
|
||
## **GET /discord-actions/invite** | ||
|
||
- return the discord invite created for the user | ||
|
||
- **Query** | ||
|
||
- Optional: `userId=[string]`: if this is provided it returns the invite of the user whose userId is provided in the query param, if the user is not a super user then this should be equal to the userId of the user, if no userId is provided, it return invite for the user who has made the request | ||
|
||
- **Headers** | ||
None | ||
- **Cookie** | ||
rds-session: `<JWT>` | ||
|
||
- **Success Response:** | ||
|
||
- **Code:** 200 | ||
- **Content:** | ||
```json | ||
{ | ||
"message": "Invite return successfully!", | ||
"inviteLink": "discord_invite_link_here" | ||
} | ||
``` | ||
|
||
- **Error Responses:** | ||
|
||
- **Code:** 401 | ||
- **Content:** | ||
```json | ||
{ | ||
"statusCode": 401, | ||
"error": "Unauthorized", | ||
"message": "You are not authorized for this action." | ||
} | ||
``` | ||
- **Code:** 403 | ||
|
||
- **Content:** | ||
```json | ||
{ | ||
"message": "You do not have permission to access this resource." | ||
} | ||
``` | ||
- **Code:** 404 | ||
|
||
- **Content:** | ||
```json | ||
{ | ||
"message": "Invite not found for user!" | ||
} | ||
``` | ||
|
||
- **Code:** 500 | ||
- **Content:** | ||
```json | ||
{ | ||
"statusCode": 500, | ||
"error": "Internal Server Error", | ||
"message": "Something went wrong. Please contact admin" | ||
} | ||
``` | ||
|
||
## **POST /discord/invites** | ||
|
||
- This Api is used to create a discord invite for the user, invite for a particular user can be generated by a super user or a that user only, invite for a particular user can be created only once, Following conditions will be there for creating invite for the user: | ||
- The user should not be archieved | ||
- The user should have one of these roles, if they want to directly generate a invite: product_manager, designer, maven | ||
- If they don't have the roles mentioned above, they should have profileStatus approved | ||
|
||
- **Params**\ | ||
None | ||
- **Query**\ | ||
- Optional: `userId=[string]`: if this is provided it create the invite for that userId if the user is a super user, if this is not provided it create invite for the user making the request | ||
- **Body**\ | ||
None | ||
- **Headers**\ | ||
None | ||
- **Cookie**\ | ||
None | ||
- **Success Response:** | ||
|
||
- **Code:** 201 | ||
- **Content:** | ||
```json | ||
{ | ||
"message": "Invite created successfully.", | ||
"inviteLink": "string" | ||
} | ||
``` | ||
- **Code:** 401 | ||
- **Content:** | ||
```json | ||
{ | ||
"statusCode": 401, | ||
"error": "Unauthorized", | ||
"message": "Unauthenticated user" | ||
} | ||
``` | ||
- **Code:** 409 | ||
|
||
- **Content:** | ||
```json | ||
{ | ||
"message": "User invite is already present!" | ||
} | ||
``` | ||
|
||
- **Code:** 403 | ||
- **Content:** | ||
```json | ||
{ | ||
"statusCode": 403, | ||
"error": "Forbidden", | ||
"message": "User should be super user to generate link for other users" "||" "Only users who have never joined discord can generate invite link" "||" "Archived users cannot generate invite" "||" "Only selected roles can generate discord link directly" | ||
} | ||
``` | ||
|
||
- **Error Response:** | ||
- **Code:** 500 | ||
- **Content:** | ||
```json | ||
{ | ||
"statusCode": 500, | ||
"error": "Internal Server Error", | ||
"message": "An internal server error occurred" | ||
} | ||
``` | ||
``` | ||
|
||
``` |