Skip to content

Commit

Permalink
Merge pull request #272 from plivo/SMS-6589
Browse files Browse the repository at this point in the history
SMS-6589: Log Redaction
  • Loading branch information
narayana-plivo authored Mar 1, 2024
2 parents 758720b + c685fc3 commit dbfedcf
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [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

## [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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
<ReleaseVersion>5.42.2</ReleaseVersion>
<ReleaseVersion>5.42.3</ReleaseVersion>
<Version />
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<summary>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</summary>
<description>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</description>
<id>Plivo</id>
<version>5.42.2</version>
<version>5.42.3</version>
<title>Plivo</title>
<authors>Plivo SDKs Team</authors>
<owners>Plivo, Inc.</owners>
Expand Down
9 changes: 8 additions & 1 deletion src/Plivo/Resource/Message/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ public class Message : Resource
/// <value>The conversation expiration timestamp.</value>
public string ConversationExpirationTimestamp { get; set; }

/// <summary>
/// Gets or sets the log.
/// </summary>
/// <value>The log.</value>
public string Log { get; set; }

public override string ToString()
{
return "\n" +
Expand Down Expand Up @@ -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
/// <summary>
Expand Down
75 changes: 71 additions & 4 deletions src/Plivo/Resource/Message/MessageInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,27 @@ public MessageInterface(HttpClient client) : base(client)
/// <param name="template_json_string">template_json_string</param>
public MessageCreateResponse Create(
List<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, 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.");
}
log = logString;

string _dst = string.Join("<", dst);
Dictionary<string, object> data = null;
Expand Down Expand Up @@ -163,10 +180,28 @@ public MessageCreateResponse Create(
/// <param name="template_json_string">template_json_string</param>
public async Task<MessageCreateResponse> CreateAsync(
List<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, 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.");
}
log = logString;


string _dst = string.Join("<", dst);
Dictionary<string, object> data = null;
Expand Down Expand Up @@ -282,11 +317,27 @@ public async Task<MessageCreateResponse> CreateAsync(
/// <param name="template_json_string">template_json_string</param>
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, 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.");
}
log = logString;
string _dst = dst;
Dictionary<string, object> data = null;
var mandatoryParams = new List<string> { "" };
Expand Down Expand Up @@ -402,11 +453,27 @@ public MessageCreateResponse Create(
/// <param name="template_json_string">template</param>
public async Task<MessageCreateResponse> 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, 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.");
}
log = logString;
string _dst = dst;
Dictionary<string, object> data = null;
var mandatoryParams = new List<string> { "" };
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Version
/// <summary>
/// DotNet SDK version
/// </summary>
public const string SdkVersion = "5.42.2";
public const string SdkVersion = "5.42.3";
/// <summary>
/// Plivo API version
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "5.42.2",
"version": "5.42.3",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
Expand Down

0 comments on commit dbfedcf

Please sign in to comment.