28 lines
668 B
Python
28 lines
668 B
Python
from __future__ import annotations
|
|
|
|
from datetime import date
|
|
|
|
from pydantic import BaseModel, Field, field_validator
|
|
|
|
|
|
class ProcessNowRequest(BaseModel):
|
|
inbox_id: str
|
|
mode: str = Field(pattern="^(new|backlog)$")
|
|
limit: int | None = None
|
|
|
|
|
|
class BacklogRequest(BaseModel):
|
|
inbox_id: str
|
|
folder: str | None = None
|
|
since: date | None = None
|
|
before: date | None = None
|
|
limit: int | None = 200
|
|
dry_run: bool = False
|
|
reprocess: bool = False
|
|
mark_seen: bool = False
|
|
|
|
@field_validator("since", "before", mode="before")
|
|
@classmethod
|
|
def empty_date_is_missing(cls, value):
|
|
return None if value == "" else value
|