quests: QuestMetrics helpers, README quests section
CI / check (push) Successful in 53s
CI / publish (push) Has been skipped

This commit is contained in:
edmand46
2026-08-25 16:25:34 +03:00
parent 2a8d5d4f2f
commit d4bbafb314
2 changed files with 41 additions and 1 deletions
+25 -1
View File
@@ -53,7 +53,7 @@ stack.
| `Auth` | `AuthService` | `LoginWithDeviceAsync`, `RefreshAsync`, `Logout`, `AuthStateChanged` |
| `Player` | `PlayerService` | `GetProfileAsync` |
| `BattlePass` | `BattlePassService` | `GetProgressAsync`, `AddXpAsync`, `ClaimRewardAsync`, `PurchasePremiumAsync` |
| `Quests` | `QuestsService` | `ListAsync`, `ClaimAsync` |
| `Quests` | `QuestsService` | `ListAsync`, `ClaimAsync`, `ReportProgressAsync` |
| `Stores` | `StoresService` | `ListAsync`, `GetAsync`, `PurchaseAsync` |
| `Inventory` | `InventoryService` | `GetAsync` |
| `Leaderboards` | `LeaderboardsService` | `FindBySlug(slug)` → handle: `SubmitAsync`, `ListAsync` |
@@ -62,6 +62,30 @@ stack.
| `Storage` | `StorageService` | `GetAsync`, `ListAllAsync`, `SaveAsync`, `DeleteAsync` |
| `Realtime` | `RealtimeService` | `ConnectAsync`, `DisconnectAsync` |
## Quests
`client.Quests` covers the player's global quests — list with per-objective
progress, claim, and metric reports. These are distinct from scenario quest
nodes, which advance through `QuestSession` (`Scenario.OnQuest`).
```csharp
var quests = await client.Quests.ListAsync();
foreach (var quest in quests)
{
if (quest.Status == "completed")
await client.Quests.ClaimAsync(quest.Id);
}
// Custom metrics advance matching objectives server-side; the call returns
// the ids of quests completed by this report.
var completedIds = await client.Quests.ReportProgressAsync("kills", 1);
```
Purchase metrics are reported automatically by store purchases;
`QuestMetrics.PurchaseOffer(offerId)` / `QuestMetrics.PurchaseItem(itemId)`
name the format (`purchase.offer:<offerId>`, `purchase.item:<itemId>`) so
quest configs and client code agree on it.
## Sessions
Every API call goes through the client's session pipeline: a 401 triggers a
+16
View File
@@ -0,0 +1,16 @@
namespace RudderSdk.Core;
/// <summary>
/// Builders for the quest metric strings known to the platform. Purchase
/// metrics are reported automatically by the shop purchase fan-out; any other
/// metric is a custom string reported via
/// <see cref="QuestsService.ReportProgressAsync"/>.
/// </summary>
public static class QuestMetrics
{
/// <summary>Metric for purchasing a store offer; auto-reported on purchase.</summary>
public static string PurchaseOffer(string offerId) => $"purchase.offer:{offerId}";
/// <summary>Metric for purchasing a catalog item; auto-reported on purchase.</summary>
public static string PurchaseItem(string itemId) => $"purchase.item:{itemId}";
}