Skip to content

Commit

Permalink
PHONUM-3115 (#260)
Browse files Browse the repository at this point in the history
* create tollfree verification api integration

* Update unitTests.yml

* Update unitTests.yml

* Added support for additional tollfree verification apis

* Added tf verification fields in list rented numbers function

* added updated_at in tf verification

* renamed created filters

* renamed created lastmodified and error message

* reverted local changes

* bump version

---------

Co-authored-by: kalyan-plivo <[email protected]>
  • Loading branch information
kapilp93 and kalyan-plivo authored Oct 31, 2023
1 parent b07ae29 commit 3440b97
Show file tree
Hide file tree
Showing 21 changed files with 1,210 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [5.37.0](https://github.com/plivo/plivo-dotnet/tree/v5.37.0) (2023-10-31)
**Feature - TollFree Verification API Support**
- API support for Create, Update, Get, Delete and List Tollfree Verification.
- Added New Param `toll_free_sms_verification_id` and `toll_free_sms_verification_order_status `in to the response of the [list all numbers API], [list single number API]
- Added `toll_free_sms_verification_order_status` filter to AccountPhoneNumber - list all my numbers API.

## [5.36.0](https://github.com/plivo/plivo-dotnet/tree/v5.36.0) (2023-10-20)
**Feature - campaign_source field**
- Added new param `campaign_source` in LIST / GET Campaign APIs
Expand Down
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.36.0
PM> Install-Package Plivo -Version 5.37.0
```

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

```
> dotnet add package Plivo --version 5.36.0
> dotnet add package Plivo --version 5.37.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.36.0</ReleaseVersion>
<ReleaseVersion>5.37.0</ReleaseVersion>
<Version />
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
1 change: 1 addition & 0 deletions src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<projectUrl>http://github.com/plivo/plivo-dotnet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>
* 5.37.0 API support for Create, Update, Get, Delete and List Tollfree Verification.
* 5.36.0 Added New Params `campaign_source`.
* 5.35.0 Fixes for Campaign services list API meta data.
* 5.34.0 Added new params `template`, `template_json_string` and message_type `whatsapp`in send message API. Added new `message_state` (`read`), `message_type` (`whatsapp`), `conversation_id`, `conversation_origin`, `conversation_expiration_timestamp` in List Message and Get Message APIs.
Expand Down
8 changes: 7 additions & 1 deletion src/Plivo/PlivoApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Plivo.Resource.Campaign;
using Plivo.Resource.Profile;
using Plivo.Resource.Token;
using Plivo.Resource.TollfreeVerification;

namespace Plivo
{
Expand Down Expand Up @@ -76,6 +77,7 @@ public class PlivoApi
private readonly Lazy<ComplianceApplicationInterface> _complianceApplication;

private readonly Lazy<MultiPartyCallInterface> _multiPartyCall;
private readonly Lazy<TollfreeVerificationInterface> _tollfreeVerification;

/// <summary>
/// Gets the account.
Expand Down Expand Up @@ -190,7 +192,10 @@ public class PlivoApi
public ComplianceApplicationInterface ComplianceApplication => _complianceApplication.Value;

public MultiPartyCallInterface MultiPartyCall => _multiPartyCall.Value;


public TollfreeVerificationInterface TollfreeVerification => _tollfreeVerification.Value;


/// <summary>
/// Initializes a new instance of the <see cref="T:plivo.PlivoApi"/> class.
/// </summary>
Expand Down Expand Up @@ -240,6 +245,7 @@ public PlivoApi(
_complianceApplication =
new Lazy<ComplianceApplicationInterface>(() => new ComplianceApplicationInterface(Client));
_multiPartyCall = new Lazy<MultiPartyCallInterface>(() => new MultiPartyCallInterface(Client));
_tollfreeVerification = new Lazy<TollfreeVerificationInterface>(() => new TollfreeVerificationInterface(Client));
}
}
}
22 changes: 14 additions & 8 deletions src/Plivo/Resource/RentedNumber/RentedNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ public class RentedNumber : Resource
public bool VoiceEnabled { get; set; }
public string VoiceRate { get; set; }

public string ComplianceApplicationId {get; set;}
public string ComplianceStatus {get; set;}
public string TendlcCampaignId {get; set;}
public string TendlcRegistrationStatus {get; set;}
public string TollFreeSmsVerification {get; set;}
public string RenewalDate {get; set;}
public string CnamLookup {get; set;}

public string ComplianceApplicationId { get; set; }
public string ComplianceStatus { get; set; }
public string TendlcCampaignId { get; set; }
public string TendlcRegistrationStatus { get; set; }
public string TollFreeSmsVerification { get; set; }
public string RenewalDate { get; set; }
public string CnamLookup { get; set; }
public string TollFreeSmsVerificationOrderStatus { get; set; }
public string TollFreeSmsVerificationId { get; set; }

public override string ToString()
{
if (string.Compare(Carrier, "Plivo", StringComparison.Ordinal) == 0)
Expand Down Expand Up @@ -69,6 +71,8 @@ public override string ToString()
"TendlcCampaignId: " + TendlcCampaignId + "\n" +
"TendlcRegistrationStatus: " + TendlcRegistrationStatus + "\n" +
"TollFreeSMSVerification: " + TollFreeSmsVerification + "\n" +
"TollFreeSmsVerificationOrderStatus: " + TollFreeSmsVerificationOrderStatus + "\n" +
"TollFreeSmsVerificationId: " + TollFreeSmsVerificationId + "\n" +
"VoiceRate: " + VoiceRate + "\n";
}
return
Expand All @@ -92,6 +96,8 @@ public override string ToString()
"TendlcCampaignId: " + TendlcCampaignId + "\n" +
"TendlcRegistrationStatus: " + TendlcRegistrationStatus + "\n" +
"TollFreeSMSVerification: " + TollFreeSmsVerification + "\n" +
"TollFreeSmsVerificationOrderStatus: " + TollFreeSmsVerificationOrderStatus + "\n" +
"TollFreeSmsVerificationId: " + TollFreeSmsVerificationId + "\n" +
"VoiceRate: " + VoiceRate + "\n";
}

