Skip to content

Commit

Permalink
Merge pull request #131 from mganisin/subject-arg
Browse files Browse the repository at this point in the history
Allow subject definition in send_message
  • Loading branch information
Marian Ganisin authored Nov 29, 2022
2 parents 33b0512 + 3dc87ed commit 9fb2dbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion threescale_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 9fb2dbd

Please sign in to comment.