diff options
| author | 2019-08-23 15:00:15 +0200 | |
|---|---|---|
| committer | 2019-08-23 15:00:15 +0200 | |
| commit | f6c90633bc415aa1a1e625fb078212e9e015ba37 (patch) | |
| tree | b211be1ec8e4b7ef38b824973716241e5bc6316b /pydis_site/apps/api/viewsets | |
| parent | Properly handle `actor` via `PrimaryKeyRelatedField`. (diff) | |
| parent | Making the comparison operators for Role act like those for d.py Role objects (diff) | |
Merge pull request #236 from python-discord/django-roles-api-add-position
Add position field to Role model
Diffstat (limited to 'pydis_site/apps/api/viewsets')
| -rw-r--r-- | pydis_site/apps/api/viewsets/bot/role.py | 21 |
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`. |