23 lines
No EOL
586 B
C#
23 lines
No EOL
586 B
C#
using System.Net.Http.Headers;
|
|
|
|
namespace AdOrbitSDK;
|
|
|
|
public partial class Client
|
|
{
|
|
private readonly string _apiKey;
|
|
|
|
public Client(HttpClient httpClient, string apiKey)
|
|
: this(httpClient)
|
|
{
|
|
_apiKey = apiKey;
|
|
}
|
|
|
|
partial void PrepareRequest(HttpClient client, HttpRequestMessage request, string url)
|
|
{
|
|
if (client.BaseAddress == null) throw new NullReferenceException("Base address cannot be null");
|
|
|
|
var authHeader = new AuthenticationHeaderValue("Bearer", _apiKey);
|
|
|
|
request.Headers.Authorization = authHeader;
|
|
}
|
|
} |