cpp Rest API
Loading...
Searching...
No Matches
cpp_restapi::GitHub::Request Class Reference

GitHub api actions. More...

#include <request.hpp>

Public Member Functions

 Request (std::shared_ptr< cpp_restapi::IConnection >)
 
 Request (const Request &)=delete
 
 ~Request ()
 
Requestoperator= (const Request &)=delete
 
std::string getUserInfo (const std::string &user)
 Request user info.
 
std::string getReleases (const std::string &user, const std::string &repo)
 Request releases for repository.
 
std::string getRelease (const std::string &user, const std::string &repo, int id)
 Request release details.
 
std::string getRateLimit ()
 Request api limits.
 
std::string listUserRepo (const std::string &user)
 Request list of user repositories.
 
std::string getAuntenticatedUser ()
 get the authenticated user info
 
std::string listUsers ()
 Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.
 
std::string getUser (const std::string &username)
 Provides publicly available information about someone with a GitHub account.
 
std::string issues ()
 List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories.
 
std::string orgIssues (const std::string &org)
 List issues in an organization assigned to the authenticated user.
 
std::string listRepoIssues (const std::string &owner, const std::string &repo)
 List issues in a repository.
 
std::string getIssue (const std::string &owner, const std::string &repo, const std::string &issueNumber)
 
std::string listPullRequest (const std::string &owner, const std::string &repo)
 List pull request in a repository.
 
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 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 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 default.
 
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 listCommits (const std::string &owner, const std::string &repo)
 List commits.
 
std::string listBranchHeadCommit (const std::string &owner, const std::string &repo, const std::string &commitSha)
 List branches for HEAD commit.
 
std::string listCommitPullRequest (const std::string &owner, const std::string &repo, const std::string &commitSha)
 List pull requests associated with a commit.
 
std::string getCommits (const std::string &owner, const std::string &repo, const std::string &reference)
 Get a commit.
 
std::string getWeeklyCommit (const std::string &owner, const std::string &repo)
 Get the weekly commit activity.
 
std::string getLastYearCommit (const std::string &owner, const std::string &repo)
 Get the last year of commit activity.
 
std::string getcontributorsActivity (const std::string &owner, const std::string &repo)
 Get all contributor commit activity.
 
std::string getCommitCount (const std::string &owner, const std::string &repo)
 Get the weekly commit count.
 
std::string getHourlyCommitCount (const std::string &owner, const std::string &repo)
 Get the hourly commit count for each day.
 
std::string getCommunityProfileMetrics (const std::string &owner, const std::string &repo)
 Get community profile metrics.
 
std::string getRepoClones (const std::string &owner, const std::string &repo)
 Get repository clones.
 
std::string getRefferalPaths (const std::string &owner, const std::string &repo)
 Get top referral paths.
 
std::string getTopreferralSource (const std::string &owner, const std::string &repo)
 Get top referral sources.
 
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 listNetworkRepoEvent (const std::string &owner, const std::string &repo)
 List public events for a network of repositories.
 
std::string listOrgEvent (const std::string &org)
 List public organization events.
 
std::string listRepoEvent (const std::string &owner, const std::string &repo)
 List repository events.
 
std::string listUserEvent (const std::string &username)
 List events for the authenticated user.
 
std::string listStargazers (const std::string &owner, const std::string &repo)
 Lists the people that have starred the repository.
 
std::string listUserStarredRepo (const std::string &username)
 List repositories starred by a user.
 
std::string listRepoWatchers (const std::string &owner, const std::string &repo)
 Lists the people watching the specified repository.
 
std::string getRepoSubscription (const std::string &owner, const std::string &repo)
 Get a repository subscription.
 
std::string listUserWatchedRepos (const std::string &username)
 List repositories watched by a user.
 
std::string listRepoCollaborators (const std::string &owner, const std::string &repo)
 List repository collaborators.
 
std::string getOrgRepo (const std::string &org)
 List organization repositories.
 
std::string getRepository (const std::string &owner, const std::string &repo)
 Get a repository.
 
std::string listAuthUserRepo ()
 List repositories for the authenticated user.
 
std::string getRepoLang (const std::string &owner, const std::string &repo)
 List repository languages.
 
