Class ProductService
The core API implementation of the Product Service, the main class used to fetch and store products from the Store Service.
Implements
Inherited Members
Namespace: UnityEngine .Purchasing
Assembly: Unity.Purchasing.dll
Syntax
public class ProductService : IProductService
Properties
Amazon
Amazon Specific Product Extensions
Declaration
public IAmazonAppsExtendedProductService? Amazon { get; }
Property Value
Type | Description |
---|---|
IAmazon |
Apple
Apple Specific Product Extensions
Declaration
public IAppleStoreExtendedProductService? Apple { get; }
Property Value
Type | Description |
---|---|
IApple |
Methods
AddProductsFetchFailedAction(Action<ProductFetchFailed>)
Add an action to be called when an attempt to fetch products has failed.
Declaration
public void AddProductsFetchFailedAction(Action<ProductFetchFailed> failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Product |
failedAction | The action to be added to the list of callbacks. |
AddProductsUpdatedAction(Action<List<Product>>)
Add an action to be called when products are successfully fetched.
Declaration
public void AddProductsUpdatedAction(Action<List<Product>> updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<List<Product>> | updatedAction | The action to be added to the list of callbacks. |
FetchProducts(List<ProductDefinition>?, IRetryPolicy?)
Fetches products matching the set of definitions passed as input.
Declaration
public void FetchProducts(List<ProductDefinition>? productDefinitions, IRetryPolicy? retryPolicy)
Parameters
Type | Name | Description |
---|---|---|
List<Product |
productDefinitions | The definitions of the products to be fetched. |
IRetry |
retryPolicy | A custom retry policy that can be used for the fetch products query. If unspecified, an exponential backoff retry policy will be used. |
FetchProductsWithNoRetries(List<ProductDefinition>?)
Fetches products matching the set of definitions passed as input.
Declaration
public void FetchProductsWithNoRetries(List<ProductDefinition>? productDefinitions)
Parameters
Type | Name | Description |
---|---|---|
List<Product |
productDefinitions | The definitions of the products to be fetched. |
GetProducts()
Gets the collection of all products that have been fetched successfully.
Declaration
public ReadOnlyObservableCollection<Product> GetProducts()
Returns
Type | Description |
---|---|
Read |
An observable collection of the products already fetched. |
RemoveProductsFetchFailedAction(Action<ProductFetchFailed>)
Remove an action to be called when an attempt to fetch products has failed.
Declaration
public void RemoveProductsFetchFailedAction(Action<ProductFetchFailed> failedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<Product |
failedAction | The action to be removed from the list of callbacks. |
RemoveProductsUpdatedAction(Action<List<Product>>)
Remove an action to be called when products are successfully fetched.
Declaration
public void RemoveProductsUpdatedAction(Action<List<Product>> updatedAction)
Parameters
Type | Name | Description |
---|---|---|
Action<List<Product>> | updatedAction | The action to be removed from the list of callbacks. |