diff --git a/README.md b/README.md index e1775e5..01d2d66 100644 --- a/README.md +++ b/README.md @@ -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:`, `purchase.item:`) so +quest configs and client code agree on it. + ## Sessions Every API call goes through the client's session pipeline: a 401 triggers a diff --git a/Services/QuestMetrics.cs b/Services/QuestMetrics.cs new file mode 100644 index 0000000..c30ade5 --- /dev/null +++ b/Services/QuestMetrics.cs @@ -0,0 +1,16 @@ +namespace RudderSdk.Core; + +/// +/// 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 +/// . +/// +public static class QuestMetrics +{ + /// Metric for purchasing a store offer; auto-reported on purchase. + public static string PurchaseOffer(string offerId) => $"purchase.offer:{offerId}"; + + /// Metric for purchasing a catalog item; auto-reported on purchase. + public static string PurchaseItem(string itemId) => $"purchase.item:{itemId}"; +}