aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/section.py
blob: cea949b143f52f80f242477b5d27dd7fa1c4e9ea (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class Section(object):
    """A block section of code to be used as a substitution."""

    def __init__(self, key=None, value=None):
        """Create a section with the given key and value.

        :param key: section of code key
        :type key: string
        :param value: section of code value
        :type value: string
        """
        self._key = None
        self._value = None

        if key is not None:
            self.key = key
        if value is not None:
            self.value = value

    @property
    def key(self):
        """A section of code's key.

        :rtype key: string
        """
        return self._key

    @key.setter
    def key(self, value):
        """A section of code's key.

        :param key: section of code key
        :type key: string
        """
        self._key = value

    @property
    def value(self):
        """A section of code's value.

        :rtype: string
        """
        return self._value

    @value.setter
    def value(self, value):
        """A section of code's value.

        :param value: A section of code's value.
        :type value: string
        """
        self._value = value

    def get(self):
        """
        Get a JSON-ready representation of this Section.

        :returns: This Section, ready for use in a request body.
        :rtype: dict
        """
        section = {}
        if self.key is not None and self.value is not None:
            section[self.key] = self.value
        return section