Welcome to mirror list, hosted at ThFree Co, Russian Federation.

viator_api.hpp « partners_api - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 363ed06132b35e0fc015926e760ee6bd979edb5e (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);

  /// 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