Class UserInventory
Inventory client wrapper for the BigScreen that provides functions to access user inventory.
Inherited Members
Namespace: STREAMSIX.BigScreen
Assembly: cs.temp.dll.dll
Syntax
public class UserInventory
Constructors
UserInventory(S6Environment, String, UserManager)
Declaration
public UserInventory(S6Environment env, string license, UserManager userManager)
Parameters
Type | Name | Description |
---|---|---|
S6Environment | env | |
System.String | license | |
UserManager | userManager |
Properties
Client
Declaration
public InventoryClient Client { get; }
Property Value
Type | Description |
---|---|
InventoryClient |
Methods
GetInventory(String, String, String, String, String, Boolean)
Return user inventory based on query parameters.
The query filters down the inventory in this order:
item_type
-> item_id
-> transac_id
-> item_index
.
Aggregated items only have item_type
and item_id
.
Non-aggregated items (such as items that will expire) will have transac_id
and item_index
.
Setting isExact
to true will strictly find an inventory item matching the query parameters.
Declaration
public async Task<List<InventoryDef>> GetInventory(string userID, string itemType = "", string itemID = "", string transacID = "", string itemIndex = "", bool isExact = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | User whose inventory to query |
System.String | itemType | |
System.String | itemID | |
System.String | transacID | |
System.String | itemIndex | |
System.Boolean | isExact |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<List<InventoryDef>> | List of inventory |
Exceptions
Type | Condition |
---|---|
GetInventoryException |
GetInventoryByProperty(String, String, Dictionary<String, Object>)
Return user inventory based on item prop.
Use item_type and item_prop together for query.
Items whose ItemProp have all matching key/value pairs are return in the query.
Declaration
public async Task<List<InventoryDef>> GetInventoryByProperty(string userID, string itemType, Dictionary<string, object> itemProp)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | User whose inventory to query |
System.String | itemType | |
Dictionary<System.String, System.Object> | itemProp |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<List<InventoryDef>> | List of inventory |
Exceptions
Type | Condition |
---|---|
GetInventoryException |
GetRecord(String, Int64, Int64)
Return record of changes in user inventory, between start and end unix timestamp.
The returned records include: purchase, consume, refund, share claimed, share revoked, and store notification.
All record types have common fields such as record_time and record_owner but each type also have its own specific fields.
Declaration
public async Task<List<object>> GetRecord(string userID, long start, long end)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | |
System.Int64 | start | |
System.Int64 | end |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<List<System.Object>> | A list of records. Each record can be any of the RecordDef. Use reflection to check the actual type |
Exceptions
Type | Condition |
---|---|
GetRecordException |
Purchase(String, String, String, String)
Process purchase of a product. Consume cost and adds items to user inventory.
For an item to be created, product definition's license must exists in the item definition's creator_license
.
The same also applies to cost of virtual product type where each cost is expected to be an item definition.
Reward product type cannot be process at this endpoint (see POST /reward).
Game owner can call this user endpoint to trigger a purchase for a user.
Declaration
public async Task<PurchaseRecordDef> Purchase(string userID, string productID, string costItemID, string receipt)
Parameters
Type | Name | Description |
---|---|---|
System.String | userID | User to receive the item |
System.String | productID | Product defined in Inventory Service |
System.String | costItemID | Which cost to use for purchase |
System.String | receipt | Receipt string from Unity IAP |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PurchaseRecordDef> | List of records of the changes made by the purchase operation |
Exceptions
Type | Condition |
---|---|
PurchaseException |