From 726868c1703ce380db8a03a64309e0808980012a Mon Sep 17 00:00:00 2001 From: Narayana Shanbhog Plivo Date: Fri, 6 Sep 2024 11:50:04 +0530 Subject: [PATCH] add more attribute on message object (#212) * add more attribute on message object * verison update --- CHANGELOG.md | 5 ++ baseclient.go | 2 +- fixtures/messageGetResponse.json | 6 +- fixtures/messageListResponse.json | 104 +++++++++++++++++++++++------- messages.go | 3 + 5 files changed, 95 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67c5ee6..c4bec3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Change Log +## [7.51.3](https://github.com/plivo/plivo-go/tree/v7.53.0) (2024-09-06) +**Feature - Adding support for Locale param in Create, Get and List Session** +- Enhance message object +- Added new object param on get and list mdr response: `message_sent_time`, `message_updated_time`, `error_message` + ## [7.51.2](https://github.com/plivo/plivo-go/tree/v7.51.2) (2024-09-06) **Feature - Adding support for brand_name, code_length and app_hash in Create,Get and List Session** - Added new request param `brand_name`, `code_length` and `app_hash` in create Session API diff --git a/baseclient.go b/baseclient.go index 996c465..41901c4 100644 --- a/baseclient.go +++ b/baseclient.go @@ -13,7 +13,7 @@ import ( "github.com/google/go-querystring/query" ) -const sdkVersion = "7.51.2" +const sdkVersion = "7.51.3" const lookupBaseUrl = "lookup.plivo.com" diff --git a/fixtures/messageGetResponse.json b/fixtures/messageGetResponse.json index 4bc717d..40eeb9f 100644 --- a/fixtures/messageGetResponse.json +++ b/fixtures/messageGetResponse.json @@ -22,6 +22,8 @@ "conversation_expiration_timestamp": "2023-08-03 23:02:00+05:30", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" - + "carrier_fees_rate": "0.00000", + "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": "" } diff --git a/fixtures/messageListResponse.json b/fixtures/messageListResponse.json index e90815e..7ac2fb1 100644 --- a/fixtures/messageListResponse.json +++ b/fixtures/messageListResponse.json @@ -30,7 +30,10 @@ "conversation_expiration_timestamp": "2023-08-03 23:02:00+05:30", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -55,7 +58,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -80,7 +86,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -105,7 +114,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -130,7 +142,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -155,7 +170,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -180,13 +198,16 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, + "error_code": "450", "from_number": "919655100565", "message_direction": "outbound", - "message_state": "sent", + "message_state": "failed", "message_time": "2017-05-16 20:52:51+05:30", "message_type": "sms", "message_uuid": "937da994-4d07-4a85-9252-764d846cacf5", @@ -205,7 +226,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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": "Destination Country Disabled" }, { "error_code": "000", @@ -230,7 +254,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -255,7 +282,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -280,7 +310,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -305,7 +338,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -330,7 +366,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -355,7 +394,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -380,7 +422,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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, @@ -405,7 +450,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -430,7 +478,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -455,7 +506,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -480,7 +534,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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", @@ -505,7 +562,10 @@ "conversation_expiration_timestamp": "", "destination_network": "", "carrier_fees": "0.00000", - "carrier_fees_rate": "0.00000" + "carrier_fees_rate": "0.00000", + "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": "" } ] } diff --git a/messages.go b/messages.go index ea779bf..40d53fd 100644 --- a/messages.go +++ b/messages.go @@ -47,6 +47,7 @@ type Message struct { MessageUUID string `json:"message_uuid,omitempty" url:"message_uuid,omitempty"` MessageTime string `json:"message_time,omitempty" url:"message_time,omitempty"` ErrorCode string `json:"error_code,omitempty" url:"error_code,omitempty"` + ErrorMessage string `json:"error_message,omitempty" url:"error_message,omitempty"` PowerpackID string `json:"powerpack_id,omitempty" url:"powerpack_id,omitempty"` RequesterIP string `json:"requester_ip,omitempty" url:"requester_ip,omitempty"` IsDomestic *bool `json:"is_domestic,omitempty" url:"is_domestic,omitempty"` @@ -64,6 +65,8 @@ type Message struct { CarrierFeesRate string `json:"carrier_fees_rate" url:"carrier_fees_rate,omitempty"` CarrierFees string `json:"carrier_fees" url:"carrier_fees,omitempty"` Log string `json:"log" url:"log,omitempty"` + MessageSentTime string `json:"message_sent_time" url:"message_sent_time,omitempty"` + MessageUpdatedTime string `json:"message_updated_time" url:"message_updated_time,omitempty"` } // Stores response for ending a message.