Skip to content

Commit

Permalink
Merge pull request #254 from plivo/SMS-6010
Browse files Browse the repository at this point in the history
SMS-6010: Add DLT Params to Send and Get Message APIs
  • Loading branch information
renoldthomas-plivo authored Aug 3, 2023
2 parents 31abccf + 19cb66b commit 02f3807
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 43 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

## [v5.32.0](https://github.com/plivo/plivo-dotnet/tree/v5.32.0) (2023-08-03)
**Feature - DLT parameters**
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the [send message API](https://www.plivo.com/docs/sms/api/message/send-a-message/)
- Added new params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)

## [v5.31.0](https://github.com/plivo/plivo-dotnet/tree/v5.31.0) (2023-06-28)
**Feature - Streaming API and XML**
- Added Stream API endpoints
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ build:
run:
@[ "${CONTAINER}" ] && \
(docker exec -it $$CONTAINER /bin/bash -c 'cd /usr/src/app/dotnet-sdk-test/ && dotnet run Program.cs') || \
(cd /usr/src/app/dotnet-sdk-test/ && dotnet run Program.cs)
(cd /usr/src/app/dotnet-sdk-test/ && dotnet run Program.cs)

start:
docker-compose up --build --remove-orphans --detach
docker attach $(shell docker-compose ps -q dotnetSDK)
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.31.0
PM> Install-Package Plivo -Version 5.32.0
```

You can also use the .NET CLI to install this package as follows

```
> dotnet add package Plivo --version 5.31.0
> dotnet add package Plivo --version 5.32.0
```

## 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.31.0</ReleaseVersion>
<ReleaseVersion>5.32.0</ReleaseVersion>
<Version />
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
3 changes: 2 additions & 1 deletion src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<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.31.0</version>
<version>5.32.0</version>
<title>Plivo</title>
<authors>Plivo SDKs Team</authors>
<owners>Plivo, Inc.</owners>
<licenseUrl>https://github.com/plivo/plivo-dotnet/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>http://github.com/plivo/plivo-dotnet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>
* 5.32.0 Added New Params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory`.
* 5.31.0 Added functionality to start, stop and fetch audio streams
* 5.30.0 Added New Param 'cnam_lookup' in to the response of the [list all numbers API], [list single number API]
* 5.29.0 Added New Param 'cnam_lookup_number_config' in GetCall and ListCalls
Expand Down
23 changes: 22 additions & 1 deletion src/Plivo/Resource/Message/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ public class Message : Resource
/// <value> The replaced sender.</value>
public string ReplacedSender { get; set; }

/// <summary>
/// Gets or sets the dlt entity id.
/// </summary>
/// <value> DLT Entity ID.</value>
public string DltEntityId { get; set; }

/// <summary>
/// Gets or sets the dlt template id.
/// </summary>
/// <value> DLT Template ID.</value>
public string DltTemplateId { get; set; }

/// <summary>
/// Gets or sets the dlt template category.
/// </summary>
/// <value> DLT Template Category.</value>
public string DltTemplateCategory { get; set; }

public override string ToString()
{
return "\n" +
Expand All @@ -145,7 +163,10 @@ public override string ToString()
"TendlcRegistrationStatus: "+ TendlcRegistrationStatus + "\n" +
"RequesterIP: " + RequesterIp + "\n" +
"IsDomestic: " + IsDomestic + "\n" +
"ReplacedSender: " + ReplacedSender + "\n";
"ReplacedSender: " + ReplacedSender + "\n" +
"DLTEntityID: " + DltEntityId + "\n" +
"DLTTemplateID: " + DltTemplateId + "\n" +
"DLTTemplateCategory: " + DltTemplateCategory + "\n";
}
#region ListMedia
/// <summary>
Expand Down
74 changes: 60 additions & 14 deletions src/Plivo/Resource/Message/MessageInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ public MessageInterface(HttpClient client) : base(client)
/// <param name="log">Log.</param>
/// <param name="trackable">trackable.</param>
/// <param name="powerpackUUID">powerpackUUID</param>
///<param name="media_urls">media_urls</param>
///<param name="media_ids">media_ids</param>
/// <param name="media_urls">media_urls</param>
/// <param name="media_ids">media_ids</param>
/// <param name="dlt_entity_id">dlt_entity_id</param>
/// <param name="dlt_template_id">dlt_template_id</param>
/// <param name="dlt_template_category">dlt_template_category</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 powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null)
string url = null, string method = null, bool? 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)
{

string _dst = string.Join("<", dst);
Expand All @@ -61,7 +66,10 @@ public MessageCreateResponse Create(
log,
trackable,
media_urls,
media_ids
media_ids,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});
}
else if (powerpack_uuid != null && src == null)
Expand All @@ -79,7 +87,10 @@ public MessageCreateResponse Create(
log,
trackable,
media_urls,
media_ids
media_ids,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});


