aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/custom_arg.py
blob: 63b22557333c11bd9f7cd3466cd7cc6d60334af9 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
class CustomArg(object):
    """Values that will be carried along with the email and its activity data.

    Substitutions will not be made on custom arguments, so any string entered
    into this parameter will be assumed to be the custom argument that you
    would like to be used. Top-level CustomArgs may be overridden by ones in a
    Personalization. May not exceed 10,000 bytes.
    """

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

            :param key: Key for this CustomArg
            :type key: string, optional
            :param value: Value of this CustomArg
            :type value: string, optional
            :param p: p is the Personalization object or Personalization
                      object index
            :type p: Personalization, integer, optional
        """
        self._key = None
        self._value = None
        self._personalization = None

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

    @property
    def key(self):
        """Key for this CustomArg.

        :rtype: string
        """
        return self._key

    @key.setter
    def key(self, value):
        """Key for this CustomArg.

        :param value: Key for this CustomArg.
        :type value: string
        """
        self._key = value

    @property
    def value(self):
        """Value of this CustomArg.

        :rtype: string
        """
        return self._value

    @value.setter
    def value(self, value):
        """Value of this CustomArg.

        :param value: Value of this CustomArg.
        :type value: string
        """
        self._value = value

    @property
    def personalization(self):
        """The Personalization object or Personalization object index

        :rtype: Personalization, integer
        """
        return self._personalization

    @personalization.setter
    def personalization(self, value):
        """The Personalization object or Personalization object index

        :param value: The Personalization object or Personalization object
                      index
        :type value: Personalization, integer
        """
        self._personalization = value

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

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