blob: 9b29b24d7cf3e55221add78092d78b7613f3a191 (
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
|
#pragma once
#include <chrono>
#include <string>
#include <vector>
namespace bot::api {
struct KickChannel {
int broadcaster_user_id;
std::string slug, stream_title, stream_game_name;
bool is_live;
std::chrono::system_clock::time_point start_time;
};
class KickAPIClient {
public:
KickAPIClient(const std::string &client_id,
const std::string &client_secret)
: client_id(client_id), client_secret(client_secret) {
this->authorize();
};
~KickAPIClient() = default;
std::vector<KickChannel> get_channels(const std::vector<int> &ids) const;
std::vector<KickChannel> get_channels(const std::string &slug) const;
void refresh_token_thread();
private:
void authorize();
std::string authorization_key;
int expires_in;
long token_acquired_timestamp;
const std::string base_url = "https://api.kick.com", client_id,
client_secret;
};
}
|