Skip to content
Garrett Serack edited this page May 19, 2014 · 8 revisions

PackageSource class

public class Request {
	public bool IsCancelled {get;}
    public bool IsElevated {get;}
    public IEnumerable<string> PackageSources {get;}
	public PSCredential Credential {get;}
	public Hashtable Options {get;}

	public void Warning(string message, params object[] args);
	public void Error(string message, params object[] args);
	public void Verbose(string message, params object[] args);
	public int StartProgress(int parentActivityId, string message, params object[] args);
	public void ReportProgress(int activityId, int progress, string message, params object[] args);
	public void CompleteProgress(int activityId, bool isSuccessful);

	public bool ShouldContinueWithUntrustedPackageSource(string package, string packageSource);
    public bool ShouldProcessPackageInstall(string packageName, string version, string source);
    public bool ShouldProcessPackageUninstall(string packageName, string version);
    public bool ShouldContinueAfterPackageInstallFailure(string packageName, string version, string source);
    public bool ShouldContinueAfterPackageUninstallFailure(string packageName, string version, string source);
    public bool ShouldContinueRunningInstallScript(string packageName, string version, string source, string scriptLocation);
    public bool ShouldContinueRunningUninstallScript(string packageName, string version, string source, string scriptLocation);
    public bool AskPermission(string permission);

	public PackageManagementService PackageManagementService {get;}
}

The Request class represents the current request context and provides access to OneGet functionality.

In PowerShell, the Request is exposed to the PowerShell session as $request and the Provider implementer does not need to specify a parameter for the value.

Property Type Description
IsCancelled bool indicates that the host has cancelled the operation, function should exit asap.
IsElevated bool indicates that the current process is elevated
PackageSources IEnumerable<string> a collection of strings representing the specified sources -- may be names or locations. Empty or null collection indicates "all"
Credential PSCredential any credential passed in from the user
Options Hashtable a set of key-value pairs of the dynamic options specified by the user
Method Return Type Description
Warning void xxx
Error void xxx
Verbose void xxx
StartProgress int xxx
ReportProgress void xxx
CompleteProgress void xxx
ShouldContinueWithUntrustedPackageSource bool xxx
ShouldProcessPackageInstall bool xxx
ShouldProcessPackageUninstall bool xxx
ShouldContinueAfterPackageInstallFailure bool xxx
ShouldContinueAfterPackageUninstallFailure bool xxx
ShouldContinueRunningInstallScript bool xxx
ShouldContinueRunningUninstallScript bool xxx
AskPermission bool xxx
PackageManagementService PackageManagementService returns a reference to the [[PackageManagementService
GetProtocols IEnumerable<ProtocolProvider> xxx