Skip to content

Commit

Permalink
Merge pull request #277 from plivo/VT-7513
Browse files Browse the repository at this point in the history
Vt 7513
  • Loading branch information
manjunath-plivo authored May 28, 2024
2 parents e0c8718 + a5eda0f commit b162b72
Show file tree
Hide file tree
Showing 15 changed files with 734 additions and 9 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

## [5.47.0](https://github.com/plivo/plivo-dotnet/tree/v5.47.0) (2024-05-28)
**Feature - Number Masking Feature Added**
- Number Masking APIs added to create, update, delete and list sessions

## [5.46.0](https://github.com/plivo/plivo-dotnet/tree/v5.46.0) (2024-05-20)
**Feature - Adding support for location whatsapp messages**
- Added new param `location` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message) to support location `whatsapp` messages
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.46.0
PM> Install-Package Plivo -Version 5.47.0
```

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

```
> dotnet add package Plivo --version 5.43.2
> dotnet add package Plivo --version 5.47.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.46.0</ReleaseVersion>
<ReleaseVersion>5.47.0</ReleaseVersion>
<Version />
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<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.46.0</version>
<version>5.47.0</version>
<title>Plivo</title>
<authors>Plivo SDKs Team</authors>
<owners>Plivo, Inc.</owners>
Expand Down
14 changes: 11 additions & 3 deletions src/Plivo/PlivoApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Plivo.Resource.Call;
using Plivo.Resource.Conference;
using Plivo.Resource.Endpoint;
using Plivo.Resource.MaskingSession;
using Plivo.Resource.Message;
using Plivo.Resource.VerifySession;
using Plivo.Resource.Lookup;
Expand Down Expand Up @@ -66,6 +67,7 @@ public class PlivoApi
private readonly Lazy<ProfileInterface> _profile;
private readonly Lazy<MediaInterface> _media;
private readonly Lazy<EndpointInterface> _endpoint;
private readonly Lazy<MaskingSessionInterface> _maskingSession;
private readonly Lazy<PricingInterface> _pricing;
private readonly Lazy<RecordingInterface> _recording;
private readonly Lazy<RentedNumberInterface> _number;
Expand Down Expand Up @@ -148,7 +150,13 @@ public class PlivoApi
/// </summary>
/// <value>The endpoint.</value>
public EndpointInterface Endpoint => _endpoint.Value;


/// <summary>
/// Gets the maskingSession.
/// </summary>
/// <value>The maskingSession.</value>
public MaskingSessionInterface MaskingSession => _maskingSession.Value;

/// <summary>
/// Gets the pricing.
/// </summary>
Expand Down Expand Up @@ -206,8 +214,7 @@ public class PlivoApi
public TollfreeVerificationInterface TollfreeVerification => _tollfreeVerification.Value;

public VerifyCallerIdInterface VerifyCallerId => _verifyCallerId.Value;



