GitWatcherBot  1.0.0
A Telegram Bot that notifies you when a new change is made in your repositories (issues, pull requests, stars, forks, and watches)
All Classes Namespaces Files Functions Variables Typedefs Macros
GitApi.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <exception>
3 #include <regex>
4 #include <sstream>
5 #include <stdexcept>
6 #include <optional>
7 #include <string>
8 #include <nlohmann/json.hpp>
9 #include <cpr/cpr.h>
10 #include "db/Database.hpp"
11 #include "log/Logger.hpp"
12 namespace nl = nlohmann;
13 
15 
17 struct GitApiRateLimitExceededException : std::runtime_error {
18  explicit GitApiRateLimitExceededException(const std::string& msg) : std::runtime_error(msg) {}
19 };
20 
22 struct GitApiRepositoryNotFoundException : std::runtime_error {
23  explicit GitApiRepositoryNotFoundException(const std::string& msg) : std::runtime_error(msg) {}
24 };
25 
26 class GitApi {
27 public:
28  GitApi() = default;
29  ~GitApi() = default;
30 
32  models::Repository getRepository(const std::string& repositoryFullName = "torvalds/linux");
33 
34 };
models::Repository getRepository(const std::string &repositoryFullName="torvalds/linux")
Returns Repository information by fullname from GitHub Api.
GitApi()=default
~GitApi()=default
<! must include Database with Logger for models::Log & Database::addLog
Definition: GitApi.hpp:17
GitApiRateLimitExceededException(const std::string &msg)
Definition: GitApi.hpp:18
Thrown when requested repository doesn't exist.
Definition: GitApi.hpp:22
GitApiRepositoryNotFoundException(const std::string &msg)
Definition: GitApi.hpp:23