using System.Threading.Tasks; namespace Octokit { /// /// A client for GitHub's Git Commits API. /// /// /// See the Git Commits API documentation for more information. /// public class CommitsClient : ApiClient, ICommitsClient { /// /// Instantiates a new GitHub Git Commits API client. /// /// An API connection public CommitsClient(IApiConnection apiConnection) : base(apiConnection) { } /// /// Gets a commit for a given repository by sha reference /// /// /// http://developer.github.com/v3/git/commits/#get-a-commit /// /// The owner of the repository /// The name of the repository /// Tha sha reference of the commit /// public Task Get(string owner, string name, string reference) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); return ApiConnection.Get(ApiUrls.Commit(owner, name, reference), null, AcceptHeaders.SignatureVerificationPreview); } /// /// Create a commit for a given repository /// /// /// http://developer.github.com/v3/git/commits/#create-a-commit /// /// The owner of the repository /// The name of the repository /// The commit to create /// public Task Create(string owner, string name, NewCommit commit) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(commit, "commit"); return ApiConnection.Post(ApiUrls.CreateCommit(owner, name), commit); } } }