quests: ReportProgressAsync + generated DTOs

This commit is contained in:
edmand46
2026-08-13 12:10:09 +03:00
parent 91c3d46ceb
commit 9d8fb29a7c
3 changed files with 41 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Code generated by apigen. DO NOT EDIT.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
namespace RudderSdk.Core.Models.Quests;
public class ReportQuestProgressRequest
{
[JsonProperty("amount")]
public long Amount { get; set; }
[JsonProperty("metric")]
public string Metric { get; set; }
}
+13
View File
@@ -0,0 +1,13 @@
// Code generated by apigen. DO NOT EDIT.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
namespace RudderSdk.Core.Models.Quests;
public class ReportQuestProgressResponse
{
[JsonProperty("completedQuestIds")]
public List<string> CompletedQuestIds { get; set; }
}
+12
View File
@@ -34,4 +34,16 @@ public sealed class QuestsService
"/sdk/v1/quests/claim", "/sdk/v1/quests/claim",
new ClaimQuestRequest { QuestId = questId }, new ClaimQuestRequest { QuestId = questId },
cancellationToken); cancellationToken);
/// <summary>Reports progress for a metric and returns the ids of quests completed by this report.</summary>
public async Task<IReadOnlyList<string>> ReportProgressAsync(string metric, long amount, CancellationToken cancellationToken = default)
{
var response = await _client.SendAsync<ReportQuestProgressRequest, ReportQuestProgressResponse>(
"POST",
"/sdk/v1/quests/progress",
new ReportQuestProgressRequest { Metric = metric, Amount = amount },
cancellationToken).ConfigureAwait(false);
return response?.CompletedQuestIds ?? new List<string>();
}
} }