Skip to content

Commit

Permalink
Merge pull request #147 from plivo/number-priority
Browse files Browse the repository at this point in the history
Add field number_priority to powerpack api request/response
  • Loading branch information
nixonsam authored Nov 17, 2020
2 parents be28000 + 71ff524 commit a1aa396
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 20 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# Change Log

## [v4.15.0](https://github.com/plivo/plivo-dotnet/tree/v4.15.0) (2020-11-17)
- Add number_priority support for Powerpack API.

## [v4.14.0](https://github.com/plivo/plivo-dotnet/tree/v4.14.0) (2020-10-27)
- Change lookup API endpoint and response.

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>4.14.0</ReleaseVersion>
<ReleaseVersion>4.15.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>4.14.0</version>
<version>4.15.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>
* 4.15.0 Add number_priority support for Powerpack API.
* 4.14.0 Change lookup API endpoint and response.
* 4.13.0 Add support for Lookup API.
* 4.12.0 Add "PublicUri" optional param support for Application API
Expand Down
25 changes: 25 additions & 0 deletions src/Plivo/Resource/Powerpack/NumberPriority.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

using Plivo.Client;

using System;
using System.Collections.Generic;
namespace Plivo.Resource.Powerpack
{
/// <summary>
/// Numberpool.
/// </summary>
public class NumberPriority : Resource
{
public string service_type { get; set; }
public string country_iso { get; set; }
public Priority priority { get; set; }

public override string ToString()
{
return "\n" +
"CountryISO: " + country_iso + "\n" +
"ServiceType: " + service_type + "\n" +
"Priority: " + priority + "\n" ;
}
}
}
20 changes: 13 additions & 7 deletions src/Plivo/Resource/Powerpack/Powerpack.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Threading.Tasks;
using Plivo.Resource.PhoneNumber;

