winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

MSStoreDownload.h (2169B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include <AppInstallerArchitecture.h>
      5 #include <AppInstallerSHA256.h>
      6 #include <AppInstallerVersions.h>
      7 #include "winget/Authentication.h"
      8 #include "winget/ManifestCommon.h"
      9 
     10 #include <string>
     11 #include <optional>
     12 #include <string_view>
     13 #include <memory>
     14 #include <vector>
     15 
     16 namespace AppInstaller::MSStore
     17 {
     18     // Struct representing 1 MSStore package file download info
     19     struct MSStoreDownloadFile
     20     {
     21         std::string Url;
     22         AppInstaller::Utility::SHA256::HashBuffer Sha256;
     23         std::string FileName;
     24         AppInstaller::Utility::UInt64Version Version = 0;
     25     };
     26 
     27     struct MSStoreDownloadInfo
     28     {
     29         std::vector<MSStoreDownloadFile> MainPackages;
     30         std::vector<MSStoreDownloadFile> DependencyPackages;
     31 
     32         std::string ContentId;
     33     };
     34 
     35     struct MSStoreDownloadContext
     36     {
     37         MSStoreDownloadContext(
     38             std::string productId,
     39             AppInstaller::Utility::Architecture architecture,
     40             AppInstaller::Manifest::PlatformEnum platform,
     41             std::string locale,
     42             AppInstaller::Authentication::AuthenticationArguments authArgs);
     43 
     44         void TargetOSVersion(std::optional<Utility::UInt64Version> targetOSVersion);
     45 
     46         // Calls display catalog API and sfs-client to get download info.
     47         MSStoreDownloadInfo GetDownloadInfo();
     48 
     49         // Gets license for the corresponding packages
     50         std::vector<BYTE> GetLicense(std::string_view contentId);
     51 
     52     private:
     53         std::string m_productId;
     54         AppInstaller::Utility::Architecture m_architecture = AppInstaller::Utility::Architecture::Unknown;
     55         AppInstaller::Manifest::PlatformEnum m_platform = AppInstaller::Manifest::PlatformEnum::Unknown;
     56         std::optional<Utility::UInt64Version> m_targetOSVersion = std::nullopt;
     57         std::string m_locale;
     58         std::unique_ptr<AppInstaller::Authentication::Authenticator> m_displayCatalogAuthenticator;
     59         std::unique_ptr<AppInstaller::Authentication::Authenticator> m_licensingAuthenticator;
     60     };
     61 }