api.v1.serializers.mailbox_serializers package

api.v1.serializers.mailbox_serializers package containing serializers for the core.models.Mailbox data.

class api.v1.serializers.mailbox_serializers.BaseMailboxSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

The base serializer for core.models.Mailbox.

Includes all viable fields from the model. Sets all constraints that must be implemented in all serializers. Other serializers for core.models.Mailbox should inherit from this.

class Meta[source]

Bases: object

Metadata class for the base serializer.

Contains constraints that must be implemented by all serializers. Other serializer metaclasses should inherit from this. read_only_fields must not be shortened in subclasses.

model

alias of Mailbox

fields = '__all__'

Includes all fields.

read_only_fields: Final[list[str]] = ['name', 'type', 'account', 'is_healthy', 'last_error', 'last_error_occurred_at', 'created', 'updated']

The core.models.Mailbox.Mailbox.name, core.models.Mailbox.Mailbox.type, core.models.Mailbox.Mailbox.account, core.models.Mailbox.Mailbox.is_healthy, core.models.Mailbox.Mailbox.created and core.models.Mailbox.Mailbox.updated fields are read-only.

_declared_fields = {}
class api.v1.serializers.mailbox_serializers.MailboxWithDaemonSerializer(*args, **kwargs)[source]

Bases: BaseMailboxSerializer

The standard serializer for a core.models.Daemon.

Includes a nested serializer for the core.models.Daemon.Daemon.daemons related field.

_declared_fields = {'daemons': BaseDaemonSerializer(many=True, read_only=True):     id = BigIntegerField(label='ID', read_only=True)     interval = IntervalScheduleSerializer():         id = IntegerField(label='ID', read_only=True)         every = IntegerField(help_text='Number of interval periods to wait before running the task again', label='Number of Periods', max_value=2147483647, min_value=1)         period = ChoiceField(choices=[('days', 'Days'), ('hours', 'Hours'), ('minutes', 'Minutes'), ('seconds', 'Seconds'), ('microseconds', 'Microseconds')], help_text='The type of period between task runs (Example: days)', label='Interval Period')     celery_task = PeriodicTaskSerializer(read_only=True):         enabled = BooleanField(help_text='Set to False to disable the schedule', read_only=True)         last_run_at = DateTimeField(allow_null=True, help_text='Datetime that the schedule last triggered the task to run. Reset to None if enabled is set to False.', label='Last Run Datetime', read_only=True)         total_run_count = IntegerField(help_text='Running count of how many times the schedule has triggered the task', label='Total Run Count', read_only=True)     is_healthy = BooleanField(allow_null=True, label='Health status', read_only=True)     last_error = CharField(read_only=True, style={'base_template': 'textarea.html'})     last_error_occurred_at = DateTimeField(allow_null=True, label='Time of last error occurrence', read_only=True)     created = DateTimeField(label='Time of creation', read_only=True)     updated = DateTimeField(label='Time of last update', read_only=True)     uuid = UUIDField(label='UUID', read_only=True)     fetching_criterion = ChoiceField(choices=[('DAILY', 'All emails received the last DAY'), ('WEEKLY', 'All emails received the last WEEK'), ('MONTHLY', 'All emails received the last MONTH'), ('ANNUALLY', 'All emails received the last YEAR'), ('RECENT', 'All RECENT emails'), ('UNSEEN', 'All UNSEEN emails'), ('SEEN', 'All SEEN emails'), ('ALL', 'All emails'), ('NEW', 'All RECENT and UNSEEN emails'), ('OLD', 'All emails that are not RECENT'), ('FLAGGED', 'FLAGGED emails'), ('UNFLAGGED', 'All emails that are not FLAGGED'), ('DRAFT', 'All email DRAFTs'), ('UNDRAFT', 'All emails that are not DRAFTs'), ('ANSWERED', 'All ANSWERED emails'), ('UNANSWERED', 'All UNANSWERED emails'), ('DELETED', 'All DELETED emails'), ('UNDELETED', 'All UNDELETED emails'), ('KEYWORD {}', 'All emails with the given KEYWORD'), ('UNKEYWORD {}', 'All emails without the given KEYWORD'), ('LARGER {}', 'All emails LARGER than the given size'), ('SMALLER {}', 'All emails SMALLER than the given size'), ('SUBJECT {}', 'All emails with SUBJECT containing the given text'), ('BODY {}', 'All emails with BODY containing the given text'), ('FROM {}', 'All emails sent FROM the given address'), ('SENTSINCE {}', 'All emails SENT SINCE the given date')], default=EmailFetchingCriterionChoices.ALL, help_text='The selection criterion for emails to archive.')     fetching_criterion_arg = CharField(allow_blank=True, help_text='Additional value for the selection criterion.', label='Filter value', max_length=255, required=False)     mailbox = PrimaryKeyRelatedField(queryset=Mailbox.objects.all(), required=True)}
daemons

The emails are serialized by api.v1.serializers.BaseDaemonSerializer.

Submodules