aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-08-15 18:24:06 +0200
committerGravatar Sebastiaan Zeeff <[email protected]>2019-08-15 18:24:06 +0200
commit1d08bd96cb089a0881ffec2ee0e9c7f4adf5493d (patch)
tree8815494032873c9dc62f89447df49b2b3f674c30 /pydis_site/apps/api/viewsets
parentMerge pull request #235 from python-discord/ouroboros-logging-handler (diff)
Adding position, role hierarchy comparisons to Role model; top_role to User model
Diffstat (limited to 'pydis_site/apps/api/viewsets')
-rw-r--r--pydis_site/apps/api/viewsets/bot/role.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/role.py b/pydis_site/apps/api/viewsets/bot/role.py
index 213f0a19..1f82208d 100644
--- a/pydis_site/apps/api/viewsets/bot/role.py
+++ b/pydis_site/apps/api/viewsets/bot/role.py
@@ -20,7 +20,8 @@ class RoleViewSet(ModelViewSet):
... 'id': 267628507062992896,
... 'name': "Admins",
... 'colour': 1337,
- ... 'permissions': 8
+ ... 'permissions': 8,
+ ... 'position': 1
... }
... ]
@@ -35,7 +36,8 @@ class RoleViewSet(ModelViewSet):
... 'id': 267628507062992896,
... 'name': "Admins",
... 'colour': 1337,
- ... 'permissions': 8
+ ... 'permissions': 8,
+ ... 'position': 1
... }
#### Status codes
@@ -51,6 +53,7 @@ class RoleViewSet(ModelViewSet):
... 'name': str,
... 'colour': int,
... 'permissions': int,
+ ... 'position': 1,
... }
#### Status codes
@@ -66,24 +69,32 @@ class RoleViewSet(ModelViewSet):
... 'id': int,
... 'name': str,
... 'colour': int,
- ... 'permissions': int
+ ... 'permissions': int,
+ ... 'position': 1,
... }
#### Status codes
- 200: returned on success
- 400: if the request body was invalid
+ - 404: if a role with the given `snowflake` does not exist
### PATCH /bot/roles/<snowflake:int>
Update the role with the given `snowflake`.
- All fields in the request body are required.
+ #### Request body
>>> {
... 'id': int,
... 'name': str,
... 'colour': int,
- ... 'permissions': int
+ ... 'permissions': int,
+ ... 'position': 1,
... }
+ #### Status codes
+ - 200: returned on success
+ - 400: if the request body was invalid
+ - 404: if a role with the given `snowflake` does not exist
+
### DELETE /bot/roles/<snowflake:int>
Deletes the role with the given `snowflake`.