SFSClient.h (2761B)
1 // Copyright (c) Microsoft Corporation. 2 // Licensed under the MIT License. 3 4 #pragma once 5 6 #include "AppContent.h" 7 #include "ClientConfig.h" 8 #include "Content.h" 9 #include "Logging.h" 10 #include "RequestParams.h" 11 #include "Result.h" 12 13 #include <memory> 14 #include <optional> 15 #include <string> 16 #include <vector> 17 18 namespace SFS 19 { 20 namespace details 21 { 22 class SFSClientInterface; 23 } 24 25 class SFSClient 26 { 27 public: 28 ~SFSClient() noexcept; 29 30 SFSClient(const SFSClient&) = delete; 31 SFSClient& operator=(const SFSClient&) = delete; 32 33 /** 34 * @brief Make a new SFSClient object 35 * @details An SFSClient object is used to make calls to the SFS service. The SFSClient object is initialized with 36 * a few parameters that are used to build the URL for the SFS service. The URL is built as follows: 37 * https://{accountId}.api.cdp.microsoft.com/api/v2/contents/{instanceId}/namespaces/{nameSpace} 38 * The instanceId and nameSpace are optionally set in @param config and have a default value if not provided. 39 * The accountId is required and must be set to a non-empty value. 40 * 41 * @param config Describes a set of startup configurations for the SFSClient 42 */ 43 [[nodiscard]] static Result Make(ClientConfig config, std::unique_ptr<SFSClient>& out) noexcept; 44 45 // 46 // API to retrieve download information from the SFS Service 47 // 48 49 /** 50 * @brief Retrieve combined metadata & download URLs from the latest version of specified products 51 * @note At the moment only a single product request is supported 52 * @param requestParams Parameters that define this request 53 * @param contents A vector of Content that is populated with the result 54 */ 55 [[nodiscard]] Result GetLatestDownloadInfo(const RequestParams& requestParams, 56 std::vector<Content>& contents) const noexcept; 57 58 /** 59 * @brief Retrieve combined metadata & download URLs from the latest version of specified apps 60 * @note At the moment only a single product request is supported 61 * @param requestParams Parameters that define this request 62 * @param contents A vector of AppContent that is populated with the result 63 */ 64 [[nodiscard]] Result GetLatestAppDownloadInfo(const RequestParams& requestParams, 65 std::vector<AppContent>& contents) const noexcept; 66 67 /** 68 * @return The version of the SFSClient library 69 */ 70 static const char* GetVersion() noexcept; 71 72 private: 73 /** 74 * @brief Construct a new SFSClient object 75 */ 76 SFSClient() noexcept; 77 78 std::unique_ptr<details::SFSClientInterface> m_impl; 79 }; 80 } // namespace SFS