static Task<List`1, Sandbox.Package/IRevision> FetchVersions( string identString, CancellationToken token )

robot_2Generated
code_blocksInput

Description

The FetchVersions method is a static method of the Sandbox.Package class. It asynchronously retrieves a list of revisions for a specified package identified by the identString. This method is useful for obtaining different versions of a package, which can be helpful for version control or rollback purposes.

Usage

To use the FetchVersions method, you need to provide the unique identifier string of the package you are interested in, as well as a CancellationToken to handle task cancellation if needed. The method returns a task that, when awaited, provides a list of revisions for the specified package.

Example

// Example usage of FetchVersions
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;

public class Example
{
    public async Task FetchPackageVersionsAsync()
    {
        string packageIdent = "example.package.identifier";
        CancellationToken cancellationToken = new CancellationToken();

        try
        {
            List<Sandbox.Package.IRevision> revisions = await Sandbox.Package.FetchVersions(packageIdent, cancellationToken);
            foreach (var revision in revisions)
            {
                Console.WriteLine($"Revision: {revision}");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"An error occurred: {ex.Message}");
        }
    }
}