using System.Collections.Generic;
namespace Plivo.Resource.Powerpack {
/// <summary>
/// Powerpack.
/// </summary>

public class Powerpack : Resource {
public new string Id => uuid;
public string number_pool_id { get; set; }
Expand Down Expand Up @@ -57,6 +56,12 @@ public class Powerpack : Resource {
/// <value>The uuid.</value>
public string uuid { get; set; }

/// <summary>
/// Number Priority
/// </summary>
/// <value>The number_priority .</value>
public List<NumberPriority> number_priority { get; set; }

/// <summary>
/// Gets or sets the number_pool.
/// </summary>
Expand All @@ -74,14 +79,14 @@ public async Task<DeleteResponse<Powerpack>> DeleteAsync (bool? unrent_numbers =
}

public UpdateResponse<Powerpack> Update (string name = null, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null) {
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null) {
return ((PowerpackInterface) Interface)
.Update (Id, name, application_type, application_id, sticky_sender, local_connect);
.Update (Id, name, application_type, application_id, sticky_sender, local_connect, number_priority);
}
public async Task<UpdateResponse<Powerpack>> UpdateAsync (string name = null, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null) {
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null) {
return await ((PowerpackInterface) Interface)
.UpdateAsync (Id, name, application_type, application_id, sticky_sender, local_connect);
.UpdateAsync (Id, name, application_type, application_id, sticky_sender, local_connect, number_priority);
}
public ListResponse<Numbers> List_Numbers (string starts_with = null, string country_iso2 = null,
string type = null, string service = null, uint? limit = null, uint? offset = null) {
Expand Down Expand Up @@ -231,7 +236,8 @@ public override string ToString () {
"ApplicationType: " + application_type + "\n" +
"ApplicationId: " + application_id + "\n" +
"NumberPool: " + number_pool + "\n" +
"CreatedOn: " + created_on + "\n";
"CreatedOn: " + created_on + "\n" +
"NumberPriority: " + number_priority + "\n";
}
}
}
31 changes: 21 additions & 10 deletions src/Plivo/Resource/Powerpack/PowerpackInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Plivo.Resource.Powerpack
{
/// <summary>
/// <summary>
/// Powerpack interface.
/// </summary>
public class PowerpackInterface : ResourceInterface
Expand All @@ -32,9 +32,10 @@ public PowerpackInterface(HttpClient client) : base(client)
/// <param name="local_connect">LocalConnect.</param>
/// <param name="application_type">ApplicationType.</param>
/// <param name="application_id">ApplicationID.</param>
/// <param name="number_priority">NumberPriority</param>
public Powerpack Create(
string name, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null)
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null)
{
var mandatoryParams = new List<string>{"name"};
var data = CreateData(
Expand All @@ -45,7 +46,8 @@ public Powerpack Create(
application_type,
application_id,
sticky_sender,
local_connect
local_connect,
number_priority
});
return ExecuteWithExceptionUnwrap(() =>
{
Expand All @@ -64,9 +66,10 @@ public Powerpack Create(
/// <param name="local_connect">LocalConnect.</param>
/// <param name="application_type">ApplicationType.</param>
/// <param name="application_id">ApplicationID.</param>
/// <param name="number_priority">NumberPriority.<param>
public async Task<Powerpack> CreateAsync(
string name, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null)
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null)
{

var mandatoryParams = new List<string>{"name"};
Expand All @@ -78,7 +81,8 @@ public async Task<Powerpack> CreateAsync(
application_type,
application_id,
sticky_sender,
local_connect
local_connect,
number_priority
});

var result = await Client.Update<Powerpack>(Uri + "Powerpack/", data);
Expand Down Expand Up @@ -222,15 +226,18 @@ public async Task<ListResponse<Powerpack>> ListAsync(
/// <param name="application_type">ApplicationType.</param>
/// <param name="application_id">ApplicationID.</param>
///<param name="uuid">UUID.</param>
/// <param name="number_priority">NumberPriority.</param>
public UpdateResponse<Powerpack> Update(string uuid, string name=null, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null)
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null)
{
var mandatoryParams = new List<string> { "uuid" };
var data = CreateData(mandatoryParams, new { name,
application_type,
application_id,
sticky_sender,
local_connect });
local_connect,
number_priority
});

return ExecuteWithExceptionUnwrap(() =>
{
Expand All @@ -249,18 +256,22 @@ public UpdateResponse<Powerpack> Update(string uuid, string name=null, string ap
/// <param name="application_type">ApplicationType.</param>
/// <param name="application_id">ApplicationID.</param>
///<param name="uuid">UUID.</param>
/// <param name="number_priority">NumberPriority.</param>

public async Task<UpdateResponse<Powerpack>> UpdateAsync(string uuid, string name=null, string application_type = null, string application_id = null,
bool? sticky_sender = null, bool? local_connect = null)
bool? sticky_sender = null, bool? local_connect = null, List<NumberPriority> number_priority = null)
{
var mandatoryParams = new List<string> { "uuid" };
var data = CreateData(
mandatoryParams, new { name,
application_type,
application_id,
sticky_sender,
local_connect });
var result = await Client.Update<UpdateResponse<Powerpack>>(Uri +"Powerpack/"+uuid+"/", data);
local_connect,
number_priority
});
var result = await Client.Update<UpdateResponse<Powerpack>>(Uri +"Powerpack/"+uuid, data);

result.Object.StatusCode = result.StatusCode;
return result.Object;
}
Expand Down
26 changes: 26 additions & 0 deletions src/Plivo/Resource/Powerpack/Priority.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Plivo.Client;

using System;
using System.Collections.Generic;
namespace Plivo.Resource.Powerpack
{
/// <summary>
/// Numberpool.
/// </summary>
public class Priority : Resource
{

public string priority1 { get; set; }
public string priority2 { get; set; }
public string priority3 { get; set; }

public override string ToString()
{
return "\n" +
"Priority1: " + priority1 + "\n" +
"Priority2: " + priority2 + "\n" +
"Priority3: " + priority3 + "\n";
}

}
}
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.14.0";
public const string SdkVersion = "4.15.0";
/// <summary>
/// Plivo API version
/// </summary>
Expand Down

0 comments on commit a1aa396

Please sign in to comment.