Skip to content
This repository was archived by the owner on Jun 9, 2024. It is now read-only.

Latest commit

 

History

History
93 lines (70 loc) · 2.91 KB

Documentation.MD

File metadata and controls

93 lines (70 loc) · 2.91 KB

Documentation

Abstractions

In GitGrabber, entities are abstracted to interfaces, which means that to use a given entity obtained from a method, you will have to perform an explicit conversion - since the same interface may, in the future, aggregate different entities.

Example:

var myUser = (GithubUser)_connection.GetUser("octocat");
Console.WriteLine(myUser.Login);

//Output: "octocat"

Setting up a GithubConnection

To connect to the Github API properly, it is necessary to instantiate a new GithubConnection using username and token.

You also need to instantiate a new GithubConnector.

Example:

var _connector = new GithubConnector();
var _connection = new GithubConnection([username], [token], _connector);

Retrieving informations

GithubConnection aggregates several methods to get data:

(GithubUser) connection.GetUser(string username)
(GithubUser) await connection.GetUserAsync(string username)
(List<GithubUser>) connection.GetUserFollowers(string username)
(List<GithubUser>) await connection.GetUserFollowersAsync(string username)
(List<GithubUser>) connection.GetUserFollowing(string username)
(List<GithubUser>) await connection.GetUserFollowingAsync(string username)
(List<GithubRepository>) connection.GetUserRepositories(string username)
(List<GithubRepository>) await connection.GetUserRepositoriesAsync(string username)
(List<GithubOrganization>) connection.GetUserOrganizations(string username)
(List<GithubOrganization>) await connection.GetUserOrganizationsAsync(string username)
(GithubOrganization) connection.GetOrganization(string organization)
(GithubOrganization) await connection.GetOrganizationAsync(string organization)
(List<GithubRepository>) connection.GetOrganizationRepositories(string organization)
(List<GithubRepository>) await connection.GetOrganizationRepositoriesAsync(string organization)
(GithubGist) connection.GetGist(long id)
(GithubGist) await connection.GetGistAsync(long id)
(GithubRepository) connection.GetRepository(string ownerUsername, string repositoryName)
(GithubRepository) await connection.GetRepositoryAsync(string ownerUsername, string repositoryName)
(List<GithubCommit>) connection.GetRepositoryCommits(string ownerUsername, string repositoryName)
(List<GithubCommit>) await connection.GetRepositoryCommitsAsync(string ownerUsername, string repositoryName)
(GithubEmojis) connection.GetEmojis()
(GithubEmojis) await connection.GetEmojisAsync()

Testing

You can change or execute the automated tests by yourself in GitGrabber.Tests, but you need to feed the "githubConfig.json" file with valid login informations in order to connect to the Github API.