Files
cosec_automation/backend/models/api/common.py
T

116 lines
4.3 KiB
Python

"""
AUTHOR:
Khushal P Soonderji
DATE:
Fri, 14th Nov, 2025
OBJECTIVE:
To provide data model(s) for common elements of every REST APi request (like the headers).
REFERENCES:
N/A
DOWNLOADS:
N/A
"""
# *****************************************************************************************************************
# ***** ****
# *** IMPORT ***
# ***** ****
# *****************************************************************************************************************
# To make sibling directories accessible for imports:
import sys
sys.path.append(".")
sys.path.append("..")
# For making data behaviour_models:
from pydantic import BaseModel, Field, field_validator, AwareDatetime
from typing import Optional, Literal
# My utils:
from utils_v2.string import regex
from utils_v2.date_time import date_time
# *****************************************************************************************************************
# ***** ****
# *** MACROS / ONE-TIME INIT ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** VARIABLES ***
# ***** ****
# *****************************************************************************************************************
# --- Nothing Yet
# *****************************************************************************************************************
# ***** ****
# *** FUNCTIONS ***
# ***** ****
# *****************************************************************************************************************
class SimpleCosecCredentialsHeaders(BaseModel):
cosecUrl: str = Field(
description = "The URL to Cosec's portal.",
frozen = True,
alias = "X-Cosec-URL"
)
cosecUsername: str = Field(
description = "The username on Cosec's portal.",
frozen = True,
alias = "X-Cosec-Username"
)
cosecPassword: str = Field(
description = "The password on Cosec's portal.",
frozen = True,
alias = "X-Cosec-Password"
)
# ┏┓ ┏•
# ┃ ┏┓┏┓╋┓┏┓
# ┗┛┗┛┛┗┛┗┗┫
# ┛
class Config:
extra = "allow"
def model_dump(self, *args, **kwargs):
return super().model_dump(*args, by_alias = True, **kwargs)
# *****************************************************************************************************************
# ***** ****
# *** MAIN PROGRAM ***
# ***** ****
# *****************************************************************************************************************
if __name__ == "__main__":
pass