std::string repoContributors (const std::string &owner, const std::string &repo)
 List repository contributors.
 

Detailed Description

GitHub api actions.

Class contains a convenient set of actions which can be executed on GitHub's api.

Before one can use it a connection with github needs to be established. Use cpp_restapi::GitHub::ConnectionBuilder to construct a cpp_restapi::IConnection object.

All methods return a response in json format.

Constructor & Destructor Documentation

◆ Request() [1/2]

cpp_restapi::GitHub::Request::Request ( std::shared_ptr< cpp_restapi::IConnection > )

◆ Request() [2/2]

cpp_restapi::GitHub::Request::Request ( const Request & )
delete

◆ ~Request()

cpp_restapi::GitHub::Request::~Request ( )

Member Function Documentation

◆ getAuntenticatedUser()

std::string cpp_restapi::GitHub::Request::getAuntenticatedUser ( )

get the authenticated user info

Returns
std::string json std::string response

◆ getCommitCount()

std::string cpp_restapi::GitHub::Request::getCommitCount ( const std::string & owner,
const std::string & repo )

Get the weekly commit count.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
The total commit counts for the owner and total commit counts in all. All is everyone combined, including the owner in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract owner from all.

◆ getCommits()

std::string cpp_restapi::GitHub::Request::getCommits ( const std::string & owner,
const std::string & repo,
const std::string & reference )

Get a commit.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
referenceref parameter
Returns
Returns the contents of a single commit reference. You must have read access for the repository to use this endpoint.

◆ getCommunityProfileMetrics()

std::string cpp_restapi::GitHub::Request::getCommunityProfileMetrics ( const std::string & owner,
const std::string & repo )

Get community profile metrics.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
all community profile metrics, including an overall health score, repository description, the presence of documentation detected code of conduct, detected license,and the presence of ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE,README, and CONTRIBUTING files

◆ getcontributorsActivity()

std::string cpp_restapi::GitHub::Request::getcontributorsActivity ( const std::string & owner,
const std::string & repo )

Get all contributor commit activity.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
std::string Returns the total number of commits authored by the contributor. In addition, the response includes a Weekly Hash (weeks array) with the following information: w - Start of the week, given as a Unix timestamp. a - Number of additions d - Number of deletions c - Number of commits

◆ getHourlyCommitCount()

std::string cpp_restapi::GitHub::Request::getHourlyCommitCount ( const std::string & owner,
const std::string & repo )

Get the hourly commit count for each day.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
std::string Returns array containing the day number, hour number, and number of commits: For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays

◆ getIssue()

std::string cpp_restapi::GitHub::Request::getIssue ( const std::string & owner,
const std::string & repo,
const std::string & issueNumber )
Parameters
ownerThe account owner of the repository.
repothe name of the repository.
issueNumberThe number that identifies the issue.
Returns
std::string all info associated with the issue

◆ getLastYearCommit()

std::string cpp_restapi::GitHub::Request::getLastYearCommit ( const std::string & owner,
const std::string & repo )

Get the last year of commit activity.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
std::string Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday

◆ getOrgRepo()

std::string cpp_restapi::GitHub::Request::getOrgRepo ( const std::string & org)

List organization repositories.

Parameters
orgThe organization name
Returns
Lists repositories for the specified organization.

◆ getPageViews()

std::string cpp_restapi::GitHub::Request::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.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
std::string Get the top 10 referrers over the last 14 days.

◆ getPullRequest()

std::string cpp_restapi::GitHub::Request::getPullRequest ( const std::string & owner,
const std::string & repo,
const std::string & pullNumber )

Lists details of a pull request by providing its number.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
pullNumberThe number that identifies the PR.
Returns
std::string, all info associated with the PR

◆ getRateLimit()

std::string cpp_restapi::GitHub::Request::getRateLimit ( )

Request api limits.

Returns
api response in json format

Request limits for api calls. Equivalent of fetching https://api.github.com/rate_limit

◆ getRefferalPaths()

std::string cpp_restapi::GitHub::Request::getRefferalPaths ( const std::string & owner,
const std::string & repo )

Get top referral paths.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
return lists of the top 10 popular contents over the last 14 days.

◆ getRelease()

