Source code for q2_sdk.hq.db.message_recipient_group

from argparse import _SubParsersAction
from functools import partial
from typing import List

from lxml.objectify import IntElement, StringElement, BoolElement

from .db_object import DbObject
from .representation_row_base import RepresentationRowBase


[docs] class MessageRecipientGroupRow(RepresentationRowBase): GroupID: IntElement = "GroupID" GroupName: StringElement = "GroupName" VisibleToEndUser: BoolElement = "VisibleToEndUser" AllowReplies: BoolElement = "AllowReplies" GroupDescription: StringElement = "GroupDescription"
[docs] class MessageRecipientGroup(DbObject): """ Used to gather the CSR message groups that can receive secure messages from within the Q2 platform. Generally used in combination with the SendSecureMessageAsXML HQ method to send a message from an end user to a CSR message group """ GET_BY_NAME_KEY = "GroupName" NAME = "MessageRecipientGroup" REPRESENTATION_ROW_CLASS = MessageRecipientGroupRow
[docs] def add_arguments(self, parser: _SubParsersAction): subparser = parser.add_parser("get_message_recipient_groups") subparser.set_defaults(parser="get_message_recipient_groups") subparser.set_defaults(func=partial(self.get, serialize_for_cli=True))
[docs] async def get(self, serialize_for_cli=False) -> List[MessageRecipientGroupRow]: response = await self.call_hq("sdk_GetMessageRecipientGroups") if serialize_for_cli: response = self.serialize_for_cli( response, fields_to_display=[ "GroupID", "GroupName", "VisibleToEndUser", "AllowReplies", "GroupDescription", ], ) return response