diff --git a/Octokit/Clients/IReferencesClient.cs b/Octokit/Clients/IReferencesClient.cs index e21ffcdf..1540fe64 100644 --- a/Octokit/Clients/IReferencesClient.cs +++ b/Octokit/Clients/IReferencesClient.cs @@ -4,6 +4,6 @@ namespace Octokit { public interface IReferencesClient { - Task Get(string owner, string repo, string reference); + Task Get(string owner, string name, string reference); } } \ No newline at end of file diff --git a/Octokit/Clients/ReferencesClient.cs b/Octokit/Clients/ReferencesClient.cs index b0f0b819..66e72319 100644 --- a/Octokit/Clients/ReferencesClient.cs +++ b/Octokit/Clients/ReferencesClient.cs @@ -1,15 +1,21 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Octokit { public class ReferencesClient : ApiClient, IReferencesClient { - public ReferencesClient(IApiConnection apiConnection) : base(apiConnection) { } - - public Task Get(string owner, string repo, string reference) + public ReferencesClient(IApiConnection apiConnection) : + base(apiConnection) { - throw new NotImplementedException(); + } + + public Task Get(string owner, string name, string reference) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); + + return ApiConnection.Get(ApiUrls.Reference(owner, name, reference)); } } } diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 5ee72100..9dd7bff3 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -469,6 +469,18 @@ namespace Octokit return "repos/{0}/{1}/git/commits/{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 reference) + { + return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, reference); + } + /// /// Returns the for creating a commit object. /// diff --git a/Octokit/Models/Response/Reference.cs b/Octokit/Models/Response/Reference.cs new file mode 100644 index 00000000..1fd8d08b --- /dev/null +++ b/Octokit/Models/Response/Reference.cs @@ -0,0 +1,9 @@ +namespace Octokit +{ + public class Reference + { + public string Ref { get; set; } + public string Url { get; set; } + public TagObject Object { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Models/Response/TagObject.cs b/Octokit/Models/Response/TagObject.cs index b9c4b7cf..183f754f 100644 --- a/Octokit/Models/Response/TagObject.cs +++ b/Octokit/Models/Response/TagObject.cs @@ -14,6 +14,7 @@ { Commit, Blob, - Tree + Tree, + Tag } } \ No newline at end of file diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index 7b4044ae..a05062be 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -117,6 +117,7 @@ + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 5547f28a..eac6c575 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -206,6 +206,7 @@ + diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 76d7c1a9..41c417c6 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -70,6 +70,7 @@ +