diff --git a/CHANGELOG.md b/CHANGELOG.md index a9a737d0..90f18255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/src/Plivo/Plivo.csproj b/src/Plivo/Plivo.csproj index e14a6d5e..356e002a 100644 --- a/src/Plivo/Plivo.csproj +++ b/src/Plivo/Plivo.csproj @@ -1,7 +1,7 @@ netstandard2.0;netstandard1.3 - 5.30.0 + 5.31.0 Plivo SDKs Team Plivo Inc. diff --git a/src/Plivo/Plivo.nuspec b/src/Plivo/Plivo.nuspec index 1b875070..8c972c57 100644 --- a/src/Plivo/Plivo.nuspec +++ b/src/Plivo/Plivo.nuspec @@ -4,7 +4,7 @@ A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML Plivo - 5.30.0 + 5.31.0 Plivo Plivo SDKs Team Plivo, Inc. @@ -12,6 +12,7 @@ http://github.com/plivo/plivo-dotnet false + * 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 diff --git a/src/Plivo/Resource/NumberUpdateResponse.cs b/src/Plivo/Resource/NumberUpdateResponse.cs new file mode 100644 index 00000000..0b33a230 --- /dev/null +++ b/src/Plivo/Resource/NumberUpdateResponse.cs @@ -0,0 +1,15 @@ +namespace Plivo.Resource +{ + public class NumberUpdateResponse : UpdateResponse + { + public string NewCnam { get; set; } + public string CnamUpdateStatus { get; set; } + + public override string ToString() + { + return base.ToString() + + "NewCnam: " + NewCnam + "\n" + + "CnamUpdateStatus: " + CnamUpdateStatus + "\n"; + } + } +} \ No newline at end of file diff --git a/src/Plivo/Resource/PhoneNumber/PhoneNumber.cs b/src/Plivo/Resource/PhoneNumber/PhoneNumber.cs index f906d0c0..f33fb26d 100755 --- a/src/Plivo/Resource/PhoneNumber/PhoneNumber.cs +++ b/src/Plivo/Resource/PhoneNumber/PhoneNumber.cs @@ -65,9 +65,12 @@ public override string ToString() /// The buy. /// App identifier. /// CnamLookup. - public PhoneNumberBuyResponse Buy(string appId = null, string cnamLookup = null) + /// Cnam. + /// CallbackUrl. + /// CallbackMethod. + 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); } /// /// Asynchronously buy PhoneNumber and associate it with @@ -76,9 +79,12 @@ public PhoneNumberBuyResponse Buy(string appId = null, string cnamLookup = null) /// The buy. /// App identifier. /// Cnam Lookup - public async Task BuyAsync(string appId = null, string cnamLookup = null) + /// Cnam. + /// CallbackUrl. + /// CallbackMethod. + public async Task 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 } diff --git a/src/Plivo/Resource/PhoneNumber/PhoneNumberBuyResponse.cs b/src/Plivo/Resource/PhoneNumber/PhoneNumberBuyResponse.cs index 91541231..e27f5f8e 100755 --- a/src/Plivo/Resource/PhoneNumber/PhoneNumberBuyResponse.cs +++ b/src/Plivo/Resource/PhoneNumber/PhoneNumberBuyResponse.cs @@ -9,7 +9,7 @@ public class PhoneNumberBuyResponse : BaseResponse public override string ToString() { - return "StatusCode:" + Status +"\n"+"[Numbers]\n" + string.Join("\n", Numbers)+"\n"+"StatusCode:" + StatusCode + "\n"; + return "Status:" + Status +"\n"+"[Numbers]\n" + string.Join("\n", Numbers)+"\n"+"StatusCode:" + StatusCode + "\n"; } } @@ -18,10 +18,15 @@ public class Phone { public string Number { get; set; } public string Status { get; set; } + public string NewCnam { get; set; } + public string CnamUpdateStatus { get; set; } public override string ToString() { - return "Number:" + Number + "\n"; + if (NewCnam != "") { + return "Number:" + Number + "\n" + "Status:" + Status + "\n" + "NewCnam:" + NewCnam + "\n" +"CnamUpdateStatus:" + CnamUpdateStatus + "\n"; + } + return "Number:" + Number + "\n" + "Status:" + Status + "\n"; } } diff --git a/src/Plivo/Resource/PhoneNumber/PhoneNumberInterface.cs b/src/Plivo/Resource/PhoneNumber/PhoneNumberInterface.cs index 14ca5a9b..0dcc221c 100755 --- a/src/Plivo/Resource/PhoneNumber/PhoneNumberInterface.cs +++ b/src/Plivo/Resource/PhoneNumber/PhoneNumberInterface.cs @@ -130,15 +130,18 @@ public async Task> ListAsync( /// /// The buy. /// Number. - /// App identifier. + /// App identifier. /// Verification information. address_id and identity_id are the keys /// Cnam Lookup - public PhoneNumberBuyResponse Buy(string number, string appId = null, string cnamLookup = null, + /// Cnam + /// callbackUrl + /// callbackMethod + public PhoneNumberBuyResponse Buy(string number, string app_id = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null, Dictionary verificationInfo = null ) { var mandatoryParams = new List {""}; var data = CreateData( - mandatoryParams, new {appId, verificationInfo, cnamLookup}); + mandatoryParams, new {app_id, verificationInfo, cnamLookup, cnam, callbackUrl, callbackMethod}); return ExecuteWithExceptionUnwrap(() => { @@ -156,15 +159,18 @@ public PhoneNumberBuyResponse Buy(string number, string appId = null, string cna /// /// The buy. /// Number. - /// App identifier. + /// App identifier. /// Verification information. address_id and identity_id are the keys /// Cnam Lookup - public async Task BuyAsync(string number, string appId = null, string cnamLookup = null, + /// Cnam + /// callbackUrl + /// callbackMethod + public async Task BuyAsync(string number, string app_id = null, string cnamLookup = null, string cnam = null, string callbackUrl = null, string callbackMethod = null, Dictionary verificationInfo = null) { var mandatoryParams = new List { "" }; var data = CreateData( - mandatoryParams, new { appId, verificationInfo, cnamLookup }); + mandatoryParams, new { app_id, verificationInfo, cnamLookup, cnam, callbackUrl, callbackMethod}); var result = await Client.Update( Uri + number + "/", data diff --git a/src/Plivo/Resource/RentedNumber/RentedNumber.cs b/src/Plivo/Resource/RentedNumber/RentedNumber.cs index 8a756a8d..5d6fec78 100755 --- a/src/Plivo/Resource/RentedNumber/RentedNumber.cs +++ b/src/Plivo/Resource/RentedNumber/RentedNumber.cs @@ -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) @@ -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" + @@ -104,7 +106,7 @@ public override string ToString() /// App identifier. /// SubAccount. /// Alias. - public UpdateResponse Update( + public NumberUpdateResponse Update( string appId = null, string subAccount = null, string alias = null) { var updateResponse = @@ -132,7 +134,7 @@ public UpdateResponse Update( /// App identifier. /// SubAccount. /// Alias. - public async Task> UpdateAsync( + public async Task> UpdateAsync( string appId = null, string subAccount = null, string alias = null) { var updateResponse = await ((RentedNumberInterface) Interface) diff --git a/src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs b/src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs index 3d1e235c..05c3b02d 100755 --- a/src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs +++ b/src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs @@ -72,6 +72,7 @@ public async Task GetAsync(string number) /// Renewal Date Greater Than /// Renewal Date Greater Than or Equal /// Cnam Lookup configuration + /// Cnam configuration public ListResponse List( string type = null, string numberStartswith = null, string subaccount = null, string alias = null, @@ -82,6 +83,7 @@ public ListResponse 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 {""}; @@ -103,6 +105,7 @@ public ListResponse List( renewalDate_Gte, renewalDate_Gt, cnamLookup, + cnam, limit, offset }); @@ -187,7 +190,7 @@ public UpdateResponse AddNumber( return ExecuteWithExceptionUnwrap(() => { - var result = Task.Run(async () => await Client.Update>(Uri, data).ConfigureAwait(false)).Result; + var result = Task.Run(async () => await Client.Update>(Uri, data).ConfigureAwait(false)).Result; result.Object.StatusCode = result.StatusCode; return result.Object; }); @@ -202,7 +205,7 @@ public UpdateResponse AddNumber( /// Number type. /// App identifier. /// Subaccount. - public async Task> AddNumberAsync( + public async Task> AddNumberAsync( List numbers, string carrier, string region, string numberType = null, string appId = null, string subaccount = null) @@ -220,7 +223,7 @@ public async Task> AddNumberAsync( appId, subaccount }); - var result = await Client.Update>(Uri, data); + var result = await Client.Update>(Uri, data); result.Object.StatusCode = result.StatusCode; return result.Object; } @@ -228,7 +231,7 @@ public async Task> AddNumberAsync( #region Update /// - /// Update RentedNumber with the specified number, appId, subaccount and alias. + /// Update RentedNumber with the specified number, appId, subaccount, alias, cnamLookup, cnam , callbackUrl and callbackMethod. /// /// The update. /// Number. @@ -237,9 +240,13 @@ public async Task> AddNumberAsync( /// Alias. /// Verification Information. /// Cnam Lookup. - public UpdateResponse Update( + /// Cnam + /// callbackUrl + /// callbackMethod + public NumberUpdateResponse Update( string number, string appId = null, string subaccount = null, - string alias = null, Dictionary verificationInfo = null, string cnamLookup = null) + string alias = null, Dictionary verificationInfo = null, string cnamLookup = null, + string cnam = null, string callbackUrl = null, string callbackMethod = null) { var mandatoryParams = new List {""}; var data = CreateData( @@ -250,13 +257,16 @@ public UpdateResponse Update( subaccount, alias, verificationInfo, - cnamLookup + cnamLookup, + cnam, + callbackUrl, + callbackMethod }); if (appId == "null") data["app_id"] = null; return ExecuteWithExceptionUnwrap(() => { - var result = Task.Run(async () => await Client.Update>( + var result = Task.Run(async () => await Client.Update>( Uri + number + "/", data ).ConfigureAwait(false)).Result; @@ -265,7 +275,7 @@ public UpdateResponse Update( }); } /// - /// 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. /// /// The update. /// Number. @@ -274,9 +284,13 @@ public UpdateResponse Update( /// Alias. /// Verification Information. /// Cnam Lookup. - public async Task> UpdateAsync( + /// Cnam + /// callbackUrl + /// callbackMethod + public async Task> UpdateAsync( string number, string appId = null, string subaccount = null, - string alias = null, Dictionary verificationInfo = null, string cnamLookup = null) + string alias = null, Dictionary verificationInfo = null, string cnamLookup = null, + string cnam = null, string callbackUrl = null, string callbackMethod = null) { var mandatoryParams = new List { "" }; var data = CreateData( @@ -287,10 +301,13 @@ public async Task> UpdateAsync( subaccount, alias, verificationInfo, - cnamLookup + cnamLookup, + cnam, + callbackUrl, + callbackMethod }); if (appId == "null") data["app_id"] = null; - var result = await Client.Update>( + var result = await Client.Update>( Uri + number + "/", data ); diff --git a/src/Plivo/Version.cs b/src/Plivo/Version.cs index 95c2b4aa..ff096991 100644 --- a/src/Plivo/Version.cs +++ b/src/Plivo/Version.cs @@ -10,7 +10,7 @@ public class Version /// /// DotNet SDK version /// - public const string SdkVersion = "5.30.0"; + public const string SdkVersion = "5.31.0"; /// /// Plivo API version /// diff --git a/tests/Plivo.Test/Mocks/numberGetResponse.json b/tests/Plivo.Test/Mocks/numberGetResponse.json index 2798285a..a5c1a06f 100755 --- a/tests/Plivo.Test/Mocks/numberGetResponse.json +++ b/tests/Plivo.Test/Mocks/numberGetResponse.json @@ -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" } diff --git a/tests/Plivo.Test/Mocks/numberListResponse.json b/tests/Plivo.Test/Mocks/numberListResponse.json index 4d3bbc29..dcc4cf1f 100755 --- a/tests/Plivo.Test/Mocks/numberListResponse.json +++ b/tests/Plivo.Test/Mocks/numberListResponse.json @@ -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", @@ -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", @@ -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" } ] } diff --git a/version.json b/version.json index 128391ac..53269aac 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { - "version": "5.30.0", + "version": "5.31.0", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$"