Expand Down
6 changes: 4 additions & 2 deletions src/Plivo/Resource/RentedNumber/RentedNumberInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ 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="tollFreeSmsVerificationOrderStatus">TollFree SMS Verification Order Status</param>
public ListResponse<RentedNumber> List(
string type = null, string numberStartswith = null,
string subaccount = null, string alias = null,
string services = null,
string tendlcCampaignId = null, string tendlcRegistrationStatus = null,
PropertyInfo tollFreeSmsVerification = null,
string tollFreeSmsVerification = null,
string renewalDate = null,
string renewalDate_Lt = null, string renewalDate_Lte = null,
string renewalDate_Gt = null, string renewalDate_Gte = null,
string cnamLookup = null,
string cnamLookup = null, string tollFreeSmsVerificationOrderStatus = null,
uint? limit = null, uint? offset = null)
{
var mandatoryParams = new List<string> {""};
Expand All @@ -103,6 +104,7 @@ public ListResponse<RentedNumber> List(
renewalDate_Gte,
renewalDate_Gt,
cnamLookup,
tollFreeSmsVerificationOrderStatus,
limit,
offset
});
Expand Down
6 changes: 6 additions & 0 deletions src/Plivo/Resource/TollfreeVerification/AsyncResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Plivo.Resource.TollfreeVerification
{
public class AsyncResponse : BaseResponse
{
}
}
164 changes: 164 additions & 0 deletions src/Plivo/Resource/TollfreeVerification/TollfreeVerification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
using System;
using System.Threading.Tasks;

