Skip to content

briandowns/libgithub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libgithub

Build and Deploy

libgithub is a C client library for accessing the Github REST API and has been tested on Linux (Debian variants), MacOS, and FreeBSD with GCC and Clang, amd64 and arm64 architectures.

Usage

To initialize the library, the user's github token is required.

gh_client_init(token);

Clean up after use.

gh_client_free();

Error Handling

If an error occurs during the call, the error will be put into the response->err_msg field and response->resp will be set to NULL.

gh_client_response_t *res = gh_client_repo_release_by_tag("briandowns", "spinner", "v1.29.16");
if (res->err_msg != NULL) {
    fprintf(stderr, "%s\n", res->err_msg);
    gh_client_response_free(res);
}

Build shared object

To build the shared object:

make install

Example

Build the example:

make example

API Coverage

  • API response data is returned in a string containing JSON.
  • The caller is responsible for how to handle the data.
  • List calls support pagination.
  • Each response from the API includes rate limit data.

Repositories

  • List repositories
  • Retrieve a repository
  • Create repository
  • Update repository
  • Delete repository
  • List languages in repository

Branches

  • List branches
  • Get a branch
  • Rename a branch
  • Sync to an upstream
  • Merge a branch

Commits

  • List commits
  • Get a commit
  • Compare commits
  • Get PR from commit

Pull Requests

  • List pull requests
  • Get a pull request by id
  • Create a pull request
  • Update a pull request
  • List pull request files
  • Check if pull request has been merged
  • Merge a pull request
  • Update a pull request branch

Release

  • List releases
  • Create a release
  • Generate release notes
  • Get latest
  • Get by tag
  • Get by id
  • Update a release
  • Delete a release
Assets
  • List release assets
  • Get a release asset
  • Update a release asset
  • Delete a release asset
  • Upload a release asset

Stargazers

  • List stargazers

Issues

  • List issues assigned to logged in user
  • List issues by repository
  • Create an issue
  • Get by id
  • Update an issue
  • Lock issue
  • Unlock issue

Users

  • Get info for logged in user
  • Get info for user by id
  • Get hovercard info
  • List blocked users
  • Block a user
  • Unblock a user
  • List followers
  • Get rate limit info for auth'd user
  • List starred repositories
  • List user repositories

Metrics

  • Community Profile Metrics
  • Repository Clones data
  • Top 10 referral paths
  • Top referral sources
  • Number of page views

Activity

  • List events by organization
  • List events by user

Billing

  • Get action billing by org

Code of Conduct

  • Get all codes of conduct
  • Get a code of conduct by key

Requirements / Dependencies

  • libcurl

Contributing

Please feel free to open a PR!

Contact

Brian Downs @bdowns328

License

BSD 2 Clause License.