std::string cpp_restapi::GitHub::Request::getRelease ( const std::string & user,
const std::string & repo,
int id )

Request release details.

Parameters
userGitHub user name
repouser's repository name
idrelease id. Id is returned as a part of getReleases
Returns
api response in json format

Request details of release. Equivalent of fetching https://api.github.com/repos/<user>/<repo>/releases/<id>

◆ getReleases()

std::string cpp_restapi::GitHub::Request::getReleases ( const std::string & user,
const std::string & repo )

Request releases for repository.

Parameters
userGitHub user name
repouser's repository name
Returns
api response in json format

Request list of releases for repository. Equivalent of fetching https://api.github.com/repos/<user>/<repo>/releases

◆ getRepoClones()

std::string cpp_restapi::GitHub::Request::getRepoClones ( const std::string & owner,
const std::string & repo )

Get repository clones.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
return Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.

◆ getRepoLang()

std::string cpp_restapi::GitHub::Request::getRepoLang ( const std::string & owner,
const std::string & repo )

List repository languages.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.

◆ getRepository()

std::string cpp_restapi::GitHub::Request::getRepository ( const std::string & owner,
const std::string & repo )

Get a repository.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
The parent and source objects are present when the repository is a fork. parent is the repository this repository was forked from, source is the ultimate source for the network.

◆ getRepoSubscription()

std::string cpp_restapi::GitHub::Request::getRepoSubscription ( const std::string & owner,
const std::string & repo )

Get a repository subscription.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
list of users subscribe to the repository

◆ getTopreferralSource()

std::string cpp_restapi::GitHub::Request::getTopreferralSource ( const std::string & owner,
const std::string & repo )

Get top referral sources.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
std::string Get the top 10 referrers over the last 14 days.

◆ getUser()

std::string cpp_restapi::GitHub::Request::getUser ( const std::string & username)

Provides publicly available information about someone with a GitHub account.

Parameters
usernamegithub user name
Returns
std::string

◆ getUserInfo()

std::string cpp_restapi::GitHub::Request::getUserInfo ( const std::string & user)

Request user info.

Parameters
userGitHub user name
Returns
api response in json format

Request user information. Equivalent of fetching https://api.github.com/users/<user>

◆ getWeeklyCommit()

std::string cpp_restapi::GitHub::Request::getWeeklyCommit ( const std::string & owner,
const std::string & repo )

Get the weekly commit activity.

Parameters
ownerThe account owner of the repository.
repothe name of the repository.
Returns
a weekly aggregate of the number of additions and deletions pushed to a repository.

◆ isPRmerged()

std::string cpp_restapi::GitHub::Request::isPRmerged ( const std::string & owner,
const std::string & repo,
const std::string & pullNumber )

Check if a pull request has been merged.

Parameters
ownerThe account owner of the repository.
repothe name of the repository
pullNumberThe number that identifies the PR.
Returns
std::string, Status: 204 if if pull request has been merged

◆ issues()

std::string cpp_restapi::GitHub::Request::issues ( )

List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories.

Returns
std::string list of issues assigned to the user

◆ listAuthUserRepo()

std::string cpp_restapi::GitHub::Request::listAuthUserRepo ( )

List repositories for the authenticated user.

Returns
Lists repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access.

◆ listBranchHeadCommit()

std::string cpp_restapi::GitHub::Request::listBranchHeadCommit ( const std::string & owner,
const std::string & repo,
const std::string & commitSha )

List branches for HEAD commit.

Parameters
ownerThe account owner of the repository.
repothe name of the repository
commitShaThe SHA of the commit.
Returns
All branches where the given commit SHA is the HEAD, or latest commit for the branch.

◆ listCommitPullRequest()

std::string cpp_restapi::GitHub::Request::listCommitPullRequest ( const std::string & owner,
const std::string & repo,
const std::string & commitSha )

List pull requests associated with a commit.

Parameters
ownerThe account owner of the repository.
repothe name of the repository
commitShaThe SHA of the commit.
Returns
All open,closed pull requests associated with the commit.

◆ listCommits()

std::string cpp_restapi::GitHub::Request::listCommits ( const std::string & owner,
const std::string & repo )

