blob: e1544e88d1e45bb59ec770e95ea87cbbff1d2a10 (
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
|
#include <chrono>
#include <string>
class Token {
public:
Token(const std::string &iTokenFilePath, const std::string &iUsername, const std::string &iPassword);
std::string toString() const;
private:
const std::string mFilePath; //!< Path to the token file
const std::string mToken; //!< Token value
const std::string mUsername; //!< Username for Battle.net API
const std::string mPassword; //!< Password for Battle.net API
std::string getValidToken() const;
void refreshToken() const;
void writeNewTokenToFile() const;
void writeTokenToFile(const std::string &iToken) const;
std::string getValidTokenWithApi() const;
std::chrono::seconds getCurrentTime() const;
std::string extractFirstMatchRegex(const std::string &t_str, const std::string &t_regex) const;
static size_t curlCallbackStringOutput(void *t_contents, size_t t_size, size_t t_nmemb, std::string *t_s);
friend class TokenTests;
};
|