-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathPackageManager.idl
931 lines (833 loc) · 42.2 KB
/
PackageManager.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Microsoft.Management.Deployment
{
[contractversion(5)]
apicontract WindowsPackageManagerContract{};
/// State of the install
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageInstallProgressState
{
/// The install is queued but not yet active. Cancellation of the IAsyncOperationWithProgress in this
/// state will prevent the package from downloading or installing.
Queued,
/// The installer is downloading. Cancellation of the IAsyncOperationWithProgress in this state will
/// end the download and prevent the package from installing.
Downloading,
/// The install is in progress. Cancellation of the IAsyncOperationWithProgress in this state will not
/// stop the installation or the post install cleanup.
Installing,
/// The installer has completed and cleanup actions are in progress. Cancellation of the
/// IAsyncOperationWithProgress in this state will not stop cleanup or roll back the install.
PostInstall,
/// The operation has completed.
Finished,
};
/// Progress object for the install
/// DESIGN NOTE: percentage for the install as a whole is purposefully not included as there is no way to
/// estimate progress when the installer is running.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
struct InstallProgress
{
/// State of the install
PackageInstallProgressState State;
/// DESIGN NOTE: BytesDownloaded may only be available for downloads done by Windows Package Manager itself.
/// Number of bytes downloaded if known
UInt64 BytesDownloaded;
/// DESIGN NOTE: BytesRequired may only be available for downloads done by Windows Package Manager itself.
/// Number of bytes required if known
UInt64 BytesRequired;
/// Download percentage completed
Double DownloadProgress;
/// Install percentage if known.
Double InstallationProgress;
};
/// Status of the Install call
/// Implementation Note: Errors mapped from AppInstallerErrors.h
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum InstallResultStatus
{
Ok,
BlockedByPolicy,
CatalogError,
InternalError,
InvalidOptions,
DownloadError,
InstallError,
ManifestError,
NoApplicableInstallers,
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
NoApplicableUpgrade,
}
};
/// Result of the install
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass InstallResult
{
/// Used by a caller to correlate the install with a caller's data.
String CorrelationData { get; };
/// Whether a restart is required to complete the install.
Boolean RebootRequired { get; };
/// Batched error code, example APPINSTALLER_CLI_ERROR_SHELLEXEC_INSTALL_FAILED
InstallResultStatus Status { get; };
/// The error code of the overall operation.
HRESULT ExtendedErrorCode { get; };
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
/// The error code from the install attempt. Only valid if the Status is InstallError.
/// This value's meaning will require knowledge of the specific installer or install technology.
UInt32 InstallerErrorCode { get; };
}
}
/// State of the uninstall
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
enum PackageUninstallProgressState
{
/// The uninstall is queued but not yet active. Cancellation of the IAsyncOperationWithProgress in this
/// state will prevent the package from uninstalling.
Queued,
/// The uninstall is in progress. Cancellation of the IAsyncOperationWithProgress in this state will not
/// stop the installation or the post uninstall steps.
Uninstalling,
/// The uninstaller has completed and cleanup actions are in progress. Cancellation of the
/// IAsyncOperationWithProgress in this state will not stop cleanup or roll back the uninstall.
PostUninstall,
/// The operation has completed.
Finished,
};
/// Progress object for the uninstall
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
struct UninstallProgress
{
/// State of the uninstall
PackageUninstallProgressState State;
/// Uninstall percentage if known.
Double UninstallationProgress;
};
/// Status of the uninstall call
/// Implementation Note: Errors mapped from AppInstallerErrors.h
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
enum UninstallResultStatus
{
Ok,
BlockedByPolicy,
CatalogError,
InternalError,
InvalidOptions,
UninstallError,
ManifestError,
};
/// Result of the uninstall
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
runtimeclass UninstallResult
{
/// Used by a caller to correlate the install with a caller's data.
String CorrelationData { get; };
/// Whether a restart is required to complete the install.
Boolean RebootRequired { get; };
/// Batched error code, example APPINSTALLER_CLI_ERROR_SHELLEXEC_INSTALL_FAILED
UninstallResultStatus Status { get; };
/// The error code of the overall operation.
HRESULT ExtendedErrorCode { get; };
/// The error code from the uninstall attempt. Only valid if the Status is UninstallError.
/// This value's meaning will require knowledge of the specific uninstaller or install technology.
UInt32 UninstallerErrorCode { get; };
}
/// IMPLEMENTATION NOTE: SourceOrigin from winget/RepositorySource.h
/// Defines the origin of the package catalog details.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageCatalogOrigin
{
/// Predefined means it came as part of the Windows Package Manager package and cannot be removed.
Predefined,
/// User means it was added by the user and could be removed.
User,
};
/// IMPLEMENTATION NOTE: SourceTrustLevel from winget/RepositorySource.h
/// Defines the trust level of the package catalog.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageCatalogTrustLevel
{
None,
Trusted,
};
/// IMPLEMENTATION NOTE: SourceDetails from winget/RepositorySource.h
/// Interface for retrieving information about an package catalog without acting on it.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageCatalogInfo
{
/// The package catalog's unique identifier.
/// SAMPLE VALUES: For OpenWindowsCatalog "Microsoft.Winget.Source_8wekyb3d8bbwe"
/// For contoso sample on msdn "contoso"
String Id { get; };
/// The name of the package catalog.
/// SAMPLE VALUES: For OpenWindowsCatalog "winget".
/// For contoso sample on msdn "contoso"
String Name { get; };
/// The type of the package catalog.
/// ALLOWED VALUES: "Microsoft.Rest", "Microsoft.PreIndexed.Package"
/// SAMPLE VALUES: For OpenWindowsCatalog "Microsoft.PreIndexed.Package".
/// For contoso sample on msdn "Microsoft.PreIndexed.Package"
String Type { get; };
/// The argument used when adding the package catalog.
/// SAMPLE VALUES: For OpenWindowsCatalog "https://winget.azureedge.net/cache"
/// For contoso sample on msdn "https://pkgmgr-int.azureedge.net/cache"
String Argument { get; };
/// The last time that this package catalog was updated.
Windows.Foundation.DateTime LastUpdateTime { get; };
/// The origin of the package catalog.
PackageCatalogOrigin Origin { get; };
/// The trust level of the package catalog
PackageCatalogTrustLevel TrustLevel { get; };
}
/// A metadata item of a package version.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageVersionMetadataField
{
/// The InstallerType of an installed package
InstallerType,
/// The Scope of an installed package
InstalledScope,
/// The system path where the package is installed
InstalledLocation,
/// The standard uninstall command; which may be interactive
StandardUninstallCommand,
/// An uninstall command that should be non-interactive
SilentUninstallCommand,
/// The publisher of the package
PublisherDisplayName,
};
/// The result of a comparison.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 2)]
enum CompareResult
{
/// The comparison did not result in a succesful ordering.
Unknown,
/// The object value is lesser than the given value.
Lesser,
/// The object value is equal to the given value.
Equal,
/// The object value is greater than the given value.
Greater,
};
/// IMPLEMENTATION NOTE: IPackageVersion from winget/RepositorySearch.h
/// A single package version.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageVersionInfo
{
/// IMPLEMENTATION NOTE: PackageVersionMetadata fields from winget/RepositorySearch.h
/// Gets any metadata associated with this package version.
/// Primarily stores data on installed packages.
/// Metadata fields may have no value (e.g. packages that aren't installed will not have an InstalledLocation).
String GetMetadata(PackageVersionMetadataField metadataField);
/// IMPLEMENTATION NOTE: PackageVersionProperty fields from winget/RepositorySearch.h
String Id { get; };
String DisplayName { get; };
String Version { get; };
String Channel { get; };
/// DESIGN NOTE: RelativePath from winget/RepositorySearch.h is excluded as not needed.
/// String RelativePath;
/// IMPLEMENTATION NOTE: PackageVersionMultiProperty fields from winget/RepositorySearch.h
/// PackageFamilyName and ProductCode can have multiple values.
Windows.Foundation.Collections.IVectorView<String> PackageFamilyNames { get; };
Windows.Foundation.Collections.IVectorView<String> ProductCodes { get; };
/// Gets the package catalog where this package version is from.
PackageCatalog PackageCatalog { get; };
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 2)]
{
/// Compares the given value against the package version of this object, with the result being
/// the enum value that represents where PackageVersionInfo::Version is ordered relative to the
/// versionString. "if (this.CompareToVersion(that) == Greater)" can be thought of as reading
/// the sentence "If this is compared to version that and is found to be greater".
/// IE if PackageVersionInfo::Version returns "2", then CompareToVersion("1") will return Greater.
/// Passing in an empty string will result in Unknown.
CompareResult CompareToVersion(String versionString);
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
/// Checks if this package version has at least one applicable installer.
Boolean HasApplicableInstaller(InstallOptions options);
/// Gets the publisher string for this package version, if one is available.
String Publisher { get; };
}
/// DESIGN NOTE:
/// GetManifest from IPackageVersion in winget/RepositorySearch is not implemented in V1. That class has
/// a lot of fields and no one requesting it.
/// Gets the manifest of this package version.
/// virtual Manifest::Manifest GetManifest() = 0;
}
/// IMPLEMENTATION NOTE: PackageVersionKey from winget/RepositorySearch.h
/// A key to identify a package version within a package.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageVersionId
{
/// The package catalog id that this version came from.
String PackageCatalogId { get; };
/// The version.
String Version { get; };
/// The channel.
String Channel { get; };
};
/// The package installer type.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
enum PackageInstallerType
{
/// Unknown type.
Unknown,
/// Inno type.
Inno,
/// Wix type.
Wix,
/// Msi type.
Msi,
/// Nullsoft type.
Nullsoft,
/// Zip type.
Zip,
/// Msix or Appx type.
Msix,
/// Exe type.
Exe,
/// Burn type.
Burn,
/// MSStore type.
MSStore,
/// Portable type.
Portable,
};
/// The package installer scope.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
enum PackageInstallerScope
{
/// Scope not declared.
Unknown,
/// User scope.
User,
/// System scope.
System,
};
/// Interface for retrieving information about a package installer.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
runtimeclass PackageInstallerInfo
{
/// The package installer type.
PackageInstallerType InstallerType { get; };
/// The nested package installer type for archives.
PackageInstallerType NestedInstallerType { get; };
/// The package installer architecture.
Windows.System.ProcessorArchitecture Architecture { get; };
/// The package installer scope.
PackageInstallerScope Scope { get; };
/// The package installer locale.
String Locale{ get; };
};
/// The installed status type. The values need to match InstalledStatusType from winget/RepositorySearch.h.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
[flags]
enum InstalledStatusType
{
/// None is checked.
None = 0x0,
/// Check Apps and Features entry.
AppsAndFeaturesEntry = 0x0001,
/// Check Apps and Features entry install location if applicable.
AppsAndFeaturesEntryInstallLocation = 0x0002,
/// Check Apps and Features entry install location with installed files if applicable.
AppsAndFeaturesEntryInstallLocationFile = 0x0004,
/// Check default install location if applicable.
DefaultInstallLocation = 0x0008,
/// Check default install location with installed files if applicable.
DefaultInstallLocationFile = 0x0010,
/// Below are helper values for calling CheckInstalledStatus as input.
/// AppsAndFeaturesEntry related checks
AllAppsAndFeaturesEntryChecks = AppsAndFeaturesEntry | AppsAndFeaturesEntryInstallLocation | AppsAndFeaturesEntryInstallLocationFile,
/// DefaultInstallLocation related checks
AllDefaultInstallLocationChecks = DefaultInstallLocation | DefaultInstallLocationFile,
/// All checks
AllChecks = AllAppsAndFeaturesEntryChecks | AllDefaultInstallLocationChecks,
};
/// Interface representing an individual installed status.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
runtimeclass InstalledStatus
{
/// The installed status type.
InstalledStatusType Type { get; };
/// The installed status path.
String Path { get; };
/// The installed status result.
HRESULT Status { get; };
};
/// Interface for retrieving information about a package installer installed status.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
runtimeclass PackageInstallerInstalledStatus
{
/// The package installer info.
PackageInstallerInfo InstallerInfo { get; };
/// A list of various types of installed status of the package installer.
Windows.Foundation.Collections.IVectorView<InstalledStatus> InstallerInstalledStatus { get; };
};
/// Status of the check installed status call.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
enum CheckInstalledStatusResultStatus
{
Ok,
InternalError,
};
/// Interface for retrieving information about a package installer installed status.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
runtimeclass CheckInstalledStatusResult
{
/// Status of the check installed status call.
CheckInstalledStatusResultStatus Status { get; };
/// A list of package installer installed status.
Windows.Foundation.Collections.IVectorView<PackageInstallerInstalledStatus> PackageInstalledStatus { get; };
};
/// IMPLEMENTATION NOTE: IPackage from winget/RepositorySearch.h
/// A package, potentially containing information about it's local state and the available versions.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass CatalogPackage
{
/// IMPLEMENTATION NOTE: PackageProperty fields from winget/RepositorySearch.h
/// Gets a property of this package.
String Id { get; };
String Name { get; };
/// Gets the installed package information if the package is installed.
PackageVersionInfo InstalledVersion { get; };
/// Gets all available versions of this package. Ordering is not guaranteed.
Windows.Foundation.Collections.IVectorView<PackageVersionId> AvailableVersions { get; };
/// Gets the version of this package that will be installed if version is not set in InstallOptions.
PackageVersionInfo DefaultInstallVersion { get; };
/// Gets a specific version of this package.
PackageVersionInfo GetPackageVersionInfo(PackageVersionId versionKey);
/// Gets a value indicating whether an available version is newer than the installed version.
Boolean IsUpdateAvailable { get; };
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
{
/// Check the installed status of the package. For more accurate and complete installed status, it's required to
/// call this method from a composite package from a newly created package catalog with installed info.
/// This may require downloading information from a server.
Windows.Foundation.IAsyncOperation<CheckInstalledStatusResult> CheckInstalledStatusAsync(InstalledStatusType checkTypes);
CheckInstalledStatusResult CheckInstalledStatus(InstalledStatusType checkTypes);
Windows.Foundation.IAsyncOperation<CheckInstalledStatusResult> CheckInstalledStatusAsync();
CheckInstalledStatusResult CheckInstalledStatus();
}
/// DESIGN NOTE:
/// IsSame from IPackage in winget/RepositorySearch is not implemented in V1.
/// Determines if the given IPackage refers to the same package as this one.
/// virtual bool IsSame(const IPackage*) const = 0;
}
/// IMPLEMENTATION NOTE: CompositeSearchBehavior from winget/RepositorySource.h
/// Search behavior for composite catalogs.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum CompositeSearchBehavior
{
/// Search local catalogs only
LocalCatalogs,
/// Search remote catalogs only, don't check local catalogs for InstalledVersion
RemotePackagesFromRemoteCatalogs,
/// Search remote catalogs, and check local catalogs for InstalledVersion
RemotePackagesFromAllCatalogs,
/// Search both local and remote catalogs.
AllCatalogs,
};
/// IMPLEMENTATION NOTE: PackageFieldMatchOption from winget/RepositorySearch.h
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageFieldMatchOption
{
Equals,
EqualsCaseInsensitive,
StartsWithCaseInsensitive,
ContainsCaseInsensitive,
};
/// IMPLEMENTATION NOTE: PackageFieldMatchOption from winget/RepositorySearch.h
/// The field to match on.
/// The values must be declared in order of preference in search results.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageMatchField
{
CatalogDefault,
Id,
Name,
Moniker,
Command,
Tag,
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 3)]
{
PackageFamilyName,
ProductCode,
}
/// DESIGN NOTE: The following PackageFieldMatchOption from winget/RepositorySearch.h are not implemented in V1.
/// NormalizedNameAndPublisher,
};
/// IMPLEMENTATION NOTE: PackageMatchFilter from winget/RepositorySearch.h
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageMatchFilter
{
PackageMatchFilter();
/// The type of string comparison for matching
PackageFieldMatchOption Option;
/// The field to search
PackageMatchField Field;
/// The value to match
String Value;
/// DESIGN NOTE: "Additional" from RequestMatch winget/RepositorySearch.h is not implemented here.
}
/// IMPLEMENTATION NOTE: MatchResult from winget/RepositorySearch.h
/// A single result from the search.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass MatchResult
{
/// The package found by the search request.
CatalogPackage CatalogPackage { get; };
/// The highest order field on which the package matched the search.
PackageMatchFilter MatchCriteria { get; };
}
/// Status of the FindPackages call
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum FindPackagesResultStatus
{
Ok,
BlockedByPolicy,
CatalogError,
InternalError,
InvalidOptions
};
/// IMPLEMENTATION NOTE: SearchResult from winget/RepositorySearch.h
/// Search result data returned from FindPackages
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass FindPackagesResult
{
/// Error codes
FindPackagesResultStatus Status{ get; };
/// The full set of results from the search.
Windows.Foundation.Collections.IVectorView<MatchResult> Matches { get; };
/// If true, the results were truncated by the given ResultLimit
/// USAGE NOTE: Windows Package Manager does not support result pagination, there is no way to continue
/// getting more results.
Boolean WasLimitExceeded{ get; };
}
/// Options for FindPackages
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass FindPackagesOptions
{
FindPackagesOptions();
/// DESIGN NOTE:
/// This class maps to SearchRequest from winget/RepositorySearch.h
/// That class is a container for data used to filter the available manifests in an package catalog.
/// Its properties can be thought of as:
/// (Query || Inclusions...) && Filters...
/// If Query and Inclusions are both empty, the starting data set will be the entire database.
/// Everything && Filters...
/// That has been translated in this api so that
/// Inclusions are Selectors below
/// Filters are Filters below
/// Query is PackageFieldMatchOption::PackageCatalogDefined and in the Selector list.
/// USAGE NOTE: Only one selector with PackageFieldMatchOption::PackageCatalogDefined is allowed.
/// Selectors = you have to match at least one selector (if there are no selectors, then nothing is selected)
Windows.Foundation.Collections.IVector<PackageMatchFilter> Selectors { get; };
/// Filters = you have to match all filters(if there are no filters, then there is no filtering of selected items)
Windows.Foundation.Collections.IVector<PackageMatchFilter> Filters{ get; };
/// Restricts the length of the returned results to the specified count.
UInt32 ResultLimit;
}
/// IMPLEMENTATION NOTE: Source from winget/RepositorySource.h
/// A catalog for searching for packages
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageCatalog
{
/// Gets a value indicating whether this package catalog is a composite of other package catalogs,
/// and thus the packages may come from disparate package catalogs as well.
Boolean IsComposite { get; };
/// The details of the package catalog if it is not a composite.
PackageCatalogInfo Info { get; };
/// Searches for Packages in the catalog.
Windows.Foundation.IAsyncOperation<FindPackagesResult> FindPackagesAsync(FindPackagesOptions options);
FindPackagesResult FindPackages(FindPackagesOptions options);
}
/// Status of the Connect call
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum ConnectResultStatus
{
Ok,
CatalogError,
};
/// Result of the Connect call
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass ConnectResult
{
/// Error codes
ConnectResultStatus Status{ get; };
PackageCatalog PackageCatalog { get; };
}
/// A reference to a catalog that callers can try to Connect.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageCatalogReference
{
/// Gets a value indicating whether this package catalog is a composite of other package catalogs,
/// and thus the packages may come from disparate package catalogs as well.
Boolean IsComposite { get; };
/// The details of the package catalog if it is not a composite.
PackageCatalogInfo Info { get; };
/// Opens a catalog. Required before searching. For remote catalogs (i.e. not Installed and Installing) this
/// may require downloading information from a server.
Windows.Foundation.IAsyncOperation<ConnectResult> ConnectAsync();
ConnectResult Connect();
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 2)]
{
/// A string that will be passed to the source server if using a REST source
String AdditionalPackageCatalogArguments;
}
}
/// Catalogs with PackageCatalogOrigin Predefined
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PredefinedPackageCatalog
{
OpenWindowsCatalog,
MicrosoftStore,
DesktopFrameworks,
};
/// Local Catalogs with PackageCatalogOrigin Predefined
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum LocalPackageCatalog
{
InstalledPackages,
InstallingPackages
};
/// Options for creating a composite catalog.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass CreateCompositePackageCatalogOptions
{
CreateCompositePackageCatalogOptions();
/// Create a composite catalog to allow searching a user defined or pre defined source
/// and a local source (Installed packages) together
IVector<PackageCatalogReference> Catalogs { get; };
/// Sets the default search behavior if the catalog is a composite catalog.
CompositeSearchBehavior CompositeSearchBehavior;
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
{
/// Create installed package catalog with required installed scope.
PackageInstallScope InstalledScope;
}
}
/// Required install scope for the package. If the package does not have an installer that
/// supports the specified scope the Install call will fail with InstallResultStatus.NoApplicableInstallers
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageInstallScope
{
/// An installer with any install scope is valid.
Any,
/// Only User install scope installers are valid
User,
/// Only System installers will be valid
System,
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
{
/// Both User and Unknown install scope installers are valid
UserOrUnknown,
/// Both System and Unknown install scope installers are valid
SystemOrUnknown,
}
};
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
enum PackageInstallMode
{
/// The default experience for the installer. Installer may show some UI.
Default,
/// Runs the installer in silent mode. This suppresses the installer's UI to the extent
/// possible (installer may still show some required UI).
Silent,
/// Runs the installer in interactive mode.
Interactive,
};
/// Options when installing a package.
/// Intended to allow full compatibility with the "winget install" command line interface.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass InstallOptions
{
InstallOptions();
/// Optionally specifies the version from the package to install. If unspecified the version matching
/// CatalogPackage.GetLatestVersion() is used.
PackageVersionId PackageVersionId;
/// Specifies alternate location to install package (if supported).
String PreferredInstallLocation;
/// User or Machine.
PackageInstallScope PackageInstallScope;
/// Silent, Interactive, or Default
PackageInstallMode PackageInstallMode;
/// Directs the logging to a log file. If provided, the installer must have write access to the file
String LogOutputPath;
/// Continues the install even if the hash in the catalog does not match the linked installer.
Boolean AllowHashMismatch;
/// A string that will be passed to the installer.
/// IMPLEMENTATION NOTE: maps to "--override" in the winget cmd line
String ReplacementInstallerArguments;
/// Used by a caller to correlate the install with a caller's data.
/// The string must be JSON encoded.
String CorrelationData;
/// A string that will be passed to the source server if using a REST source
String AdditionalPackageCatalogArguments;
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 2)]
{
// The set of allowed Architectures, in preference order, that will be considered for
// the install operation. Initially the vector contains the default allowed architectures
// in the default preference order for the current system. It is allowed to have repeated
// values in the list, to make prepending a preference override easier. Instances of an
// architecture after the first will simply be ignored.
Windows.Foundation.Collections.IVector<Windows.System.ProcessorArchitecture> AllowedArchitectures { get; };
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
/// Allow the upgrade to continue for upgrade packages with manifest versions Unknown.
Boolean AllowUpgradeToUnknownVersion;
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
{
/// Force the operation to continue upon non security related failures.
Boolean Force;
}
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
enum PackageUninstallMode
{
/// The default experience for the installer. Installer may show some UI.
Default,
/// Runs the installer in silent mode. This suppresses the installer's UI to the extent
/// possible (installer may still show some required UI).
Silent,
/// Runs the installer in interactive mode.
Interactive,
};
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
enum PackageUninstallScope
{
/// Use default uninstall behavior.
Any,
/// Uninstall for current user. Currently only applicable to msix.
User,
/// Uninstall for all users. Currently only applicable to msix.
System,
};
/// Options when uninstalling a package.
/// Intended to allow full compatibility with the "winget uninstall" command line interface.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
runtimeclass UninstallOptions
{
UninstallOptions();
/// Optionally specifies the version from the package to uninstall. If unspecified the version matching
/// CatalogPackage.GetLatestVersion() is used.
PackageVersionId PackageVersionId;
/// Silent, Interactive, or Default
PackageUninstallMode PackageUninstallMode;
/// Directs the logging to a log file. If provided, the installer must have write access to the file
String LogOutputPath;
/// Used by a caller to correlate the install with a caller's data.
/// The string must be JSON encoded.
String CorrelationData;
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 5)]
{
/// Force the operation to continue upon non security related failures.
Boolean Force;
// The scope the uninstall will perform. Currently only applicable to msix.
PackageUninstallScope PackageUninstallScope;
}
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 1)]
runtimeclass PackageManager
{
PackageManager();
/// Get the available catalogs. Each source will have a separate catalog.
/// This does not open the catalog. These catalogs can be used individually or merged with CreateCompositePackageCatalogAsync.
/// IMPLEMENTATION NOTE: This is a list of sources returned by Windows Package Manager source list
Windows.Foundation.Collections.IVectorView<PackageCatalogReference> GetPackageCatalogs();
/// Get a built in catalog
PackageCatalogReference GetPredefinedPackageCatalog(PredefinedPackageCatalog predefinedPackageCatalog);
/// Get a built in catalog
PackageCatalogReference GetLocalPackageCatalog(LocalPackageCatalog localPackageCatalog);
/// Get a catalog by a known name
PackageCatalogReference GetPackageCatalogByName(String catalogName);
/// Get a composite catalog to allow searching a user defined or pre defined source and a local source
/// (Installing, Installed) together at the same time.
PackageCatalogReference CreateCompositePackageCatalog(CreateCompositePackageCatalogOptions options);
/// Install the specified package
Windows.Foundation.IAsyncOperationWithProgress<InstallResult, InstallProgress> InstallPackageAsync(CatalogPackage package, InstallOptions options);
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 2)]
{
/// Get install progress
Windows.Foundation.IAsyncOperationWithProgress<InstallResult, InstallProgress> GetInstallProgress(CatalogPackage package, PackageCatalogInfo catalogInfo);
}
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
{
/// Upgrade the specified package
Windows.Foundation.IAsyncOperationWithProgress<InstallResult, InstallProgress> UpgradePackageAsync(CatalogPackage package, InstallOptions options);
/// Uninstall the specified package
Windows.Foundation.IAsyncOperationWithProgress<UninstallResult, UninstallProgress> UninstallPackageAsync(CatalogPackage package, UninstallOptions options);
/// Get uninstall progress
Windows.Foundation.IAsyncOperationWithProgress<UninstallResult, UninstallProgress> GetUninstallProgress(CatalogPackage package, PackageCatalogInfo catalogInfo);
}
}
/// Global settings for PackageManager operations.
/// This settings should be invoked prior to invocation of PackageManager class.
/// This settings is only exposed in in-proc Com invocation.
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 4)]
runtimeclass PackageManagerSettings
{
PackageManagerSettings();
/// Sets caller name to be used in telemetry logging. Default value is the calling process name.
/// Call this before any PackageManager operations.
/// Returns true if successful, false if caller name is already set.
/// This is a one time setup, multiple calls will not override existing caller name.
Boolean SetCallerIdentifier(String callerIdentifier);
/// Sets state name for state separation. If not set, state will be written in a default location and states may be affected by other callers.
/// Call this before any PackageManager operations.
/// Returns true if successful, false if state name is already set.
/// This is a one time setup, multiple calls will not override existing state name.
Boolean SetStateIdentifier(String stateIdentifier);
/// Sets custom UserSettings.
/// Returns true if successful, false if settingsContent cannot be parsed or UserSettings is already created.
/// This is a one time setup, multiple calls will not override existing UserSettings.
Boolean SetUserSettings(String settingsContent);
}
/// Force midl3 to generate vector marshalling info.
declare
{
interface Windows.Foundation.Collections.IVector<PackageCatalog>;
interface Windows.Foundation.Collections.IVectorView<PackageCatalog>;
interface Windows.Foundation.Collections.IVector<PackageCatalogInfo>;
interface Windows.Foundation.Collections.IVectorView<PackageCatalogInfo>;
interface Windows.Foundation.Collections.IVector<PackageCatalogReference>;
interface Windows.Foundation.Collections.IVectorView<PackageCatalogReference>;
interface Windows.Foundation.Collections.IVector<CatalogPackage>;
interface Windows.Foundation.Collections.IVectorView<CatalogPackage>;
interface Windows.Foundation.Collections.IVector<FindPackagesOptions>;
interface Windows.Foundation.Collections.IVectorView<FindPackagesOptions>;
interface Windows.Foundation.Collections.IVector<FindPackagesResult>;
interface Windows.Foundation.Collections.IVectorView<FindPackagesResult>;
interface Windows.Foundation.Collections.IVector<CreateCompositePackageCatalogOptions>;
interface Windows.Foundation.Collections.IVectorView<CreateCompositePackageCatalogOptions>;
interface Windows.Foundation.Collections.IVector<InstallOptions>;
interface Windows.Foundation.Collections.IVectorView<InstallOptions>;
interface Windows.Foundation.Collections.IVector<InstallResult>;
interface Windows.Foundation.Collections.IVectorView<InstallResult>;
interface Windows.Foundation.Collections.IVector<UninstallOptions>;
interface Windows.Foundation.Collections.IVectorView<UninstallOptions>;
interface Windows.Foundation.Collections.IVector<UninstallResult>;
interface Windows.Foundation.Collections.IVectorView<UninstallResult>;
interface Windows.Foundation.Collections.IVector<MatchResult>;
interface Windows.Foundation.Collections.IVectorView<MatchResult>;
interface Windows.Foundation.Collections.IVector<PackageMatchFilter>;
interface Windows.Foundation.Collections.IVectorView<PackageMatchFilter>;
interface Windows.Foundation.Collections.IVector<PackageVersionId>;
interface Windows.Foundation.Collections.IVectorView<PackageVersionId>;
interface Windows.Foundation.Collections.IVector<PackageVersionInfo>;
interface Windows.Foundation.Collections.IVectorView<PackageVersionInfo>;
interface Windows.Foundation.Collections.IVector<PackageInstallerInfo>;
interface Windows.Foundation.Collections.IVectorView<PackageInstallerInfo>;
interface Windows.Foundation.Collections.IVector<InstalledStatus>;
interface Windows.Foundation.Collections.IVectorView<InstalledStatus>;
interface Windows.Foundation.Collections.IVector<PackageInstallerInstalledStatus>;
interface Windows.Foundation.Collections.IVectorView<PackageInstallerInstalledStatus>;
interface Windows.Foundation.Collections.IVector<CheckInstalledStatusResult>;
interface Windows.Foundation.Collections.IVectorView<CheckInstalledStatusResult>;
}
}