summaryrefslogtreecommitdiff
path: root/battleNetApi/include/apiUrl.hpp
blob: bc62d42813909b4193538e1894664a6cbbaa697e (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
#pragma once
#include <cstdint>
#include <string>
#include <unordered_map>

namespace bnet
{

class ApiUrl
{
  public:
    ApiUrl(const std::string& iContentType,
           const std::string& iRegion);

    void setRegion(const std::string& iRegion);
    void setLocale(const std::string& iLocale);
    void setGameMode(const std::string& iGameMode);
    void setPage(uint64_t iPage);
    void setPageSize(uint64_t iPageSize);

    bool hasRegion() const;
    bool hasLocale() const;
    bool hasGameMode() const;
    bool hasPage() const;
    bool hasPageSize() const;

    std::string text() const;

  private:
    std::string_view kLOCALE_KEY{"locale"};
    std::string_view kGAME_MODE_KEY{"gameMode"};
    std::string_view kPAGE_KEY{"page"};
    std::string_view kPAGE_SIZE_KEY{"pageSize"};
    std::string mContentType;
    std::string mRegion;
    std::unordered_map<std::string_view, std::string> aParameters;

    void setValue(std::string_view iKey,
                  const std::string& iValue);
    bool hasValue(std::string_view iKey) const;
};
}; // namespace bnet