List commits.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
The response will include a verification object that describes the result of verifying the commit's signature. returns list of objects

◆ listNetworkRepoEvent()

std::string cpp_restapi::GitHub::Request::listNetworkRepoEvent ( const std::string & owner,
const std::string & repo )

List public events for a network of repositories.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
public event associated with repo

◆ listOrgEvent()

std::string cpp_restapi::GitHub::Request::listOrgEvent ( const std::string & org)

List public organization events.

Parameters
orgThe organization name.
Returns
public event associated with repo

◆ listPullRequest()

std::string cpp_restapi::GitHub::Request::listPullRequest ( const std::string & owner,
const std::string & repo )

List pull request in a repository.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
std::string list of pull request associated with owner

◆ listPullRequestCommit()

std::string cpp_restapi::GitHub::Request::listPullRequestCommit ( const std::string & owner,
const std::string & repo,
const std::string & pullNumber )

Lists a maximum of 250 commits for a pull request.

Parameters
ownerThe account owner of the repository.
repothe name of the repository
pullNumberThe number that identifies the PR.
Returns
std::string, Lists up to 250 commits for a pull request

◆ listPullRequestfiles()

std::string cpp_restapi::GitHub::Request::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 default.

Parameters
ownerThe account owner of the repository.
repothe name of the repository
pullNumberThe number that identifies the PR.
Returns
std::string, list of dict with details of each committed file

◆ listRepoCollaborators()

std::string cpp_restapi::GitHub::Request::listRepoCollaborators ( const std::string & owner,
const std::string & repo )

List repository collaborators.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners

◆ listRepoEvent()

std::string cpp_restapi::GitHub::Request::listRepoEvent ( const std::string & owner,
const std::string & repo )

List repository events.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
public event associated with repo

◆ listRepoIssues()

std::string cpp_restapi::GitHub::Request::listRepoIssues ( const std::string & owner,
const std::string & repo )

List issues in a repository.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
std::string list of isues associated with owner

◆ listRepoWatchers()

std::string cpp_restapi::GitHub::Request::listRepoWatchers ( const std::string & owner,
const std::string & repo )

Lists the people watching the specified repository.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
list of github account watching the repository

◆ listStargazers()

std::string cpp_restapi::GitHub::Request::listStargazers ( const std::string & owner,
const std::string & repo )

Lists the people that have starred the repository.

Parameters
ownerThe account owner of the repository.
repoThe name of the repository.
Returns
returns Lists of people that have starred the repository.

◆ listUserEvent()

std::string cpp_restapi::GitHub::Request::listUserEvent ( const std::string & username)

List events for the authenticated user.

Parameters
usernameThe handle for the GitHub user account
Returns
If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.

◆ listUserRepo()

std::string cpp_restapi::GitHub::Request::listUserRepo ( const std::string & user)

Request list of user repositories.

Parameters
userGitHub user name
Returns
api response in json format

Request list of repositories for user. Equivalent of fetching https://api.github.com/users/<user>/repos

◆ listUsers()

std::string cpp_restapi::GitHub::Request::listUsers ( )

Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.

Returns
std::string list of gitub account

◆ listUserStarredRepo()

std::string cpp_restapi::GitHub::Request::listUserStarredRepo ( const std::string & username)

List repositories starred by a user.

Parameters
usernameThe handle for the GitHub user account
Returns
returns a list of repositories a user has starred

◆ listUserWatchedRepos()

std::string cpp_restapi::GitHub::Request::listUserWatchedRepos ( const std::string & username)

List repositories watched by a user.

Parameters
usernameThe handle for the GitHub user account
Returns
Lists repositories a user is watching.

◆ operator=()

Request & cpp_restapi::GitHub::Request::operator= ( const Request & )
delete

◆ orgIssues()

std::string cpp_restapi::GitHub::Request::orgIssues ( const std::string & org)

List issues in an organization assigned to the authenticated user.

Parameters
orggithub organization
Returns
std::string

◆ repoContributors()

std::string cpp_restapi::GitHub::Request::repoContributors ( const std::string & owner,
const std::string & repo )

List repository contributors.

Parameters
ownerThe account owner of the repository
repoThe name of the repository
Returns
Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order

The documentation for this class was generated from the following file: