|
2 | 2 |
|
3 | 3 | ## **Requests**
|
4 | 4 |
|
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 | + |
9 | 10 | ---
|
10 | 11 |
|
11 | 12 | ## **GET /discord-actions/invite**
|
|
28 | 29 | ```json
|
29 | 30 | {
|
30 | 31 | "message": "Invite return successfully!",
|
31 |
| - "inviteLink": "discord_invite_link_here" |
| 32 | + "inviteLink": "discord_invite_link_here" |
32 | 33 | }
|
33 | 34 | ```
|
34 | 35 |
|
35 | 36 | - **Error Responses:**
|
| 37 | + |
36 | 38 | - **Code:** 401
|
37 | 39 | - **Content:**
|
38 | 40 | ```json
|
|
58 | 60 | "message": "Invite not found for user!"
|
59 | 61 | }
|
60 | 62 | ```
|
| 63 | + |
61 | 64 | - **Code:** 500
|
62 | 65 | - **Content:**
|
63 | 66 | ```json
|
|
70 | 73 |
|
71 | 74 | ## **POST /discord/invites**
|
72 | 75 |
|
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 |
74 | 80 |
|
75 | 81 | - **Params**\
|
76 |
| - None |
| 82 | + None |
77 | 83 | - **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 |
79 | 85 | - **Body**\
|
80 |
| - None |
| 86 | + None |
81 | 87 | - **Headers**\
|
82 |
| - None |
| 88 | + None |
83 | 89 | - **Cookie**\
|
84 |
| - None |
| 90 | + None |
85 | 91 | - **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 | + ``` |
94 | 101 | - **Code:** 401
|
95 | 102 | - **Content:**
|
96 | 103 | ```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 | + } |
102 | 109 | ```
|
103 | 110 | - **Code:** 409
|
| 111 | + |
104 | 112 | - **Content:**
|
105 | 113 | ```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" |
108 | 126 | }
|
109 | 127 | ```
|
110 | 128 |
|
111 | 129 | - **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 | + } |
120 | 138 | ```
|
| 139 | + ``` |
| 140 | + |
| 141 | + ``` |
0 commit comments