Skip to content

Commit

Permalink
Merge pull request #94 from plivo/version_upgrade
Browse files Browse the repository at this point in the history
Version upgrade
  • Loading branch information
Sachin Kulshrestha authored Dec 27, 2018
2 parents dc90e11 + 3786eaa commit f5d7117
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

# Change Log

## [v4.2.2](https://github.com/plivo/plivo-dotnet/tree/v4.2.2) (2018-12-27)
- Fix dynamic object usage with async/await statement.

## [v4.2.1](https://github.com/plivo/plivo-dotnet/tree/v4.2.1) (2018-12-13)
- Fix Web Proxy Support.

Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Client/SystemHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public async Task<PlivoResponse<T>> SendRequest<T>(string method, string uri, Di

response = await _client.SendAsync(request);

var responseContent = response.Content.ReadAsStringAsync().Result;
var responseContent = await response.Content.ReadAsStringAsync();

// create Plivo response object along with the deserialized object
PlivoResponse<T> plivoResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
<ReleaseVersion>4.2.1</ReleaseVersion>
<ReleaseVersion>4.2.2</ReleaseVersion>
<Version></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 &amp; send SMS using Plivo and to generate Plivo XML</summary>
<description>A .NET SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML</description>
<id>Plivo</id>
<version>4.2.1</version>
<version>4.2.2</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>
* 4.2.2 Fix dynamic object usage with async/await statement.
* 4.2.1 Fix Web Proxy support.
* 4.2.0 Changed base reference to .NET Standard 2.0 to support System.Web.Proxy. Added Strong Naming instructions
* 4.1.7 Add hangup party details to CDR. CDR filtering allowed by hangup_source and hangup_cause_code.
Expand Down
87 changes: 78 additions & 9 deletions src/Plivo/Resource/Message/MessageInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public MessageCreateResponse Create(
{

string _dst = string.Join("<", dst);
var data = (dynamic)null;
Dictionary<string, object> data = null;
var mandatoryParams = new List<string> {""};
if (src != null && powerpack_uuid == null){
data = CreateData(
Expand Down Expand Up @@ -83,15 +83,84 @@ public MessageCreateResponse Create(
var result = Client.Update<MessageCreateResponse>(Uri, data).Result;
return result.Object;
}
#endregion

#region getResponseValidation
/// <summary>
/// validation for src and powerpack id and return the repsonse.
/// </summary>
/// <returns>The get.</returns>
/// <param name="errormessagetext">errormessagetext</param>
private MessageCreateResponse getResponseValidation(string errorMessageText){
/// <summary>
/// Asynchronously Create Message with the specified src, dst, text, type, url, method and log.
/// </summary>
/// <returns>The create.</returns>
/// <param name="src">Source.</param>
/// <param name="dst">Dst.</param>
/// <param name="text">Text.</param>
/// <param name="type">Type.</param>
/// <param name="url">URL.</param>
/// <param name="method">Method.</param>
/// <param name="log">Log.</param>
/// <param name="trackable">trackable.</param>
/// <param name="powerpackUUID">powerpackUUID</param>
public async Task<MessageCreateResponse> CreateAsync(
List<string> dst, string text, string src = null, string type = null,
string url = null, string method = null, bool? log = null, bool? trackable = null, string powerpack_uuid = null)
{

string _dst = string.Join("<", dst);
Dictionary<string, object> data = null;
var mandatoryParams = new List<string> { "" };
if (src != null && powerpack_uuid == null)
{
data = CreateData(
mandatoryParams,
new
{
src,
_dst,
text,
type,
url,
method,
log,
trackable
});
}
else if (powerpack_uuid != null && src == null)
{
data = CreateData(
mandatoryParams,
new
{
powerpack_uuid,
_dst,
text,
type,
url,
method,
log,
trackable
});


}
else if (src != null && powerpack_uuid != null)
{
return getResponseValidation("Both powerpack_uuid and src cannot be specified. Specify either powerpack_uuid or src in request params to send a message.");
}
else if (src == null && powerpack_uuid == null)
{
return getResponseValidation("Specify either powerpack_uuid or src in request params to send a message.");
}

var result = await Client.Update<MessageCreateResponse>(Uri, data);
return result.Object;
}

#endregion

#region getResponseValidation
/// <summary>
/// validation for src and powerpack id and return the repsonse.
/// </summary>
/// <returns>The get.</returns>
/// <param name="errormessagetext">errormessagetext</param>
private MessageCreateResponse getResponseValidation(string errorMessageText){

MessageCreateResponse notValidResponse = new MessageCreateResponse();
notValidResponse.ApiId = null;
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 = "4.2.1";
public const string SdkVersion = "4.2.2";

/// <summary>
/// Plivo API version
Expand Down

0 comments on commit f5d7117

Please sign in to comment.