Description
The Interaction
property of the Package
class provides information about the authenticated user's interactions with a specific package. This property is only available client-side for certain users, allowing them to view details such as play history, favorite status, and whether they have rated the item. This information is crucial for personalizing user experience and providing insights into user engagement with the package.
Usage
To access the Interaction
property, you need to have an instance of the Package
class. This property is read-only and provides a PackageInteraction
object that contains the interaction details.
Example
// Assuming 'package' is an instance of Sandbox.Package
var userInteraction = package.Interaction;
// Check if the user has favorited the package
bool isFavorited = userInteraction.IsFavorited;
// Get the user's play history
var playHistory = userInteraction.PlayHistory;
// Check if the user has rated the package
bool hasRated = userInteraction.HasRated;