aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-07-16 13:27:08 +0200
committerGravatar Leon Sandøy <[email protected]>2020-07-16 13:27:08 +0200
commitce3d207a65a888e30e55448d7c902475a03906d3 (patch)
treeda4c545c524dc715bf388ae2de5e4d18363dd551 /pydis_site/apps
parentAdd tests for the AllowList model. (diff)
Improve some docstrings.
https://github.com/python-discord/site/issues/305
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/api/models/mixins.py2
-rw-r--r--pydis_site/apps/api/viewsets/bot/allowlist.py30
2 files changed, 26 insertions, 6 deletions
diff --git a/pydis_site/apps/api/models/mixins.py b/pydis_site/apps/api/models/mixins.py
index 942edaa1..5d75b78b 100644
--- a/pydis_site/apps/api/models/mixins.py
+++ b/pydis_site/apps/api/models/mixins.py
@@ -26,4 +26,6 @@ class ModelTimestampMixin(models.Model):
updated_at = models.DateTimeField(auto_now=True)
class Meta:
+ """Metaconfig for the mixin."""
+
abstract = True
diff --git a/pydis_site/apps/api/viewsets/bot/allowlist.py b/pydis_site/apps/api/viewsets/bot/allowlist.py
index 9b907d05..7cc82ff7 100644
--- a/pydis_site/apps/api/viewsets/bot/allowlist.py
+++ b/pydis_site/apps/api/viewsets/bot/allowlist.py
@@ -27,27 +27,45 @@ class AllowListViewSet(ModelViewSet):
#### Status codes
- 200: returned on success
+ - 401: returned if unauthenticated
+
+ ### GET /bot/allowlists/<id:int>
+ Returns a specific AllowList item from the database.
+
+ #### Response format
+ >>> {
+ ... 'id': "2309268224",
+ ... 'created_at': "01-01-2020 ...",
+ ... 'updated_at': "01-01-2020 ...",
+ ... 'type': "file_format",
+ ... 'allowed': 'true',
+ ... 'content': ".jpeg",
+ ... }
+
+ #### Status codes
+ - 200: returned on success
+ - 404: returned if the id was not found.
### POST /bot/allowedlists
Adds a single allowedlist item to the database.
#### Request body
>>> {
- ... 'type': str,
- ... 'allowed': bool,
- ... 'content': str,
+ ... 'type': str,
+ ... 'allowed': bool,
+ ... 'content': str,
... }
#### Status codes
- 201: returned on success
- 400: if one of the given fields is invalid
- ### DELETE /bot/allowedlists/<title:str>
- Deletes the tag with the given `title`.
+ ### DELETE /bot/allowedlists/<id:int>
+ Deletes the tag with the given `id`.
#### Status codes
- 204: returned on success
- - 404: if a tag with the given `title` does not exist
+ - 404: if a tag with the given `id` does not exist
"""
serializer_class = AllowListSerializer