(20250115) Can accept WhatsApp (Nimbus) integrations now.
This commit is contained in:
+36
-4
@@ -95,6 +95,32 @@ class TelegramAuth(BaseModel):
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class WhatsAppNimbusAuth(BaseModel):
|
||||
|
||||
apiKey: str = Field(
|
||||
description = "???",
|
||||
min_length = 1,
|
||||
frozen = True
|
||||
)
|
||||
|
||||
senderId: str = Field(
|
||||
description = "???",
|
||||
min_length = 1,
|
||||
frozen = True
|
||||
)
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
# ┗┛┗┛┛┗┛┗┗┫
|
||||
# ┛
|
||||
|
||||
class Config:
|
||||
extra = "forbid"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class ChatAuthRequestHeaders(BaseModel):
|
||||
|
||||
sessionToken: str = Field(
|
||||
@@ -121,8 +147,12 @@ class ChatAuthRequestHeaders(BaseModel):
|
||||
|
||||
class ChatAuthRequestData(BaseModel):
|
||||
|
||||
chatClient: Literal["telegram", "whatsapp"] = Field(alias = "client")
|
||||
auth: Union[TelegramAuth]
|
||||
chatClient: Literal[
|
||||
"telegram", # ........ Official Telegram API.
|
||||
"whatsapp", # ........ Official WhatsApp API.
|
||||
"whatsappNimbus" # ... Nimbus IT's unofficial WhatsApp API.
|
||||
] = Field(alias = "client")
|
||||
auth: Union[TelegramAuth, WhatsAppNimbusAuth]
|
||||
|
||||
# ┏┓ ┏•
|
||||
# ┃ ┏┓┏┓╋┓┏┓
|
||||
@@ -138,10 +168,12 @@ class ChatAuthRequestData(BaseModel):
|
||||
|
||||
@model_validator(mode = "after")
|
||||
def ensure_harmony(cls, values):
|
||||
client = values.client
|
||||
client = values.chatClient
|
||||
auth = values.auth
|
||||
harmony_map = {
|
||||
"telegram": TelegramAuth
|
||||
"telegram": TelegramAuth,
|
||||
# "whatsapp": None,
|
||||
"whatsappNimbus": WhatsAppNimbusAuth
|
||||
}
|
||||
if not isinstance(auth, harmony_map[client]):
|
||||
raise ValueError(f"incorrect 'auth' for selected client '{client}'")
|
||||
|
||||
@@ -106,7 +106,7 @@ class CoreAuthTokenModel(BaseModel):
|
||||
|
||||
client: Literal[
|
||||
"gmail", "outlook", # ............................. Mail Clients
|
||||
"telegram", "whatsapp", # ......................... Chat Clients
|
||||
"telegram", "whatsapp", "whatsappNimbus", # ....... Chat Clients
|
||||
"nimbusSmsIndia", "savvyBulkSmsKenya", # .......... SMS Clients
|
||||
"razorpay", "safaricomMPesaExpress", # ............ Payment Gateways
|
||||
"zerodhaKite", "iciciBreeze", "paperTrading", # ... Stock Brokers
|
||||
|
||||
@@ -112,9 +112,9 @@ class CoreMessageModel(BaseModel):
|
||||
)
|
||||
|
||||
client: Literal[
|
||||
"gmail", "outlook", # ...................... Mail Clients
|
||||
"telegram", "whatsapp", # .................. Chat Clients
|
||||
"nimbusSmsIndia", "savvyBulkSmsKenya", # ... SMS Clients
|
||||
"gmail", "outlook", # ........................................ Mail Clients
|
||||
"telegram", "whatsapp", "whatsappNimbus", # .................. Chat Clients
|
||||
"nimbusSmsIndia", "savvyBulkSmsKenya", # ..................... SMS Clients
|
||||
] = Field(
|
||||
description = "the third-part client that was used",
|
||||
frozen = True
|
||||
|
||||
Reference in New Issue
Block a user