summaryrefslogtreecommitdiff
path: root/bot/src/api/twitch/schemas/stream.hpp
blob: 69f4642b8ac6baa68765763cef6bf36fd4f2ec3c (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 <chrono>
#include <string>

#include "../../../utils/chrono.hpp"

namespace bot::api::twitch::schemas {
  class Stream {
    public:
      Stream(int user_id, std::string user_login, std::string game_name,
             std::string title, std::string started_at)
          : user_id(user_id),
            user_login(user_login),
            game_name(game_name),
            title(title),
            started_at(utils::chrono::string_to_time_point(
                started_at, "%Y-%m-%dT%H:%M:%SZ")) {}

      Stream(int user_id, std::string user_login, std::string game_name,
             std::string title)
          : user_id(user_id),
            user_login(user_login),
            game_name(game_name),
            title(title) {}

      Stream(int user_id) : user_id(user_id) {}

      const int &get_user_id() const { return this->user_id; }
      const std::string &get_user_login() const { return this->user_login; }
      const std::string &get_game_name() const { return this->game_name; }
      const std::string &get_title() const { return this->title; }
      const std::chrono::system_clock::time_point &get_started_at() const {
        return this->started_at;
      }

    private:
      int user_id;
      std::string user_login, game_name, title;
      std::chrono::system_clock::time_point started_at;
  };
}