From 3dc87ed71cee2e3b5f623a54432f444721c7b690 Mon Sep 17 00:00:00 2001 From: Marian Ganisin Date: Wed, 23 Nov 2022 22:57:43 +0000 Subject: [PATCH] Allow subject definition in send_message --- threescale_api/resources.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/threescale_api/resources.py b/threescale_api/resources.py index f086afc..f37c311 100644 --- a/threescale_api/resources.py +++ b/threescale_api/resources.py @@ -198,7 +198,7 @@ def set_plan(self, entity_id: int, plan_id: int, **kwargs): instance = self._create_instance(response=response) return instance - def send_message(self, entity_id: int, body: str, **kwargs) -> Dict: + def send_message(self, entity_id: int, body: str, subject: str = None, **kwargs) -> Dict: """Send message to a developer account Args: entity_id(int): Entity id @@ -208,6 +208,8 @@ def send_message(self, entity_id: int, body: str, **kwargs) -> Dict: """ log.info("[MSG] Send message to account (%s): %s %s", entity_id, body, kwargs) params = dict(body=body) + if subject: + params["subject"] = subject url = self._entity_url(entity_id=entity_id) + '/messages' response = self.rest.post(url=url, json=params, **kwargs) instance = utils.extract_response(response=response)