Description
The Fetch
method in the Sandbox.Package
class is a static method used to asynchronously retrieve a package from the Asset Party service. It takes an identifier string and a boolean indicating whether to allow partial matches, and returns a Task<Package>
representing the asynchronous operation, which resolves to the fetched package.
Usage
To use the Fetch
method, call it with the appropriate identifier string and a boolean value for partial matching. The method will return a Task<Package>
, which you can await to get the Package
object.
Example
// Example usage of the Fetch method
public async Task FetchPackageExample()
{
string packageIdentifier = "example.package.identifier";
bool allowPartial = false;
try
{
Package package = await Package.Fetch(packageIdentifier, allowPartial);
// Use the fetched package
Console.WriteLine($"Package Title: {package.Title}");
}
catch (Exception ex)
{
// Handle exceptions
Console.WriteLine($"Error fetching package: {ex.Message}");
}
}