api.v1.views package¶
api.v1.views package containing the views for the Eonvelope API version 1.
- class api.v1.views.AccountViewSet(**kwargs)[source]¶
Bases:
ModelViewSet,ToggleFavoriteMixinViewset 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']¶
- get_queryset()[source]¶
Fetches the queryset by filtering the data for entries connected to the request user.
- Return type:
- Returns:
The account entries matching the request user.
- URL_PATH_UPDATE_MAILBOXES = 'update-mailboxes'¶
- URL_NAME_UPDATE_MAILBOXES = 'update-mailboxes'¶
- URL_PATH_ADD_DAEMONS = 'add-routines'¶
- URL_NAME_ADD_DAEMONS = 'add-daemons'¶
- URL_PATH_TEST = 'test'¶
- URL_NAME_TEST = 'test'¶
- 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:
- 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)¶
- class api.v1.views.AttachmentViewSet(**kwargs)[source]¶
Bases:
ReadOnlyModelViewSet,DestroyModelMixin,ToggleFavoriteMixinViewset for the
core.models.Attachment.Provides every read-only and a destroy action.
- BASENAME = 'attachment'¶
- serializer_class¶
alias of
BaseAttachmentSerializer
- filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]¶
- filterset_class¶
alias of
AttachmentFilterSet
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- ordering_fields: Final[list[str]] = ['file_name', 'datasize', 'email__datetime', 'is_favorite', 'created', 'updated']¶
- get_queryset()[source]¶
Filters the data for entries connected to the request user.
- Return type:
- Returns:
The attachment entries matching the request user.
- URL_PATH_DOWNLOAD = 'download'¶
- URL_NAME_DOWNLOAD = 'download'¶
- download(request, pk=None)[source]¶
Action method downloading the attachment.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
- Returns:
A fileresponse containing the requested file.
- URL_PATH_DOWNLOAD_BATCH = 'download'¶
- URL_NAME_DOWNLOAD_BATCH = 'download-batch'¶
- download_batch(request)[source]¶
Action method downloading a batch of attachments.
- Parameters:
request (
Request) – The request triggering the action.- Raises:
Http404 – If no downloadable attachment has been requested.
ValidationError – If id param is missing or in invalid format.
- Return type:
Response|FileResponse- Returns:
A fileresponse containing the requested file.
- URL_PATH_THUMBNAIL = 'thumbnail'¶
- URL_NAME_THUMBNAIL = 'thumbnail'¶
- download_thumbnail(request, pk=None)[source]¶
Action method downloading the attachment thumbnail.
Returns the same filedata as ‘download’, but as inline.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
- Returns:
A fileresponse containing the requested file.
- URL_PATH_SHARE_TO_PAPERLESS = 'share/paperless'¶
- URL_NAME_SHARE_TO_PAPERLESS = 'share-to-paperless'¶
Action method sending the attachment to the users Paperless server.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
Response- Returns:
A fileresponse containing the requested file.
- URL_PATH_SHARE_TO_IMMICH = 'share/immich'¶
- URL_NAME_SHARE_TO_IMMICH = 'share-to-immich'¶
Action method sending the attachment to the users Immich server.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
Response- Returns:
A fileresponse containing the requested file.
- basename = None¶
- description = None¶
- destroy(request, *args, **kwargs)¶
- detail = None¶
- list(request, *args, **kwargs)¶
- name = None¶
- retrieve(request, *args, **kwargs)¶
- suffix = None¶
- class api.v1.views.CorrespondentViewSet(**kwargs)[source]¶
Bases:
ReadOnlyModelViewSet,UpdateModelMixin,DestroyModelMixin,ToggleFavoriteMixinViewset for the
core.models.Correspondent.Correspondent.Provides every read-only and a destroy action.
- BASENAME = 'correspondent'¶
- serializer_class¶
alias of
CorrespondentSerializer
- filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]¶
- filterset_class¶
alias of
CorrespondentFilterSet
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- ordering_fields: Final[list[str]] = ['email_name', 'email_address', 'is_favorite', 'created', 'updated']¶
- get_queryset()[source]¶
Filters the data for entries connected to the request user.
- Return type:
- Returns:
The correspondent entries matching the request user.
- get_serializer_class()[source]¶
Sets the serializer for list requests to the simplified version.
- Return type:
type[BaseSerializer]
- URL_PATH_DOWNLOAD = 'download'¶
- URL_NAME_DOWNLOAD = 'download'¶
- download(request, pk=None)[source]¶
Action method downloading the correspondent.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
- Returns:
A fileresponse containing the requested file.
- URL_PATH_DOWNLOAD_BATCH = 'download'¶
- URL_NAME_DOWNLOAD_BATCH = 'download-batch'¶
- download_batch(request)[source]¶
Action method downloading a batch of correspondents.
- Parameters:
request (
Request) – The request triggering the action.- Raises:
Http404 – If no downloadable correspondent has been requested.
ValidationError – If id param is missing or in invalid format.
- Return type:
Response|FileResponse- Returns:
A fileresponse containing the requested file.
- URL_PATH_SHARE_TO_NEXTCLOUD = 'share/nextcloud'¶
- URL_NAME_SHARE_TO_NEXTCLOUD = 'share-to-nextcloud'¶
Action method sending the correspondent to the users Immich server.
- 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)¶
- class api.v1.views.DaemonViewSet(**kwargs)[source]¶
Bases:
ModelViewSetViewset for the
core.models.Daemon.Provides all CRUD actions.
Note
To update instances the user must specify format “json” with the request.
- BASENAME = 'daemon'¶
- serializer_class¶
alias of
BaseDaemonSerializer
- filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]¶
- filterset_class¶
alias of
DaemonFilterSet
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- ordering_fields: Final[list[str]] = ['fetching_criterion', 'interval__every', 'interval__period', 'celery_task__last_run_at', 'celery_task__total_run_count', 'is_healthy', 'mailbox__name', 'mailbox__account__mail_address', 'mailbox__account__mail_host', 'mailbox__account__protocol', 'created', 'updated']¶
- get_queryset()[source]¶
Filters the data for entries connected to the request user.
- Return type:
- Returns:
The daemon entries matching the request user.
- URL_PATH_TEST = 'test'¶
- URL_NAME_TEST = 'test'¶
- URL_PATH_START = 'start'¶
- URL_NAME_START = 'start'¶
- URL_PATH_STOP = 'stop'¶
- URL_NAME_STOP = 'stop'¶
- 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)¶
- class api.v1.views.DatabaseStatsView(**kwargs)[source]¶
Bases:
APIViewAPIView for the statistics of the database.
- NAME = 'stats'¶
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- serializer_class¶
alias of
DatabaseStatsSerializer
- class api.v1.views.EmailViewSet(**kwargs)[source]¶
Bases:
ReadOnlyModelViewSet,DestroyModelMixin,ToggleFavoriteMixinViewset for the
core.models.Email.Email.Provides every read-only and a destroy action.
- BASENAME = 'email'¶
- serializer_class¶
alias of
FullEmailSerializer
- filter_backends = [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>, <class 'rest_framework.filters.OrderingFilter'>]¶
- filterset_class¶
alias of
EmailFilterSet
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- ordering_fields: Final[list[str]] = ['datetime', 'subject', 'datasize', 'is_favorite', 'created', 'updated', 'user_agent', 'language', 'content_language', 'importance', 'priority', 'precedence', 'x_priority', 'x_originated_client']¶
- get_queryset()[source]¶
Filters the data for entries connected to the request user.
- Return type:
- Returns:
The email entries matching the request user.
- get_serializer_class()[source]¶
Sets the serializer for list requests to the simplified version.
- Return type:
type[BaseSerializer]
- URL_PATH_DOWNLOAD = 'download'¶
- URL_NAME_DOWNLOAD = 'download'¶
- download(request, pk=None)[source]¶
Action method downloading the eml file of the email.
- Parameters:
- Raises:
Http404 – If the filepath is not in the database or it doesn’t exist.
- Return type:
- Returns:
A fileresponse containing the requested file.
- URL_PATH_DOWNLOAD_BATCH = 'download'¶
- URL_NAME_DOWNLOAD_BATCH = 'download-batch'¶
- download_batch(request)[source]¶
Action method downloading a batch of emails.
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 emails in the requested format.
- URL_PATH_THUMBNAIL = 'thumbnail'¶
- URL_NAME_THUMBNAIL = 'thumbnail'¶
- download_thumbnail(request, pk=None)[source]¶
Action method downloading the html version of the mail.
- Parameters:
- Return type:
- Returns:
A fileresponse containing the requested file.
- URL_PATH_FULLCONVERSATION = 'full-conversation'¶
- URL_NAME_FULLCONVERSATION = 'full-conversation'¶
- conversation(request, pk=None)[source]¶
Action method getting the complete conversation a mail is part of.
The response data is paginated analogous to the list method.
- URL_PATH_RESTORE = 'restore'¶
- URL_NAME_RESTORE = 'restore'¶
- URL_PATH_REPROCESS = 'reprocess'¶
- URL_NAME_REPROCESS = 'reprocess'¶
- reprocess(request, pk=None)[source]¶
Action method reprocessing the emails connections to other emails.
- basename = None¶
- description = None¶
- destroy(request, *args, **kwargs)¶
- detail = None¶
- list(request, *args, **kwargs)¶
- name = None¶
- retrieve(request, *args, **kwargs)¶
- suffix = None¶
- class api.v1.views.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)¶
- class api.v1.views.UserProfileView(**kwargs)[source]¶
Bases:
RetrieveUpdateAPIViewView for retrieving and updating the users
eonvelope.models.UserProfile.- NAME = 'profile'¶
- serializer_class¶
alias of
UserProfileSerializer
- permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]¶
- get_object()[source]¶
Fetches the profile connected to the request user.
- Return type:
- Returns:
The UserProfile model of the request user.
- retrieve(request, *args, **kwargs)¶
- update(request, *args, **kwargs)¶