Skip to content

Commit 6cce825

Browse files
authored
Merge pull request #293 from plivo/sync-geoperms
Add GeoPermissions exception on synchronous geo permissions error
2 parents d70d295 + 0c853b9 commit 6cce825

File tree

8 files changed

+35
-6
lines changed

8 files changed

+35
-6
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Change Log
2+
## [5.49.3](https://github.com/plivo/plivo-dotnet/tree/v5.49.3) (2025-02-18)
3+
**Feature - Throw PlivoGeoPermissionException on synchronous geopermissions error**
4+
25
## [5.49.2](https://github.com/plivo/plivo-dotnet/tree/v5.49.2) (2024-10-23)
36
**Feature - FraudCheck param in Create, Get and List Session**
47
- Support for the `fraud_check` parameter in sms verify session request

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ You can install this SDK either by referencing the .dll file or using NuGet.
1212
Use the following line to install the latest SDK using the NuGet CLI.
1313

1414
```
15-
PM> Install-Package Plivo -Version 5.49.2
15+
PM> Install-Package Plivo -Version 5.49.3
1616
```
1717

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

2020
```
21-
> dotnet add package Plivo --version 5.49.2
21+
> dotnet add package Plivo --version 5.49.3
2222
```
2323

2424
## Getting started

Diff for: src/Plivo/Exception/PlivoGeoPermissionException.cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Plivo.Exception
2+
{
3+
public class PlivoGeoPermissionException : PlivoRestException
4+
{
5+
public PlivoGeoPermissionException(string message, uint statusCode = 403) : base(message, statusCode)
6+
{
7+
}
8+
}
9+
}

Diff for: src/Plivo/Http/PlivoResponse.cs

+17
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public class PlivoResponse<T>
3737
/// </summary>
3838
public PlivoRequest PlivoRequest;
3939

40+
private static readonly HashSet<string> GeoPermissionEndpoints = new HashSet<string>
41+
{
42+
"/Message/",
43+
"/Session/",
44+
"/Call/"
45+
};
46+
4047
/// <summary>
4148
/// Initializes a new instance of the <see cref="T:plivo.Http.PlivoResponse`1"/> class.
4249
/// </summary>
@@ -89,6 +96,16 @@ private void ThrowException(string message)
8996
throw new PlivoValidationException(message);
9097
case 401:
9198
throw new PlivoAuthenticationException(message);
99+
case 403:
100+
if (PlivoRequest.Method == "POST" &&
101+
GeoPermissionEndpoints.Any(endpoint => PlivoRequest.Uri.EndsWith(endpoint)))
102+
{
103+
throw new PlivoGeoPermissionException(message);
104+
}
105+
else
106+
{
107+
throw new PlivoRestException(message, StatusCode);
108+
}
92109
case 404:
93110
throw new PlivoNotFoundException(message);
94111
case 405:

Diff for: src/Plivo/Plivo.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
4-
<ReleaseVersion>5.49.2</ReleaseVersion>
4+
<ReleaseVersion>5.49.3</ReleaseVersion>
55
<Version />
66
<Authors>Plivo SDKs Team</Authors>
77
<Owners>Plivo Inc.</Owners>

Diff for: src/Plivo/Plivo.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<summary>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</summary>
55
<description>A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML</description>
66
<id>Plivo</id>
7-
<version>5.49.2</version>
7+
<version>5.49.3</version>
88
<title>Plivo</title>
99
<authors>Plivo SDKs Team</authors>
1010
<owners>Plivo, Inc.</owners>

Diff for: src/Plivo/Version.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class Version
1010
/// <summary>
1111
/// DotNet SDK version
1212
/// </summary>
13-
public const string SdkVersion = "5.49.2";
13+
public const string SdkVersion = "5.49.3";
1414
/// <summary>
1515
/// Plivo API version
1616
/// </summary>

Diff for: version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "5.49.2",
2+
"version": "5.49.3",
33
"publicReleaseRefSpec": [
44
"^refs/heads/master$",
55
"^refs/heads/v\\d+(?:\\.\\d+)?$"

0 commit comments

Comments
 (0)