Skip to content

Commit 00afcee

Browse files
updated api contract for discord invite
1 parent 0d3612a commit 00afcee

File tree

1 file changed

+55
-34
lines changed

1 file changed

+55
-34
lines changed

discord-actions/README.md

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## **Requests**
44

5-
| Route | Description |
6-
| :--------------------------: | :-----------------------: |
7-
| [GET /discord/invites](#get-discord-actions-invites) | return all the invites generated |
8-
[POST /discord/invites](#post-discord-actions -invites) | generates a invite for a user |
5+
| Route | Description |
6+
| :-----------------------------------------------------: | :------------------------------: |
7+
| [GET /discord/invites](#get-discord-actions-invites) | return all the invites generated |
8+
| [POST /discord/invites](#post-discord-actions -invites) | generates a invite for a user |
9+
910
---
1011

1112
## **GET /discord-actions/invite**
@@ -28,11 +29,12 @@
2829
```json
2930
{
3031
"message": "Invite return successfully!",
31-
"inviteLink": "discord_invite_link_here"
32+
"inviteLink": "discord_invite_link_here"
3233
}
3334
```
3435

3536
- **Error Responses:**
37+
3638
- **Code:** 401
3739
- **Content:**
3840
```json
@@ -58,6 +60,7 @@
5860
"message": "Invite not found for user!"
5961
}
6062
```
63+
6164
- **Code:** 500
6265
- **Content:**
6366
```json
@@ -70,51 +73,69 @@
7073

7174
## **POST /discord/invites**
7275

73-
- 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
76+
- 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:
77+
- The user should not be archieved
78+
- The user should have one of these roles, if they want to directly generate a invite: product_manager, designer, maven
79+
- If they don't have the roles mentioned above, they should have profileStatus approved
7480

7581
- **Params**\
76-
None
82+
None
7783
- **Query**\
78-
- 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
84+
- 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
7985
- **Body**\
80-
None
86+
None
8187
- **Headers**\
82-
None
88+
None
8389
- **Cookie**\
84-
None
90+
None
8591
- **Success Response:**
86-
- **Code:** 201
87-
- **Content:**
88-
```json
89-
{
90-
"message": "Invite created successfully.",
91-
"inviteLink": "string",
92-
}
93-
```
92+
93+
- **Code:** 201
94+
- **Content:**
95+
```json
96+
{
97+
"message": "Invite created successfully.",
98+
"inviteLink": "string"
99+
}
100+
```
94101
- **Code:** 401
95102
- **Content:**
96103
```json
97-
{
98-
"statusCode": 401,
99-
"error": "Unauthorized",
100-
"message": "Unauthenticated user"
101-
}
104+
{
105+
"statusCode": 401,
106+
"error": "Unauthorized",
107+
"message": "Unauthenticated user"
108+
}
102109
```
103110
- **Code:** 409
111+
104112
- **Content:**
105113
```json
106-
{
107-
"message": "User invite is already present!"
114+
{
115+
"message": "User invite is already present!"
116+
}
117+
```
118+
119+
- **Code:** 403
120+
- **Content:**
121+
```json
122+
{
123+
"statusCode": 403,
124+
"error": "Forbidden",
125+
"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"
108126
}
109127
```
110128

111129
- **Error Response:**
112-
- **Code:** 500
113-
- **Content:**
114-
```json
115-
{
116-
"statusCode": 500,
117-
"error": "Internal Server Error",
118-
"message": "An internal server error occurred"
119-
}
130+
- **Code:** 500
131+
- **Content:**
132+
```json
133+
{
134+
"statusCode": 500,
135+
"error": "Internal Server Error",
136+
"message": "An internal server error occurred"
137+
}
120138
```
139+
```
140+
141+
```

0 commit comments

Comments
 (0)