diff options
author | 2020-07-27 09:53:38 +0200 | |
---|---|---|
committer | 2020-07-27 09:53:38 +0200 | |
commit | 285c81bc13e996246ad9463951853fc12903d766 (patch) | |
tree | ce6d40f8bdf494cb438f94676e16fbf98c167a37 /pydis_site/apps/api/viewsets | |
parent | Minor changes to tests, use subTest. (diff) |
Rename AllowDenyList to FilterList
Diffstat (limited to 'pydis_site/apps/api/viewsets')
-rw-r--r-- | pydis_site/apps/api/viewsets/__init__.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/viewsets/bot/__init__.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/viewsets/bot/filter_list.py (renamed from pydis_site/apps/api/viewsets/bot/allow_deny_list.py) | 34 |
3 files changed, 19 insertions, 19 deletions
diff --git a/pydis_site/apps/api/viewsets/__init__.py b/pydis_site/apps/api/viewsets/__init__.py index eb7d5098..8699517e 100644 --- a/pydis_site/apps/api/viewsets/__init__.py +++ b/pydis_site/apps/api/viewsets/__init__.py @@ -1,6 +1,6 @@ # flake8: noqa from .bot import ( - AllowDenyListViewSet, + FilterListViewSet, BotSettingViewSet, DeletedMessageViewSet, DocumentationLinkViewSet, diff --git a/pydis_site/apps/api/viewsets/bot/__init__.py b/pydis_site/apps/api/viewsets/bot/__init__.py index 11638dd8..e64e3988 100644 --- a/pydis_site/apps/api/viewsets/bot/__init__.py +++ b/pydis_site/apps/api/viewsets/bot/__init__.py @@ -1,5 +1,5 @@ # flake8: noqa -from .allow_deny_list import AllowDenyListViewSet +from .filter_list import FilterListViewSet from .bot_setting import BotSettingViewSet from .deleted_message import DeletedMessageViewSet from .documentation_link import DocumentationLinkViewSet diff --git a/pydis_site/apps/api/viewsets/bot/allow_deny_list.py b/pydis_site/apps/api/viewsets/bot/filter_list.py index 6ea8da56..2cb21ab9 100644 --- a/pydis_site/apps/api/viewsets/bot/allow_deny_list.py +++ b/pydis_site/apps/api/viewsets/bot/filter_list.py @@ -3,17 +3,17 @@ from rest_framework.request import Request from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet -from pydis_site.apps.api.models.bot.allow_deny_list import AllowDenyList -from pydis_site.apps.api.serializers import AllowDenyListSerializer +from pydis_site.apps.api.models.bot.filter_list import FilterList +from pydis_site.apps.api.serializers import FilterListSerializer -class AllowDenyListViewSet(ModelViewSet): +class FilterListViewSet(ModelViewSet): """ View providing CRUD operations on items allowed or denied by our bot. ## Routes - ### GET /bot/allow_deny_lists - Returns all allow and denylist items in the database. + ### GET /bot/filter-lists + Returns all filterlist items in the database. #### Response format >>> [ @@ -33,8 +33,8 @@ class AllowDenyListViewSet(ModelViewSet): - 200: returned on success - 401: returned if unauthenticated - ### GET /bot/allow_deny_lists/<id:int> - Returns a specific AllowDenyList item from the database. + ### GET /bot/filter-lists/<id:int> + Returns a specific FilterList item from the database. #### Response format >>> { @@ -51,7 +51,7 @@ class AllowDenyListViewSet(ModelViewSet): - 200: returned on success - 404: returned if the id was not found. - ### GET /bot/allow_deny_lists/get_types + ### GET /bot/filter-lists/get-types Returns a list of valid list types that can be used in POST requests. #### Response format @@ -65,8 +65,8 @@ class AllowDenyListViewSet(ModelViewSet): #### Status codes - 200: returned on success - ### POST /bot/allow_deny_lists - Adds a single AllowDenyList item to the database. + ### POST /bot/filter-lists + Adds a single FilterList item to the database. #### Request body >>> { @@ -80,18 +80,18 @@ class AllowDenyListViewSet(ModelViewSet): - 201: returned on success - 400: if one of the given fields is invalid - ### DELETE /bot/allow_deny_lists/<id:int> - Deletes the AllowDenyList item with the given `id`. + ### DELETE /bot/filter-lists/<id:int> + Deletes the FilterList item with the given `id`. #### Status codes - 204: returned on success - 404: if a tag with the given `id` does not exist """ - serializer_class = AllowDenyListSerializer - queryset = AllowDenyList.objects.all() + serializer_class = FilterListSerializer + queryset = FilterList.objects.all() - @action(detail=False, methods=["get"]) + @action(detail=False, url_path='get-types', methods=["get"]) def get_types(self, _: Request) -> Response: - """Get a list of all the types of AllowDenyLists we support.""" - return Response(AllowDenyList.AllowDenyListType.choices) + """Get a list of all the types of FilterLists we support.""" + return Response(FilterList.FilterListType.choices) |