aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets/bot
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-07-17 14:59:59 +0200
committerGravatar Leon Sandøy <[email protected]>2020-07-17 15:00:40 +0200
commit061ace4c1013abbdb5408f682c0c8401d13a59ec (patch)
tree8b05d0712cf53ea4821c6f430e0ccff5ce4ca7ca /pydis_site/apps/api/viewsets/bot
parentMerge branch 'master' into whitelist_system (diff)
Add an endpoint for getting AllowDenyList types.
https://github.com/python-discord/site/issues/305
Diffstat (limited to 'pydis_site/apps/api/viewsets/bot')
-rw-r--r--pydis_site/apps/api/viewsets/bot/allow_deny_list.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/allow_deny_list.py b/pydis_site/apps/api/viewsets/bot/allow_deny_list.py
index a2499d89..2b9fd6a7 100644
--- a/pydis_site/apps/api/viewsets/bot/allow_deny_list.py
+++ b/pydis_site/apps/api/viewsets/bot/allow_deny_list.py
@@ -1,3 +1,6 @@
+from rest_framework.decorators import action
+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
@@ -70,3 +73,8 @@ class AllowDenyListViewSet(ModelViewSet):
serializer_class = AllowDenyListSerializer
queryset = AllowDenyList.objects.all()
+
+ @action(detail=False, methods=["get"])
+ def get_types(self, _: Request) -> Response:
+ """Get a list of all the types of AllowDenyLists we support."""
+ return Response(AllowDenyList.AllowDenyListType.choices)