|
6 | 6 | | :-----------------------------------------------------: | :------------------------------: |
|
7 | 7 | | [GET /discord-actions/invites](#get-discord-actions-invites) | return all the invites generated |
|
8 | 8 | | [POST /discord-actions/invites](#post-discord-actions-invites) | generates a invite for a user |
|
| 9 | +| [GET /discord-actions/groups](#get-discord-actions-groups) | Returns all group roles or paginated results | |
9 | 10 |
|
10 | 11 | ---
|
11 | 12 |
|
|
139 | 140 | ```
|
140 | 141 |
|
141 | 142 | ```
|
| 143 | + |
| 144 | +## **GET /discord-actions/groups** |
| 145 | + |
| 146 | +- Fetches all Discord group roles or provides paginated results when the `?dev=true` query parameter is passed. |
| 147 | + |
| 148 | +- **Query** |
| 149 | + |
| 150 | + - Optional: `page=[number]`: Specifies the page of results to fetch (used only when `dev=true`). Must be `>= 0`. Defaults to `0`. |
| 151 | + - Optional: `size=[number]`: Specifies the number of results per page (used only when `dev=true`). Must be between `1` and `100`. Defaults to `10`. |
| 152 | + - Optional: `dev=[boolean]`: When set to `true`, returns paginated results with additional metadata. Defaults to `false`. |
| 153 | + |
| 154 | +- **Headers** |
| 155 | + None |
| 156 | + |
| 157 | +- **Cookie** |
| 158 | + `rds-session`: `<JWT>` (Required for authentication) |
| 159 | + |
| 160 | +- **Success Response** |
| 161 | + |
| 162 | + - **Code:** 200 |
| 163 | + - **Content:** |
| 164 | + ```json |
| 165 | + { |
| 166 | + "message": "Roles fetched successfully!", |
| 167 | + "groups": [ |
| 168 | + { |
| 169 | + "id": "string", |
| 170 | + "rolename": "string", |
| 171 | + "roleid": "string", |
| 172 | + "description": "string", |
| 173 | + "createdBy": "string", |
| 174 | + "firstName": "string", |
| 175 | + "lastName": "string", |
| 176 | + "image": "string", |
| 177 | + "date": "string (ISO timestamp)", |
| 178 | + "lastUsedOn": "string (ISO timestamp)", |
| 179 | + "memberCount": 0, |
| 180 | + "isMember": true |
| 181 | + } |
| 182 | + ], |
| 183 | + "links": { |
| 184 | + "next": "string (URL for the next page)", |
| 185 | + "prev": "string (URL for the previous page)" |
| 186 | + } |
| 187 | + } |
| 188 | + ``` |
| 189 | + |
| 190 | +- **Error Responses** |
| 191 | + |
| 192 | + - **Code:** 400 (Bad Request) |
| 193 | + - **Content:** Invalid `page` parameter: |
| 194 | + ```json |
| 195 | + { |
| 196 | + "message": "Invalid page parameter. Must be 0 or greater." |
| 197 | + } |
| 198 | + ``` |
| 199 | + - **Content:** Invalid `size` parameter: |
| 200 | + ```json |
| 201 | + { |
| 202 | + "message": "Invalid size. Must be between 1 and 100." |
| 203 | + } |
| 204 | + ``` |
| 205 | + |
| 206 | + - **Code:** 401 (Unauthorized) |
| 207 | + - **Content:** |
| 208 | + ```json |
| 209 | + { |
| 210 | + "statusCode": 401, |
| 211 | + "error": "Unauthorized", |
| 212 | + "message": "You are not authorized for this action." |
| 213 | + } |
| 214 | + ``` |
| 215 | + |
| 216 | + - **Code:** 500 (Internal Server Error) |
| 217 | + - **Content:** |
| 218 | + ```json |
| 219 | + { |
| 220 | + "statusCode": 500, |
| 221 | + "error": "Internal Server Error", |
| 222 | + "message": "An internal server error occurred" |
| 223 | + } |
| 224 | + ``` |
0 commit comments