about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py')
-rw-r--r--.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py90
1 files changed, 90 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py b/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py
new file mode 100644
index 00000000..d515e885
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/sendgrid/helpers/mail/substitution.py
@@ -0,0 +1,90 @@
+class Substitution(object):
+    """A string substitution to be applied to the text and HTML contents of
+    the body of your email, as well as in the Subject and Reply-To parameters.
+    """
+
+    def __init__(self, key=None, value=None, p=None):
+        """Create a Substitution with the given key and value.
+
+        :param key: Text to be replaced with "value" param
+        :type key: string, optional
+        :param value: Value to substitute into email
+        :type value: string, optional
+        :param name: p is the Personalization object or Personalization object
+                     index
+        :type name: 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):
+        """The substitution key.
+
+        :rtype key: string
+        """
+        return self._key
+
+    @key.setter
+    def key(self, value):
+        """The substitution key.
+
+        :param key: The substitution key.
+        :type key: string
+        """
+        self._key = value
+
+    @property
+    def value(self):
+        """The substitution value.
+
+        :rtype value: string
+        """
+        return str(self._value) if isinstance(self._value, int) else self._value
+
+    @value.setter
+    def value(self, value):
+        """The substitution value.
+
+        :param value: The substitution value.
+        :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 Substitution.
+
+        :returns: This Substitution, ready for use in a request body.
+        :rtype: dict
+        """
+        substitution = {}
+        if self.key is not None and self.value is not None:
+            substitution[self.key] = self.value
+        return substitution