Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cnam changes done #252

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## [5.31.0](https://github.com/plivo/plivo-dotnet/tree/v5.31.0) (2023-06-27)
**Feature - CNAM**
- Added New Param `cnam` in to the response of the [list all numbers API], [list single number API]
- Added `cnam` parameter to buy number[Buy a Phone Number] to configure CNAM while buying a US number
- Added `callback_url` parameter to buy number[Buy a Phone Number] to configure CNAM callback url while buying a US number
- Added `callback_method` parameter to buy number[Buy a Phone Number] to configure CNAM callback method while buying a US number
- Added `cnam` parameter to update number[Update an account phone number] to configure CNAM while updating a US number
- Added `callback_url` parameter to update number[Update an account phone number] to configure CNAM callback url while updating a US number
- Added `callback_method` parameter to update number[Update an account phone number] to configure CNAM callback method while updating a US number

## [5.30.0](https://github.com/plivo/plivo-dotnet/tree/v5.30.0) (2023-05-02)
**Feature - CNAM Lookup**
- Added New Param `cnam_lookup` in to the response of the [list all numbers API], [list single number API]
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.30.0</ReleaseVersion>
<ReleaseVersion>5.31.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.30.0</version>
<version>5.31.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.31.0 Added New Param 'cnam' in to the response of the [list all numbers API], [list single number API]
* 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
* 5.28.0 Added new Params 'MonthlyRecordingStorageAmount', 'RecordingStorageRate', 'RecordingStorageDuration' and 'RoundedRecordingDuration' to List Recordings and Get Recording APIs
Expand Down
14 changes: 10 additions & 4 deletions src/Plivo/Resource/PhoneNumber/PhoneNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ public override string ToString()
/// <returns>The buy.</returns>
/// <param name="appId">App identifier.</param>
/// <param name="cnamLookup">CnamLookup.</param>
public PhoneNumberBuyResponse Buy(string appId = null, string cnamLookup = null)
/// <param name="cnam">Cnam.</param>
/// <param name="callbackUrl">CallbackUrl.</param>
/// <param name="callbackMethod">CallbackMethod.</param>
public PhoneNumberBuyResponse Buy(string appId = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null)
{
return ((PhoneNumberInterface) Interface).Buy(Id, appId, cnamLookup);
return ((PhoneNumberInterface) Interface).Buy(Id, appId, cnamLookup, cnam, callbackUrl, callbackMethod);
}
/// <summary>
/// Asynchronously buy PhoneNumber and associate it with
Expand All @@ -76,9 +79,12 @@ public PhoneNumberBuyResponse Buy(string appId = null, string cnamLookup = null)
/// <returns>The buy.</returns>
/// <param name="appId">App identifier.</param>
/// <param name="cnamLookup">Cnam Lookup</param>
public async Task<PhoneNumberBuyResponse> BuyAsync(string appId = null, string cnamLookup = null)
/// <param name="cnam">Cnam.</param>
/// <param name="callbackUrl">CallbackUrl.</param>
/// <param name="callbackMethod">CallbackMethod.</param>
public async Task<PhoneNumberBuyResponse> BuyAsync(string appId = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null)
{
return await ((PhoneNumberInterface)Interface).BuyAsync(Id, appId, cnamLookup);
return await ((PhoneNumberInterface)Interface).BuyAsync(Id, appId, cnamLookup, cnam, callbackUrl, callbackMethod);
}
#endregion
}
Expand Down
14 changes: 10 additions & 4 deletions src/Plivo/Resource/PhoneNumber/PhoneNumberInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ public async Task<ListResponse<PhoneNumber>> ListAsync(
/// <param name="appId">App identifier.</param>
/// <param name="verificationInfo">Verification information. address_id and identity_id are the keys</param>
/// <param name="cnamLookup">Cnam Lookup</param>
public PhoneNumberBuyResponse Buy(string number, string appId = null, string cnamLookup = null,
/// <param name="cnam">Cnam</param>
/// <param name="callbackUrl">CallbackUrl</param>
/// <param name="callbackMethod">CallbackMethod</param>
public PhoneNumberBuyResponse Buy(string number, string appId = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null,
Dictionary<string, string> verificationInfo = null )
{
var mandatoryParams = new List<string> {""};
var data = CreateData(
mandatoryParams, new {appId, verificationInfo, cnamLookup});
mandatoryParams, new {appId, verificationInfo, cnamLookup, cnam, callbackUrl, callbackMethod});

return ExecuteWithExceptionUnwrap(() =>
{
Expand All @@ -159,12 +162,15 @@ public PhoneNumberBuyResponse Buy(string number, string appId = null, string cna
/// <param name="appId">App identifier.</param>
/// <param name="verificationInfo">Verification information. address_id and identity_id are the keys</param>
/// <param name="cnamLookup">Cnam Lookup</param>
public async Task<PhoneNumberBuyResponse> BuyAsync(string number, string appId = null, string cnamLookup = null,
/// <param name="cnam">Cnam</param>
/// <param name="callbackUrl">CallbackUrl</param>
/// <param name="callbackMethod">CallbackMethod</param>
public async Task<PhoneNumberBuyResponse> BuyAsync(string number, string appId = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null,
Dictionary<string, string> verificationInfo = null)
{
var mandatoryParams = new List<string> { "" };
var data = CreateData(
mandatoryParams, new { appId, verificationInfo, cnamLookup });
mandatoryParams, new { appId, verificationInfo, cnamLookup, cnam, callbackUrl, callbackMethod});
var result = await Client.Update<PhoneNumberBuyResponse>(
Uri + number + "/",
data
Expand Down
4 changes: 3 additions & 1 deletion src/Plivo/Resource/RentedNumber/RentedNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class RentedNumber : Resource
public string TollFreeSmsVerification {get; set;}
public string RenewalDate {get; set;}
public string CnamLookup {get; set;}

public string Cnam{get; set;}

public override string ToString()
{
if (string.Compare(Carrier, "Plivo", StringComparison.Ordinal) == 0)
Expand All @@ -50,6 +51,7 @@ public override string ToString()
"City: " + City + "\n" +
"Country: " + Country + "\n" +
"CnamLookup: " + CnamLookup + "\n" +
"Cnam: " + Cnam + "\n" +
"MmsEnabled: " + MmsEnabled + "\n" +
"MmsRate: " + MmsRate + "\n" +
"MonthlyRentalRate: " + MonthlyRentalRate + "\n" +
Expand Down
29 changes: 23 additions & 6 deletions src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public async Task<RentedNumber> GetAsync(string number)
/// <param name="renewalDate_Gt">Renewal Date Greater Than</param>
/// <param name="renewalDate_Gte">Renewal Date Greater Than or Equal</param>
/// <param name="cnamLookup">Cnam Lookup configuration</param>
/// <param name="cnam">Cnam configuration</param>
public ListResponse<RentedNumber> List(
string type = null, string numberStartswith = null,
string subaccount = null, string alias = null,
Expand All @@ -82,6 +83,7 @@ public ListResponse<RentedNumber> List(
string renewalDate_Lt = null, string renewalDate_Lte = null,
string renewalDate_Gt = null, string renewalDate_Gte = null,
string cnamLookup = null,
string cnam = null,
uint? limit = null, uint? offset = null)
{
var mandatoryParams = new List<string> {""};
Expand All @@ -103,6 +105,7 @@ public ListResponse<RentedNumber> List(
renewalDate_Gte,
renewalDate_Gt,
cnamLookup,
cnam,
limit,
offset
});
Expand Down Expand Up @@ -228,7 +231,7 @@ public async Task<UpdateResponse<RentedNumber>> AddNumberAsync(

#region Update
/// <summary>
/// Update RentedNumber with the specified number, appId, subaccount and alias.
/// Update RentedNumber with the specified number, appId, subaccount, alias, cnamLookup, cnam , callbackUrl and callbackMethod.
/// </summary>
/// <returns>The update.</returns>
/// <param name="number">Number.</param>
Expand All @@ -237,9 +240,13 @@ public async Task<UpdateResponse<RentedNumber>> AddNumberAsync(
/// <param name="alias">Alias.</param>
/// <param name="verificationInfo">Verification Information.</param>
/// <param name="cnamLookup">Cnam Lookup.</param>
/// <param name="cnam">Cnam</param>
/// <param name="callbackUrl">CallbackUrl</param>
/// <param name="callbackMethod">CallbackMethod</param>
public UpdateResponse<RentedNumber> Update(
string number, string appId = null, string subaccount = null,
string alias = null, Dictionary<string, string> verificationInfo = null, string cnamLookup = null)
string alias = null, Dictionary<string, string> verificationInfo = null, string cnamLookup = null,
string cnam = null, string callbackUrl = null, string callbackMethod = null)
{
var mandatoryParams = new List<string> {""};
var data = CreateData(
Expand All @@ -250,7 +257,10 @@ public UpdateResponse<RentedNumber> Update(
subaccount,
alias,
verificationInfo,
cnamLookup
cnamLookup,
cnam,
callbackUrl,
callbackMethod
});
if (appId == "null") data["app_id"] = null;

Expand All @@ -265,7 +275,7 @@ public UpdateResponse<RentedNumber> Update(
});
}
/// <summary>
/// Asynchronously update RentedNumber with the specified number, appId, subaccount and alias.
/// Asynchronously update RentedNumber with the specified number, appId, subaccount cnamLookup, cnam , callbackUrl and callbackMethod.
/// </summary>
/// <returns>The update.</returns>
/// <param name="number">Number.</param>
Expand All @@ -274,9 +284,13 @@ public UpdateResponse<RentedNumber> Update(
/// <param name="alias">Alias.</param>
/// <param name="verificationInfo">Verification Information.</param>
/// <param name="cnamLookup">Cnam Lookup.</param>
/// <param name="cnam">Cnam</param>
/// <param name="callbackUrl">CallbackUrl</param>
/// <param name="callbackMethod">CallbackMethod</param>
public async Task<UpdateResponse<RentedNumber>> UpdateAsync(
string number, string appId = null, string subaccount = null,
string alias = null, Dictionary<string, string> verificationInfo = null, string cnamLookup = null)
string alias = null, Dictionary<string, string> verificationInfo = null, string cnamLookup = null,
string cnam = null, string callbackUrl = null, string callbackMethod = null)
{
var mandatoryParams = new List<string> { "" };
var data = CreateData(
Expand All @@ -287,7 +301,10 @@ public async Task<UpdateResponse<RentedNumber>> UpdateAsync(
subaccount,
alias,
verificationInfo,
cnamLookup
cnamLookup,
cnam,
callbackUrl,
callbackMethod
});
if (appId == "null") data["app_id"] = null;
var result = await Client.Update<UpdateResponse<RentedNumber>>(
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.30.0";
public const string SdkVersion = "5.31.0";
/// <summary>
/// Plivo API version
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion tests/Plivo.Test/Mocks/numberGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date": "2023-05-01",
"cnam_lookup": "enabled"
"cnam_lookup": "enabled",
"cnam": "test1"
}
9 changes: 6 additions & 3 deletions tests/Plivo.Test/Mocks/numberListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date": "2023-05-01",
"cnam_lookup": "enabled"
"cnam_lookup": "enabled",
"cnam": "test1"
},
{
"added_on": "2013-01-01",
Expand All @@ -48,7 +49,8 @@
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date": "2023-05-01",
"cnam_lookup": "enabled"
"cnam_lookup": "enabled",
"cnam": "test1"
},
{
"added_on": "2013-03-25",
Expand All @@ -69,7 +71,8 @@
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": "verified",
"renewal_date": "2023-05-01",
"cnam_lookup": "enabled"
"cnam_lookup": "enabled",
"cnam": "test1"
}
]
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "5.30.0",
"version": "5.31.0",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
Expand Down