Beamable SDK
Public Member Functions | Static Public Attributes | Protected Member Functions | Properties | List of all members
Beamable.Common.Api.Inventory.AbsInventoryApi Class Referenceabstract

This type defines the Client main entry point for the Inventory feature. More...

Inheritance diagram for Beamable.Common.Api.Inventory.AbsInventoryApi:
Inheritance graph
[legend]
Collaboration diagram for Beamable.Common.Api.Inventory.AbsInventoryApi:
Collaboration graph
[legend]

Public Member Functions

 AbsInventoryApi (IBeamableRequester requester, IUserContext userContext)
 
Promise< PreviewCurrencyGainResponsePreviewCurrencyGain (Dictionary< string, long > currencyIdsToAmount)
 Players may sometimes receive additional currency as a result of qualifying for a VIP Tier This API previews what that amount of currency would be ahead of an update. More...
 
Promise< GetMultipliersResponseGetMultipliers ()
 Provides the VIP Bonus multipliers that are applicable for this player according to their tier. More...
 
Promise< long > GetCurrency (CurrencyRef currency)
 Gets the currency. More...
 
Promise< UnitAddItem (ItemRef itemRef, Dictionary< string, string > properties=null, string transaction=null)
 Add an instance of the given itemRef to the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitAddItem (string contentId, Dictionary< string, string > properties=null, string transaction=null)
 Add an item instance of the given contentId to the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitDeleteItem (string contentId, long itemId, string transaction=null)
 Remove an item instance from the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitUpdateItem (ItemRef itemRef, long itemId, Dictionary< string, string > properties, string transaction=null)
 Update the instance level item properties of an item in the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitUpdateItem (string contentId, long itemId, Dictionary< string, string > properties, string transaction=null)
 Update the instance level item properties of an item in the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitSetCurrency (CurrencyRef currency, long amount, string transaction=null)
 Sets the currency. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitSetCurrencyProperties (string currencyId, List< CurrencyProperty > properties, string transaction=null)
 Set the CurrencyProperty values for a player's currency More...
 
Promise< UnitSetCurrencyProperties (CurrencyRef currency, List< CurrencyProperty > properties, string transaction=null)
 Set the CurrencyProperty values for a player's currency More...
 
Promise< UnitAddCurrency (string currencyId, long amount, string transaction=null)
 Adds the currency If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitAddCurrency (CurrencyRef currency, long amount, string transaction=null)
 Adds the currency If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitSetCurrencies (Dictionary< CurrencyRef, long > currencyToAmount, string transaction=null)
 Set multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitAddCurrencies (Dictionary< string, long > currencyIdsToAmount, string transaction=null)
 Add multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitAddCurrencies (Dictionary< CurrencyRef, long > currencyToAmount, string transaction=null)
 Add multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitSetCurrency (string currencyId, long amount, string transaction=null)
 Sets the currency. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< UnitSetCurrencies (Dictionary< string, long > currencyIdsToAmount, string transaction=null)
 Set multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method. More...
 
Promise< Dictionary< string, long > > GetCurrencies (string[] currencyIds)
 Get a set of currency values for the current player. More...
 
Promise< Dictionary< CurrencyRef, long > > GetCurrencies (CurrencyRef[] currencyRefs)
 Get a set of currency values for the current player. More...
 
Promise< long > GetCurrency (string currencyId)
 Gets the currency. More...
 
Promise< UnitUpdate (Action< InventoryUpdateBuilder > action, string transaction=null)
 
Promise< UnitUpdate (InventoryUpdateBuilder builder, string transaction=null)
 Perform multiple updates to the player's inventory in one network call. The InventoryUpdateBuilder that you pass to this method will be converted into one update call to Beamable. More...
 
Promise< List< InventoryObject< TContent > > > ViewToItems< TContent > (InventoryView view, IEnumerable< string > filter=null)
 
Promise< List< InventoryObject< TContent > > > GetItems< TContent > ()
 Get every InventoryObject<TContent> that is of a specific item content type. More...
 
Promise< List< InventoryObject< TContent > > > GetItems< TContent > (params ItemRef< TContent >[] itemReferences)
 Get the InventoryObject<TContent> that are of a specific item content type and match the given itemReferences More...
 
void GetLatestItems (ItemRef itemRef)
 
abstract Promise< InventoryViewGetCurrent (string scope="")
 Get the current data from the given scope. More...
 
- Public Member Functions inherited from Beamable.Common.Api.ISupportsGet< InventoryView >
Promise< TData > GetCurrent (string scope="")
 Manually fetch the available data. If the server hasn't delivered a new update, this method will not return the absolute latest data unless you pass forceRefresh as true. More...
 

Static Public Attributes

const string SERVICE_OBJECT = "object/inventory"
 

Protected Member Functions

string CreateRefreshUrl (string scope)
 

