added new overloads

This commit is contained in:
aedampir@gmail.com
2016-06-10 23:32:36 +07:00
parent 11dd7e5869
commit 254ad67bd4
4 changed files with 112 additions and 0 deletions
@@ -25,6 +25,19 @@ namespace Octokit.Reactive
Justification = "Method makes a network request")]
IObservable<Commit> Get(string owner, string name, string reference);
/// <summary>
/// Gets a commit for a given repository by sha reference
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#get-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">Tha sha reference of the commit</param>
/// <returns>A <see cref="Commit"/> representing commit for specified repository and reference</returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Commit> Get(int repositoryId, string reference);
/// <summary>
/// Create a commit for a given repository
/// </summary>
@@ -36,5 +49,16 @@ namespace Octokit.Reactive
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="IObservable{Commit}"/> of <see cref="Commit"/> representing created commit for specified repository</returns>
IObservable<Commit> Create(string owner, string name, NewCommit commit);
/// <summary>
/// Create a commit for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#create-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="IObservable{Commit}"/> of <see cref="Commit"/> representing created commit for specified repository</returns>
IObservable<Commit> Create(int repositoryId, NewCommit commit);
}
}
@@ -39,6 +39,22 @@ namespace Octokit.Reactive
return _client.Get(owner, name, reference).ToObservable();
}
/// <summary>
/// Gets a commit for a given repository by sha reference
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#get-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">Tha sha reference of the commit</param>
/// <returns>A <see cref="Commit"/> representing commit for specified repository and reference</returns>
public IObservable<Commit> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _client.Get(repositoryId, reference).ToObservable();
}
/// <summary>
/// Create a commit for a given repository
/// </summary>
@@ -57,5 +73,21 @@ namespace Octokit.Reactive
return _client.Create(owner, name, commit).ToObservable();
}
/// <summary>
/// Create a commit for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#create-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="IObservable{Commit}"/> of <see cref="Commit"/> representing created commit for specified repository</returns>
public IObservable<Commit> Create(int repositoryId, NewCommit commit)
{
Ensure.ArgumentNotNull(commit, "commit");
return _client.Create(repositoryId, commit).ToObservable();
}
}
}
+32
View File
@@ -38,6 +38,22 @@ namespace Octokit
return ApiConnection.Get<Commit>(ApiUrls.Commit(owner, name, reference), null, AcceptHeaders.SignatureVerificationPreview);
}
/// <summary>
/// Gets a commit for a given repository by sha reference
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#get-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">Tha sha reference of the commit</param>
/// <returns>A <see cref="Commit"/> representing commit for specified repository and reference</returns>
public Task<Commit> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Get<Commit>(ApiUrls.Commit(repositoryId, reference));
}
/// <summary>
/// Create a commit for a given repository
/// </summary>
@@ -56,5 +72,21 @@ namespace Octokit
return ApiConnection.Post<Commit>(ApiUrls.CreateCommit(owner, name), commit);
}
/// <summary>
/// Create a commit for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#create-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="Commit"/> representing created commit for specified repository</returns>
public Task<Commit> Create(int repositoryId, NewCommit commit)
{
Ensure.ArgumentNotNull(commit, "commit");
return ApiConnection.Post<Commit>(ApiUrls.CreateCommit(repositoryId), commit);
}
}
}
+24
View File
@@ -25,6 +25,19 @@ namespace Octokit
Justification = "Method makes a network request")]
Task<Commit> Get(string owner, string name, string reference);
/// <summary>
/// Gets a commit for a given repository by sha reference
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#get-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">Tha sha reference of the commit</param>
/// <returns>A <see cref="Commit"/> representing commit for specified repository and reference</returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Commit> Get(int repositoryId, string reference);
/// <summary>
/// Create a commit for a given repository
/// </summary>
@@ -36,5 +49,16 @@ namespace Octokit
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="Commit"/> representing created commit for specified repository</returns>
Task<Commit> Create(string owner, string name, NewCommit commit);
/// <summary>
/// Create a commit for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/commits/#create-a-commit
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="commit">The commit to create</param>
/// <returns>A <see cref="Commit"/> representing created commit for specified repository</returns>
Task<Commit> Create(int repositoryId, NewCommit commit);
}
}