api.v1.views.AccountViewSet module

Module with the AccountViewSet viewset.

class api.v1.views.AccountViewSet.AccountViewSet(**kwargs)[source]

Bases: ModelViewSet, ToggleFavoriteMixin

Viewset for the core.models.Account.

Provides all actions.

BASENAME = 'account'
serializer_class

alias of AccountSerializer

filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]
filterset_class

alias of AccountFilterSet

permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]
ordering_fields: Final[list[str]] = ['mail_address', 'mail_host', 'mail_host_port', 'protocol', 'timeout', 'is_healthy', 'is_favorite', 'created', 'updated']
ordering: Final[list[str]] = ['id']
get_queryset()[source]

Fetches the queryset by filtering the data for entries connected to the request user.

Return type:

QuerySet

Returns:

The account entries matching the request user.

URL_PATH_UPDATE_MAILBOXES = 'update-mailboxes'
URL_NAME_UPDATE_MAILBOXES = 'update-mailboxes'
update_mailboxes(request, pk=None)[source]

Action method updating the mailboxes in the account.

Parameters:
  • request (Request) – The request triggering the action.

  • pk (int | None) – The private key of the account to scan for mailboxes. Defaults to None.

Return type:

Response

Returns:

A response containing the updated account data.

URL_PATH_ADD_DAEMONS = 'add-routines'
URL_NAME_ADD_DAEMONS = 'add-daemons'
add_daemons(request, pk=None)[source]

Action method updating the mailboxes in the account.

Parameters:
  • request (Request) – The request triggering the action.

  • pk (int | None) – The private key of the account to scan for mailboxes. Defaults to None.

Return type:

Response

Returns:

A response containing the updated account data.

URL_PATH_TEST = 'test'
URL_NAME_TEST = 'test'
test(request, pk=None)[source]

Action method testing the account data.

Parameters:
  • request (Request) – The request triggering the action.

  • pk (int | None) – The private key of the account to test. Defaults to None.

Return type:

Response

Returns:

A response containing the updated account data and the test result.

URL_PATH_DOWNLOAD = 'download'
URL_NAME_DOWNLOAD = 'download'
download(request, pk=None)[source]

Action method downloading the eml files of all emails in the account in a single file.

Parameters:
  • request (Request) – The request triggering the action.

  • pk (int | None) – The private key of the account to download. Defaults to None.

Raises:
  • Http404 – If there are no mailboxes in the account.

  • ValidationError – If file_format is missing or unsupported.

Return type:

Response | FileResponse

Returns:

A fileresponse containing the mailboxes in the requested format.

basename = None
create(request, *args, **kwargs)
description = None
destroy(request, *args, **kwargs)
detail = None
list(request, *args, **kwargs)
name = None
retrieve(request, *args, **kwargs)
suffix = None
update(request, *args, **kwargs)