A modern .NET client for the GoAffPro Affiliate Marketing API with Kiota-generated clients and event detection.
$ dotnet add package GoAffPro.ClientAsync-first .NET client for GoAffPro using Kiota-generated models plus a thin wrapper for auth and polling observers.
net9.0net10.0dotnet add package GoAffPro.Client
using GoAffPro.Client;
await using var client = new GoAffProClient(new GoAffProClientOptions
{
BearerToken = "your-access-token",
});
// Or login first:
string token = await client.LoginAsync("affiliate@example.com", "password123");
Use the generated API root from the wrapper:
var sites = await client.Api.User.Sites.GetAsync(config =>
{
config.QueryParameters.Limit = 20;
config.QueryParameters.Offset = 0;
});
Wrapper helpers:
LoginAsync(email, password, ct)SetBearerToken(token)Stream-based:
await foreach (var order in client.NewOrdersAsync(
pollingInterval: TimeSpan.FromSeconds(30),
pageSize: 100,
cancellationToken: cancellationToken))
{
Console.WriteLine(order.Id?.String);
}
Event-based:
client.OrderDetected += (_, e) => Console.WriteLine(e.Order.Id?.String);
client.AffiliateDetected += (_, e) => Console.WriteLine(e.Affiliate.AffiliateId?.String);
await client.StartEventObserverAsync(
pollingInterval: TimeSpan.FromSeconds(30),
pageSize: 100,
cancellationToken: cancellationToken);
Backfill controls:
OrderObserverStartTimeAffiliateObserverStartTimePayoutObserverStartTimeservices.AddGoAffProClient(options =>
{
options.BaseUrl = new Uri("https://api.goaffpro.com/v1/", UriKind.Absolute);
options.BearerToken = configuration["GoAffPro:Token"];
options.Timeout = TimeSpan.FromSeconds(30);
});
Project: examples/GoAffPro.Client.Example
Interactive mode:
dotnet run --project examples/GoAffPro.Client.Example
CLI sweep mode:
dotnet run --project examples/GoAffPro.Client.Example -- \
--run-tests \
--access_token=env:GOAFFPRO_TEST_TOKEN \
--products-timeout-seconds=90 \
--output=api-sweep.json
Generation is handled by src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj:
openapi/goaffpro-canonical.yamlsrc/GoAffPro.Client.Generated/GeneratedDo not manually edit generated files.
Unit tests:
dotnet test tests/GoAffPro.Client.Tests/GoAffPro.Client.Tests.csproj
Integration tests:
dotnet test tests/GoAffPro.Client.IntegrationTests/GoAffPro.Client.IntegrationTests.csproj --filter "Category=Integration"
Integration auth sources:
GOAFFPRO_TEST_TOKENGOAFFPRO_TEST_EMAIL + GOAFFPRO_TEST_PASSWORDtests/GoAffPro.Client.IntegrationTests/appsettings.Test.local.json (template: appsettings.Test.local.example.json)Tracked in openapi/goaffpro-canonical.yaml comments:
/user/feed/products can time out/user/feed/rewards can return 404/non-JSON/user/feed/transactions can return 500 with non-JSON payload/user/payouts/pending tracked as parity endpoint also seen under /sdk/user/*