Skip to content

udpate get messages with status #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion telstra/messaging/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Messaging."""

__version__ = "3.3.17"
__version__ = "3.3.18"
11 changes: 10 additions & 1 deletion telstra/messaging/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand All @@ -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.
Expand All @@ -765,6 +773,7 @@ def get_all(
endTime=endTime,
reverse=reverse,
direction=direction,
status=status,
)

try:
Expand All @@ -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",
)
Expand Down
1 change: 1 addition & 0 deletions telstra/messaging/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
TEndTime = str
TReverse = bool
TDirection = str
TStatus = str


class TMultimediaContentTypes(Enum):
Expand Down