-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial commit for tn lookup * Additional tn lookup changes * Update phone number default lookup * Add create lookup test * Remove Guid object for a string * Add integration test stubs * Update to the latest OpenAPI spec * Update test stubs to the latest OpenAPI spec * Fill out tn lookup integration tests * Grab the number for testing * Remove test assertion * Bump up sleep to avoid rate limit * Remove hardcoded number and test assert * Move sleep to before the status lookup * Add additional sleeps to avoid rate limiting * Test request id assert * Remove test assert * Remove forgotten test assert * Update tests for rate limiting * Simplify tests and monitor rate limiting * Skip tests due to rate limiting
- Loading branch information
Showing
13 changed files
with
2,130 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Bandwidth.Standard/Authentication/IPhoneNumberLookupBasicAuthCredentials.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// <copyright file="IPhoneNumberLookupBasicAuthCredentials.cs" company="APIMatic"> | ||
// Copyright (c) APIMatic. All rights reserved. | ||
// </copyright> | ||
namespace Bandwidth.Standard.Authentication | ||
{ | ||
using System; | ||
|
||
public interface IPhoneNumberLookupBasicAuthCredentials | ||
{ | ||
/// <summary> | ||
/// Gets basicAuthUserName. | ||
/// </summary> | ||
string BasicAuthUserName { get; } | ||
|
||
/// <summary> | ||
/// Gets basicAuthPassword. | ||
/// </summary> | ||
string BasicAuthPassword { get; } | ||
|
||
/// <summary> | ||
/// Returns true if credentials matched. | ||
/// </summary> | ||
bool Equals(string basicAuthUserName, string basicAuthPassword); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
Bandwidth.Standard/Authentication/PhoneNumberLookupBasicAuthManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// <copyright file="PhoneNumberLookupBasicAuthManager.cs" company="APIMatic"> | ||
// Copyright (c) APIMatic. All rights reserved. | ||
// </copyright> | ||
namespace Bandwidth.Standard.Authentication | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Bandwidth.Standard.Http.Request; | ||
|
||
/// <summary> | ||
/// PhoneNumberLookupBasicAuthManager Class. | ||
/// </summary> | ||
internal class PhoneNumberLookupBasicAuthManager : IPhoneNumberLookupBasicAuthCredentials, IAuthManager | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="IrisBasicAuthManager"/> class. | ||
/// </summary> | ||
/// <param name="username"> Username.</param> | ||
/// <param name="password"> Password.</param> | ||
public PhoneNumberLookupBasicAuthManager(string username, string password) | ||
{ | ||
this.BasicAuthUserName = username; | ||
this.BasicAuthPassword = password; | ||
} | ||
|
||
/// <summary> | ||
/// Gets basicAuthUserName. | ||
/// </summary> | ||
public string BasicAuthUserName { get; } | ||
|
||
/// <summary> | ||
/// Gets basicAuthPassword. | ||
/// </summary> | ||
public string BasicAuthPassword { get; } | ||
|
||
/// <summary> | ||
/// Check if credentials match. | ||
/// </summary> | ||
/// <param name="basicAuthUserName"> BasicAuthUserName.</param> | ||
/// <param name="basicAuthPassword"> BasicAuthPassword.</param> | ||
/// <returns> The boolean value.</returns> | ||
public bool Equals(string basicAuthUserName, string basicAuthPassword) | ||
{ | ||
return basicAuthUserName.Equals(this.BasicAuthUserName) | ||
&& basicAuthPassword.Equals(this.BasicAuthPassword); | ||
} | ||
|
||
/// <summary> | ||
/// Adds authentication to the given HttpRequest. | ||
/// </summary> | ||
/// <param name="httpRequest">Http Request.</param> | ||
/// <returns>Returns the httpRequest after adding authentication.</returns> | ||
public HttpRequest Apply(HttpRequest httpRequest) | ||
{ | ||
string authCredentials = this.BasicAuthUserName + ":" + this.BasicAuthPassword; | ||
byte[] data = Encoding.ASCII.GetBytes(authCredentials); | ||
httpRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(data); | ||
return httpRequest; | ||
} | ||
|
||
/// <summary> | ||
/// Adds authentication to the given HttpRequest. | ||
/// </summary> | ||
/// <param name="httpRequest">Http Request.</param> | ||
/// <returns>Returns the httpRequest after adding authentication.</returns> | ||
public Task<HttpRequest> ApplyAsync(HttpRequest httpRequest) | ||
{ | ||
string authCredentials = this.BasicAuthUserName + ":" + this.BasicAuthPassword; | ||
byte[] data = Encoding.ASCII.GetBytes(authCredentials); | ||
httpRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(data); | ||
return Task.FromResult(httpRequest); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.