Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added api contract for discord actions #127

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
- [Users](/users)
- [Badges](/badges)
- [CloudflareCache](/cloudflare-cache)
- [Discord-actions](/discordactions)
103 changes: 103 additions & 0 deletions discordactions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 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 a 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"
},
]
}

DashDeipayan marked this conversation as resolved.
Show resolved Hide resolved
```


## **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"
}
```

## **POST /roles**

> This request allows users to add group-roles to themselves

## Body

Request

```json
{
"userid": "<unique discord id of the rds member>",
"roleid": "<role id of the group>"
}
```

Response

```json
{
"message": "Role added successfully!"
}
```
- **Error Response:**
- **Code:** 404
DashDeipayan marked this conversation as resolved.
Show resolved Hide resolved
- **Content:**
```json
{
"statusCode": 400,
"error": "BAD REQUEST",
"message": "Role already exists!"
}
```