huaweicloud-sdk-python-v3/huaweicloud-sdk-smn/huaweicloudsdksmn/v2/model/publish_message_request_bod...

290 lines
18 KiB
Python
Raw Normal View History

# coding: utf-8
import six
2021-07-26 11:24:08 +00:00
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class PublishMessageRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
sensitive_list = []
openapi_types = {
'subject': 'str',
'message': 'str',
'message_structure': 'str',
'message_template_name': 'str',
'tags': 'dict(str, str)',
2024-01-04 08:24:03 +00:00
'time_to_live': 'str',
'message_attributes': 'list[MessageAttribute]'
}
attribute_map = {
'subject': 'subject',
'message': 'message',
'message_structure': 'message_structure',
'message_template_name': 'message_template_name',
'tags': 'tags',
2024-01-04 08:24:03 +00:00
'time_to_live': 'time_to_live',
'message_attributes': 'message_attributes'
}
2024-01-04 08:24:03 +00:00
def __init__(self, subject=None, message=None, message_structure=None, message_template_name=None, tags=None, time_to_live=None, message_attributes=None):
2022-04-21 12:03:46 +00:00
"""PublishMessageRequestBody
The model defined in huaweicloud sdk
:param subject: 消息标题给邮箱订阅者发送邮件时作为邮件主题长度不能超过512个字节
:type subject: str
:param message: 发送的消息消息体必须是UTF-8编码的字符串大小至多256KB如果订阅者是手机号码长度不超过490个字符超出部分系统自动截断短信内容不能包含[]或者符号 对于移动推送订阅者推送消息message消息必须符合移动推送平台的消息格式消息格式请参见application消息体格式否则移动app无法收到消息目前支持的平台有HMSAPNSAPNS_SANDBOX 说明 三种消息发送方式 message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
:type message: str
2023-06-01 09:10:44 +00:00
:param message_structure: Json格式的字符串支持emailsms httphttpsdmsfunctiongraphfunctionstageHMSAPNSAPNS_SANDBOX \"dingding\", \"wechat\",feishu, \"welink\"其中HMSAPNS以及APNS_SANDBOX三种消息的格式请参见application消息体格式必须设置默认的消息default当匹配不到消息协议时default中的内容发送其中钉钉微信飞书welink协议类型的消息需指定msgType字段钉钉微信和飞书机器人协议支持msgType为text纯文本和markdownMD格式消息welink和红版welink机器人类型暂仅支持msgType为text的纯文本消息 说明 三种消息发送方式 message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message 华为透传消息 { \"hps\": { \"msg\": { \"type\": 1, \"body\": { \"key\": \"value\" } } } } 华为系统通知栏消息 { \"hps\": { \"msg\": { \"type\": 3, \"body\": { \"content\": \"Push message content\", \"title\": \"Push message content\" }, \"action\": { \"type\": 1, \"param\": { \"intent\": \"#Intent;compo=com.rvr/.Activity;S.W=U;end\" } } }, \"ext\": { \"biTag\": \"Trump\", \"icon\": \"http://upload.w.org/00/150pxsvg.png\" } } } 苹果平台消息格式 { \"aps\": { \"alert\": \"hello world\" } }
2022-04-21 12:03:46 +00:00
:type message_structure: str
2023-06-01 09:10:44 +00:00
:param message_template_name: 消息模板名称可通过[查询消息模板列表](ListMessageTemplates.xml)获取名称 说明 三种消息发送方式: message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
2022-04-21 12:03:46 +00:00
:type message_template_name: str
:param tags: tag以及替换tag的参数组成的字典消息模板中的标签对应的值使用消息模板方式的消息发布必须携带该参数字典中的key为消息模板中的参数名称不超过21个字符字典中的value为消息模板中的参数被替换后的值不超过1KB
:type tags: dict(str, str)
:param time_to_live: 指消息在SMN系统内部的最长存留时间超过该存留时间系统将不再发送该消息单位是s变量默认值是3600s即一小时值为正整数且小于等于3600*24
:type time_to_live: str
2024-01-04 08:24:03 +00:00
:param message_attributes: 消息属性列表
:type message_attributes: list[:class:`huaweicloudsdksmn.v2.MessageAttribute`]
2022-04-21 12:03:46 +00:00
"""
self._subject = None
self._message = None
self._message_structure = None
self._message_template_name = None
self._tags = None
self._time_to_live = None
2024-01-04 08:24:03 +00:00
self._message_attributes = None
self.discriminator = None
if subject is not None:
self.subject = subject
if message is not None:
self.message = message
if message_structure is not None:
self.message_structure = message_structure
if message_template_name is not None:
self.message_template_name = message_template_name
if tags is not None:
self.tags = tags
2021-06-10 11:54:19 +00:00
if time_to_live is not None:
self.time_to_live = time_to_live
2024-01-04 08:24:03 +00:00
if message_attributes is not None:
self.message_attributes = message_attributes
@property
def subject(self):
"""Gets the subject of this PublishMessageRequestBody.
2021-06-10 11:54:19 +00:00
消息标题给邮箱订阅者发送邮件时作为邮件主题长度不能超过512个字节
:return: The subject of this PublishMessageRequestBody.
:rtype: str
"""
return self._subject
@subject.setter
def subject(self, subject):
"""Sets the subject of this PublishMessageRequestBody.
2021-06-10 11:54:19 +00:00
消息标题给邮箱订阅者发送邮件时作为邮件主题长度不能超过512个字节
:param subject: The subject of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type subject: str
"""
self._subject = subject
@property
def message(self):
"""Gets the message of this PublishMessageRequestBody.
发送的消息消息体必须是UTF-8编码的字符串大小至多256KB如果订阅者是手机号码长度不超过490个字符超出部分系统自动截断短信内容不能包含[]或者符号 对于移动推送订阅者推送消息message消息必须符合移动推送平台的消息格式消息格式请参见application消息体格式否则移动app无法收到消息目前支持的平台有HMSAPNSAPNS_SANDBOX 说明 三种消息发送方式 message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
:return: The message of this PublishMessageRequestBody.
:rtype: str
"""
return self._message
@message.setter
def message(self, message):
"""Sets the message of this PublishMessageRequestBody.
发送的消息消息体必须是UTF-8编码的字符串大小至多256KB如果订阅者是手机号码长度不超过490个字符超出部分系统自动截断短信内容不能包含[]或者符号 对于移动推送订阅者推送消息message消息必须符合移动推送平台的消息格式消息格式请参见application消息体格式否则移动app无法收到消息目前支持的平台有HMSAPNSAPNS_SANDBOX 说明 三种消息发送方式 message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
:param message: The message of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type message: str
"""
self._message = message
@property
def message_structure(self):
"""Gets the message_structure of this PublishMessageRequestBody.
2023-06-01 09:10:44 +00:00
Json格式的字符串支持emailsms httphttpsdmsfunctiongraphfunctionstageHMSAPNSAPNS_SANDBOX \"dingding\", \"wechat\",”feishu“, \"welink\"。其中“HMS”、“APNS”以及“APNS_SANDBOX”三种消息的格式请参见application消息体格式。必须设置默认的消息“default”当匹配不到消息协议时按“default”中的内容发送。其中钉钉、微信、飞书、welink协议类型的消息需指定msgType字段钉钉微信和飞书机器人协议支持msgType为text纯文本和markdownMD格式消息welink和红版welink机器人类型暂仅支持msgType为text的纯文本消息。 说明: 三种消息发送方式 message message_structure message_template_name 至少设置其中一个,如果同时设置,生效的优先级为 message_structure > message_template_name > message。 华为透传消息 { \"hps\": { \"msg\": { \"type\": 1, \"body\": { \"key\": \"value\" } } } } 华为系统通知栏消息 { \"hps\": { \"msg\": { \"type\": 3, \"body\": { \"content\": \"Push message content\", \"title\": \"Push message content\" }, \"action\": { \"type\": 1, \"param\": { \"intent\": \"#Intent;compo=com.rvr/.Activity;S.W=U;end\" } } }, \"ext\": { \"biTag\": \"Trump\", \"icon\": \"http://upload.w.org/00/150pxsvg.png\" } } } 苹果平台消息格式 { \"aps\": { \"alert\": \"hello world\" } }
:return: The message_structure of this PublishMessageRequestBody.
:rtype: str
"""
return self._message_structure
@message_structure.setter
def message_structure(self, message_structure):
"""Sets the message_structure of this PublishMessageRequestBody.
2023-06-01 09:10:44 +00:00
Json格式的字符串支持emailsms httphttpsdmsfunctiongraphfunctionstageHMSAPNSAPNS_SANDBOX \"dingding\", \"wechat\",”feishu“, \"welink\"。其中“HMS”、“APNS”以及“APNS_SANDBOX”三种消息的格式请参见application消息体格式。必须设置默认的消息“default”当匹配不到消息协议时按“default”中的内容发送。其中钉钉、微信、飞书、welink协议类型的消息需指定msgType字段钉钉微信和飞书机器人协议支持msgType为text纯文本和markdownMD格式消息welink和红版welink机器人类型暂仅支持msgType为text的纯文本消息。 说明: 三种消息发送方式 message message_structure message_template_name 至少设置其中一个,如果同时设置,生效的优先级为 message_structure > message_template_name > message。 华为透传消息 { \"hps\": { \"msg\": { \"type\": 1, \"body\": { \"key\": \"value\" } } } } 华为系统通知栏消息 { \"hps\": { \"msg\": { \"type\": 3, \"body\": { \"content\": \"Push message content\", \"title\": \"Push message content\" }, \"action\": { \"type\": 1, \"param\": { \"intent\": \"#Intent;compo=com.rvr/.Activity;S.W=U;end\" } } }, \"ext\": { \"biTag\": \"Trump\", \"icon\": \"http://upload.w.org/00/150pxsvg.png\" } } } 苹果平台消息格式 { \"aps\": { \"alert\": \"hello world\" } }
:param message_structure: The message_structure of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type message_structure: str
"""
self._message_structure = message_structure
@property
def message_template_name(self):
"""Gets the message_template_name of this PublishMessageRequestBody.
2023-06-01 09:10:44 +00:00
消息模板名称可通过[查询消息模板列表](ListMessageTemplates.xml)获取名称 说明 三种消息发送方式: message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
:return: The message_template_name of this PublishMessageRequestBody.
:rtype: str
"""
return self._message_template_name
@message_template_name.setter
def message_template_name(self, message_template_name):
"""Sets the message_template_name of this PublishMessageRequestBody.
2023-06-01 09:10:44 +00:00
消息模板名称可通过[查询消息模板列表](ListMessageTemplates.xml)获取名称 说明 三种消息发送方式: message message_structure message_template_name 至少设置其中一个如果同时设置生效的优先级为 message_structure > message_template_name > message
:param message_template_name: The message_template_name of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type message_template_name: str
"""
self._message_template_name = message_template_name
@property
def tags(self):
"""Gets the tags of this PublishMessageRequestBody.
tag以及替换tag的参数组成的字典消息模板中的标签对应的值使用消息模板方式的消息发布必须携带该参数字典中的key为消息模板中的参数名称不超过21个字符字典中的value为消息模板中的参数被替换后的值不超过1KB
:return: The tags of this PublishMessageRequestBody.
:rtype: dict(str, str)
"""
return self._tags
@tags.setter
def tags(self, tags):
"""Sets the tags of this PublishMessageRequestBody.
tag以及替换tag的参数组成的字典消息模板中的标签对应的值使用消息模板方式的消息发布必须携带该参数字典中的key为消息模板中的参数名称不超过21个字符字典中的value为消息模板中的参数被替换后的值不超过1KB
:param tags: The tags of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type tags: dict(str, str)
"""
self._tags = tags
@property
def time_to_live(self):
"""Gets the time_to_live of this PublishMessageRequestBody.
指消息在SMN系统内部的最长存留时间超过该存留时间系统将不再发送该消息单位是s变量默认值是3600s即一小时值为正整数且小于等于3600*24
:return: The time_to_live of this PublishMessageRequestBody.
:rtype: str
"""
return self._time_to_live
@time_to_live.setter
def time_to_live(self, time_to_live):
"""Sets the time_to_live of this PublishMessageRequestBody.
指消息在SMN系统内部的最长存留时间超过该存留时间系统将不再发送该消息单位是s变量默认值是3600s即一小时值为正整数且小于等于3600*24
:param time_to_live: The time_to_live of this PublishMessageRequestBody.
2022-04-21 12:03:46 +00:00
:type time_to_live: str
"""
self._time_to_live = time_to_live
2024-01-04 08:24:03 +00:00
@property
def message_attributes(self):
"""Gets the message_attributes of this PublishMessageRequestBody.
消息属性列表
:return: The message_attributes of this PublishMessageRequestBody.
:rtype: list[:class:`huaweicloudsdksmn.v2.MessageAttribute`]
"""
return self._message_attributes
@message_attributes.setter
def message_attributes(self, message_attributes):
"""Sets the message_attributes of this PublishMessageRequestBody.
消息属性列表
:param message_attributes: The message_attributes of this PublishMessageRequestBody.
:type message_attributes: list[:class:`huaweicloudsdksmn.v2.MessageAttribute`]
"""
self._message_attributes = message_attributes
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
if attr in self.sensitive_list:
result[attr] = "****"
else:
result[attr] = value
return result
def to_str(self):
2021-08-10 12:26:18 +00:00
"""Returns the string representation of the model"""
2021-07-09 10:57:08 +00:00
import simplejson as json
2021-08-10 12:26:18 +00:00
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
def __repr__(self):
2021-08-10 12:26:18 +00:00
"""For `print`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, PublishMessageRequestBody):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other