aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets/bot/deleted_message.py
blob: c14171bdd4b02043e9d7ef460ae32581fa4d26f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from rest_framework.mixins import CreateModelMixin
from rest_framework.viewsets import GenericViewSet

from pydis_site.apps.api.models.bot.message_deletion_context import MessageDeletionContext
from pydis_site.apps.api.serializers import MessageDeletionContextSerializer


class DeletedMessageViewSet(CreateModelMixin, 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_class = MessageDeletionContextSerializer