#pragma once #include #include #include #include #include #include #include #include #include #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable : 4702) #endif #include #if defined(_MSC_VER) # pragma warning(pop) #endif namespace scwx::provider { /** * @brief Warnings Provider */ class IemApiProvider { public: explicit IemApiProvider(); ~IemApiProvider(); IemApiProvider(const IemApiProvider&) = delete; IemApiProvider& operator=(const IemApiProvider&) = delete; IemApiProvider(IemApiProvider&&) noexcept; IemApiProvider& operator=(IemApiProvider&&) noexcept; static boost::outcome_v2::result> ListTextProducts(std::chrono::sys_time date, std::optional cccc = {}, std::optional pil = {}); static boost::outcome_v2::result> ListTextProducts( ranges::any_view> dates, ranges::any_view ccccs = {}, ranges::any_view pils = {}); template requires std::same_as, std::string> static std::vector> LoadTextProducts(const Range& textProducts) { auto parameters = cpr::Parameters {{"nolimit", "true"}}; std::vector> asyncResponses {}; asyncResponses.reserve(textProducts.size()); const std::string endpointUrl = kBaseUrl_ + kNwsTextProductEndpoint_; for (const auto& productId : textProducts) { asyncResponses.emplace_back( productId, cpr::GetAsync(cpr::Url {endpointUrl + productId}, network::cpr::GetHeader(), parameters)); } return ProcessTextProductResponses(asyncResponses); } private: class Impl; std::unique_ptr p; static const std::string kBaseUrl_; static const std::string kListNwsTextProductsEndpoint_; static const std::string kNwsTextProductEndpoint_; static std::vector> ProcessTextProductResponses( std::vector>& asyncResponses); }; } // namespace scwx::provider