blob: dcd63f900d31bca8dbd426f31b88f72e2891df10 (
plain)
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
|
#pragma once
#include <functional>
#include <string>
#include <vector>
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
|