api.v1.views.CorrespondentViewSet module

Module with the CorrespondentViewSet viewset.

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

Bases: ReadOnlyModelViewSet, UpdateModelMixin, DestroyModelMixin, ToggleFavoriteMixin

Viewset 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']
ordering: Final[list[str]] = ['id']
get_queryset()[source]

Filters the data for entries connected to the request user.

Return type:

QuerySet

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:
  • request (Request) – The request triggering the action.

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

Raises:

Http404 – If the filepath is not in the database or it doesn’t exist.

Return type:

FileResponse

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'
share_to_nextcloud(request, pk=None)[source]

Action method sending the correspondent to the users Immich server.

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

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

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
update(request, *args, **kwargs)