Skip to content

Commit

Permalink
Add message group id for common info (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
xncbf authored Sep 30, 2022
1 parent f20fbc1 commit 84f8a70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rcs-pydantic"
version = "0.5.3"
version = "0.5.4"
description = ""
authors = ["xncbf <[email protected]>"]
keywords = ["pydantic", "rcs", "fastapi"]
Expand Down
19 changes: 13 additions & 6 deletions rcs_pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
buttons: Optional[list] = None,
chips: Optional[list] = None,
legacy: Optional[scheme.LegacyInfo] = None,
message_group_id: Optional[str] = None,
):
self.message_info = message_info
self.agency_id = agency_id
Expand All @@ -46,6 +47,7 @@ def __init__(
self.buttons = buttons
self.chips = chips
self.legacy = legacy
self.message_group_id = message_group_id
self.send_info = self.make_send_info(
common=scheme.CommonInfo(**self.make_common_info(message_info)),
rcs=scheme.RcsInfo(**self.make_rcs_info(message_info)),
Expand All @@ -71,12 +73,17 @@ def make_common_info(self, message_info: scheme.MessageInfo) -> dict:
else:
msg_service_type = enums.MessageServiceTypeEnum.RCS

return scheme.CommonInfo(
msgId=str(uuid.uuid4()),
userContact=message_info.userContact,
scheduleType=0,
msgServiceType=msg_service_type,
).dict(exclude_unset=True)
common = {
"msgId": str(uuid.uuid4()),
"userContact": message_info.userContact,
"scheduleType": 0,
"msgServiceType": msg_service_type,
}

if self.message_group_id:
common["msgGroupId"] = self.message_group_id

return scheme.CommonInfo(**common).dict(exclude_unset=True)

def make_rcs_info(self, message_info: scheme.MessageInfo) -> dict:
rcs_info = scheme.RcsInfo(
Expand Down

0 comments on commit 84f8a70

Please sign in to comment.