quests: ReportProgressAsync + generated DTOs
This commit is contained in:
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -34,4 +34,16 @@ public sealed class QuestsService
|
||||
"/sdk/v1/quests/claim",
|
||||
new ClaimQuestRequest { QuestId = questId },
|
||||
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>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user