cpp Rest API master
C++ library for REST API access with Qt, Curl and cpp-httplib backends
 
Loading...
Searching...
No Matches
request.hpp
Go to the documentation of this file.
1
2#ifndef REQUEST_HPP
3#define REQUEST_HPP
4
5#include <cpp_restapi/version.hpp>
6
7#if !CPP_RESTAPI_HAS_GITHUB
8#error "cpp_restapi was built without GitHub helpers. Rebuild with -DCppRestAPI_GitHub=ON to use cpp_restapi::GitHub::Request."
9#endif
10
11#include <memory>
12#include <string>
13
15#include "cpp_restapi_export.h"
16
17
18namespace cpp_restapi::GitHub
19{
35 class CPP_RESTAPI_EXPORT Request
36 {
37 public:
38 explicit Request(std::unique_ptr<cpp_restapi::IConnection>);
39 Request(const Request &) = delete;
41
42 Request& operator=(const Request &) = delete;
43
51 std::string getUserInfo(const std::string& user);
52
61 std::string getReleases(const std::string& user, const std::string& repo);
62
72 std::string getRelease(const std::string& user, const std::string& repo, int id);
73
80 std::string getRateLimit();
81
89 std::string listUserRepo(const std::string& user);
90
91 // --------------- user info related api
92
98 std::string getAuthenticatedUser();
99
107 std::string listUsers();
108
116 std::string getUser(const std::string& username);
117
118 // issues related api methods
127 std::string issues();
128
136 std::string orgIssues(const std::string& org);
137
145 std::string listRepoIssues(const std::string& owner, const std::string& repo);
146
155 std::string getIssue(const std::string& owner, const std::string& repo, const std::string& issueNumber);
156
157 // pull request related api methods
165 std::string listPullRequest(const std::string& owner, const std::string& repo);
166
175 std::string getPullRequest(const std::string& owner, const std::string& repo, const std::string& pullNumber);
176
185 std::string listPullRequestCommit(const std::string& owner, const std::string& repo, const std::string& pullNumber);
186
197 std::string listPullRequestfiles(const std::string& owner, const std::string& repo, const std::string& pullNumber);
198
207 std::string isPRmerged(const std::string& owner, const std::string& repo, const std::string& pullNumber);
208
209 // commits related api methods
219 std::string listCommits(const std::string& owner, const std::string& repo);
220
230 std::string listBranchHeadCommit(const std::string& owner, const std::string& repo,const std::string& commitSha);
231
240 std::string listCommitPullRequest(const std::string& owner, const std::string& repo, const std::string& commitSha);
241
252 std::string getCommits(const std::string& owner, const std::string& repo, const std::string& reference);
253
254 // metrics related api methods
263 std::string getWeeklyCommit(const std::string& owner, const std::string& repo);
264
273 std::string getLastYearCommit(const std::string& owner, const std::string& repo);
274
288 std::string getcontributorsActivity(const std::string& owner, const std::string& repo);
289
300 std::string getCommitCount(const std::string& owner, const std::string& repo);
301
312 std::string getHourlyCommitCount(const std::string& owner, const std::string& repo);
313
325 std::string getCommunityProfileMetrics(const std::string& owner, const std::string& repo);
326
337 std::string getRepoClones(const std::string& owner, const std::string& repo);
338
347 std::string getRefferalPaths(const std::string& owner, const std::string& repo);
348
356 std::string getTopreferralSource(const std::string& owner, const std::string& repo);
357
366 std::string getPageViews(const std::string& owner, const std::string& repo);
367
368 // event related apis
377 std::string listNetworkRepoEvent(const std::string& owner, const std::string& repo);
378
385 std::string listOrgEvent(const std::string& org);
386
394 std::string listRepoEvent(const std::string& owner, const std::string& repo);
395
403 std::string listUserEvent(const std::string& username);
404
405 // staring related api methods
406
414 std::string listStargazers(const std::string& owner, const std::string& repo);
415
422 std::string listUserStarredRepo(const std::string& username);
423
424 // watching related api
425
433 std::string listRepoWatchers(const std::string& owner, const std::string& repo);
434
442 std::string getRepoSubscription(const std::string& owner, const std::string& repo);
443
450 std::string listUserWatchedRepos(const std::string& username);
451
463 std::string listRepoCollaborators(const std::string& owner, const std::string& repo);
464
471 std::string getOrgRepo(const std::string& org);
472
483 std::string getRepository(const std::string& owner, const std::string& repo);
484
492 std::string listAuthUserRepo();
493
503 std::string getRepoLang(const std::string& owner, const std::string& repo);
504
514 std::string repoContributors(const std::string& owner, const std::string& repo);
515
516 private:
517 std::unique_ptr<cpp_restapi::IConnection> m_connection;
518
519 std::string doRequest(const std::string &);
520 };
521}
522
523#endif // REQUEST_H
GitHub api actions.
Definition request.hpp:36
std::string listCommitPullRequest(const std::string &owner, const std::string &repo, const std::string &commitSha)
List pull requests associated with a commit.
std::string getcontributorsActivity(const std::string &owner, const std::string &repo)
Get all contributor commit activity.
std::string getRepoLang(const std::string &owner, const std::string &repo)
List repository languages.
std::string getRateLimit()
Request api limits.
std::string getRefferalPaths(const std::string &owner, const std::string &repo)
Get top referral paths.
std::string getUser(const std::string &username)
Provides publicly available information about someone with a GitHub account.
std::string getRepoClones(const std::string &owner, const std::string &repo)
Get repository clones.
std::string listRepoIssues(const std::string &owner, const std::string &repo)
List issues in a repository.
std::string listUserEvent(const std::string &username)
List events for the authenticated user.
Request(std::unique_ptr< cpp_restapi::IConnection >)
std::string getOrgRepo(const std::string &org)
List organization repositories.
Request(const Request &)=delete
std::string listPullRequest(const std::string &owner, const std::string &repo)
List pull request in a repository.
std::string getWeeklyCommit(const std::string &owner, const std::string &repo)
Get the weekly commit activity.
std::string repoContributors(const std::string &owner, const std::string &repo)
List repository contributors.
std::string listOrgEvent(const std::string &org)
List public organization events.
std::string getTopreferralSource(const std::string &owner, const std::string &repo)
Get top referral sources.
std::string getPullRequest(const std::string &owner, const std::string &repo, const std::string &pullNumber)
Lists details of a pull request by providing its number.
std::string getUserInfo(const std::string &user)
Request user info.
std::string listUsers()
Lists all users, in the order that they signed up on GitHub. This list includes personal user account...
std::string getHourlyCommitCount(const std::string &owner, const std::string &repo)
Get the hourly commit count for each day.
std::string listRepoCollaborators(const std::string &owner, const std::string &repo)
List repository collaborators.
std::string listNetworkRepoEvent(const std::string &owner, const std::string &repo)
List public events for a network of repositories.
std::string getPageViews(const std::string &owner, const std::string &repo)
Get page views. Get the total number of views and breakdown per day or week for the last 14 days.
std::string listAuthUserRepo()
List repositories for the authenticated user.
std::string getIssue(const std::string &owner, const std::string &repo, const std::string &issueNumber)
std::string isPRmerged(const std::string &owner, const std::string &repo, const std::string &pullNumber)
Check if a pull request has been merged.
std::string getRepoSubscription(const std::string &owner, const std::string &repo)
Get a repository subscription.
std::string getRelease(const std::string &user, const std::string &repo, int id)
Request release details.
std::string listCommits(const std::string &owner, const std::string &repo)
List commits.
std::string listPullRequestfiles(const std::string &owner, const std::string &repo, const std::string &pullNumber)
Responses include a maximum of 3000 files. The paginated response returns 30 files per page by defaul...
std::string issues()
List issues assigned to the authenticated user across all visible repositories including owned reposi...
std::string getCommunityProfileMetrics(const std::string &owner, const std::string &repo)
Get community profile metrics.
std::string listBranchHeadCommit(const std::string &owner, const std::string &repo, const std::string &commitSha)
List branches for HEAD commit.
Request & operator=(const Request &)=delete
std::string getAuthenticatedUser()
Get the authenticated user info.
std::string getLastYearCommit(const std::string &owner, const std::string &repo)
Get the last year of commit activity.
std::string getReleases(const std::string &user, const std::string &repo)
Request releases for repository.
std::string listStargazers(const std::string &owner, const std::string &repo)
Lists the people that have starred the repository.
std::string getCommitCount(const std::string &owner, const std::string &repo)
Get the weekly commit count.
std::string listPullRequestCommit(const std::string &owner, const std::string &repo, const std::string &pullNumber)
Lists a maximum of 250 commits for a pull request.
std::string listRepoWatchers(const std::string &owner, const std::string &repo)
Lists the people watching the specified repository.
std::string listRepoEvent(const std::string &owner, const std::string &repo)
List repository events.
std::string orgIssues(const std::string &org)
List issues in an organization assigned to the authenticated user.
std::string listUserWatchedRepos(const std::string &username)
List repositories watched by a user.
std::string getCommits(const std::string &owner, const std::string &repo, const std::string &reference)
Get a commit.
std::string listUserStarredRepo(const std::string &username)
List repositories starred by a user.
std::string listUserRepo(const std::string &user)
Request list of user repositories.
std::string getRepository(const std::string &owner, const std::string &repo)
Get a repository.
Definition connection_builder.hpp:14