The PEX SDK for .NET provides access to the PEX platform via the REST API. For more information on the API or to obtain your credentials, please # on the PEX Developer Center.
Package | Description |
---|---|
PexCard.Api.Client.Core | Contains interfaces, models, and extension methods use to describe and work with the PEX API |
PexCard.Api.Client | Contains interface implementations and error handling for working with the PEX API |
- A platform supported by .NET Standard 2.0
- Valid PEX API credentials obtained from https://developer.pexcard.com
All packages following the semantic versioning 2.0 convention.
- dotnet CLI
dotnet add package PexCard.Api.Client
dotnet add package PexCard.Api.Client.Core
- Reference the following packages:
- Configure the IoC container:
public void ConfigureServices(IServiceCollection services)
{
services.AddPexAuthClient(options =>
{
options.BaseUri = new Uri("https://oauth.pexcard.com");
options.Timeout = TimeSpan.FromSeconds(30);
options.LogLevelSuccess = LogLevel.Debug;
options.LogLevelFailure = LogLevel.Warning;
options.Retries = new PexRetryPolicyOptions
{
RetryLogLevel = LogLevel.Warning,
TooManyRequests = new BackoffRetryPolicy(TimeSpan.FromSeconds(5), 7),
Timeouts = new BackoffRetryPolicy(TimeSpan.FromSeconds(1), 2),
ServerErrors = new BackoffRetryPolicy(TimeSpan.FromMilliseconds(100), 1)
};
});
services.AddPexApiClient(options =>
{
options.BaseUri = new Uri("https://coreapi.pexcard.com");
options.Timeout = TimeSpan.FromMinutes(3);
options.LogLevelSuccess = LogLevel.Debug;
options.LogLevelFailure = LogLevel.Warning;
options.Retries = new PexRetryPolicyOptions
{
RetryLogLevel = LogLevel.Warning,
TooManyRequests = new BackoffRetryPolicy(TimeSpan.FromSeconds(5), 7),
Timeouts = new BackoffRetryPolicy(TimeSpan.FromSeconds(1), 2),
ServerErrors = new BackoffRetryPolicy(TimeSpan.FromMilliseconds(100), 1)
};
});
}
{
"Pex": {
"Auth": {
"BaseUri": "https://oauth.pexcard.com",
"Timeout": "00:00:30",
"LogLevelSuccess": "Debug",
"LogLevelFailure": "Warning",
"Retries": {
"RetryLogLevel": "Warning",
"TooManyRequests": {
"Delay": "00:00:05",
"Retries": 7
},
"Timeouts": {
"Delay": "00:00:01",
"Retries": 2
},
"ServerErrors": {
"Delay": "00:00:00.100",
"Retries": 1
}
}
},
"Api": {
"BaseUri": "https://coreapi.pexcard.com",
"Timeout": "00:03:00",
"LogLevelSuccess": "Debug",
"LogLevelFailure": "Warning",
"Retries": {
"RetryLogLevel": "Warning",
"TooManyRequests": {
"Delay": "00:00:05",
"Retries": 7
},
"Timeouts": {
"Delay": "00:00:01",
"Retries": 2
},
"ServerErrors": {
"Delay": "00:00:00.100",
"Retries": 1
}
}
}
}
}
public void ConfigureServices(IServiceCollection services)
{
services.AddPexAuthClient(Configuration.GetSection("Pex:Auth"));
services.AddPexApiClient(Configuration.GetSection("Pex:Api"));
}
- Inject an instance of
IPexAuthClient
orIPexApiClient
into the class in which you want to use it.
Please create an issue tagged with bug
including the following information:
- Repro Steps
- Expected Result
- Actual Result
- Package Version
- Operating System
Please create an issue tagged with question
.
Please create an issue tagged with enhancement
.