Skip to content

Commit 4a064c5

Browse files
discord invite API contract
1 parent 618ca00 commit 4a064c5

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

discord/README.md renamed to discord-actions/README.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,27 @@
55

66
```json
77
{
8+
"id": "string",
9+
"inviteLink": "string",
810
"userId": "string",
9-
"invite": "string",
10-
"timestamp": "<unix-timestamp>"
1111
}
1212
```
1313

1414
## **Requests**
1515

1616
| Route | Description |
1717
| :--------------------------: | :-----------------------: |
18-
| [GET /discord/invites](#get-discord-invites) | return all the invites generated |
19-
[POST /discord/invites](#post-discord-invites) | generates a invite for a user |
18+
| [GET /discord/invites](#get-discord-actions-invites) | return all the invites generated |
19+
[POST /discord/invites](#post-discord-actions -invites) | generates a invite for a user |
2020
---
2121

22-
## **GET /discord/invites**
22+
## **GET /discord-actions/invite**
2323

24-
- This API can only be accessed by super user and if the query param contains userId and the userId matches the userId of the user then it return the invite generated by that user
25-
26-
returns all the invites if there is no query param sent in the url, if there is a query param userId it return invite generated for a particulat user
24+
- return the discord invite created for the user
2725

2826
- **Query**
2927

30-
- Optional: `userId=[string]`: if this is provided it returns the invite for a pariticular user if the userId of the user matches the userId in query param, or the user is super user, other it return 403
28+
- 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
3129

3230
- **Headers**
3331
None
@@ -40,8 +38,8 @@ returns all the invites if there is no query param sent in the url, if there is
4038
- **Content:**
4139
```json
4240
{
43-
"message": "invite returned successfully" || "invites returned successfully",
44-
"invite": ["<invite object>, <invite object>"] || "<invite object>"
41+
"message": "Invite return successfully!",
42+
"inviteResponse": "<invite_object>"
4543
}
4644
```
4745

@@ -68,7 +66,7 @@ returns all the invites if there is no query param sent in the url, if there is
6866
- **Content:**
6967
```json
7068
{
71-
"message": "User not found."
69+
"message": "Invite not found for user!"
7270
}
7371
```
7472
- **Code:** 500
@@ -88,9 +86,9 @@ returns all the invites if there is no query param sent in the url, if there is
8886
- **Params**\
8987
None
9088
- **Query**\
91-
None
89+
- 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
9290
- **Body**\
93-
`{ userId: <string> }`
91+
None
9492
- **Headers**\
9593
None
9694
- **Cookie**\
@@ -100,7 +98,8 @@ returns all the invites if there is no query param sent in the url, if there is
10098
- **Content:**
10199
```json
102100
{
103-
"message": "Invite created successfully."
101+
"message": "Invite created successfully.",
102+
"inviteLink": "string",
104103
}
105104
```
106105
- **Code:** 401
@@ -112,18 +111,11 @@ returns all the invites if there is no query param sent in the url, if there is
112111
"message": "Unauthenticated user"
113112
}
114113
```
115-
- **Code:** 404
116-
- **Content:**
117-
```json
118-
{
119-
"message": "user doesn't exist"
120-
}
121-
```
122114
- **Code:** 409
123115
- **Content:**
124116
```json
125117
{
126-
"message": "invite already exists"
118+
"message": "User invite is already present!"
127119
}
128120
```
129121

0 commit comments

Comments
 (0)