Properties

IBeamableRequester Requester [get]
 
IUserContext UserContext [get]
 

Detailed Description

This type defines the Client main entry point for the Inventory feature.

Related Links

img beamable-logo

Member Function Documentation

◆ AddCurrencies() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddCurrencies ( Dictionary< CurrencyRef, long >  currencyToAmount,
string  transaction = null 
)
inline

Add multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyToAmountA dictionary where the keys are CurrencyRefs, and the values are the new currency values for the player
transactionAn inventory transaction ID. Leave this argument empty.
Returns
A Promise<T> representing the network call.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ AddCurrencies() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddCurrencies ( Dictionary< string, long >  currencyIdsToAmount,
string  transaction = null 
)
inline

Add multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyIdsToAmountA dictionary where the keys are content IDs of the currency, and the values are the new currency values for the player
transactionAn inventory transaction ID. Leave this argument empty.
Returns
A Promise<T> representing the network call.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ AddCurrency() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddCurrency ( CurrencyRef  currency,
long  amount,
string  transaction = null 
)
inline

Adds the currency If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currency
amount
transaction
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ AddCurrency() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddCurrency ( string  currencyId,
long  amount,
string  transaction = null 
)
inline

Adds the currency If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyId
amount
transaction
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ AddItem() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddItem ( ItemRef  itemRef,
Dictionary< string, string >  properties = null,
string  transaction = null 
)

Add an instance of the given itemRef to the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
itemRefA ItemRef
propertiesa set of instance properties for the new item
transactionAn inventory transaction id
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ AddItem() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.AddItem ( string  contentId,
Dictionary< string, string >  properties = null,
string  transaction = null 
)
inline

Add an item instance of the given contentId to the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
contentIdA content ID of the item type
propertiesa set of instance properties for the new item
transactionAn inventory transaction ID. Leave this argument empty.
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ DeleteItem()

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.DeleteItem ( string  contentId,
long  itemId,
string  transaction = null 
)
inline

Remove an item instance from the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
contentIdThe content ID of the type of item to remove
itemIdThe runtime ID of the item to remove
transactionan inventory transaction ID
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ GetCurrencies() [1/2]

Promise< Dictionary< CurrencyRef, long > > Beamable.Common.Api.Inventory.AbsInventoryApi.GetCurrencies ( CurrencyRef[]  currencyRefs)
inline

Get a set of currency values for the current player.

Parameters
currencyRefsCurrencyRefs for the currencies that will be returned
Returns
A Promise<T> containing a dictionary where the keys are CurrencyRefs and the values are the player currency values.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ GetCurrencies() [2/2]

Promise< Dictionary< string, long > > Beamable.Common.Api.Inventory.AbsInventoryApi.GetCurrencies ( string[]  currencyIds)
inline

Get a set of currency values for the current player.

Parameters
currencyIdsthe content IDs for the currencies that will be returned
Returns
A Promise<T> containing a dictionary where the keys are content IDs and the values are the player currency values.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ GetCurrency() [1/2]

Promise< long > Beamable.Common.Api.Inventory.AbsInventoryApi.GetCurrency ( CurrencyRef  currency)
inline

Gets the currency.

Parameters
currencyA CurrencyRef
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ GetCurrency() [2/2]

Promise< long > Beamable.Common.Api.Inventory.AbsInventoryApi.GetCurrency ( string  currencyId)
inline

Gets the currency.

Parameters
currencyId
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ GetCurrent()

abstract Promise< InventoryView > Beamable.Common.Api.Inventory.AbsInventoryApi.GetCurrent ( string  scope = "")
pure virtual

Get the current data from the given scope.

Parameters
scope
Returns

Implemented in Beamable.Api.Inventory.InventoryService.

◆ GetItems< TContent >() [1/2]

Promise< List< InventoryObject< TContent > > > Beamable.Common.Api.Inventory.AbsInventoryApi.GetItems< TContent > ( )
inline

Get every InventoryObject<TContent> that is of a specific item content type.

Template Parameters
TContentThe type of content to retrieve. All children types will be included the result.
Returns
A Promise containing the InventoryObject<TContent> that matches the given item type

Implements Beamable.Common.Api.Inventory.IInventoryApi.

Type Constraints
TContent :ItemContent 
TContent :new() 

◆ GetItems< TContent >() [2/2]

Promise< List< InventoryObject< TContent > > > Beamable.Common.Api.Inventory.AbsInventoryApi.GetItems< TContent > ( params ItemRef< TContent >[]  itemReferences)
inline

Get the InventoryObject<TContent> that are of a specific item content type and match the given itemReferences

Parameters
itemReferencesFilter for only the items that match the given ItemRef<TContent> types.
Template Parameters
TContentThe type of content to retrieve. All children types will be included the result.
Returns
A Promise containing the InventoryObject<TContent> that match the given item type

