diff --git a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs index aa30a251..43922e5d 100644 --- a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs +++ b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs @@ -28,7 +28,7 @@ namespace Octokit.Reactive /// public IObservable GetAll(string owner, string name, string reference) { - return _connection.GetAndFlattenAllPages(ApiUrls.CommitStatus(owner, name, reference)); + return _connection.GetAndFlattenAllPages(ApiUrls.CommitStatuses(owner, name, reference)); } /// diff --git a/Octokit.Tests/Clients/CommitStatusClientTests.cs b/Octokit.Tests/Clients/CommitStatusClientTests.cs index 7d59da72..f00374e1 100644 --- a/Octokit.Tests/Clients/CommitStatusClientTests.cs +++ b/Octokit.Tests/Clients/CommitStatusClientTests.cs @@ -20,7 +20,7 @@ namespace Octokit.Tests.Clients client.GetAll("fake", "repo", "sha"); connection.Received() - .GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/statuses/sha"), null); + .GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/commits/sha/statuses")); } [Fact] diff --git a/Octokit/Clients/CommitStatusClient.cs b/Octokit/Clients/CommitStatusClient.cs index 93c3aca9..6a42091e 100644 --- a/Octokit/Clients/CommitStatusClient.cs +++ b/Octokit/Clients/CommitStatusClient.cs @@ -23,7 +23,9 @@ namespace Octokit /// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -34,18 +36,16 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - // This is currently a preview feature of the API and is subject to change - // https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref - return ApiConnection.GetAll( - ApiUrls.CommitStatus(owner, name, reference), - null); + return ApiConnection.GetAll(ApiUrls.CommitStatuses(owner, name, reference)); } /// /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -62,6 +62,9 @@ namespace Octokit /// /// Creates a commit status for the specified ref. /// + /// + /// https://developer.github.com/v3/repos/statuses/#create-a-status + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -74,11 +77,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); Ensure.ArgumentNotNull(commitStatus, "commitStatus"); - // This is currently a preview feature of the API and is subject to change - // https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref - return ApiConnection.Post( - ApiUrls.CommitStatus(owner, name, reference), - commitStatus); + return ApiConnection.Post(ApiUrls.CreateCommitStatus(owner, name, reference), commitStatus); } } } diff --git a/Octokit/Clients/ICommitStatusClient.cs b/Octokit/Clients/ICommitStatusClient.cs index 84307e8a..e9743ea7 100644 --- a/Octokit/Clients/ICommitStatusClient.cs +++ b/Octokit/Clients/ICommitStatusClient.cs @@ -15,7 +15,9 @@ namespace Octokit /// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -26,7 +28,9 @@ namespace Octokit /// Retrieves a combined view of statuses for the specified reference. A reference can be a commit SHA, a branch name, or /// a tag name. /// - /// Only users with pull access can see this. + /// + /// https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for @@ -36,6 +40,9 @@ namespace Octokit /// /// Creates a commit status for the specified ref. /// + /// + /// https://developer.github.com/v3/repos/statuses/#create-a-status + /// /// The owner of the repository /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 6407c7ec..501fb20f 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -543,6 +543,18 @@ namespace Octokit return "repos/{0}/{1}/milestones/{2}/labels".FormatUri(owner, repo, number); } + /// + /// Returns the to use when creating a commit status for the specified reference. + /// + /// The owner of the repository + /// The name of the repository + /// The reference (SHA, branch name, or tag name) to list commits for + /// + public static Uri CreateCommitStatus(string owner, string name, string reference) + { + return "repos/{0}/{1}/statuses/{2}".FormatUri(owner, name, reference); + } + /// /// Returns the that lists the commit statuses for the specified reference. /// @@ -550,9 +562,9 @@ namespace Octokit /// The name of the repository /// The reference (SHA, branch name, or tag name) to list commits for /// - public static Uri CommitStatus(string owner, string name, string reference) + public static Uri CommitStatuses(string owner, string name, string reference) { - return "repos/{0}/{1}/statuses/{2}".FormatUri(owner, name, reference); + return "repos/{0}/{1}/commits/{2}/statuses".FormatUri(owner, name, reference); } ///