Skip to content

Commit 055df64

Browse files
committed
Adding AMP body support to injectionAPI
1 parent aa9cd17 commit 055df64

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

socketlabs/injectionapi/core/injectionrequestfactory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def generate_base_message(message: MessageBase):
142142
message_json.subject = message.subject
143143
message_json.plain_text_body = message.plain_text_body
144144
message_json.html_body = message.html_body
145+
message_json.amp_body = message.amp_body
145146
message_json.mailing_id = message.mailing_id
146147
message_json.message_id = message.message_id
147148
message_json.charset = message.charset

socketlabs/injectionapi/core/serialization/messagejson.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self):
1414
self._subject = None
1515
self._plain_text_body = None
1616
self._html_body = None
17+
self._amp_body = None
1718
self._api_template = None
1819
self._mailing_id = None
1920
self._message_id = None
@@ -147,6 +148,24 @@ def html_body(self, val: str):
147148
"""
148149
self._html_body = val
149150

151+
@property
152+
def amp_body(self):
153+
"""
154+
Get the AMP portion of the message body.
155+
:return the AMP body
156+
:rtype str
157+
"""
158+
return self._amp_body
159+
160+
@amp_body.setter
161+
def amp_body(self, val: str):
162+
"""
163+
Set the AMP portion of the message body.
164+
:param val: the AMP body
165+
:type val: str
166+
"""
167+
self._amp_body = val
168+
150169
@property
151170
def api_template(self):
152171
"""
@@ -353,6 +372,9 @@ def to_json(self):
353372
if self.html_body is not None and self.html_body.strip() != '':
354373
json["htmlBody"] = self.html_body
355374

375+
if self.amp_body is not None and self._amp_body.strip() != '':
376+
json["ampBody"] = self.amp_body
377+
356378
if self.plain_text_body is not None and self.plain_text_body.strip() != '':
357379
json["textBody"] = self.plain_text_body
358380

socketlabs/injectionapi/message/basicmessage.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(self):
3535
self._subject = None
3636
self._plain_text_body = None
3737
self._html_body = None
38+
self._amp_body = None
3839
self._api_template = None
3940
self._mailing_id = None
4041
self._message_id = None
@@ -213,6 +214,24 @@ def html_body(self, val: str):
213214
"""
214215
self._html_body = val
215216

217+
@property
218+
def amp_body(self):
219+
"""
220+
Get the AMP portion of the message body.
221+
:return the AMP body
222+
:rtype str
223+
"""
224+
return self._amp_body
225+
226+
@amp_body.setter
227+
def amp_body(self, val: str):
228+
"""
229+
Set the AMP portion of the message body.
230+
:param val: the AMP body
231+
:type val: str
232+
"""
233+
self._amp_body = val
234+
216235
@property
217236
def api_template(self):
218237
"""

socketlabs/injectionapi/message/bulkmessage.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(self):
3939
self._subject = None
4040
self._plain_text_body = None
4141
self._html_body = None
42+
self._amp_body = None
4243
self._api_template = None
4344
self._mailing_id = None
4445
self._message_id = None
@@ -174,6 +175,24 @@ def html_body(self, val: str):
174175
"""
175176
self._html_body = val
176177

178+
@property
179+
def amp_body(self):
180+
"""
181+
Get the AMP portion of the message body.
182+
:return the AMP body
183+
:rtype str
184+
"""
185+
return self._amp_body
186+
187+
@amp_body.setter
188+
def amp_body(self, val: str):
189+
"""
190+
Set the AMP portion of the message body.
191+
:param val: the AMP body
192+
:type val: str
193+
"""
194+
self._amp_body = val
195+
177196
@property
178197
def api_template(self):
179198
"""

socketlabs/injectionapi/message/messagebase.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ def html_body(self, val: str):
7070
"""
7171
pass
7272

73+
@property
74+
@abstractmethod
75+
def amp_body(self):
76+
"""
77+
Get the AMP portion of the message body.
78+
:return the AMP body
79+
:rtype str
80+
"""
81+
pass
82+
83+
@amp_body.setter
84+
@abstractmethod
85+
def amp_body(self, val: str):
86+
"""
87+
Set the AMP portion of the message body.
88+
:param val: the AMP body
89+
:type val: str
90+
"""
91+
pass
92+
7393
@property
7494
@abstractmethod
7595
def api_template(self):

0 commit comments

Comments
 (0)