namespace Plivo.Resource.TollfreeVerification
{
/// <summary>
/// TollfreeVerification.
/// </summary>
public class TollfreeVerification : Resource
{
public string Uuid { get; set; }
public string ProfileUuid { get; set; }
public string Number { get; set; }
public string Usecase { get; set; }
public string UsecaseSummary { get; set; }
public string MessageSample { get; set; }
public string OptinImageUrl { get; set; }
public string OptinType { get; set; }
public string Volume { get; set; }
public string AdditionalInformation { get; set; }
public string ExtraData { get; set; }
public string CallbackUrl { get; set; }
public string CallbackMethod { get; set; }
public string Status { get; set; }
public string ErrorMessage { get; set; }
public string Created { get; set; }
public string LastModified { get; set; }

public TollfreeVerification()
{
}

#region Delete

/// <summary>
/// Delete this instance.
/// </summary>
/// <returns>The delete.</returns>
public DeleteResponse<TollfreeVerification> Delete()
{
return ((TollfreeVerificationInterface)Interface).Delete(Uuid);
}

/// <summary>
/// Asynchronously delete this instance.
/// </summary>
/// <returns>The delete.</returns>
public async Task<AsyncResponse> DeleteAsync()
{
return await ((TollfreeVerificationInterface)Interface).DeleteAsync(Uuid);
}

#endregion

#region Update

/// <summary>
/// Update Tollfree Verification request with the specified profileUuid, usecase, usecaseSummary, messageSample, optinImageUrl,
/// optinType, volume, additionalInformation, extraData, callbackUrl, callbackMethod.
/// </summary>
/// <returns>The update.</returns>
/// <param name="profileUuid">The profile UUID.</param>
/// <param name="usecase">The use case, e.g., "2FA, App Notifications".</param>
/// <param name="usecaseSummary">The summary of the use case.</param>
/// <param name="messageSample">Sample messages associated with the use case.</param>
/// <param name="optinImageUrl">The URL of the opt-in image.</param>
/// <param name="optinType">The type of opt-in.</param>
/// <param name="volume">The message volume.</param>
/// <param name="additionalInformation">Additional information.</param>
/// <param name="extraData">Extra data.</param>
/// <param name="callbackUrl">The callback URL.</param>
/// <param name="callbackMethod">The callback method.</param>
public UpdateResponse<TollfreeVerification> Update(
string profileUuid = null, string usecase = null, string usecaseSummary = null,
string messageSample = null, string optinImageUrl = null, string optinType = null, string volume = null,
string additionalInformation = null, string extraData = null, string callbackUrl = null,
string callbackMethod = null)
{
var updateResponse = ((TollfreeVerificationInterface)Interface).Update(
Uuid, profileUuid, usecase, usecaseSummary, messageSample,
optinImageUrl, optinType, volume, additionalInformation,
extraData, callbackUrl, callbackMethod);

if (profileUuid != null) ProfileUuid = profileUuid;
if (usecase != null) Usecase = usecase;
if (usecaseSummary != null) UsecaseSummary = usecaseSummary;
if (messageSample != null) MessageSample = messageSample;
if (optinImageUrl != null) OptinImageUrl = optinImageUrl;
if (optinType != null) OptinType = optinType;
if (volume != null) Volume = volume;
if (additionalInformation != null) AdditionalInformation = additionalInformation;
if (extraData != null) ExtraData = extraData;
if (callbackUrl != null) CallbackUrl = callbackUrl;
if (callbackMethod != null) CallbackMethod = callbackMethod;

return updateResponse;
}

/// <summary>
/// Asynchronously Update Tollfree Verification request with the specified profileUuid, usecase, usecaseSummary, messageSample, optinImageUrl,
/// optinType, volume, additionalInformation, extraData, callbackUrl, callbackMethod.
/// </summary>
/// <returns>The update.</returns>
/// <param name="profileUuid">The profile UUID.</param>
/// <param name="usecase">The use case, e.g., "2FA, App Notifications".</param>
/// <param name="usecaseSummary">The summary of the use case.</param>
/// <param name="messageSample">Sample messages associated with the use case.</param>
/// <param name="optinImageUrl">The URL of the opt-in image.</param>
/// <param name="optinType">The type of opt-in.</param>
/// <param name="volume">The message volume.</param>
/// <param name="additionalInformation">Additional information.</param>
/// <param name="extraData">Extra data.</param>
/// <param name="callbackUrl">The callback URL.</param>
/// <param name="callbackMethod">The callback method.</param>
public async Task<AsyncResponse> UpdateAsync(
string profileUuid = null, string usecase = null, string usecaseSummary = null,
string messageSample = null, string optinImageUrl = null, string optinType = null, string volume = null,
string additionalInformation = null, string extraData = null, string callbackUrl = null,
string callbackMethod = null)
{
var updateResponse = await ((TollfreeVerificationInterface)Interface).UpdateAsync(
Uuid, profileUuid, usecase, usecaseSummary, messageSample, optinImageUrl, optinType, volume,
additionalInformation, extraData, callbackUrl, callbackMethod);

if (profileUuid != null) ProfileUuid = profileUuid;
if (usecase != null) Usecase = usecase;
if (usecaseSummary != null) UsecaseSummary = usecaseSummary;
if (messageSample != null) MessageSample = messageSample;
if (optinImageUrl != null) OptinImageUrl = optinImageUrl;
if (optinType != null) OptinType = optinType;
if (volume != null) Volume = volume;
if (additionalInformation != null) AdditionalInformation = additionalInformation;
if (extraData != null) ExtraData = extraData;
if (callbackUrl != null) CallbackUrl = callbackUrl;
if (callbackMethod != null) CallbackMethod = callbackMethod;

return updateResponse;
}

#endregion

public override string ToString()
{
return "\n" +
"UUID: " + Uuid + "\n" +
"ProfileUuid: " + ProfileUuid + "\n" +
"Number: " + Number + "\n" +
"Usecase: " + Usecase + "\n" +
"UsecaseSummary: " + UsecaseSummary + "\n" +
"MessageSample: " + MessageSample + "\n" +
"OptinImageUrl: " + OptinImageUrl + "\n" +
"OptinType: " + OptinType + "\n" +
"Volume: " + Volume + "\n" +
"AdditionalInformation: " + AdditionalInformation + "\n" +
"ExtraData: " + ExtraData + "\n" +
"CallbackUrl: " + CallbackUrl + "\n" +
"CallbackMethod: " + CallbackMethod + "\n" +
"Status: " + Status + "\n" +
"ErrorMessage: " + ErrorMessage + "\n" +
"Created: " + Created + "\n" +
"LastModified: " + LastModified + "\n";
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Plivo.Resource.TollfreeVerification
{
public class TollfreeVerificationCreateResponse : CreateResponse
{
/// <summary>
/// Gets or sets the request uuid.
/// </summary>
/// <value>The tollfree verification request identifier.</value>
public string Uuid { get; set; }
/// <summary>
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:plivo.Resource.TollfreeVerification.TollfreeVerificationCreateResponse"/>.
/// </summary>
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="T:plivo.Resource.TollfreeVerification.TollfreeVerificationCreateResponse"/>.</returns>
public override string ToString()
{
return base.ToString() +
"UUID: " + Uuid + "\n";
}
}
}
Loading

0 comments on commit 3440b97

Please sign in to comment.