Expand Down Expand Up @@ -116,9 +127,14 @@ public MessageCreateResponse Create(
/// <param name="powerpackUUID">powerpackUUID</param>
///<param name="media_urls">media_urls</param>
///<param name="media_ids">media_ids</param>
/// <param name="dlt_entity_id">dlt_entity_id</param>
/// <param name="dlt_template_id">dlt_template_id</param>
/// <param name="dlt_template_category">dlt_template_category</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 powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null)
string url = null, string method = null, bool? 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)
{

string _dst = string.Join("<", dst);
Expand All @@ -139,7 +155,10 @@ public async Task<MessageCreateResponse> CreateAsync(
log,
trackable,
media_urls,
media_ids
media_ids,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});
}
else if (powerpack_uuid != null && src == null)
Expand All @@ -157,7 +176,10 @@ public async Task<MessageCreateResponse> CreateAsync(
log,
trackable,
media_urls,
media_ids
media_ids,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});


Expand Down Expand Up @@ -196,9 +218,15 @@ public async Task<MessageCreateResponse> CreateAsync(
///<param name="media_urls">media_urls</param>
///<param name="media_ids">media_ids</param>
///<param name="message_expiry">message_expiry</param>
/// <param name="dlt_entity_id">dlt_entity_id</param>
/// <param name="dlt_template_id">dlt_template_id</param>
/// <param name="dlt_template_category">dlt_template_category</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 powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null)
string url = null, string method = null, bool? 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)
{
string _dst = dst;
Dictionary<string, object> data = null;
Expand All @@ -219,7 +247,10 @@ public MessageCreateResponse Create(
trackable,
media_urls,
media_ids,
message_expiry
message_expiry,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});
}
else if (powerpack_uuid != null && src == null)
Expand All @@ -238,7 +269,10 @@ public MessageCreateResponse Create(
trackable,
media_urls,
media_ids,
message_expiry
message_expiry,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});


Expand Down Expand Up @@ -276,9 +310,15 @@ public MessageCreateResponse Create(
///<param name="media_urls">media_urls</param>
///<param name="media_ids">media_ids</param>
///<param name="message_expiry">message_expiry</param>
/// <param name="dlt_entity_id">dlt_entity_id</param>
/// <param name="dlt_template_id">dlt_template_id</param>
/// <param name="dlt_template_category">dlt_template_category</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 powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, uint? message_expiry = null)
string url = null, string method = null, bool? 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)
{
string _dst = dst;
Dictionary<string, object> data = null;
Expand All @@ -299,7 +339,10 @@ public async Task<MessageCreateResponse> CreateAsync(
trackable,
media_urls,
media_ids,
message_expiry
message_expiry,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});
}
else if (powerpack_uuid != null && src == null)
Expand All @@ -318,7 +361,10 @@ public async Task<MessageCreateResponse> CreateAsync(
trackable,
media_urls,
media_ids,
message_expiry
message_expiry,
dlt_entity_id,
dlt_template_id,
dlt_template_category
});


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.31.0";
public const string SdkVersion = "5.32.0";
/// <summary>
/// Plivo API version
/// </summary>
Expand Down
5 changes: 4 additions & 1 deletion tests/Plivo.Test/Mocks/messageGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"to_number": "911231231231",
"total_amount": "0.00250",
"total_rate": "0.00250",
"units": 1
"units": 1,
"dlt_entity_id": "1111",
"dlt_template_id": "2222",
"dlt_template_category": "promotional"
}
Loading

0 comments on commit 02f3807

Please sign in to comment.