Skip to content
Snippets Groups Projects
Commit 070f222a authored by Robert Habermann's avatar Robert Habermann
Browse files

add option to get for html body as attachment

parent 3405aef3
No related branches found
No related tags found
No related merge requests found
...@@ -1128,7 +1128,8 @@ class Client(object): ...@@ -1128,7 +1128,8 @@ class Client(object):
ticket_id, ticket_id,
articles=False, articles=False,
attachments=False, attachments=False,
dynamic_fields=True): dynamic_fields=True,
html_body_as_attachment=False):
"""ticket_get_by_id """ticket_get_by_id
Args: Args:
...@@ -1138,6 +1139,8 @@ class Client(object): ...@@ -1138,6 +1139,8 @@ class Client(object):
Articles (*default: False*) Articles (*default: False*)
dynamic_fields (bool): will request OTRS to include all dynamic_fields (bool): will request OTRS to include all
Dynamic Fields (*default: True*) Dynamic Fields (*default: True*)
html_body_as_attachment (bool): Optional, If enabled the HTML body version of
each article is added to the attachments list
Returns: Returns:
**Ticket** or **False**: Ticket object if successful, otherwise **False**. **Ticket** or **False**: Ticket object if successful, otherwise **False**.
...@@ -1153,7 +1156,8 @@ class Client(object): ...@@ -1153,7 +1156,8 @@ class Client(object):
"TicketID": "{0}".format(ticket_id), "TicketID": "{0}".format(ticket_id),
"AllArticles": int(articles), "AllArticles": int(articles),
"Attachments": int(attachments), "Attachments": int(attachments),
"DynamicFields": int(dynamic_fields) "DynamicFields": int(dynamic_fields),
"HTMLBodyAsAttachment": int(html_body_as_attachment),
} }
if not self._parse_and_validate_response(self._send_request(payload)): if not self._parse_and_validate_response(self._send_request(payload)):
...@@ -1165,7 +1169,8 @@ class Client(object): ...@@ -1165,7 +1169,8 @@ class Client(object):
ticket_id_list, ticket_id_list,
articles=False, articles=False,
attachments=False, attachments=False,
dynamic_fields=True): dynamic_fields=True,
html_body_as_attachment=False):
"""ticket_get_by_list """ticket_get_by_list
Args: Args:
...@@ -1175,6 +1180,8 @@ class Client(object): ...@@ -1175,6 +1180,8 @@ class Client(object):
Articles (*default: False*) Articles (*default: False*)
dynamic_fields (bool): will request OTRS to include all dynamic_fields (bool): will request OTRS to include all
Dynamic Fields (*default: True*) Dynamic Fields (*default: True*)
html_body_as_attachment (bool): Optional, If enabled the HTML body version of
each article is added to the attachments list
Returns: Returns:
**list**: Ticket objects (as list) if successful, otherwise **False**. **list**: Ticket objects (as list) if successful, otherwise **False**.
...@@ -1193,7 +1200,8 @@ class Client(object): ...@@ -1193,7 +1200,8 @@ class Client(object):
"TicketID": ','.join([str(item) for item in ticket_id_list]), "TicketID": ','.join([str(item) for item in ticket_id_list]),
"AllArticles": int(articles), "AllArticles": int(articles),
"Attachments": int(attachments), "Attachments": int(attachments),
"DynamicFields": int(dynamic_fields) "DynamicFields": int(dynamic_fields),
"HTMLBodyAsAttachment": int(html_body_as_attachment),
} }
if not self._parse_and_validate_response(self._send_request(payload)): if not self._parse_and_validate_response(self._send_request(payload)):
...@@ -1205,7 +1213,8 @@ class Client(object): ...@@ -1205,7 +1213,8 @@ class Client(object):
ticket_number, ticket_number,
articles=False, articles=False,
attachments=False, attachments=False,
dynamic_fields=True): dynamic_fields=True,
html_body_as_attachment=False):
"""ticket_get_by_number """ticket_get_by_number
Args: Args:
...@@ -1215,6 +1224,8 @@ class Client(object): ...@@ -1215,6 +1224,8 @@ class Client(object):
Articles (*default: False*) Articles (*default: False*)
dynamic_fields (bool): will request OTRS to include all dynamic_fields (bool): will request OTRS to include all
Dynamic Fields (*default: True*) Dynamic Fields (*default: True*)
html_body_as_attachment (bool): Optional, If enabled the HTML body version of
each article is added to the attachments list
Raises: Raises:
ValueError ValueError
...@@ -1235,7 +1246,8 @@ class Client(object): ...@@ -1235,7 +1246,8 @@ class Client(object):
result = self.ticket_get_by_id(result_list[0], result = self.ticket_get_by_id(result_list[0],
articles=articles, articles=articles,
attachments=attachments, attachments=attachments,
dynamic_fields=dynamic_fields) dynamic_fields=dynamic_fields,
html_body_as_attachment=html_body_as_attachment)
if not result: if not result:
return False return False
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment