added new overloads

This commit is contained in:
aedampir@gmail.com
2016-06-10 17:54:00 +07:00
parent 02c677d832
commit 9383756137
4 changed files with 122 additions and 0 deletions
@@ -2,6 +2,12 @@
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Git Blobs API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/git/blobs/">Git Blobs API documentation</a> for more information.
/// </remarks>
public interface IObservableBlobsClient
{
/// <summary>
@@ -17,6 +23,18 @@ namespace Octokit.Reactive
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
IObservable<Blob> Get(string owner, string name, string reference);
/// <summary>
/// Gets a single Blob by SHA.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#get-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The SHA of the blob</param>
/// <returns>The <see cref="Blob"/> for the specified SHA.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
IObservable<Blob> Get(int repositoryId, string reference);
/// <summary>
/// Creates a new Blob
/// </summary>
@@ -28,5 +46,16 @@ namespace Octokit.Reactive
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
IObservable<BlobReference> Create(string owner, string name, NewBlob newBlob);
/// <summary>
/// Creates a new Blob
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#create-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
IObservable<BlobReference> Create(int repositoryId, NewBlob newBlob);
}
}
@@ -3,6 +3,12 @@ using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
{
/// <summary>
/// A client for GitHub's Git Blobs API.
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/git/blobs/">Git Blobs API documentation</a> for more information.
/// </remarks>
public class ObservableBlobClient : IObservableBlobsClient
{
readonly IBlobsClient _client;
@@ -33,6 +39,22 @@ namespace Octokit.Reactive
return _client.Get(owner, name, reference).ToObservable();
}
/// <summary>
/// Gets a single Blob by SHA.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#get-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The SHA of the blob</param>
/// <returns>The <see cref="Blob"/> for the specified SHA.</returns>
public IObservable<Blob> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _client.Get(repositoryId, reference).ToObservable();
}
/// <summary>
/// Creates a new Blob
/// </summary>
@@ -51,5 +73,21 @@ namespace Octokit.Reactive
return _client.Create(owner, name, newBlob).ToObservable();
}
/// <summary>
/// Creates a new Blob
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#create-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
public IObservable<BlobReference> Create(int repositoryId, NewBlob newBlob)
{
Ensure.ArgumentNotNull(newBlob, "newBlob");
return _client.Create(repositoryId, newBlob).ToObservable();
}
}
}
+32
View File
@@ -38,6 +38,22 @@ namespace Octokit
return ApiConnection.Get<Blob>(ApiUrls.Blob(owner, name, reference));
}
/// <summary>
/// Gets a single Blob by SHA.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#get-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The SHA of the blob</param>
/// <returns>The <see cref="Blob"/> for the specified SHA.</returns>
public Task<Blob> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Get<Blob>(ApiUrls.Blob(repositoryId, reference));
}
/// <summary>
/// Creates a new Blob
/// </summary>
@@ -56,5 +72,21 @@ namespace Octokit
return ApiConnection.Post<BlobReference>(ApiUrls.Blobs(owner, name), newBlob);
}
/// <summary>
/// Creates a new Blob
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#create-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
public Task<BlobReference> Create(int repositoryId, NewBlob newBlob)
{
Ensure.ArgumentNotNull(newBlob, "newBlob");
return ApiConnection.Post<BlobReference>(ApiUrls.Blobs(repositoryId), newBlob);
}
}
}
+23
View File
@@ -23,6 +23,18 @@ namespace Octokit
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
Task<Blob> Get(string owner, string name, string reference);
/// <summary>
/// Gets a single Blob by SHA.
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#get-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The SHA of the blob</param>
/// <returns>The <see cref="Blob"/> for the specified SHA.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
Task<Blob> Get(int repositoryId, string reference);
/// <summary>
/// Creates a new Blob
/// </summary>
@@ -34,5 +46,16 @@ namespace Octokit
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
Task<BlobReference> Create(string owner, string name, NewBlob newBlob);
/// <summary>
/// Creates a new Blob
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/blobs/#create-a-blob
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="newBlob">The new Blob</param>
/// <returns>The <see cref="Blob"/> that was just created.</returns>
Task<BlobReference> Create(int repositoryId, NewBlob newBlob);
}
}