Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/sendgrid/helpers/mail/plain_text_content.py: 39%
25 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1from .content import Content
2from .validators import ValidateApiKey
5class PlainTextContent(Content):
6 """Plain text content to be included in your email.
7 """
9 def __init__(self, content):
10 """Create a PlainTextContent with the specified MIME type and content.
12 :param content: The actual text content.
13 :type content: string
14 """
15 self._content = None
16 self._validator = ValidateApiKey()
18 if content is not None:
19 self.content = content
21 @property
22 def mime_type(self):
23 """The MIME type.
25 :rtype: string
26 """
27 return "text/plain"
29 @property
30 def content(self):
31 """The actual text content.
33 :rtype: string
34 """
35 return self._content
37 @content.setter
38 def content(self, value):
39 """The actual text content.
41 :param value: The actual text content.
42 :type value: string
43 """
44 self._validator.validate_message_dict(value)
45 self._content = value
47 def get(self):
48 """
49 Get a JSON-ready representation of this PlainTextContent.
51 :returns: This PlainTextContent, ready for use in a request body.
52 :rtype: dict
53 """
54 content = {}
55 if self.mime_type is not None:
56 content["type"] = self.mime_type
58 if self.content is not None:
59 content["value"] = self.content
60 return content