GoAffPro.Client 0.2.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package GoAffPro.Client --version 0.2.0
                    
NuGet\Install-Package GoAffPro.Client -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GoAffPro.Client" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GoAffPro.Client" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="GoAffPro.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GoAffPro.Client --version 0.2.0
                    
#r "nuget: GoAffPro.Client, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GoAffPro.Client@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GoAffPro.Client&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=GoAffPro.Client&version=0.2.0
                    
Install as a Cake Tool

GoAffPro.Client

Async-first .NET client for the GoAffPro API with build-time NSwag generation and polling/event-based change detection.

Targets

  • net8.0
  • net10.0

Install

dotnet add package GoAffPro.Client

Quick Start

using GoAffPro.Client;

// Option 1: create from existing token
await using var client = new GoAffProClient(new GoAffProClientOptions
{
    BearerToken = "your-access-token",
});

// Option 2: login and create
await using var loggedInClient = await GoAffProClient.CreateLoggedInAsync(
    email: "affiliate@example.com",
    password: "password123");

Wrapper Methods (DX Layer)

The wrapper methods are built on top of generated clients:

var orders = await client.GetOrdersAsync(limit: 50);
var affiliates = await client.GetAffiliatesAsync(limit: 50);

Wrapper methods return typed models:

  • GoAffProOrder
  • GoAffProAffiliate
  • GoAffProReward

Each model includes strongly typed fields and RawPayload (JsonElement) for advanced scenarios.

GetRewardsAsync is currently disabled because /user/feed/rewards is returning 404 (observed on 2026-02-18). The method is marked [Obsolete] and currently returns an empty collection.

Access Generated Clients Directly

var loginResponse = await client.User.UserLoginAsync(new GoAffPro.Client.Generated.User.Body
{
    Email = "affiliate@example.com",
    Password = "password123",
});

var publicSites = await client.PublicApi.PublicSitesAsync(
    site_ids: null,
    currency: null,
    keyword: null,
    limit: 20,
    offset: 0);

Event Detection

GoAffProEventDetector supports both async streams and classic .NET events.

Async Streams

using GoAffPro.Client.Events;

var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromSeconds(30));

await foreach (var order in detector.NewOrdersAsync(cancellationToken))
{
    Console.WriteLine($"New order: {order.Id}");
}

Event Handlers

using GoAffPro.Client.Events;

var detector = new GoAffProEventDetector(client, pollingInterval: TimeSpan.FromSeconds(30));

detector.OrderDetected += (_, args) => Console.WriteLine($"Order: {args.Order.Id}");
detector.AffiliateDetected += (_, args) => Console.WriteLine($"Affiliate: {args.Affiliate.Id}");

await detector.StartAsync(cancellationToken);

Dependency Injection

services.AddGoAffProClient(options =>
{
    options.BaseUrl = new Uri("https://api.goaffpro.com/v1/", UriKind.Absolute);
    options.BearerToken = configuration["GoAffPro:Token"];
    options.Timeout = TimeSpan.FromSeconds(30);
});

Example App

An executable sample is included at:

  • examples/GoAffPro.Client.Example

Run it with:

dotnet run --project examples/GoAffPro.Client.Example

Build-Time Generation

On build, GoAffPro.Client.Generator:

  1. Fetches https://api.goaffpro.com/docs/admin/swagger-ui-init.js (or uses openapi/swagger-ui-init.js only if you provide a local override file)
  2. Extracts OpenAPI JSON
  3. Filters to /user/* and /public/*
  4. Normalizes schema gaps for generation
  5. Generates:
    • src/GoAffPro.Client/Generated/GoAffProUserClient.g.cs
    • src/GoAffPro.Client/Generated/GoAffProPublicClient.g.cs

Do not edit *.g.cs manually.

Testing

dotnet test

Integration Tests

$env:GOAFFPRO_TEST_TOKEN="your-token"
dotnet test --filter "Category=Integration"

Contract Snapshot Test

The test suite validates generated client method signatures against:

  • tests/GoAffPro.Client.Tests/Snapshots/GeneratedClientSignatures.snapshot

If generated signatures change, update the snapshot intentionally in the same change.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0-dev2 0 2/25/2026
0.3.0-dev1 0 2/25/2026
0.2.1-dev1 41 2/22/2026
0.2.0 45 2/18/2026