diff options
author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
---|---|---|
committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py | |
parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
download | gn-ai-master.tar.gz |
Diffstat (limited to '.venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py')
-rw-r--r-- | .venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py b/.venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py new file mode 100644 index 00000000..ae8774f2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/mailersend/sms_recipients/__init__.py @@ -0,0 +1,76 @@ +""" +Handles /sms-recipients endpoint +""" + +import requests +from mailersend.base import base + + +class NewSmsRecipients(base.NewAPIClient): + """ + Instantiates the /sms-recipients endpoint object + """ + + pass + + def get_recipients(self, status="active", sms_number_id=None, page=None, limit=25): + """ + Get information about SMS recipients. + + @params: + status (string) - Possible values are `active` and `opt_out` + sms_number_id (string) + page (int) + limit (int): Min: `10`, Max: `100`, default is 25 + """ + + passed_arguments = locals() + query_params = {} + + for key, value in passed_arguments.items(): + if key != "self": + query_params[key] = value + + request = requests.get( + f"{self.api_base}/sms-recipients", + headers=self.headers_default, + params=query_params, + ) + + return f"{request.status_code}\n{request.text}" + + def get_recipient(self, sms_recipient_id): + """ + Get information about a specific SMS recipient. + + @params: + sms_recipient_id (string) - Possible values are `active` and `opt_out` + """ + + request = requests.get( + f"{self.api_base}/sms-recipients/{sms_recipient_id}", + headers=self.headers_default, + ) + + return f"{request.status_code}\n{request.text}" + + def update_recipient(self, sms_recipient_id, status): + """ + Update a specific SMS recipient + + @params: + sms_recipient_id (string) + status (string) + """ + + query_params = {"status": status} + data = {"sms_recipient_id": sms_recipient_id} + + request = requests.put( + f"{self.api_base}/sms-recipients/{sms_recipient_id}", + headers=self.headers_default, + params=query_params, + json=data, + ) + + return f"{request.status_code}\n{request.text}" |