From ce3d207a65a888e30e55448d7c902475a03906d3 Mon Sep 17 00:00:00 2001 From: Leon Sandøy Date: Thu, 16 Jul 2020 13:27:08 +0200 Subject: Improve some docstrings. https://github.com/python-discord/site/issues/305 --- pydis_site/apps/api/models/mixins.py | 2 ++ pydis_site/apps/api/viewsets/bot/allowlist.py | 30 +++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'pydis_site') 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/ + 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/ - Deletes the tag with the given `title`. + ### DELETE /bot/allowedlists/ + 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 -- cgit v1.2.3