(20250620) SMS sending module also ported for internal use.

This commit is contained in:
2025-06-20 12:15:51 +05:30
parent ff490a55b2
commit 1ec1c0a4ec
3 changed files with 107 additions and 176 deletions
+50 -38
View File
@@ -71,25 +71,46 @@ from utils_v2.string import regex
# *****************************************************************************************************************
class NimbusSendSMS(BaseModel):
class NimbusSMSSendRequest(BaseModel):
"""
This data model is used when the API call is made to send an SMS message.
'entityId': is the id given to you by DLT.
'templateId' is the id given to you by DLT for a template of a message.
'recipientNo' is the phone number of the person you want to send the message to.
'senderId' 6-char code like "HDFCBK", "NSESMS", "ZRODHA" that you see in your SMS inbox.
'userId' is the 6-digit id given to you by Nimbus.
'apiKey' is the key generated on Nimbus's portal.
"""
entityId: str | int | None = Field(
description = "The id given to you by DLT.",
default = None,
frozen = True
)
entityId: str | int
templateId: str | int
recipientNo: str | int
message: str
senderId: str | int
userId: str | int
apiKey: str
templateId: str | int = Field(
description = "The id given to you by DLT for a template of a message.",
frozen = True
)
recipientNo: str | int = Field(
description = "The phone number of the person you want to send the message to.",
frozen = True
)
message: str = Field(
description = "The message you want to send.",
frozen = True
)
senderId: str | int | None = Field(
description = "6-char code like 'HDFCBK', 'NSESMS', 'ZRODHA' that you see in your SMS inbox.",
default = None,
frozen = True
)
userId: str | int | None = Field(
description = "The 6-digit id given to you by Nimbus.",
default = None,
frozen = True
)
apiKey: str | None = Field(
description = "The key generated on Nimbus's portal.",
default = None,
frozen = True
)
class Config:
extra = "forbid"
@@ -118,16 +139,19 @@ class NimbusSendSMS(BaseModel):
# ---------------------------------------------------------------------------------------------------------------------
class NimbusGetBalance(BaseModel):
class NimbusGetBalanceRequest(BaseModel):
"""
This data model is used when the API call is made to check how much balance is remaining in your Nimbus wallet.
'userId' is the 6-digit id given to you by Nimbus.
'apiKey' is the key generated on Nimbus's portal.
"""
userId: str | int | None = Field(
description = "The 6-digit id given to you by Nimbus.",
default = None,
frozen = True
)
userId: str | int
apiKey: str
apiKey: str | None = Field(
description = "The key generated on Nimbus's portal.",
default = None,
frozen = True
)
class Config:
extra = "forbid"
@@ -151,16 +175,4 @@ class NimbusGetBalance(BaseModel):
if __name__ == "__main__":
from utils_v2.string import json
my_msg = NimbusSendSMS(
entityId = 123,
templateId = 456,
recipientNo = "789",
message = "Hello, World!",
senderId = "TCAOFF",
userId = "123456",
apiKey = "123@ABC"
)
print(json.to_string(my_msg.model_dump()))
pass