Implements Beamable.Common.Api.Inventory.IInventoryApi.

Type Constraints
TContent :ItemContent 
TContent :new() 

◆ GetMultipliers()

Promise< GetMultipliersResponse > Beamable.Common.Api.Inventory.AbsInventoryApi.GetMultipliers ( )
inline

Provides the VIP Bonus multipliers that are applicable for this player according to their tier.

Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ PreviewCurrencyGain()

Promise< PreviewCurrencyGainResponse > Beamable.Common.Api.Inventory.AbsInventoryApi.PreviewCurrencyGain ( Dictionary< string, long >  currencyIdsToAmount)
inline

Players may sometimes receive additional currency as a result of qualifying for a VIP Tier This API previews what that amount of currency would be ahead of an update.

Parameters
currencyIdsToAmount
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrencies() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrencies ( Dictionary< CurrencyRef, long >  currencyToAmount,
string  transaction = null 
)
inline

Set multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyToAmountA dictionary where the keys are CurrencyRefs, and the values are the new currency values for the player
transactionAn inventory transaction ID. Leave this argument empty.
Returns
A Promise<T> representing the network call.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrencies() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrencies ( Dictionary< string, long >  currencyIdsToAmount,
string  transaction = null 
)
inline

Set multiple currency values. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyIdsToAmountA dictionary where the keys are content IDs of the currency, and the values are the new currency values for the player
transactionAn inventory transaction ID. Leave this argument empty.
Returns
A Promise<T> representing the network call.

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrency() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrency ( CurrencyRef  currency,
long  amount,
string  transaction = null 
)
inline

Sets the currency. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currency
amount
transaction
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrency() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrency ( string  currencyId,
long  amount,
string  transaction = null 
)
inline

Sets the currency. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
currencyId
amount
transaction
Returns

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrencyProperties() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrencyProperties ( CurrencyRef  currency,
List< CurrencyProperty properties,
string  transaction = null 
)
inline

Set the CurrencyProperty values for a player's currency

Parameters
currencyA CurrencyRef
propertiesA list of CurrencyProperty values
transactionAn inventory transaction id
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ SetCurrencyProperties() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.SetCurrencyProperties ( string  currencyId,
List< CurrencyProperty properties,
string  transaction = null 
)
inline

Set the CurrencyProperty values for a player's currency

Parameters
currencyIdThe content id of the currency
propertiesA list of CurrencyProperty values
transactionAn inventory transaction id.
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ Update() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.Update ( Action< InventoryUpdateBuilder action,
string  transaction = null 
)
inline

Parameters
actionA configurator for the InventoryUpdateBuilder. You should configure the builder with all of the inventory updates. If you already have an instance of the builder, use the Update(InventoryUpdateBuilder,string) method instead.
transactionan inventory transaction ID
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ Update() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.Update ( InventoryUpdateBuilder  builder,
string  transaction = null 
)
inline

Perform multiple updates to the player's inventory in one network call. The InventoryUpdateBuilder that you pass to this method will be converted into one update call to Beamable.

Parameters
builderAn InventoryUpdateBuilder containing all of the inventory updates. Use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method to configure an InventoryUpdateBuilder instead.
transactionan inventory transaction ID
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ UpdateItem() [1/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.UpdateItem ( ItemRef  itemRef,
long  itemId,
Dictionary< string, string >  properties,
string  transaction = null 
)

Update the instance level item properties of an item in the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
itemRefAn ItemRef pointing to the content type of the item to update.
itemIdThe runtime ID of the item to remove
propertiesA new set of instance property values for the item. This will overwrite the existing properties.
transactionan inventory transaction ID
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ UpdateItem() [2/2]

Promise< Unit > Beamable.Common.Api.Inventory.AbsInventoryApi.UpdateItem ( string  contentId,
long  itemId,
Dictionary< string, string >  properties,
string  transaction = null 
)
inline

Update the instance level item properties of an item in the player's inventory. If you need to make multiple inventory updates, use the Update(System.Action<Beamable.Common.Api.Inventory.InventoryUpdateBuilder>,string) method.

Parameters
contentIdA content ID pointing to the content type of the item to update.
itemIdThe runtime ID of the item to remove
propertiesA new set of instance property values for the item. This will overwrite the existing properties.
transactionan inventory transaction ID
Returns
A Promise<T> representing the network call

Implements Beamable.Common.Api.Inventory.IInventoryApi.

◆ ViewToItems< TContent >()

Promise< List< InventoryObject< TContent > > > Beamable.Common.Api.Inventory.AbsInventoryApi.ViewToItems< TContent > ( InventoryView  view,
IEnumerable< string >  filter = null 
)
inline
Type Constraints
TContent :ItemContent 
TContent :new() 

The documentation for this class was generated from the following file: