diff options
Diffstat (limited to 'bot/src/api/kick.hpp')
| -rw-r--r-- | bot/src/api/kick.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bot/src/api/kick.hpp b/bot/src/api/kick.hpp new file mode 100644 index 0000000..9b29b24 --- /dev/null +++ b/bot/src/api/kick.hpp @@ -0,0 +1,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; + }; +}
\ No newline at end of file |
