added new overloads

This commit is contained in:
aedampir@gmail.com
2016-06-16 15:32:27 +07:00
parent de00adc2d6
commit 2244baf53d
4 changed files with 330 additions and 2 deletions
@@ -25,6 +25,19 @@ namespace Octokit.Reactive
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Reference> Get(string owner, string name, string reference);
/// <summary>
/// Gets a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable<Reference> Get(int repositoryId, string reference);
/// <summary>
/// Gets all references for a given repository
@@ -37,6 +50,16 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Reference> GetAll(string owner, string name);
/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
IObservable<Reference> GetAll(int repositoryId);
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
@@ -49,6 +72,17 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(string owner, string name, string subNamespace);
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
IObservable<Reference> GetAllForSubNamespace(int repositoryId, string subNamespace);
/// <summary>
/// Creates a reference for a given repository
/// </summary>
@@ -61,6 +95,17 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Reference> Create(string owner, string name, NewReference reference);
/// <summary>
/// Creates a reference for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#create-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference to create</param>
/// <returns></returns>
IObservable<Reference> Create(int repositoryId, NewReference reference);
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
@@ -74,6 +119,18 @@ namespace Octokit.Reactive
/// <returns></returns>
IObservable<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate);
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#update-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <param name="referenceUpdate">The updated reference data</param>
/// <returns></returns>
IObservable<Reference> Update(int repositoryId, string reference, ReferenceUpdate referenceUpdate);
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
@@ -85,5 +142,16 @@ namespace Octokit.Reactive
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
IObservable<Unit> Delete(string owner, string name, string reference);
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#delete-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
IObservable<Unit> Delete(int repositoryId, string reference);
}
}
@@ -43,6 +43,22 @@ namespace Octokit.Reactive
return _reference.Get(owner, name, reference).ToObservable();
}
/// <summary>
/// Gets a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
public IObservable<Reference> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _reference.Get(repositoryId, reference).ToObservable();
}
/// <summary>
/// Gets all references for a given repository
/// </summary>
@@ -60,6 +76,19 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name));
}
/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
public IObservable<Reference> GetAll(int repositoryId)
{
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId));
}
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
@@ -79,6 +108,22 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(owner, name, subNamespace));
}
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
public IObservable<Reference> GetAllForSubNamespace(int repositoryId, string subNamespace)
{
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
return _connection.GetAndFlattenAllPages<Reference>(ApiUrls.Reference(repositoryId, subNamespace));
}
/// <summary>
/// Creates a reference for a given repository
/// </summary>
@@ -98,6 +143,22 @@ namespace Octokit.Reactive
return _reference.Create(owner, name, reference).ToObservable();
}
/// <summary>
/// Creates a reference for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#create-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference to create</param>
/// <returns></returns>
public IObservable<Reference> Create(int repositoryId, NewReference reference)
{
Ensure.ArgumentNotNull(reference, "reference");
return _reference.Create(repositoryId, reference).ToObservable();
}
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
@@ -119,6 +180,24 @@ namespace Octokit.Reactive
return _reference.Update(owner, name, reference, referenceUpdate).ToObservable();
}
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#update-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <param name="referenceUpdate">The updated reference data</param>
/// <returns></returns>
public IObservable<Reference> Update(int repositoryId, string reference, ReferenceUpdate referenceUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
Ensure.ArgumentNotNull(referenceUpdate, "update");
return _reference.Update(repositoryId, reference, referenceUpdate).ToObservable();
}
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
@@ -137,5 +216,21 @@ namespace Octokit.Reactive
return _reference.Delete(owner, name, reference).ToObservable();
}
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#delete-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
public IObservable<Unit> Delete(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return _reference.Delete(repositoryId, reference).ToObservable();
}
}
}
+70 -2
View File
@@ -23,9 +23,22 @@ namespace Octokit
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Justification = "Method makes a network request")]
Task<Reference> Get(string owner, string name, string reference);
/// <summary>
/// Gets a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Reference> Get(int repositoryId, string reference);
/// <summary>
/// Gets all references for a given repository
/// </summary>
@@ -37,6 +50,16 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Reference>> GetAll(string owner, string name);
/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
Task<IReadOnlyList<Reference>> GetAll(int repositoryId);
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
@@ -49,6 +72,17 @@ namespace Octokit
/// <returns></returns>
Task<IReadOnlyList<Reference>> GetAllForSubNamespace(string owner, string name, string subNamespace);
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
Task<IReadOnlyList<Reference>> GetAllForSubNamespace(int repositoryId, string subNamespace);
/// <summary>
/// Creates a reference for a given repository
/// </summary>
@@ -61,6 +95,17 @@ namespace Octokit
/// <returns></returns>
Task<Reference> Create(string owner, string name, NewReference reference);
/// <summary>
/// Creates a reference for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#create-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference to create</param>
/// <returns></returns>
Task<Reference> Create(int repositoryId, NewReference reference);
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
@@ -74,6 +119,18 @@ namespace Octokit
/// <returns></returns>
Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate);
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#update-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <param name="referenceUpdate">The updated reference data</param>
/// <returns></returns>
Task<Reference> Update(int repositoryId, string reference, ReferenceUpdate referenceUpdate);
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
@@ -85,5 +142,16 @@ namespace Octokit
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
Task Delete(string owner, string name, string reference);
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#delete-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
Task Delete(int repositoryId, string reference);
}
}
}
+97
View File
@@ -39,6 +39,22 @@ namespace Octokit
return ApiConnection.Get<Reference>(ApiUrls.Reference(owner, name, reference));
}
/// <summary>
/// Gets a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
public Task<Reference> Get(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Get<Reference>(ApiUrls.Reference(repositoryId, reference));
}
/// <summary>
/// Gets all references for a given repository
/// </summary>
@@ -56,6 +72,19 @@ namespace Octokit
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name));
}
/// <summary>
/// Gets all references for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <returns></returns>
public Task<IReadOnlyList<Reference>> GetAll(int repositoryId)
{
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(repositoryId));
}
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
@@ -77,6 +106,24 @@ namespace Octokit
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name, subNamespace));
}
/// <summary>
/// Gets references for a given repository by sub-namespace, i.e. "tags" or "heads"
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#get-all-references
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="subNamespace">The sub-namespace to get references for</param>
/// <returns></returns>
public Task<IReadOnlyList<Reference>> GetAllForSubNamespace(int repositoryId, string subNamespace)
{
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
// TODO: Handle 404 when subNamespace cannot be found
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(repositoryId, subNamespace));
}
/// <summary>
/// Creates a reference for a given repository
/// </summary>
@@ -96,6 +143,22 @@ namespace Octokit
return ApiConnection.Post<Reference>(ApiUrls.Reference(owner, name), reference);
}
/// <summary>
/// Creates a reference for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#create-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The reference to create</param>
/// <returns></returns>
public Task<Reference> Create(int repositoryId, NewReference reference)
{
Ensure.ArgumentNotNull(reference, "reference");
return ApiConnection.Post<Reference>(ApiUrls.Reference(repositoryId), reference);
}
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
@@ -117,6 +180,24 @@ namespace Octokit
return ApiConnection.Patch<Reference>(ApiUrls.Reference(owner, name, reference), referenceUpdate);
}
/// <summary>
/// Updates a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#update-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <param name="referenceUpdate">The updated reference data</param>
/// <returns></returns>
public Task<Reference> Update(int repositoryId, string reference, ReferenceUpdate referenceUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
Ensure.ArgumentNotNull(referenceUpdate, "update");
return ApiConnection.Patch<Reference>(ApiUrls.Reference(repositoryId, reference), referenceUpdate);
}
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
@@ -135,5 +216,21 @@ namespace Octokit
return ApiConnection.Delete(ApiUrls.Reference(owner, name, reference));
}
/// <summary>
/// Deletes a reference for a given repository by reference name
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/git/refs/#delete-a-reference
/// </remarks>
/// <param name="repositoryId">The ID of the repository</param>
/// <param name="reference">The name of the reference</param>
/// <returns></returns>
public Task Delete(int repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
return ApiConnection.Delete(ApiUrls.Reference(repositoryId, reference));
}
}
}