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

namespace bnet {
enum class GameMode { constructed, battlegrounds, mercenaries };

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 GameMode &iGameMode);
    void setPage(const std::string &iPage);
    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:
    static constexpr std::string kLOCALE_KEY{"locale"};
    static constexpr std::string kGAME_MODE_KEY{"gameMode"};
    static constexpr std::string kPAGE_KEY{"page"};
    static constexpr std::string kPAGE_SIZE_KEY{"pageSize"};
    std::string mContentType;
    std::string mRegion;
    std::unordered_map<std::string, std::string> aParameters;

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