api.v1.views.MailboxViewSet module¶
Module with the MailboxViewSet viewset.
- class api.v1.views.MailboxViewSet.MailboxViewSet(**kwargs)[source]¶
Bases:
ReadOnlyModelViewSet,UpdateModelMixin,DestroyModelMixin,ToggleFavoriteMixinViewset for the
core.models.Mailbox.Mailbox.Provides all but the create action.
- BASENAME = 'mailbox'¶
- serializer_class¶
alias of
MailboxWithDaemonSerializer
- filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]¶
- filterset_class¶
alias of
MailboxFilterSet
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- ordering_fields: Final[list[str]] = ['name', 'account__mail_address', 'account__mail_host', 'account__protocol', 'save_attachments', 'save_to_eml', 'is_favorite', 'is_healthy', 'created', 'updated']¶
- get_queryset()[source]¶
Filters the data for entries connected to the request user.
- Return type:
- Returns:
The mailbox entries matching the request user.
- URL_PATH_TEST = 'test'¶
- URL_NAME_TEST = 'test'¶
- URL_PATH_FETCHING_OPTIONS = 'fetching-options'¶
- URL_NAME_FETCHING_OPTIONS = 'fetching-options'¶
- fetching_options(request, pk=None)[source]¶
Action method returning all fetching options for the mailbox.
- URL_PATH_FETCH = 'fetch'¶
- URL_NAME_FETCH = 'fetch'¶
- URL_PATH_DOWNLOAD = 'download'¶
- URL_NAME_DOWNLOAD = 'download'¶
- download(request, pk=None)[source]¶
Action method downloading the eml files of all emails in the mailbox in a single file.
- Parameters:
- Raises:
Http404 – If there are no emails in the mailbox.
ValidationError – If file_format is missing or unsupported.
- Return type:
Response|FileResponse- Returns:
A fileresponse containing the emails in the requested format.
- URL_PATH_DOWNLOAD_BATCH = 'download'¶
- URL_NAME_DOWNLOAD_BATCH = 'download-batch'¶
- download_batch(request)[source]¶
Action method downloading a batch of mailboxes.
Todo
Validation and parsing of queryparams can probably be done more concisely with a serializer.
- Parameters:
request (
Request) – The request triggering the action.- Raises:
Http404 – If there are no emails in the mailbox.
ValidationError – If id or file_format param is missing or in invalid format or file_format is unsupported.
- Return type:
Response|FileResponse- Returns:
A fileresponse containing the mailboxes emails in the requested format.
- URL_PATH_UPLOAD_MAILBOX = 'upload'¶
- URL_NAME_UPLOAD_MAILBOX = 'upload'¶
- upload_emails(request, pk=None)[source]¶
Action method allowing upload of a mailbox file and adding the contained mails to a mailbox.
- basename = None¶
- description = None¶
- destroy(request, *args, **kwargs)¶
- detail = None¶
- list(request, *args, **kwargs)¶
- name = None¶
- retrieve(request, *args, **kwargs)¶
- suffix = None¶
- update(request, *args, **kwargs)¶