diff --git a/Octokit/Clients/IReferencesClient.cs b/Octokit/Clients/IReferencesClient.cs index fa73e41c..b07ab5fc 100644 --- a/Octokit/Clients/IReferencesClient.cs +++ b/Octokit/Clients/IReferencesClient.cs @@ -1,17 +1,22 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Octokit { public interface IReferencesClient { + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", + Justification = "Method makes a network request")] Task Get(string owner, string name, string reference); - Task> GetAll(string owner, string name, string subNamespace = null); + Task> GetAll(string owner, string name); + + Task> GetAll(string owner, string name, string subNamespace); Task Create(string owner, string name, NewReference reference); - Task Update(string owner, string name, string reference, ReferenceUpdate update); + Task Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate); Task Delete(string owner, string name, string reference); } diff --git a/Octokit/Clients/ReferencesClient.cs b/Octokit/Clients/ReferencesClient.cs index b4d557ea..0e73210e 100644 --- a/Octokit/Clients/ReferencesClient.cs +++ b/Octokit/Clients/ReferencesClient.cs @@ -19,11 +19,20 @@ namespace Octokit return ApiConnection.Get(ApiUrls.Reference(owner, name, reference)); } - public Task> GetAll(string owner, string name, string subNamespace = null) + public Task> GetAll(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); + return ApiConnection.GetAll(ApiUrls.Reference(owner, name)); + } + + public Task> GetAll(string owner, string name, string subNamespace) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace"); + return ApiConnection.GetAll(ApiUrls.Reference(owner, name, subNamespace)); } @@ -36,14 +45,14 @@ namespace Octokit return ApiConnection.Post(ApiUrls.Reference(owner, name), reference); } - public Task Update(string owner, string name, string reference, ReferenceUpdate update) + public Task Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - Ensure.ArgumentNotNull(update, "update"); + Ensure.ArgumentNotNull(referenceUpdate, "update"); - return ApiConnection.Patch(ApiUrls.Reference(owner, name, reference), update); + return ApiConnection.Patch(ApiUrls.Reference(owner, name, reference), referenceUpdate); } public Task Delete(string owner, string name, string reference) diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 0b6cb37e..6e9b2c2b 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -474,16 +474,22 @@ namespace Octokit /// /// The owner of the repository /// The name of the repository - /// The reference name /// - public static Uri Reference(string owner, string name, string reference = null) + public static Uri Reference(string owner, string name) { - if (string.IsNullOrEmpty(reference)) - { - return "repos/{0}/{1}/git/refs".FormatUri(owner, name); - } + return "repos/{0}/{1}/git/refs".FormatUri(owner, name); + } - return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, reference); + /// + /// Returns the for the specified reference. + /// + /// The owner of the repository + /// The name of the repository + /// The reference name + /// + public static Uri Reference(string owner, string name, string referenceName) + { + return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, referenceName); } /// diff --git a/Octokit/Models/Request/ReferenceUpdate.cs b/Octokit/Models/Request/ReferenceUpdate.cs index b2bf7442..0b187397 100644 --- a/Octokit/Models/Request/ReferenceUpdate.cs +++ b/Octokit/Models/Request/ReferenceUpdate.cs @@ -2,7 +2,11 @@ { public class ReferenceUpdate { - public ReferenceUpdate(string sha, bool force = false) + public ReferenceUpdate(string sha) : this(sha, false) + { + } + + public ReferenceUpdate(string sha, bool force) { Ensure.ArgumentNotNullOrEmptyString(sha, "sha"); diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index 4a3b0d7d..4e32d67f 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -234,6 +234,11 @@ + + + + + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index 3189e64f..0704707f 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -229,6 +229,11 @@ + + + + + \ No newline at end of file