Skip to content

Commit c8114d4

Browse files
committed
chore(repo): general cleanup
- update framework targets - update readme
1 parent 9616526 commit c8114d4

3 files changed

Lines changed: 25 additions & 10 deletions

File tree

README.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Async-first .NET client for the GoAffPro API with build-time NSwag generation an
55
## Targets
66

77
- `net8.0`
8-
- `net10.0`
8+
- `net10.0` (working on native-AOT compatibility)
99

1010
## Install
1111

@@ -35,18 +35,28 @@ await using var loggedInClient = await GoAffProClient.CreateLoggedInAsync(
3535
The wrapper methods are built on top of generated clients:
3636

3737
```csharp
38-
var orders = await client.GetOrdersAsync(limit: 50);
39-
var affiliates = await client.GetAffiliatesAsync(limit: 50);
38+
// Fetch orders with optional time filtering
39+
var orders = await client.GetOrdersAsync(from: DateTimeOffset.UtcNow.AddDays(-1), limit: 50);
40+
41+
// Fetch affiliates with time range
42+
var affiliates = await client.GetAffiliatesAsync(from: startDate, toDate: endDate, limit: 50);
43+
44+
// Fetch payouts and products
45+
var payouts = await client.GetPayoutsAsync(limit: 50);
46+
var products = await client.GetProductsAsync(limit: 50);
4047
```
4148

4249
Wrapper methods return typed models:
43-
- `GoAffProOrder`
44-
- `GoAffProAffiliate`
45-
- `GoAffProReward`
50+
51+
- `GoAffProOrder` (includes Subtotal, AffiliateId, Status)
52+
- `GoAffProAffiliate` (includes FirstName, LastName, Phone, Country, GroupId)
53+
- `GoAffProReward` (includes AffiliateId, Type, Metadata, Level, Status) - currently disabled
54+
- `GoAffProPayout`
55+
- `GoAffProProduct`
4656

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

49-
`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.
59+
`GetRewardsAsync` is currently disabled because `/user/feed/rewards` is returning `404` (observed on 2026-02-18). The method is marked `[Obsolete]` and returns an empty collection.
5060

5161
### Access Generated Clients Directly
5262

@@ -67,7 +77,7 @@ var publicSites = await client.PublicApi.PublicSitesAsync(
6777

6878
## Event Detection
6979

70-
`GoAffProEventDetector` supports both async streams and classic `.NET` events.
80+
`GoAffProEventDetector` supports both async streams and classic `.NET` events. It uses time-based filtering to fetch only new items since the last poll.
7181

7282
### Async Streams
7383

@@ -76,6 +86,9 @@ using GoAffPro.Client.Events;
7686

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

89+
// Optional: backfill historical data from a specific time
90+
detector.OrderStartTime = DateTimeOffset.UtcNow.AddDays(-7);
91+
7992
await foreach (var order in detector.NewOrdersAsync(cancellationToken))
8093
{
8194
Console.WriteLine($"New order: {order.Id}");
@@ -95,6 +108,8 @@ detector.AffiliateDetected += (_, args) => Console.WriteLine($"Affiliate: {args.
95108
await detector.StartAsync(cancellationToken);
96109
```
97110

111+
The detector stores the last poll timestamp internally. Use `OrderStartTime` and `AffiliateStartTime` properties to backfill historical data on first run.
112+
98113
## Dependency Injection
99114

100115
```csharp

src/GoAffPro.Client.Generator/GoAffPro.Client.Generator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

src/GoAffPro.Client/GoAffPro.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PackageReadmeFile>README.md</PackageReadmeFile>
1414
<PackageTags>goaffpro;affiliate;marketing;api;client;dotnet</PackageTags>
1515
<NoWarn>$(NoWarn);CS8981;CA1708</NoWarn>
16-
<GoAffProGeneratorTargetFramework>net8.0</GoAffProGeneratorTargetFramework>
16+
<GoAffProGeneratorTargetFramework>net10.0</GoAffProGeneratorTargetFramework>
1717
<GoAffProSwaggerInitPath>$(MSBuildProjectDirectory)\..\..\openapi\swagger-ui-init.js</GoAffProSwaggerInitPath>
1818
</PropertyGroup>
1919

0 commit comments

Comments
 (0)