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)
Loading...
Searching...
No Matches
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"
12namespace nl = nlohmann;
13
15
17struct GitApiRateLimitExceededException : std::runtime_error {
18 explicit GitApiRateLimitExceededException(const std::string& msg) : std::runtime_error(msg) {}
19};
20
22struct GitApiRepositoryNotFoundException : std::runtime_error {
23 explicit GitApiRepositoryNotFoundException(const std::string& msg) : std::runtime_error(msg) {}
24};
25
26class GitApi {
27public:
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