From 9b825cffb6efe3135a098620e5070e8d7566c27d Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Mon, 29 Jan 2024 15:33:48 +0530 Subject: [PATCH 1/6] SMS-6589: Log Redaction --- CHANGELOG.md | 5 +++++ README.md | 4 ++-- src/Plivo/Plivo.csproj | 2 +- src/Plivo/Plivo.nuspec | 2 +- src/Plivo/Resource/Message/Message.cs | 9 ++++++++- src/Plivo/Resource/Message/MessageInterface.cs | 8 ++++---- src/Plivo/Version.cs | 2 +- version.json | 2 +- 8 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5cff40..b5e3e57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [5.42.3](https://github.com/plivo/plivo-dotnet/tree/v5.42.3) (2024-01-29) +**Feature - Log Redaction Enhancement** +- Added log attribute in GET and List MDR response +- Change log field from bool to string in send SMS + ## [5.42.2](https://github.com/plivo/plivo-dotnet/tree/v5.42.2) (2024-01-25) **Feature - added field in profile apis** - Added new field `alt_business_id` for POST create Profile, GET List Profiles, GET Profiles SDKs diff --git a/README.md b/README.md index d9813224..8850b19d 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ You can install this SDK either by referencing the .dll file or using NuGet. Use the following line to install the latest SDK using the NuGet CLI. ``` -PM> Install-Package Plivo -Version 5.42.2 +PM> Install-Package Plivo -Version 5.42.3 ``` You can also use the .NET CLI to install this package as follows ``` -> dotnet add package Plivo --version 5.42.2 +> dotnet add package Plivo --version 5.42.3 ``` ## Getting started diff --git a/src/Plivo/Plivo.csproj b/src/Plivo/Plivo.csproj index 29c02a4f..66e36bbd 100644 --- a/src/Plivo/Plivo.csproj +++ b/src/Plivo/Plivo.csproj @@ -1,7 +1,7 @@ netstandard2.0;netstandard1.3 - 5.42.2 + 5.42.3 Plivo SDKs Team Plivo Inc. diff --git a/src/Plivo/Plivo.nuspec b/src/Plivo/Plivo.nuspec index 6774e02f..a5d1e7c5 100644 --- a/src/Plivo/Plivo.nuspec +++ b/src/Plivo/Plivo.nuspec @@ -4,7 +4,7 @@ A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML Plivo - 5.42.2 + 5.42.3 Plivo Plivo SDKs Team Plivo, Inc. diff --git a/src/Plivo/Resource/Message/Message.cs b/src/Plivo/Resource/Message/Message.cs index dc9052df..e3260958 100755 --- a/src/Plivo/Resource/Message/Message.cs +++ b/src/Plivo/Resource/Message/Message.cs @@ -178,6 +178,12 @@ public class Message : Resource /// The conversation expiration timestamp. public string ConversationExpirationTimestamp { get; set; } + /// + /// Gets or sets the log. + /// + /// The log. + public string Log { get; set; } + public override string ToString() { return "\n" + @@ -209,7 +215,8 @@ public override string ToString() "DLTTemplateCategory: " + DltTemplateCategory + "\n" + "ConversationID: " + ConversationId + "\n" + "ConversationOrigin: " + ConversationOrigin + "\n" + - "ConversationExpirationTimestamp: " + ConversationExpirationTimestamp + "\n"; + "ConversationExpirationTimestamp: " + ConversationExpirationTimestamp + "\n" + + "Log: " + Log + "\n"; } #region ListMedia /// diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index e0b8d333..8a9b78d1 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -46,7 +46,7 @@ public MessageInterface(HttpClient client) : base(client) /// template_json_string public MessageCreateResponse Create( List dst, string text = null, string src = null, string type = null, - string url = null, string method = null, bool? log = null, bool? trackable = null, + string url = null, string method = null, string log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { @@ -163,7 +163,7 @@ public MessageCreateResponse Create( /// template_json_string public async Task CreateAsync( List dst, string text = null, string src = null, string type = null, - string url = null, string method = null, bool? log = null, bool? trackable = null, + string url = null, string method = null, string log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { @@ -282,7 +282,7 @@ public async Task CreateAsync( /// template_json_string public MessageCreateResponse Create( string dst, string text = null, string src = null, string type = null, - string url = null, string method = null, bool? log = null, bool? trackable = null, + string url = null, string method = null, string log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) @@ -402,7 +402,7 @@ public MessageCreateResponse Create( /// template public async Task CreateAsync( string dst, string text = null, string src = null, string type = null, - string url = null, string method = null, bool? log = null, bool? trackable = null, + string url = null, string method = null, string log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) diff --git a/src/Plivo/Version.cs b/src/Plivo/Version.cs index 9120e790..bddb427b 100644 --- a/src/Plivo/Version.cs +++ b/src/Plivo/Version.cs @@ -10,7 +10,7 @@ public class Version /// /// DotNet SDK version /// - public const string SdkVersion = "5.42.2"; + public const string SdkVersion = "5.42.3"; /// /// Plivo API version /// diff --git a/version.json b/version.json index cf85d3a9..c510164e 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "5.42.2", + "version": "5.42.3", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$" From d8d562891dc9d360f0b82fbc0cb789ff0794f266 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Fri, 16 Feb 2024 11:16:49 +0530 Subject: [PATCH 2/6] address review comment --- src/Plivo/Resource/Message/MessageInterface.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index 8a9b78d1..cbc60643 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -46,7 +46,7 @@ public MessageInterface(HttpClient client) : base(client) /// template_json_string public MessageCreateResponse Create( List dst, string text = null, string src = null, string type = null, - string url = null, string method = null, string log = null, bool? trackable = null, + string url = null, string method = null, string? log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { From 4fad782704473f32af35241b77e9d838b59082f8 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Thu, 22 Feb 2024 12:40:14 +0530 Subject: [PATCH 3/6] data-type conversion --- .../Resource/Message/MessageInterface.cs | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index cbc60643..89c4ce9e 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -46,10 +46,26 @@ public MessageInterface(HttpClient client) : base(client) /// template_json_string public MessageCreateResponse Create( List dst, string text = null, string src = null, string type = null, - string url = null, string method = null, string? log = null, bool? trackable = null, + string url = null, string method = null, object log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { + // Check if log is a boolean + string logString=""; + if (log is bool) + { + bool logValue = (bool)log; + logString = logValue ? "true" : "false"; + } + // Check if log is a string + else if (log is string) + { + logString = (string)log; + } + else if (log != null) + { + throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); + } string _dst = string.Join("<", dst); Dictionary data = null; @@ -91,7 +107,7 @@ public MessageCreateResponse Create( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -163,10 +179,25 @@ public MessageCreateResponse Create( /// template_json_string public async Task CreateAsync( List dst, string text = null, string src = null, string type = null, - string url = null, string method = null, string log = null, bool? trackable = null, + string url = null, string method = null, object log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { + // Check if log is a boolean + if (log is bool) + { + bool logValue = (bool)log; + string logString = logValue ? "true" : "false"; + } + // Check if log is a string + else if (log is string) + { + string logString = (string)log; + } + else if (log != null) + { + throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); + } string _dst = string.Join("<", dst); Dictionary data = null; From 87f1b50f790f335297659dcb614ff68560128975 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Fri, 1 Mar 2024 11:46:05 +0530 Subject: [PATCH 4/6] fix --- .../Resource/Message/MessageInterface.cs | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index 89c4ce9e..32f428f3 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -129,7 +129,7 @@ public MessageCreateResponse Create( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -184,15 +184,16 @@ public async Task CreateAsync( string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { // Check if log is a boolean + string logString=""; if (log is bool) { bool logValue = (bool)log; - string logString = logValue ? "true" : "false"; + logString = logValue ? "true" : "false"; } // Check if log is a string else if (log is string) { - string logString = (string)log; + logString = (string)log; } else if (log != null) { @@ -239,7 +240,7 @@ public async Task CreateAsync( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -261,7 +262,7 @@ public async Task CreateAsync( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -313,11 +314,26 @@ public async Task CreateAsync( /// template_json_string public MessageCreateResponse Create( string dst, string text = null, string src = null, string type = null, - string url = null, string method = null, string log = null, bool? trackable = null, + string url = null, string method = null, object log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { + string logString=""; + if (log is bool) + { + bool logValue = (bool)log; + logString = logValue ? "true" : "false"; + } + // Check if log is a string + else if (log is string) + { + logString = (string)log; + } + else if (log != null) + { + throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); + } string _dst = dst; Dictionary data = null; var mandatoryParams = new List { "" }; @@ -358,7 +374,7 @@ public MessageCreateResponse Create( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -381,7 +397,7 @@ public MessageCreateResponse Create( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -433,11 +449,26 @@ public MessageCreateResponse Create( /// template public async Task CreateAsync( string dst, string text = null, string src = null, string type = null, - string url = null, string method = null, string log = null, bool? trackable = null, + string url = null, string method = null, object log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null, string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { + string logString=""; + if (log is bool) + { + bool logValue = (bool)log; + logString = logValue ? "true" : "false"; + } + // Check if log is a string + else if (log is string) + { + logString = (string)log; + } + else if (log != null) + { + throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); + } string _dst = dst; Dictionary data = null; var mandatoryParams = new List { "" }; @@ -479,7 +510,7 @@ public async Task CreateAsync( type, url, method, - log, + logString, trackable, media_urls, media_ids, @@ -502,7 +533,7 @@ public async Task CreateAsync( type, url, method, - log, + logString, trackable, media_urls, media_ids, From 0e4c19bfa23bcf0d3bccd2f05e41874e5f2dfdb9 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Fri, 1 Mar 2024 12:43:54 +0530 Subject: [PATCH 5/6] fix type conversion --- .../Resource/Message/MessageInterface.cs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index 32f428f3..5f2be1d2 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -66,6 +66,7 @@ public MessageCreateResponse Create( { throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); } + log = logString; string _dst = string.Join("<", dst); Dictionary data = null; @@ -107,7 +108,7 @@ public MessageCreateResponse Create( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -129,7 +130,7 @@ public MessageCreateResponse Create( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -199,6 +200,8 @@ public async Task CreateAsync( { throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); } + log = logString; + string _dst = string.Join("<", dst); Dictionary data = null; @@ -240,7 +243,7 @@ public async Task CreateAsync( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -262,7 +265,7 @@ public async Task CreateAsync( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -334,6 +337,7 @@ public MessageCreateResponse Create( { throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); } + log = logString; string _dst = dst; Dictionary data = null; var mandatoryParams = new List { "" }; @@ -374,7 +378,7 @@ public MessageCreateResponse Create( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -397,7 +401,7 @@ public MessageCreateResponse Create( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -469,6 +473,7 @@ public async Task CreateAsync( { throw new ArgumentException("Invalid type for log parameter. Expected boolean or string."); } + log = logString; string _dst = dst; Dictionary data = null; var mandatoryParams = new List { "" }; @@ -510,7 +515,7 @@ public async Task CreateAsync( type, url, method, - logString, + log, trackable, media_urls, media_ids, @@ -533,7 +538,7 @@ public async Task CreateAsync( type, url, method, - logString, + log, trackable, media_urls, media_ids, From c685fc379dc25947bf97c61135f49f011150b107 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Fri, 1 Mar 2024 13:21:08 +0530 Subject: [PATCH 6/6] update date release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5e3e57c..c80390ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [5.42.3](https://github.com/plivo/plivo-dotnet/tree/v5.42.3) (2024-01-29) +## [5.42.3](https://github.com/plivo/plivo-dotnet/tree/v5.42.3) (2024-03-01) **Feature - Log Redaction Enhancement** - Added log attribute in GET and List MDR response - Change log field from bool to string in send SMS