ea20ea6d51
LeaderboardSession.ClaimAsync sends onClaim. Generated DTOs live under Models/ with nullable wire fields. Remove incomplete duplicate type files.
2.8 KiB
2.8 KiB
Stores — client.Stores (StoresService)
Source: Services/StoresService.cs, Stores/*.cs (generated DTOs).
In-game stores with offers priced in wallet currencies. Purchasing charges the player's wallet and grants the offer contents.
Methods
// GET /sdk/v1/stores
public Task<IReadOnlyList<Store>> ListAsync(CancellationToken cancellationToken = default);
// GET /sdk/v1/stores/{slug}
public Task<Store> GetAsync(string slug, CancellationToken cancellationToken = default);
// POST /sdk/v1/stores/{storeSlug}/offers/{offerId}/purchase
// When idempotencyKey is null a random GUID is generated; pass a stable key to
// make retries safe.
public Task<PurchaseOfferResponse> PurchaseAsync(
string storeSlug, string offerId, string? idempotencyKey = null,
CancellationToken cancellationToken = default);
Models (RudderSdk.Core.Models.Stores)
public class Store
{
public string? Id { get; set; } // "id"
public string? Slug { get; set; } // "slug"
public string? Name { get; set; } // "name"
public string? Description { get; set; } // "description"
public string? Status { get; set; } // "status"
public string? Environment { get; set; } // "environment"
public string? ProjectId { get; set; } // "projectId"
public string? ScenarioId { get; set; } // "scenarioId"
public JToken? Data { get; set; } // "data" — free-form
public List<Offer>? Offers { get; set; } // "offers"
public DateTimeOffset? CreatedAt { get; set; } // "createdAt"
public DateTimeOffset? UpdatedAt { get; set; } // "updatedAt"
}
public class Offer
{
public string? Id { get; set; } // "id"
public string? Name { get; set; } // "name"
public OfferPrice? Price { get; set; } // "price"
public List<OfferContent>? Contents { get; set; }// "contents"
public int? MaxPurchases { get; set; } // "maxPurchases"
public DateTimeOffset? CreatedAt { get; set; } // "createdAt"
public DateTimeOffset? UpdatedAt { get; set; } // "updatedAt"
}
public class OfferPrice { public long? Amount { get; set; } public string? Currency { get; set; } }
public class OfferContent { public long? Amount { get; set; } public string? ItemId { get; set; } }
public class PurchaseOfferResponse
{
public string? Error { get; set; } // "error"
public string? PurchaseId { get; set; } // "purchaseId"
public bool? Success { get; set; } // "success"
}
PurchaseOfferResponse.Error carries a business error string when
Success is false — check the flag instead of relying on exceptions alone.
Purchases also auto-report quest metrics (purchase.offer:{offerId}) — see
quests.md.