Class UserInventory

Inventory client wrapper for the Client that provides functions to access user inventory.

Inheritance

System.Object
UserInventory

Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: STREAMSIX.Client
Assembly: cs.temp.dll.dll

Syntax

public class UserInventory

Constructors

UserInventory(S6Environment, String, UserManager)

Declaration

public UserInventory(S6Environment env, string license, UserManager userManager)

Parameters

TypeNameDescription
S6Environmentenv
System.Stringlicense
UserManageruserManager

Properties

Client

Declaration

public InventoryClient Client { get; }

Property Value

TypeDescription
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

TypeNameDescription
System.StringuserID

User whose inventory to query

System.StringitemType
System.StringitemID
System.StringtransacID
System.StringitemIndex
System.BooleanisExact

Returns

TypeDescription
System.Threading.Tasks.Task<List<InventoryDef>>

List of inventory

Exceptions

TypeCondition
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

TypeNameDescription
System.StringuserID

User whose inventory to query

System.StringitemType
Dictionary<System.String, System.Object>itemProp

Returns

TypeDescription
System.Threading.Tasks.Task<List<InventoryDef>>

List of inventory

Exceptions

TypeCondition
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

TypeNameDescription
System.StringuserID
System.Int64start
System.Int64end

Returns

TypeDescription
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

TypeCondition
GetRecordException

Purchase(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 receipt)

Parameters

TypeNameDescription
System.StringuserID

User to receive the item

System.StringproductID

Product defined in Inventory Service

System.Stringreceipt

Receipt string from Unity IAP

Returns

TypeDescription
System.Threading.Tasks.Task<PurchaseRecordDef>

List of records of the changes made by the purchase operation

Exceptions

TypeCondition
PurchaseException