aboutsummaryrefslogtreecommitdiffstats
path: root/api/viewsets.py
diff options
context:
space:
mode:
Diffstat (limited to 'api/viewsets.py')
-rw-r--r--api/viewsets.py41
1 files changed, 38 insertions, 3 deletions
diff --git a/api/viewsets.py b/api/viewsets.py
index 08660810..bc34de1d 100644
--- a/api/viewsets.py
+++ b/api/viewsets.py
@@ -11,20 +11,55 @@ from rest_framework_bulk import BulkCreateModelMixin
from .models import (
DocumentationLink, Member,
- OffTopicChannelName,
+ MessageDeletionContext, OffTopicChannelName,
SnakeFact, SnakeIdiom,
SnakeName, SpecialSnake,
Tag
)
from .serializers import (
- DocumentationLinkSerializer,
- MemberSerializer, OffTopicChannelNameSerializer,
+ DocumentationLinkSerializer, MemberSerializer,
+ MessageDeletionContextSerializer, OffTopicChannelNameSerializer,
SnakeFactSerializer, SnakeIdiomSerializer,
SnakeNameSerializer, SpecialSnakeSerializer,
TagSerializer
)
+class DeletedMessageViewSet(GenericViewSet):
+ """
+ View providing support for posting bulk deletion logs generated by the bot.
+
+ ## Routes
+ ### POST /bot/deleted-messages
+ Post messages from bulk deletion logs.
+
+ #### Body schema
+ >>> {
+ ... # The member ID of the original actor, if applicable.
+ ... # If a member ID is given, it must be present on the site.
+ ... 'actor': Optional[int]
+ ... 'creation': datetime,
+ ... 'messages': [
+ ... {
+ ... 'id': int,
+ ... 'author': int,
+ ... 'channel_id': int,
+ ... 'content': str,
+ ... 'embeds': [
+ ... # Discord embed objects
+ ... ]
+ ... }
+ ... ]
+ ... }
+
+ #### Status codes
+ - 204: returned on success
+ """
+
+ queryset = MessageDeletionContext.objects.all()
+ serializer = MessageDeletionContextSerializer
+
+
class DocumentationLinkViewSet(
CreateModelMixin, DestroyModelMixin, ListModelMixin, RetrieveModelMixin, GenericViewSet
):