/// <summary>
/// Initializes a new instance of the <see cref="T:plivo.PlivoApi"/> class.
/// </summary>
Expand Down Expand Up @@ -243,6 +250,7 @@ public PlivoApi(
_campiagn = new Lazy<CampaignInterface>(() => new CampaignInterface(Client));
_media = new Lazy<MediaInterface>(() => new MediaInterface(Client));
_endpoint = new Lazy<EndpointInterface>(() => new EndpointInterface(Client));
_maskingSession = new Lazy<MaskingSessionInterface>(() => new MaskingSessionInterface(Client));
_pricing = new Lazy<PricingInterface>(() => new PricingInterface(Client));
_recording = new Lazy<RecordingInterface>(() => new RecordingInterface(Client));
_number = new Lazy<RentedNumberInterface>(() => new RentedNumberInterface(Client));
Expand Down
75 changes: 75 additions & 0 deletions src/Plivo/Resource/ListMaskingSessionResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Plivo.Resource
{
/// <summary>
/// List response.
/// </summary>
[JsonObject]
public class ListMaskingSessionResponse<T> : BaseResponse, IEnumerable<T>
{
/// <summary>
/// Gets or sets the meta.
/// </summary>
/// <value>The meta.</value>
public Meta Meta { get; set; }
/// <summary>
/// Gets or sets the objects.
/// </summary>
/// <value>The objects.</value>
public List<T> Objects { get; set; }

public NestedResponse Response;

/// <summary>
/// Initializes a new instance of the <see cref="T:plivo.Resource.ListResponse`1"/> class.
/// </summary>
public ListMaskingSessionResponse()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="T:plivo.Resource.ListResponse`1"/> class.
/// </summary>
/// <param name="meta">Meta.</param>
/// <param name="objects">Objects.</param>
public ListMaskingSessionResponse(Meta meta, List<T> objects)
{
Meta = meta ?? throw new ArgumentNullException(nameof(meta));
Objects = objects ?? throw new ArgumentNullException(nameof(objects));
}

/// <summary>
/// System.s the collections. IE numerable. get enumerator.
/// </summary>
/// <returns>The collections. IE numerable. get enumerator.</returns>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}

/// <summary>
/// Gets the enumerator.
/// </summary>
/// <returns>The enumerator.</returns>
public IEnumerator<T> GetEnumerator()
{
return ((IEnumerable<T>)Objects).GetEnumerator();
}

/// <summary>
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:plivo.Resource.ListResponse`1"/>.
/// </summary>
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="T:plivo.Resource.ListResponse`1"/>.</returns>
public override string ToString()
{
return "Api Id: " + ApiId + "\n" +
"[Meta]\n" + Meta +
"[Response]\n" + Response + "\n" +
"StatusCode:" + StatusCode;
}
}
}
6 changes: 6 additions & 0 deletions src/Plivo/Resource/MaskingSession/AsyncResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Plivo.Resource.MaskingSession
{
public class AsyncResponse : BaseResponse
{
}
}
63 changes: 63 additions & 0 deletions src/Plivo/Resource/MaskingSession/MaskingSession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

using System;
using System.Threading.Tasks;

namespace Plivo.Resource.MaskingSession
{
public class MaskingSession : Resource
{
public new string Id => SessionUuid;
public string SessionUuid { get; set; }
public object Response { get; set; }

public override string ToString()
{
return "ApiId: " + ApiId + "\n"+
"Response: " + Response + "\n";
}

#region Delete
public DeleteResponse<MaskingSession> Delete()
{
return ((MaskingSessionInterface) Interface).Delete(Id);
}
public async Task<AsyncResponse> DeleteAsync(string Id)
{
return await ((MaskingSessionInterface)Interface).DeleteAsync(Id);
}
#endregion


#region Update
public MaskingSessionUpdateResponse<MaskingSession> Update(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null,
bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null,
string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null,
string recording_callback_method = null, string subaccount = null, bool? geomatch = null
)
{
var updateResponse =
((MaskingSessionInterface) Interface)
.Update(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method,
subaccount, geomatch);
return updateResponse;
}

public async Task<AsyncResponse> UpdateAsync(string sessionUuid, uint? session_expiry = null, uint? call_time_limit = null,
bool? record = null, string record_file_format = null, string recording_callback_url = null, string callback_url = null,
string callback_method = null, uint? ring_timeout = null, string first_party_play_url = null, string second_party_play_url = null,
string recording_callback_method = null, string subaccount = null, bool? geomatch = null
)
{
var updateResponse = await
((MaskingSessionInterface)Interface)
.UpdateAsync(Id, session_expiry, call_time_limit, record, record_file_format, recording_callback_url, callback_url,
callback_method, ring_timeout, first_party_play_url, second_party_play_url, recording_callback_method,
subaccount, geomatch);

return updateResponse;
}
#endregion

}
}
18 changes: 18 additions & 0 deletions src/Plivo/Resource/MaskingSession/MaskingSessionCreateResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

namespace Plivo.Resource.MaskingSession
{
public class MaskingSessionCreateResponse : CreateResponse
{
public string SessionUuid { get; set; }
public string VirtualNumber { get; set; }
public object Session { get; set; }

public override string ToString()
{
return base.ToString() +
"Session Uuid: " + SessionUuid + "\n" +
"VirtualNumber: " + VirtualNumber + "\n" +
"Session: " + Session + "\n";
}
}
}
Loading

0 comments on commit b162b72

Please sign in to comment.