diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-20 13:04:38 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-20 13:04:38 +0300 |
commit | 7471d5acb83e7dcf06783b3467607d2200de4bff (patch) | |
tree | 337c6bcc73cdcfe6158303f78800a7ad82ff48a3 /partners_api/viator_api.hpp | |
parent | df51b0c0e83cbd312f14cdf727f15975464fb52e (diff) |
[partners_api] viator
Diffstat (limited to 'partners_api/viator_api.hpp')
-rw-r--r-- | partners_api/viator_api.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/partners_api/viator_api.hpp b/partners_api/viator_api.hpp new file mode 100644 index 0000000000..1c2edc4986 --- /dev/null +++ b/partners_api/viator_api.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include <functional> +#include <string> + +namespace viator +{ +class RawApi +{ +public: + /// Returns top <count> products for specified city id. + static bool GetTopProducts(std::string const & destId, std::string const & currency, int count, + std::string & result); +}; + +struct Product +{ + std::string m_title; + double m_rating; + int m_reviewCount; + std::string m_duration; + double m_price; + std::string m_priceFormatted; + std::string m_currency; + std::string m_photoUrl; + std::string m_pageUrl; +}; + +using GetTop5ProductsCallback = + std::function<void(std::string const & destId, std::vector<Product> const & products)>; + +class Api +{ +public: + /// Returns web page address for specified city id. + static std::string GetCityUrl(std::string const & destId, std::string const & name); + + /// Returns top-5 products for specified city id. + /// @currency - currency of the price, if empty then USD will be used. + void GetTop5Products(std::string const & destId, std::string const & currency, + GetTop5ProductsCallback const & fn) const; +}; + +bool operator<(Product const & lhs, Product const & rhs); +void SortProducts(std::vector<Product> & products); +} // namespace viator |