mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
added new overloads
modified XML docs a little bit
This commit is contained in:
@@ -2,6 +2,12 @@ using System;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Git Trees API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/git/trees/">Git Trees API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public interface IObservableTreesClient
|
||||
{
|
||||
/// <summary>
|
||||
@@ -17,6 +23,18 @@ namespace Octokit.Reactive
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
|
||||
IObservable<TreeResponse> Get(string owner, string name, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#get-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
|
||||
IObservable<TreeResponse> Get(int repositoryId, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
@@ -29,6 +47,17 @@ namespace Octokit.Reactive
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
IObservable<TreeResponse> GetRecursive(string owner, string name, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
IObservable<TreeResponse> GetRecursive(int repositoryId, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
@@ -40,5 +69,16 @@ namespace Octokit.Reactive
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
IObservable<TreeResponse> Create(string owner, string name, NewTree newTree);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#create-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
IObservable<TreeResponse> Create(int repositoryId, NewTree newTree);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,12 @@ using System.Reactive.Threading.Tasks;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Git Trees API.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/git/trees/">Git Trees API documentation</a> for more information.
|
||||
/// </remarks>
|
||||
public class ObservableTreesClient : IObservableTreesClient
|
||||
{
|
||||
readonly ITreesClient _client;
|
||||
@@ -33,6 +39,22 @@ namespace Octokit.Reactive
|
||||
return _client.Get(owner, name, reference).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#get-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
public IObservable<TreeResponse> Get(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return _client.Get(repositoryId, reference).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
@@ -52,6 +74,22 @@ namespace Octokit.Reactive
|
||||
return _client.GetRecursive(owner, name, reference).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
public IObservable<TreeResponse> GetRecursive(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return _client.GetRecursive(repositoryId, reference).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
@@ -70,5 +108,21 @@ namespace Octokit.Reactive
|
||||
|
||||
return _client.Create(owner, name, newTree).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#create-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
public IObservable<TreeResponse> Create(int repositoryId, NewTree newTree)
|
||||
{
|
||||
Ensure.ArgumentNotNull(newTree, "newTree");
|
||||
|
||||
return _client.Create(repositoryId, newTree).ToObservable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,18 @@ namespace Octokit
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
|
||||
Task<TreeResponse> Get(string owner, string name, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#get-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
|
||||
Task<TreeResponse> Get(int repositoryId, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
@@ -35,6 +47,17 @@ namespace Octokit
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
Task<TreeResponse> GetRecursive(string owner, string name, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
Task<TreeResponse> GetRecursive(int repositoryId, string reference);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
@@ -46,5 +69,16 @@ namespace Octokit
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
Task<TreeResponse> Create(string owner, string name, NewTree newTree);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#create-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
Task<TreeResponse> Create(int repositoryId, NewTree newTree);
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,22 @@ namespace Octokit
|
||||
return ApiConnection.Get<TreeResponse>(ApiUrls.Tree(owner, name, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#get-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
public Task<TreeResponse> Get(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<TreeResponse>(ApiUrls.Tree(repositoryId, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
@@ -59,6 +75,22 @@ namespace Octokit
|
||||
return ApiConnection.Get<TreeResponse>(ApiUrls.TreeRecursive(owner, name, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Tree Response for a given SHA.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/git/trees/#get-a-tree-recursively
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="reference">The SHA that references the tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> for the specified Tree.</returns>
|
||||
public Task<TreeResponse> GetRecursive(int repositoryId, string reference)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
|
||||
|
||||
return ApiConnection.Get<TreeResponse>(ApiUrls.TreeRecursive(repositoryId, reference));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
@@ -82,5 +114,26 @@ namespace Octokit
|
||||
|
||||
return ApiConnection.Post<TreeResponse>(ApiUrls.Tree(owner, name), newTree);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Tree in the specified repo
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/git/trees/#create-a-tree
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The ID of the repository</param>
|
||||
/// <param name="newTree">The value of the new tree</param>
|
||||
/// <returns>The <see cref="TreeResponse"/> that was just created.</returns>
|
||||
public Task<TreeResponse> Create(int repositoryId, NewTree newTree)
|
||||
{
|
||||
Ensure.ArgumentNotNull(newTree, "newTree");
|
||||
|
||||
if (newTree.Tree.Any(t => string.IsNullOrWhiteSpace(t.Mode)))
|
||||
{
|
||||
throw new ArgumentException("You have specified items in the tree which do not have a Mode value set.");
|
||||
}
|
||||
|
||||
return ApiConnection.Post<TreeResponse>(ApiUrls.Tree(repositoryId), newTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user