From 582b587eb60aeb06d1ee6623e8c3d2fc58e5866c Mon Sep 17 00:00:00 2001 From: "ACCOUNT-01\\d650261" Date: Fri, 30 Aug 2024 13:15:01 +1000 Subject: [PATCH] udpate get messages with status --- CHANGELOG.md | 2 +- README.md | 1 + pyproject.toml | 2 +- telstra/messaging/__init__.py | 2 +- telstra/messaging/message.py | 11 ++++++++++- telstra/messaging/types.py | 1 + 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31bc43f..e89261b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.3.17] - 2024-08-30 +## [3.3.18] - 2024-08-30 - Update get messages diff --git a/README.md b/README.md index 4110075..c22702a 100644 --- a/README.md +++ b/README.md @@ -509,6 +509,7 @@ following arguments: - `endTime`: Use ISO format, e.g. "2024-01-24T16:39:00Z". - `reverse`: If set to Ture the results will be returned in reverse order. - `direction`: Filter your messages by direction: outgoing or incoming. +- `status`: Filter your messages by status. Raises `telstra.messaging.exceptions.MessageError` if anything goes wrong. diff --git a/pyproject.toml b/pyproject.toml index 431d1d6..ab32c5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "telstra.messaging" -version = "3.3.17" +version = "3.3.18" readme = "README.md" description = "SDK for the Telstra Messaging API V3 - Beta" license = "Apache-2.0" diff --git a/telstra/messaging/__init__.py b/telstra/messaging/__init__.py index 65fcc47..389f60d 100644 --- a/telstra/messaging/__init__.py +++ b/telstra/messaging/__init__.py @@ -1,3 +1,3 @@ """Messaging.""" -__version__ = "3.3.17" +__version__ = "3.3.18" diff --git a/telstra/messaging/message.py b/telstra/messaging/message.py index e0f8871..2cd18bc 100644 --- a/telstra/messaging/message.py +++ b/telstra/messaging/message.py @@ -683,6 +683,7 @@ def _validate_get_all_args( endTime: typing.Optional[types.TEndTime] = None, reverse: typing.Optional[types.TReverse] = None, direction: typing.Optional[types.TDirection] = None, + status: typing.Optional[types.TStatus] = None, ) -> None: # Validate limit if (limit is not None and not isinstance(limit, types.TLimit)) or ( @@ -737,6 +738,12 @@ def _validate_get_all_args( f'received "{direction}"' ) + if status is not None and not isinstance(status, types.TStatus): + raise exceptions.MessageError( + 'the value of "status" is not valid, expected a string, ' + f'received "{status}"' + ) + def get_all( limit: typing.Optional[types.TLimit] = None, @@ -746,6 +753,7 @@ def get_all( endTime: typing.Optional[types.TEndTime] = None, reverse: typing.Optional[types.TReverse] = None, direction: typing.Optional[types.TDirection] = None, + status: typing.Optional[types.TStatus] = None, ) -> TMessages: """ Retrieve all messages. @@ -765,6 +773,7 @@ def get_all( endTime=endTime, reverse=reverse, direction=direction, + status=status, ) try: @@ -783,7 +792,7 @@ def get_all( } messages_get_request = request.Request( - f"{_URL}{querystring.build(limit=limit, offset=offset, filter=filter,startTime=startTime,endTime=endTime,reverse=reverse,direction=direction)}", + f"{_URL}{querystring.build(limit=limit, offset=offset, filter=filter,startTime=startTime,endTime=endTime,reverse=reverse,direction=direction,status=status)}", headers=headers, method="GET", ) diff --git a/telstra/messaging/types.py b/telstra/messaging/types.py index d725ff5..3528c6f 100644 --- a/telstra/messaging/types.py +++ b/telstra/messaging/types.py @@ -19,6 +19,7 @@ TEndTime = str TReverse = bool TDirection = str +TStatus = str class TMultimediaContentTypes(Enum):