diff --git a/README.md b/README.md index df13066a..e6e68afe 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,4 @@ - [Users](/users) - [Badges](/badges) - [CloudflareCache](/cloudflare-cache) +- [Discord-actions](/discordactions) diff --git a/discordactions/README.md b/discordactions/README.md new file mode 100644 index 00000000..409feb22 --- /dev/null +++ b/discordactions/README.md @@ -0,0 +1,139 @@ +# Discord actions + + +## **Requests** + +| Route | Description | +|:------------------------------------------------------:|:-----------------------------:| +| [GET /groups](#get-groups) | Returns all group roles | +| [POST /groups](#post-groups) | Creates new group role | +| [POST /roles](#post-roles) | Adds group role to a user | | + +## **GET /groups** + +> returns all group roles + +## Response + +```json +{ + "message":"Roles fetched successfully!", + "groups":[ + { + "id":"BcfrtGo9hAhVxcDZ5ADQ", + "date":{ + "_seconds":1683970114, + "_nanoseconds":286000000 + }, + "createdBy":"k15z2SLFe1U2J3gshXUG", + "rolename":"group-peer-programming", + "roleid":"1106875628000653332" + }, + { + "id":"ELqELhWrdoSX1AusBwPw", + "date":{ + "_seconds":1683917265, + "_nanoseconds":874000000 + }, + "createdBy":"1uilsoHQZ1TzcYyy25BA", + "rolename":"group-live-site", + "roleid":"1106653965799657533" + }, + ] +} + +``` +- **Error Response:** + - **Code:** 500 + - **Content:** + ```json + { + "statusCode": 500, + "error": "INTERNAL SERVER ERROR", + "message": "Internal server error" + } + ``` + - **Code:** 404 + - **Content:** + ```json + { + "statusCode": 404, + "error": "NOT FOUND", + "message": "Not found" + } + ``` + +## **POST /group** +> creates a new group role +## Body + +```json +{ + "rolename": "some-demo" +} +``` + +## Response + + +- **Error Response:** + - **Code:** 400 + - **Content:** + ```json + { + "statusCode": 400, + "error": "BAD REQUEST", + "message": "Role already exists" + } + ``` + - **Code:** 500 + - **Content:** + ```json + { + "statusCode": 500, + "error": "INTERNAL SERVER ERROR", + "message": "Internal server error!" + } + ``` + +## **POST /roles** + +> This request allows users to add group-roles to themselves + +## Body + +Request + +```json +{ + "userid": "", + "roleid": "" +} +``` + +Response + +```json +{ + "message": "Role added successfully!" +} +``` +- **Error Response:** + - **Code:** 400 + - **Content:** + ```json + { + "statusCode": 400, + "error": "BAD REQUEST", + "message": "Role already exists!" + } + ``` + - **Code:** 500 + - **Content:** + ```json + { + "statusCode": 500, + "error": "INTERNAL SERVER ERROR", + "message": "Internal server error!" + } + ```