Skip to content

Commit 8fd565a

Browse files
committed
feat(openapi): updated spec file, corrections & improvement following new spec
- spec update according to [anonymized](#1 (comment)) input from @WolfwithSword. - added comments (still needs proper XML formatting) to the spec and marked required fields as such - added more convenience methods, since the required fields are mostly in query params and required query params can still be nullable according to spec - naming (affiliate events -> traffic events) - resilience policy are now configurable - added static methods for parsing UTC DateTimeOffset and Monetary Values consistently - general cleanup of type naming
1 parent 94a9999 commit 8fd565a

86 files changed

Lines changed: 3064 additions & 1841 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

GoAffPro.Client.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<File Path="Directory.Packages.props" />
66
<File Path="global.json" />
77
<File Path="NuGet.config" />
8+
<File Path="openapi/goaffpro-canonical.yaml" />
89
</Folder>
910
<Folder Name="/src/">
1011
<Project Path="src/GoAffPro.Client.Generated/GoAffPro.Client.Generated.csproj" />

examples/GoAffPro.Client.Example/GoAffPro.Client.Example.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFramework>net10.0</TargetFramework>
65
<ImplicitUsings>enable</ImplicitUsings>
76
<Nullable>enable</Nullable>
87
<EnableNativeAotCompilation>true</EnableNativeAotCompilation>
8+
<PublishSingleFile>true</PublishSingleFile>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
10+
<InvariantGlobalization>true</InvariantGlobalization>
911
</PropertyGroup>
1012

1113
<ItemGroup>
@@ -22,4 +24,7 @@
2224
<PackageReference Include="Spectre.Console" />
2325
</ItemGroup>
2426

27+
<ItemGroup>
28+
<Folder Include="Properties\" />
29+
</ItemGroup>
2530
</Project>

examples/GoAffPro.Client.Example/Program.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ static async Task CallEndpointAsync(GoAffProClient client)
242242
"GET /user/stats/aggregate" => await client.Api.User.Stats.Aggregate.GetAsync(config =>
243243
{
244244
config.QueryParameters.SiteIds = siteIds;
245-
config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime;
246-
config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime;
245+
config.QueryParameters.StartTime = DateTimeOffset.Parse(AskOptional("start_time (ISO8601, optional)") ?? startTime, CultureInfo.InvariantCulture);
246+
config.QueryParameters.EndTime = DateTimeOffset.Parse(AskOptional("end_time (ISO8601, optional)") ?? endTime, CultureInfo.InvariantCulture);
247247
config.QueryParameters.FieldsAsGetFieldsQueryParameterType =
248248
[
249249
AggregateField.Total_sales,
@@ -258,24 +258,24 @@ static async Task CallEndpointAsync(GoAffProClient client)
258258
config.QueryParameters.Limit = limit;
259259
config.QueryParameters.Offset = offset;
260260
config.QueryParameters.SiteIds = siteIds;
261-
config.QueryParameters.CreatedAtMin = AskOptional("created_at_min (ISO8601, optional)") ?? startTime;
262-
config.QueryParameters.CreatedAtMax = AskOptional("created_at_max (ISO8601, optional)") ?? endTime;
261+
config.QueryParameters.CreatedAtMin = DateTimeOffset.Parse(AskOptional("created_at_min (ISO8601, optional)") ?? startTime, CultureInfo.InvariantCulture);
262+
config.QueryParameters.CreatedAtMax = DateTimeOffset.Parse(AskOptional("created_at_max (ISO8601, optional)") ?? endTime, CultureInfo.InvariantCulture);
263263
}).ConfigureAwait(false),
264264
"GET /user/feed/traffic" => await client.Api.User.Feed.Traffic.GetAsync(config =>
265265
{
266266
config.QueryParameters.Limit = limit;
267267
config.QueryParameters.Offset = offset;
268268
config.QueryParameters.SiteIds = siteIds;
269-
config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime;
270-
config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime;
269+
config.QueryParameters.StartTime = DateTimeOffset.Parse(AskOptional("start_time (ISO8601, optional)") ?? startTime, CultureInfo.InvariantCulture);
270+
config.QueryParameters.EndTime = DateTimeOffset.Parse(AskOptional("end_time (ISO8601, optional)") ?? endTime, CultureInfo.InvariantCulture);
271271
}).ConfigureAwait(false),
272272
"GET /user/feed/payouts" => await client.Api.User.Feed.Payouts.GetAsync(config =>
273273
{
274274
config.QueryParameters.Limit = limit;
275275
config.QueryParameters.Offset = offset;
276276
config.QueryParameters.SiteIds = siteIds;
277-
config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime;
278-
config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime;
277+
config.QueryParameters.StartTime = DateTimeOffset.Parse(AskOptional("start_time (ISO8601, optional)") ?? startTime, CultureInfo.InvariantCulture);
278+
config.QueryParameters.EndTime = DateTimeOffset.Parse(AskOptional("end_time (ISO8601, optional)") ?? endTime, CultureInfo.InvariantCulture);
279279
}).ConfigureAwait(false),
280280
"GET /user/feed/products" => await client.Api.User.Feed.Products.GetAsync(config =>
281281
{
@@ -287,8 +287,8 @@ static async Task CallEndpointAsync(GoAffProClient client)
287287
config.QueryParameters.Limit = limit;
288288
config.QueryParameters.Offset = offset;
289289
config.QueryParameters.SiteIds = siteIds;
290-
config.QueryParameters.StartTime = AskOptional("start_time (ISO8601, optional)") ?? startTime;
291-
config.QueryParameters.EndTime = AskOptional("end_time (ISO8601, optional)") ?? endTime;
290+
config.QueryParameters.StartTime = DateTimeOffset.Parse(AskOptional("start_time (ISO8601, optional)") ?? startTime, CultureInfo.InvariantCulture);
291+
config.QueryParameters.EndTime = DateTimeOffset.Parse(AskOptional("end_time (ISO8601, optional)") ?? endTime, CultureInfo.InvariantCulture);
292292
}).ConfigureAwait(false),
293293
"GET /user/feed/transactions" => await client.Api.User.Feed.Transactions.GetAsync(config =>
294294
{
@@ -474,8 +474,8 @@ public Task StartAsync()
474474

475475
client.OrderDetected += (_, args) =>
476476
WriteLiveEvent("order", args.Order.Id?.String ?? args.Order.OrderId?.String ?? "<unknown>");
477-
client.AffiliateDetected += (_, args) =>
478-
WriteLiveEvent("affiliate", args.Affiliate.AffiliateId?.String ?? args.Affiliate.Id?.String ?? args.Affiliate.CustomerId?.String ?? "<unknown>");
477+
client.TrafficDetected += (_, args) =>
478+
WriteLiveEvent("traffic", args.Traffic.AffiliateId?.String ?? args.Traffic.Id?.String ?? args.Traffic.CustomerId?.String ?? "<unknown>");
479479
client.PayoutDetected += (_, args) =>
480480
WriteLiveEvent("payout", args.Payout.Id?.String ?? args.Payout.PayoutId?.String ?? "<unknown>");
481481

@@ -572,8 +572,8 @@ public static async Task<ApiSweepReport> RunAllAsync(
572572
TimeSpan productTimeout,
573573
CancellationToken cancellationToken)
574574
{
575-
string startTime = DateTimeOffset.UtcNow.AddDays(-1).ToString("o", CultureInfo.InvariantCulture);
576-
string endTime = DateTimeOffset.UtcNow.ToString("o", CultureInfo.InvariantCulture);
575+
DateTimeOffset startTime = DateTimeOffset.UtcNow.AddDays(-1);
576+
DateTimeOffset endTime = DateTimeOffset.UtcNow;
577577
var results = new List<ApiEndpointResult>();
578578

579579
await RunEndpointAsync(results, "GET /user", () => client.Api.User.GetAsync(cancellationToken: cancellationToken)).ConfigureAwait(false);

0 commit comments

Comments
 (0)