Add project files
This commit is contained in:
parent
4dafed3553
commit
8cf01ead74
40 changed files with 3967 additions and 0 deletions
23
StalwartSDK/StalwartClientFactory.cs
Normal file
23
StalwartSDK/StalwartClientFactory.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue