From 0c13447f2a1d714a7b12a1f512aec10cdafafda2 Mon Sep 17 00:00:00 2001 From: Narayana Shanbhog Plivo Date: Fri, 6 Sep 2024 14:31:28 +0530 Subject: [PATCH] adding more attribute to message object (#347) * adding more attribute to message object * version upgrade --- CHANGELOG.md | 4 + src/Plivo/Resources/Message/Message.php | 12 +++ src/Plivo/Version.php | 3 +- tests/Mocks/messageGetResponse.json | 5 +- tests/Mocks/messageListResponse.json | 100 +++++++++++++++++++----- 5 files changed, 102 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16d0315f..2cae0508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [4.65.3](https://github.com/plivo/plivo-php/tree/v4.65.3)(2024-09-06) +**Feature - Adding more attribute on mdr object** +- Added `message_sent_time`, `message_updated_time` and `error-message` on get and list Message API + ## [4.65.2](https://github.com/plivo/plivo-php/tree/v4.65.2)(2024-09-06) **Feature - Adding support for brand_name,app_hash ,code_length in Create,Get and List Session** - Added new request param `brand_name`, `code_length` and `app_hash` in create Session API diff --git a/src/Plivo/Resources/Message/Message.php b/src/Plivo/Resources/Message/Message.php index bd8d6b5a..2c35a51b 100644 --- a/src/Plivo/Resources/Message/Message.php +++ b/src/Plivo/Resources/Message/Message.php @@ -29,6 +29,9 @@ * @property ?string $conversationExpirationTimestamp * @property ?bool $isDomestic * @property ?string $log + * @property ?string $message_sent_time + * @property ?string $message_updated_time + * @property ?string $error_message */ class Message extends Resource { @@ -121,6 +124,15 @@ public function __construct( if (!empty($response['log'])) { $this->properties['log'] = $response['log']; } + if (!empty($response['message_sent_time'])) { + $this->properties['message_sent_time'] = $response['message_sent_time']; + } + if (!empty($response['message_updated_time'])) { + $this->properties['message_updated_time'] = $response['message_updated_time']; + } + if (!empty($response['error_message'])) { + $this->properties['error_message'] = $response['error_message']; + } $this->pathParams = [ 'authId' => $authId, diff --git a/src/Plivo/Version.php b/src/Plivo/Version.php index 295e1d1c..55dcb392 100644 --- a/src/Plivo/Version.php +++ b/src/Plivo/Version.php @@ -26,7 +26,8 @@ class Version * @const int PHP helper library patch number */ - const PATCH = 2; + const PATCH = 3; + /** * @return string */ diff --git a/tests/Mocks/messageGetResponse.json b/tests/Mocks/messageGetResponse.json index b6e31eaa..a3c14023 100644 --- a/tests/Mocks/messageGetResponse.json +++ b/tests/Mocks/messageGetResponse.json @@ -25,5 +25,8 @@ "conversation_expiration_timestamp": "2023-08-03 23:02:00+05:30", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" } \ No newline at end of file diff --git a/tests/Mocks/messageListResponse.json b/tests/Mocks/messageListResponse.json index a79e8e22..70e588d2 100644 --- a/tests/Mocks/messageListResponse.json +++ b/tests/Mocks/messageListResponse.json @@ -32,7 +32,10 @@ "conversation_expiration_timestamp": "2023-08-03 23:02:00+05:30", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -59,7 +62,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -86,7 +92,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -113,7 +122,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -140,7 +152,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -167,7 +182,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -194,7 +212,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -221,7 +242,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -248,7 +272,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -275,7 +302,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -302,7 +332,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -329,7 +362,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -356,7 +392,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -383,7 +422,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -410,7 +452,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": null, @@ -437,7 +482,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -464,7 +512,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -491,7 +542,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -518,7 +572,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" }, { "error_code": "000", @@ -545,7 +602,10 @@ "conversation_expiration_timestamp": "", "destination_network": "Verizon", "carrier_fees_rate": "0.420", - "carrier_fees": "0.001" + "carrier_fees": "0.001", + "message_sent_time": "2024-08-21 18:28:49.244057+05:30", + "message_updated_time": "2024-08-21 18:28:51.94772+05:30", + "error_message": "" } ] } \ No newline at end of file