v3.1.2
2020.3+

Interface IEconomyConfigurationApiClient

This class allows you to retrieve items from the global economy configuration as it is set up in the Unity Dashboard.

Namespace: Unity.Services.Economy
Syntax
public interface IEconomyConfigurationApiClient

Methods

GetConfigAssignmentHash()

Returns the cached config assignment hash.

Declaration
string GetConfigAssignmentHash()
Returns
TypeDescription
String

A config assignment hash or null if Economy doesn't have one

GetCurrencies()

Gets the currencies from the cached configuration.

Declaration
List<CurrencyDefinition> GetCurrencies()
Returns
TypeDescription
List<CurrencyDefinition>

A list of CurrencyDefinition

Exceptions
TypeCondition
EconomyException

GetCurrenciesAsync()

Gets the Currencies that have been configured and published in the Unity Dashboard.

Declaration
[Obsolete("GetCurrenciesAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetCurrencies method. This API will be removed in an upcoming release.", false)]
Task<List<CurrencyDefinition>> GetCurrenciesAsync()
Returns
TypeDescription
Task<List<CurrencyDefinition>>

A list of CurrencyDefinition

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetCurrency(String)

Gets a specific currency from the cached config.

Declaration
CurrencyDefinition GetCurrency(string id)
Parameters
TypeNameDescription
Stringid

The ID of the currency to fetch.

Returns
TypeDescription
CurrencyDefinition

A CurrencyDefinition or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetCurrencyAsync(String)

Gets a Currency Definition for a specific currency.

Declaration
[Obsolete("GetCurrencyAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetCurrency method. This API will be removed in an upcoming release.", false)]
Task<CurrencyDefinition> GetCurrencyAsync(string id)
Parameters
TypeNameDescription
Stringid

The configuration ID of the currency to fetch.

Returns
TypeDescription
Task<CurrencyDefinition>

A CurrencyDefinition for the specified currency, or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetInventoryItem(String)

Gets a specific inventory item from the cached config.

Declaration
InventoryItemDefinition GetInventoryItem(string id)
Parameters
TypeNameDescription
Stringid

The ID of the inventory item to fetch.

Returns
TypeDescription
InventoryItemDefinition

A InventoryItemDefinition or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetInventoryItemAsync(String)

Gets a InventoryItemDefinition for a specific currency.

Declaration
[Obsolete("GetInventoryItemAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetInventoryItem method. This API will be removed in an upcoming release.", false)]
Task<InventoryItemDefinition> GetInventoryItemAsync(string id)
Parameters
TypeNameDescription
Stringid

The configuration ID of the item to fetch.

Returns
TypeDescription
Task<InventoryItemDefinition>

A InventoryItemDefinition for the specified currency, or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetInventoryItems()

Gets the inventory items from the cached configuration.

Declaration
List<InventoryItemDefinition> GetInventoryItems()
Returns
TypeDescription
List<InventoryItemDefinition>

A list of InventoryItemDefinition

Exceptions
TypeCondition
EconomyException

GetInventoryItemsAsync()

Gets the Inventory Items that have been configured and published in the Unity Dashboard.

Declaration
[Obsolete("GetInventoryItemsAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetInventoryItems method. This API will be removed in an upcoming release.", false)]
Task<List<InventoryItemDefinition>> GetInventoryItemsAsync()
Returns
TypeDescription
Task<List<InventoryItemDefinition>>

A list of InventoryItemDefinition

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetRealMoneyPurchase(String)

Gets a specific real money purchase from the cached config.

Declaration
RealMoneyPurchaseDefinition GetRealMoneyPurchase(string id)
Parameters
TypeNameDescription
Stringid

The ID of the real money purchase to fetch.

Returns
TypeDescription
RealMoneyPurchaseDefinition

A RealMoneyPurchaseDefinition or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetRealMoneyPurchaseAsync(String)

Gets a RealMoneyPurchaseDefinition for a specific real money purchase.

Declaration
[Obsolete("GetRealMoneyPurchaseAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetRealMoneyPurchase method. This API will be removed in an upcoming release.", false)]
Task<RealMoneyPurchaseDefinition> GetRealMoneyPurchaseAsync(string id)
Parameters
TypeNameDescription
Stringid

The ID of the purchase to retrieve

Returns
TypeDescription
Task<RealMoneyPurchaseDefinition>

A RealMoneyPurchaseDefinition for the specified purchase if it exists, or null otherwise.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetRealMoneyPurchases()

Gets the real money purchases from the cached configuration.

Declaration
List<RealMoneyPurchaseDefinition> GetRealMoneyPurchases()
Returns
TypeDescription
List<RealMoneyPurchaseDefinition>

A list of RealMoneyPurchaseDefinition

Exceptions
TypeCondition
EconomyException

GetRealMoneyPurchasesAsync()

Gets all the real money purchases currently configured and published in the Economy Dashboard.

Declaration
[Obsolete("GetRealMoneyPurchasesAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetRealMoneyPurchases method. This API will be removed in an upcoming release.", false)]
Task<List<RealMoneyPurchaseDefinition>> GetRealMoneyPurchasesAsync()
Returns
TypeDescription
Task<List<RealMoneyPurchaseDefinition>>

A list of RealMoneyPurchaseDefinition

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetVirtualPurchase(String)

Gets a specific virtual purchase from the cached config.

Declaration
VirtualPurchaseDefinition GetVirtualPurchase(string id)
Parameters
TypeNameDescription
Stringid

The ID of the virtual purchase to fetch.

Returns
TypeDescription
VirtualPurchaseDefinition

A VirtualPurchaseDefinition or null if the currency doesn't exist.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetVirtualPurchaseAsync(String)

Gets a VirtualPurchaseDefinition for a specific virtual purchase.

Note that this will also fetch the associated Inventory Items/Currencies associated with this purchase.

Declaration
[Obsolete("GetVirtualPurchaseAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetVirtualPurchase method. This API will be removed in an upcoming release.", false)]
Task<VirtualPurchaseDefinition> GetVirtualPurchaseAsync(string id)
Parameters
TypeNameDescription
Stringid

The ID of the purchase to retrieve

Returns
TypeDescription
Task<VirtualPurchaseDefinition>

A VirtualPurchaseDefinition for the specified purchase if it exists, or null otherwise.

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

GetVirtualPurchases()

Gets the virtual purchases from the cached configuration.

Declaration
List<VirtualPurchaseDefinition> GetVirtualPurchases()
Returns
TypeDescription
List<VirtualPurchaseDefinition>

A list of VirtualPurchaseDefinition

Exceptions
TypeCondition
EconomyException

GetVirtualPurchasesAsync()

Gets all the virtual purchases currently configured and published in the Economy Dashboard.

Note that this will also fetch all associated Inventory Items/Currencies associated with the purchase.

Declaration
[Obsolete("GetVirtualPurchasesAsync has been replaced by first caching your configuration using SyncConfigurationAsync and then using the GetVirtualPurchases method. This API will be removed in an upcoming release.", false)]
Task<List<VirtualPurchaseDefinition>> GetVirtualPurchasesAsync()
Returns
TypeDescription
Task<List<VirtualPurchaseDefinition>>

A list of VirtualPurchaseDefinition

Exceptions
TypeCondition
EconomyException

Thrown if request is unsuccessful

SyncConfigurationAsync()

Gets the currently published Economy configuration and caches it.

Declaration
Task<List<ConfigurationItemDefinition>> SyncConfigurationAsync()
Returns
TypeDescription
Task<List<ConfigurationItemDefinition>>

A list of ConfigurationItemDefinition

Exceptions
TypeCondition
EconomyException