(20241213) Mail Module Reworked!
This commit is contained in:
+10
-4
@@ -37,7 +37,7 @@ sys.path.append("..")
|
||||
|
||||
# For making data behaviour_models:
|
||||
from pydantic import BaseModel, Field, field_validator, PastDatetime
|
||||
from typing import Optional, Literal, List
|
||||
from typing import Optional, Literal, List, Any
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import regex
|
||||
@@ -99,10 +99,10 @@ class MailListRequestHeaders(BaseModel):
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class MailListByAccountIdRequestData(BaseModel):
|
||||
class MailListRequestData(BaseModel):
|
||||
|
||||
tokenId: str | List[str] = Field(
|
||||
description = "the account identifier(s) (Mongo ObjectId) granted by 'MailOAuthModel.get_account_identifier'",
|
||||
tokenIds: str | List[str] = Field(
|
||||
description = "the token identifier(s) that tell you which auth-tokens were used for fetching those messages",
|
||||
frozen = True
|
||||
)
|
||||
|
||||
@@ -116,10 +116,16 @@ class MailListByAccountIdRequestData(BaseModel):
|
||||
|
||||
fromCount: int = Field(
|
||||
description = "the no. of mails to skip before picking mails to list; useful for pagination",
|
||||
ge = 0,
|
||||
default = 0,
|
||||
frozen = True
|
||||
)
|
||||
|
||||
tags: List[Any] | None = Field(
|
||||
description = "any no. of tags that you want to filter by",
|
||||
default = None
|
||||
)
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
# ┗┛┗┛┛┗┛┗┗┫
|
||||
|
||||
+17
-5
@@ -6,11 +6,11 @@
|
||||
|
||||
DATE:
|
||||
|
||||
Tuesday, 3rd Dec., 2024.
|
||||
Friday, 13th Dec., 2024.
|
||||
|
||||
OBJECTIVE:
|
||||
|
||||
To provide a structure to query the full payload of an email.
|
||||
To provide a structure to work with the tags on mail messages.
|
||||
|
||||
REFERENCES:
|
||||
|
||||
@@ -37,7 +37,7 @@ sys.path.append("..")
|
||||
|
||||
# For making data behaviour_models:
|
||||
from pydantic import BaseModel, Field, field_validator, PastDatetime
|
||||
from typing import Optional, Literal
|
||||
from typing import Optional, Literal, List, Any
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import regex
|
||||
@@ -75,7 +75,7 @@ REGEX_SESSION_TOKEN = r"^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]
|
||||
# *****************************************************************************************************************
|
||||
|
||||
|
||||
class MailGetRequestHeaders(BaseModel):
|
||||
class MailUpdateTagsRequestHeaders(BaseModel):
|
||||
|
||||
sessionToken: str = Field(
|
||||
description = "the session token of the user who is requesting the service",
|
||||
@@ -99,7 +99,7 @@ class MailGetRequestHeaders(BaseModel):
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class MailGetRequestData(BaseModel):
|
||||
class MailUpdateTagsRequestData(BaseModel):
|
||||
|
||||
tokenId: str = Field(
|
||||
description = "the id of the token associated with the mail; needed for security",
|
||||
@@ -111,6 +111,18 @@ class MailGetRequestData(BaseModel):
|
||||
frozen = True
|
||||
)
|
||||
|
||||
unsetTags: List[Any] | None = Field(
|
||||
description = "the list of tags to remove from the mail",
|
||||
frozen = True,
|
||||
default = None
|
||||
)
|
||||
|
||||
setTags: List[Any] | None = Field(
|
||||
description = "the list of tags to add to the mail",
|
||||
frozen = True,
|
||||
default = None
|
||||
)
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
# ┗┛┗┛┛┗┛┗┗┫
|
||||
|
||||
Reference in New Issue
Block a user