Skip to content

Commit

Permalink
fix: add missing ApplicationId property on NumberSearchRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Jul 30, 2024
1 parent 8538de3 commit 7ea2677
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Vonage.Test/NumbersTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Net;
#region
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using Vonage.Numbers;
using Vonage.Request;
using Xunit;
#endregion

namespace Vonage.Test;

Expand Down Expand Up @@ -178,11 +180,11 @@ public async Task GetOwnedNumbersAsyncWithCredentials()
const string expectedResponse =
@"{""count"": 1234,""numbers"": [{""country"": ""GB"",""msisdn"": ""447700900000"",""type"": ""mobile-lvn"",""cost"": ""1.25"",""features"": [""VOICE"",""SMS""]}]}";
var expectedUri =
$"{this.RestUrl}/account/numbers?country=GB&type=mobile-lvn&pattern=12345&search_pattern=1&features=SMS&size=10&index=1&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
$"{this.RestUrl}/account/numbers?country=GB&type=mobile-lvn&pattern=12345&search_pattern=1&features=SMS&size=10&index=1&application_id=testApp&api_key={this.ApiKey}&api_secret={this.ApiSecret}&";
var request = new NumberSearchRequest
{
Country = "GB", Type = "mobile-lvn", Pattern = "12345", SearchPattern = SearchPattern.Contains,
Features = "SMS", Size = 10, Index = 1,
Features = "SMS", Size = 10, Index = 1, ApplicationId = "testApp",
};
this.Setup(expectedUri, expectedResponse);
var response = await this.client.NumbersClient.GetOwnedNumbersAsync(request, this.credentials);
Expand Down
14 changes: 12 additions & 2 deletions Vonage/Numbers/NumberSearchRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#region
using Newtonsoft.Json;
#endregion

namespace Vonage.Numbers;

Expand Down Expand Up @@ -39,13 +41,15 @@ public class NumberSearchRequest
/// <summary>
/// Page size
/// </summary>
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("size", DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore)]
public int? Size { get; set; }

/// <summary>
/// Page index
/// </summary>
[JsonProperty("index", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("index", DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore)]
public int? Index { get; set; }

/// <summary>
Expand All @@ -54,4 +58,10 @@ public class NumberSearchRequest
/// </summary>
[JsonProperty("has_application", NullValueHandling = NullValueHandling.Ignore)]
public bool? HasApplication { get; set; }

/// <summary>
/// The application Id linked to the number.
/// </summary>
[JsonProperty("application_id", NullValueHandling = NullValueHandling.Ignore)]
public string ApplicationId { get; set; }
}

0 comments on commit 7ea2677

Please sign in to comment.