From 1a5e3d15dc7ca4ded16d498bd5682e0e053ffd01 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Fri, 15 Jan 2016 12:38:23 +0200 Subject: [PATCH 01/10] Add regular interface and models --- Octokit/Clients/IRepositoryPagesClient.cs | 40 ++++++++++++ Octokit/Models/Response/Page.cs | 76 +++++++++++++++++++++++ Octokit/Models/Response/PagesBuild.cs | 53 ++++++++++++++++ Octokit/Octokit.csproj | 3 + 4 files changed, 172 insertions(+) create mode 100644 Octokit/Clients/IRepositoryPagesClient.cs create mode 100644 Octokit/Models/Response/Page.cs create mode 100644 Octokit/Models/Response/PagesBuild.cs diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs new file mode 100644 index 0000000000..71709f9f96 --- /dev/null +++ b/Octokit/Clients/IRepositoryPagesClient.cs @@ -0,0 +1,40 @@ +using Octokit.Models.Response; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Clients +{ + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + interface IRepositoryPagesClient + { + /// + /// Gets the page metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + Task> Get(string owner, string repositoryName); + /// + /// Gets all build metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + Task> GetBuilds(string owner, string repositoryName); + /// + /// Gets the build metadata for the last build for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + Task GetLatestBuild(string owner, string repositoryName); + } +} \ No newline at end of file diff --git a/Octokit/Models/Response/Page.cs b/Octokit/Models/Response/Page.cs new file mode 100644 index 0000000000..ddfff06cf2 --- /dev/null +++ b/Octokit/Models/Response/Page.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Models.Response +{ + public enum PagesBuildStatus + { + /// + /// The site has yet to be built + /// + Null, + /// + /// The build is in progress + /// + Building, + /// + /// The site has been built + /// + Built, + /// + /// An error occurred during the build + /// + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Errored")] + Errored, + } + + /// + /// Information about your GitHub Pages configuration + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class Page + { + public Page() { } + + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "cname")] + public Page(string url, PagesBuildStatus status, string cname, bool custom404) + { + Url = url; + Status = status; + CName = cname; + Custom404 = custom404; + } + + /// + /// The pages's API URL. + /// + public string Url { get; protected set; } + /// + /// Build status of the pages site. + /// + public PagesBuildStatus Status { get; protected set; } + /// + /// CName of the pages site. Will be null if no CName was provided by the user. + /// + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "CName")] + public string CName { get; protected set; } + /// + /// Is a custom 404 page provided. + /// + public bool Custom404 { get; protected set; } + + internal string DebuggerDisplay + { + get + { + return string.Format(CultureInfo.InvariantCulture, "CName: {0}, Status: {1}", CName, Status.ToString()); + } + } + } +} diff --git a/Octokit/Models/Response/PagesBuild.cs b/Octokit/Models/Response/PagesBuild.cs new file mode 100644 index 0000000000..cc11a47d08 --- /dev/null +++ b/Octokit/Models/Response/PagesBuild.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Models.Response +{ + /// + /// Metadata of a Github Pages build. + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class PagesBuild + { + public PagesBuild() { } + + public PagesBuild(string url, PagesBuildStatus status, User pusher, Commit commit, TimeSpan duration, DateTime createdAt, DateTime updatedAt) + { + Url = url; + Status = status; + Pusher = pusher; + Commit = commit; + Duration = duration; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + } + + /// + /// The pages's API URL. + /// + public string Url { get; protected set; } + /// + /// The status of the build. + /// + public PagesBuildStatus Status { get; protected set; } + /// + /// The user whose commit intiated the build. + /// + public User Pusher { get; protected set; } + /// + /// Commit SHA. + /// + public Commit Commit { get; protected set; } + /// + /// Duration of the build + /// + public TimeSpan Duration { get; protected set; } + public DateTime CreatedAt { get; protected set; } + public DateTime UpdatedAt { get; protected set; } + } +} diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 3bd8bb7a7c..7238ed974d 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -62,6 +62,7 @@ + @@ -133,6 +134,8 @@ + + From 15c8ff9362719e392302bb5b402471696674ee14 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Sun, 17 Jan 2016 22:33:02 +0200 Subject: [PATCH 02/10] Add implementation and unit tests --- .../Clients/RepositoryPagesClientTests.cs | 85 +++++++++++++++++++ Octokit.Tests/Octokit.Tests.csproj | 1 + Octokit/Clients/IRepositoriesClient.cs | 10 ++- Octokit/Clients/IRepositoryPagesClient.cs | 22 +++-- Octokit/Clients/RepositoriesClient.cs | 9 ++ Octokit/Clients/RepositoryPagesClient.cs | 77 +++++++++++++++++ Octokit/Helpers/ApiUrls.cs | 15 ++++ Octokit/Models/Response/Page.cs | 2 +- Octokit/Models/Response/PagesBuild.cs | 6 +- Octokit/Octokit.csproj | 1 + 10 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 Octokit.Tests/Clients/RepositoryPagesClientTests.cs create mode 100644 Octokit/Clients/RepositoryPagesClient.cs diff --git a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs new file mode 100644 index 0000000000..6088c9d470 --- /dev/null +++ b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs @@ -0,0 +1,85 @@ +using NSubstitute; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Octokit.Tests.Clients +{ + public class RepositoryPagesClientTests + { + public class TheGetMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + client.Get("fake", "repo"); + + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/pages"), null); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + await Assert.ThrowsAsync(() => client.Get(null, "name")); + await Assert.ThrowsAsync(() => client.Get("owner", null)); + } + } + + public class TheGetBuildsMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + client.GetBuilds("fake", "repo"); + + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pages/builds")); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + await Assert.ThrowsAsync(() => client.Get(null, "name")); + await Assert.ThrowsAsync(() => client.Get("owner", null)); + } + } + + public class TheGetLatestBuildMethod + { + [Fact] + public void RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + client.GetLatestBuild("fake", "repo"); + + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/pages/builds/latest"), null); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var connection = Substitute.For(); + var client = new RepositoryPagesClient(connection); + + await Assert.ThrowsAsync(() => client.Get(null, "name")); + await Assert.ThrowsAsync(() => client.Get("owner", null)); + } + } + } +} diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index 5dc32016bc..57055097f4 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -93,6 +93,7 @@ + diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs index 654a4231b9..d88480a6df 100644 --- a/Octokit/Clients/IRepositoriesClient.cs +++ b/Octokit/Clients/IRepositoriesClient.cs @@ -269,7 +269,7 @@ public interface IRepositoriesClient /// See the Commits API documentation for more details /// IRepositoryCommitsClient Commit { get; } - + /// /// Access GitHub's Releases API. /// @@ -384,5 +384,13 @@ public interface IRepositoriesClient /// New values to update the branch with /// The updated Task EditBranch(string owner, string name, string branch, BranchUpdate update); + + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + IRepositoryPagesClient Page { get; } } } diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs index 71709f9f96..eb3a05553c 100644 --- a/Octokit/Clients/IRepositoryPagesClient.cs +++ b/Octokit/Clients/IRepositoryPagesClient.cs @@ -1,32 +1,39 @@ -using Octokit.Models.Response; -using System; +using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Octokit.Clients +namespace Octokit { /// /// A client for GitHub's Repository Pages API. /// /// - /// See the Repository Pages API documentation for more information. + /// See the Repository Pages API documentation for more information. /// - interface IRepositoryPagesClient + public interface IRepositoryPagesClient { /// /// Gets the page metadata for a given repository /// /// The owner of the repository /// The name of the repository + /// + /// See the API documentation for more information. + /// /// - Task> Get(string owner, string repositoryName); + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] + Task Get(string owner, string repositoryName); /// /// Gets all build metadata for a given repository /// /// The owner of the repository /// The name of the repository + /// + /// See the API documentation for more information. + /// /// Task> GetBuilds(string owner, string repositoryName); /// @@ -34,6 +41,9 @@ interface IRepositoryPagesClient /// /// The owner of the repository /// The name of the repository + /// + /// See the API documentation for more information. + /// /// Task GetLatestBuild(string owner, string repositoryName); } diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index 8360a97001..0c3c937995 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -44,6 +44,7 @@ public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection) DeployKeys = new RepositoryDeployKeysClient(apiConnection); Merging = new MergingClient(apiConnection); Content = new RepositoryContentsClient(apiConnection); + Page = new RepositoryPagesClient(apiConnection); } /// @@ -577,5 +578,13 @@ public Task GetBranch(string owner, string repositoryName, string branch return ApiConnection.Get(ApiUrls.RepoBranch(owner, repositoryName, branchName), null, AcceptHeaders.ProtectedBranchesApiPreview); } + + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + public IRepositoryPagesClient Page { get; private set; } } } diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs new file mode 100644 index 0000000000..a8492d9fcd --- /dev/null +++ b/Octokit/Clients/RepositoryPagesClient.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit +{ + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + public class RepositoryPagesClient : ApiClient, IRepositoryPagesClient + { + /// + /// Initializes a new GitHub Repository Pages API client. + /// + /// An API connection. + public RepositoryPagesClient(IApiConnection apiConnection) : base(apiConnection) + { + + } + + /// + /// Gets the page metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + public Task Get(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return ApiConnection.Get(ApiUrls.RepositoryPage(owner, repositoryName)); + } + + /// + /// Gets all build metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + public Task> GetBuilds(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return ApiConnection.GetAll(ApiUrls.RepositoryBuilds(owner, repositoryName)); + } + + /// + /// Gets the build metadata for the last build for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + public Task GetLatestBuild(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return ApiConnection.Get(ApiUrls.RepositoryBuildsLatest(owner, repositoryName)); + } + } +} diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index f8f79d68cd..ee3b0d22c4 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -1554,5 +1554,20 @@ public static Uri RepositoryContent(string owner, string name, string path, stri { return "repos/{0}/{1}/contents/{2}?ref={3}".FormatUri(owner, name, path, reference); } + + public static Uri RepositoryPage(string owner, string name) + { + return "repos/{0}/{1}/pages".FormatUri(owner, name); + } + + public static Uri RepositoryBuilds(string owner, string name) + { + return "repos/{0}/{1}/pages/builds".FormatUri(owner, name); + } + + public static Uri RepositoryBuildsLatest(string owner, string name) + { + return "repos/{0}/{1}/pages/builds/latest".FormatUri(owner, name); + } } } diff --git a/Octokit/Models/Response/Page.cs b/Octokit/Models/Response/Page.cs index ddfff06cf2..454f25659e 100644 --- a/Octokit/Models/Response/Page.cs +++ b/Octokit/Models/Response/Page.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Octokit.Models.Response +namespace Octokit { public enum PagesBuildStatus { diff --git a/Octokit/Models/Response/PagesBuild.cs b/Octokit/Models/Response/PagesBuild.cs index cc11a47d08..b40199a889 100644 --- a/Octokit/Models/Response/PagesBuild.cs +++ b/Octokit/Models/Response/PagesBuild.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace Octokit.Models.Response +namespace Octokit { /// /// Metadata of a Github Pages build. @@ -16,10 +16,11 @@ public class PagesBuild { public PagesBuild() { } - public PagesBuild(string url, PagesBuildStatus status, User pusher, Commit commit, TimeSpan duration, DateTime createdAt, DateTime updatedAt) + public PagesBuild(string url, PagesBuildStatus status, ApiError error, User pusher, Commit commit, TimeSpan duration, DateTime createdAt, DateTime updatedAt) { Url = url; Status = status; + Error = error; Pusher = pusher; Commit = commit; Duration = duration; @@ -35,6 +36,7 @@ public PagesBuild(string url, PagesBuildStatus status, User pusher, Commit commi /// The status of the build. /// public PagesBuildStatus Status { get; protected set; } + public ApiError Error { get; set; } /// /// The user whose commit intiated the build. /// diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 7238ed974d..73a2f14493 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -73,6 +73,7 @@ + From 4265b62573f573056d954d76c4bda21e57f469b4 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Tue, 19 Jan 2016 00:15:21 +0200 Subject: [PATCH 03/10] Figured out how to include the files for the other projects --- Octokit.Tests/OctoKit.Tests-NetCore45.csproj | 1 + Octokit.Tests/Octokit.Tests-Portable.csproj | 1 + Octokit/Octokit-Mono.csproj | 4 ++++ Octokit/Octokit-Portable.csproj | 4 ++++ Octokit/Octokit-netcore45.csproj | 4 ++++ 5 files changed, 14 insertions(+) diff --git a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj index 278138adb3..c5ccda1c8c 100644 --- a/Octokit.Tests/OctoKit.Tests-NetCore45.csproj +++ b/Octokit.Tests/OctoKit.Tests-NetCore45.csproj @@ -95,6 +95,7 @@ + diff --git a/Octokit.Tests/Octokit.Tests-Portable.csproj b/Octokit.Tests/Octokit.Tests-Portable.csproj index 0651b2e513..8babf25a20 100644 --- a/Octokit.Tests/Octokit.Tests-Portable.csproj +++ b/Octokit.Tests/Octokit.Tests-Portable.csproj @@ -104,6 +104,7 @@ + diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index 3b4d98aecf..ff99d83200 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -69,6 +69,7 @@ + @@ -85,6 +86,7 @@ + @@ -172,6 +174,8 @@ + + diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj index b1ac0d7072..5e047bd0b9 100644 --- a/Octokit/Octokit-Portable.csproj +++ b/Octokit/Octokit-Portable.csproj @@ -57,6 +57,7 @@ + @@ -116,6 +117,7 @@ + @@ -241,6 +243,8 @@ + + diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index 11a51e179e..5a583ea6d5 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -73,6 +73,7 @@ + @@ -123,6 +124,7 @@ + @@ -270,6 +272,8 @@ + + From 3003fb3e60cf1b41b701b40b5fcde09b0c1bd9ff Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Wed, 20 Jan 2016 12:45:18 +0200 Subject: [PATCH 04/10] Add IObservable + impl --- .../Clients/IObservableRepositoriesClient.cs | 7 +++ .../IObservableRepositoryPagesClient.cs | 44 +++++++++++++++++ .../Clients/ObservableRepositoriesClient.cs | 8 ++++ .../ObservableRepositoryPagesClient.cs | 48 +++++++++++++++++++ Octokit.Reactive/Octokit.Reactive.csproj | 2 + Octokit/Clients/RepositoryPagesClient.cs | 4 +- Octokit/Helpers/ApiUrls.cs | 4 +- 7 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs create mode 100644 Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs index 9ccf2107fe..2b1a1bb234 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs @@ -347,5 +347,12 @@ public interface IObservableRepositoriesClient /// See the Repository Deploy Keys API documentation for more information. /// IObservableRepositoryDeployKeysClient DeployKeys { get; } + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + IObservableRepositoryPagesClient Page { get; } } } diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs new file mode 100644 index 0000000000..cca0df7203 --- /dev/null +++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Reactive +{ + public interface IObservableRepositoryPagesClient + { + /// + /// Gets the page metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] + IObservable Get(string owner, string repositoryName); + /// + /// Gets all build metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + IObservable GetBuilds(string owner, string repositoryName); + /// + /// Gets the build metadata for the last build for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + IObservable GetLatestBuild(string owner, string repositoryName); + } +} diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index 0ee0fb2455..39b21268d9 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -41,6 +41,7 @@ public ObservableRepositoriesClient(IGitHubClient client) DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); + Page = new ObservableRepositoryPagesClient(client); } /// @@ -493,5 +494,12 @@ public IObservable Compare(string owner, string name, string @bas /// See the Repository Deploy Keys API documentation for more information. /// public IObservableRepositoryDeployKeysClient DeployKeys { get; private set; } + /// + /// A client for GitHub's Repository Pages API. + /// + /// + /// See the Repository Pages API documentation for more information. + /// + public IObservableRepositoryPagesClient Page { get; private set; } } } diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs new file mode 100644 index 0000000000..68ad0a6c1f --- /dev/null +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -0,0 +1,48 @@ +using Octokit.Reactive.Internal; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reactive.Threading.Tasks; +using System.Text; +using System.Threading.Tasks; + +namespace Octokit.Reactive +{ + public class ObservableRepositoryPagesClient : IObservableRepositoryPagesClient + { + readonly IRepositoryPagesClient _client; + readonly IConnection _connection; + + public ObservableRepositoryPagesClient(IGitHubClient client) + { + Ensure.ArgumentNotNull(client, "client"); + + _client = client.Repository.Page; + _connection = client.Connection; + } + + public IObservable Get(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return _client.Get(owner, repositoryName).ToObservable(); + } + + public IObservable GetBuilds(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryPageBuilds(owner, repositoryName)); + } + + public IObservable GetLatestBuild(string owner, string repositoryName) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); + + return _client.GetLatestBuild(owner, repositoryName).ToObservable(); + } + } +} diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index d25d860ae6..ad06ce2c5f 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -79,6 +79,7 @@ + @@ -102,6 +103,7 @@ + diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs index a8492d9fcd..f6065633a7 100644 --- a/Octokit/Clients/RepositoryPagesClient.cs +++ b/Octokit/Clients/RepositoryPagesClient.cs @@ -54,7 +54,7 @@ public Task> GetBuilds(string owner, string repository Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); - return ApiConnection.GetAll(ApiUrls.RepositoryBuilds(owner, repositoryName)); + return ApiConnection.GetAll(ApiUrls.RepositoryPageBuilds(owner, repositoryName)); } /// @@ -71,7 +71,7 @@ public Task GetLatestBuild(string owner, string repositoryName) Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); - return ApiConnection.Get(ApiUrls.RepositoryBuildsLatest(owner, repositoryName)); + return ApiConnection.Get(ApiUrls.RepositoryPageBuildsLatest(owner, repositoryName)); } } } diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index ee3b0d22c4..a1bc2dcab7 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -1560,12 +1560,12 @@ public static Uri RepositoryPage(string owner, string name) return "repos/{0}/{1}/pages".FormatUri(owner, name); } - public static Uri RepositoryBuilds(string owner, string name) + public static Uri RepositoryPageBuilds(string owner, string name) { return "repos/{0}/{1}/pages/builds".FormatUri(owner, name); } - public static Uri RepositoryBuildsLatest(string owner, string name) + public static Uri RepositoryPageBuildsLatest(string owner, string name) { return "repos/{0}/{1}/pages/builds/latest".FormatUri(owner, name); } From 0435cd29293d14e26b7aac5cec86ce6b65d827e3 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Wed, 20 Jan 2016 12:52:15 +0200 Subject: [PATCH 05/10] :lipstick: usings and fix missing files --- .../Clients/IObservableRepositoryPagesClient.cs | 4 ---- .../Clients/ObservableRepositoryPagesClient.cs | 4 ---- Octokit.Reactive/Octokit.Reactive-Mono.csproj | 4 +++- Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj | 4 +++- Octokit.Reactive/Octokit.Reactive-Monotouch.csproj | 4 +++- Octokit.Tests/Clients/RepositoryPagesClientTests.cs | 3 --- Octokit/Clients/IRepositoryPagesClient.cs | 5 +---- Octokit/Clients/RepositoryPagesClient.cs | 5 +---- Octokit/Models/Response/Page.cs | 7 +------ Octokit/Models/Response/PagesBuild.cs | 5 ----- Octokit/Octokit-MonoAndroid.csproj | 4 ++++ Octokit/Octokit-Monotouch.csproj | 4 ++++ 12 files changed, 20 insertions(+), 33 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs index cca0df7203..8e82d59d26 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Octokit.Reactive { diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs index 68ad0a6c1f..6c827482a8 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -1,10 +1,6 @@ using Octokit.Reactive.Internal; using System; -using System.Collections.Generic; -using System.Linq; using System.Reactive.Threading.Tasks; -using System.Text; -using System.Threading.Tasks; namespace Octokit.Reactive { diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj index ceafa27403..194345c7f3 100644 --- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj @@ -157,6 +157,8 @@ + + @@ -165,4 +167,4 @@ Octokit-Mono - + \ No newline at end of file diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj index 3faa06a17b..1f676b026f 100644 --- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj +++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj @@ -165,6 +165,8 @@ + + @@ -173,4 +175,4 @@ Octokit-MonoAndroid - + \ No newline at end of file diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj index 4dbf2a612d..9fb92e213c 100644 --- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj +++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj @@ -161,6 +161,8 @@ + + @@ -169,4 +171,4 @@ Octokit-Monotouch - + \ No newline at end of file diff --git a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs index 6088c9d470..e303b2dda5 100644 --- a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs @@ -1,8 +1,5 @@ using NSubstitute; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Xunit; diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs index eb3a05553c..668563ac19 100644 --- a/Octokit/Clients/IRepositoryPagesClient.cs +++ b/Octokit/Clients/IRepositoryPagesClient.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; using System.Threading.Tasks; namespace Octokit diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs index f6065633a7..32081088af 100644 --- a/Octokit/Clients/RepositoryPagesClient.cs +++ b/Octokit/Clients/RepositoryPagesClient.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit diff --git a/Octokit/Models/Response/Page.cs b/Octokit/Models/Response/Page.cs index 454f25659e..b35aa53be2 100644 --- a/Octokit/Models/Response/Page.cs +++ b/Octokit/Models/Response/Page.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Octokit { diff --git a/Octokit/Models/Response/PagesBuild.cs b/Octokit/Models/Response/PagesBuild.cs index b40199a889..5260209bc3 100644 --- a/Octokit/Models/Response/PagesBuild.cs +++ b/Octokit/Models/Response/PagesBuild.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Octokit { diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index 83b337ac6a..d77e6d9108 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -421,6 +421,10 @@ + + + + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index 79d05bde5d..25462c6b93 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -417,6 +417,10 @@ + + + + From e690e22637b7e857bfbcaeaae4d0350e0aa6ba2d Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Wed, 20 Jan 2016 15:49:10 +0200 Subject: [PATCH 06/10] Fix up xml and add missing docs --- .../IObservableRepositoryPagesClient.cs | 6 ++-- .../ObservableRepositoryPagesClient.cs | 29 +++++++++++++++++++ Octokit/Clients/IRepositoryPagesClient.cs | 6 ++-- Octokit/Clients/RepositoryPagesClient.cs | 6 ++-- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs index 8e82d59d26..9e30b366c2 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs @@ -9,7 +9,7 @@ public interface IObservableRepositoryPagesClient /// Gets the page metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -20,7 +20,7 @@ public interface IObservableRepositoryPagesClient /// Gets all build metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -30,7 +30,7 @@ public interface IObservableRepositoryPagesClient /// Gets the build metadata for the last build for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs index 6c827482a8..2f44dee6aa 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -1,5 +1,6 @@ using Octokit.Reactive.Internal; using System; +using System.Diagnostics.CodeAnalysis; using System.Reactive.Threading.Tasks; namespace Octokit.Reactive @@ -17,6 +18,16 @@ public ObservableRepositoryPagesClient(IGitHubClient client) _connection = client.Connection; } + /// + /// Gets the page metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")] public IObservable Get(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); @@ -25,6 +36,15 @@ public IObservable Get(string owner, string repositoryName) return _client.Get(owner, repositoryName).ToObservable(); } + /// + /// Gets all build metadata for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// public IObservable GetBuilds(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); @@ -33,6 +53,15 @@ public IObservable GetBuilds(string owner, string repositoryName) return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryPageBuilds(owner, repositoryName)); } + /// + /// Gets the build metadata for the last build for a given repository + /// + /// The owner of the repository + /// The name of the repository + /// + /// See the API documentation for more information. + /// + /// public IObservable GetLatestBuild(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs index 668563ac19..25c02ea096 100644 --- a/Octokit/Clients/IRepositoryPagesClient.cs +++ b/Octokit/Clients/IRepositoryPagesClient.cs @@ -16,7 +16,7 @@ public interface IRepositoryPagesClient /// Gets the page metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -27,7 +27,7 @@ public interface IRepositoryPagesClient /// Gets all build metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -37,7 +37,7 @@ public interface IRepositoryPagesClient /// Gets the build metadata for the last build for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs index 32081088af..698a516f23 100644 --- a/Octokit/Clients/RepositoryPagesClient.cs +++ b/Octokit/Clients/RepositoryPagesClient.cs @@ -24,7 +24,7 @@ public RepositoryPagesClient(IApiConnection apiConnection) : base(apiConnection) /// Gets the page metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -41,7 +41,7 @@ public Task Get(string owner, string repositoryName) /// Gets all build metadata for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// @@ -58,7 +58,7 @@ public Task> GetBuilds(string owner, string repository /// Gets the build metadata for the last build for a given repository /// /// The owner of the repository - /// The name of the repository + /// The name of the repository /// /// See the API documentation for more information. /// From c113292f5bea1ddc37390c9817d3f407d701b45b Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Thu, 21 Jan 2016 07:31:32 +0200 Subject: [PATCH 07/10] Fix convention errors --- .../Clients/IObservableRepositoryPagesClient.cs | 2 +- .../Clients/ObservableRepositoryPagesClient.cs | 2 +- .../Clients/RepositoryPagesClientTests.cs | 2 +- Octokit/Clients/IRepositoryPagesClient.cs | 2 +- Octokit/Clients/RepositoryPagesClient.cs | 2 +- Octokit/Models/Response/ApiError.cs | 11 +++++++++++ Octokit/Models/Response/ApiErrorDetail.cs | 11 +++++++++++ Octokit/Models/Response/PagesBuild.cs | 14 +++++++++++++- 8 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs index 9e30b366c2..2cbd6d73f0 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs @@ -25,7 +25,7 @@ public interface IObservableRepositoryPagesClient /// See the API documentation for more information. /// /// - IObservable GetBuilds(string owner, string repositoryName); + IObservable GetAllBuilds(string owner, string repositoryName); /// /// Gets the build metadata for the last build for a given repository /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs index 2f44dee6aa..6b23365a8e 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -45,7 +45,7 @@ public IObservable Get(string owner, string repositoryName) /// See the API documentation for more information. /// /// - public IObservable GetBuilds(string owner, string repositoryName) + public IObservable GetAllBuilds(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); diff --git a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs index e303b2dda5..b169bd834c 100644 --- a/Octokit.Tests/Clients/RepositoryPagesClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryPagesClientTests.cs @@ -39,7 +39,7 @@ public void RequestsCorrectUrl() var connection = Substitute.For(); var client = new RepositoryPagesClient(connection); - client.GetBuilds("fake", "repo"); + client.GetAllBuilds("fake", "repo"); connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pages/builds")); } diff --git a/Octokit/Clients/IRepositoryPagesClient.cs b/Octokit/Clients/IRepositoryPagesClient.cs index 25c02ea096..b04c538cf2 100644 --- a/Octokit/Clients/IRepositoryPagesClient.cs +++ b/Octokit/Clients/IRepositoryPagesClient.cs @@ -32,7 +32,7 @@ public interface IRepositoryPagesClient /// See the API documentation for more information. /// /// - Task> GetBuilds(string owner, string repositoryName); + Task> GetAllBuilds(string owner, string repositoryName); /// /// Gets the build metadata for the last build for a given repository /// diff --git a/Octokit/Clients/RepositoryPagesClient.cs b/Octokit/Clients/RepositoryPagesClient.cs index 698a516f23..549077bebb 100644 --- a/Octokit/Clients/RepositoryPagesClient.cs +++ b/Octokit/Clients/RepositoryPagesClient.cs @@ -46,7 +46,7 @@ public Task Get(string owner, string repositoryName) /// See the API documentation for more information. /// /// - public Task> GetBuilds(string owner, string repositoryName) + public Task> GetAllBuilds(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); diff --git a/Octokit/Models/Response/ApiError.cs b/Octokit/Models/Response/ApiError.cs index e28368b835..b6614a0f01 100644 --- a/Octokit/Models/Response/ApiError.cs +++ b/Octokit/Models/Response/ApiError.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -9,6 +11,7 @@ namespace Octokit #if !NETFX_CORE [Serializable] #endif + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ApiError { public ApiError() { } @@ -39,5 +42,13 @@ public ApiError(string message, string documentationUrl, IReadOnlyList public IReadOnlyList Errors { get; protected set; } + + internal string DebuggerDisplay + { + get + { + return string.Format(CultureInfo.InvariantCulture, "Message: {0}", Message); + } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/ApiErrorDetail.cs b/Octokit/Models/Response/ApiErrorDetail.cs index 253a7e593a..cf7142c831 100644 --- a/Octokit/Models/Response/ApiErrorDetail.cs +++ b/Octokit/Models/Response/ApiErrorDetail.cs @@ -1,10 +1,13 @@ using System; +using System.Diagnostics; +using System.Globalization; namespace Octokit { #if !NETFX_CORE [Serializable] #endif + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ApiErrorDetail { public ApiErrorDetail() { } @@ -24,5 +27,13 @@ public ApiErrorDetail(string message, string code, string field, string resource public string Field { get; protected set; } public string Resource { get; protected set; } + + internal string DebuggerDisplay + { + get + { + return string.Format(CultureInfo.InvariantCulture, "Message: {0}, Code: {1}, Field: {2}", Message, Code, Field); + } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/PagesBuild.cs b/Octokit/Models/Response/PagesBuild.cs index 5260209bc3..01bce080ef 100644 --- a/Octokit/Models/Response/PagesBuild.cs +++ b/Octokit/Models/Response/PagesBuild.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Globalization; namespace Octokit { @@ -31,7 +32,10 @@ public PagesBuild(string url, PagesBuildStatus status, ApiError error, User push /// The status of the build. /// public PagesBuildStatus Status { get; protected set; } - public ApiError Error { get; set; } + /// + /// + /// + public ApiError Error { get; protected set; } /// /// The user whose commit intiated the build. /// @@ -46,5 +50,13 @@ public PagesBuild(string url, PagesBuildStatus status, ApiError error, User push public TimeSpan Duration { get; protected set; } public DateTime CreatedAt { get; protected set; } public DateTime UpdatedAt { get; protected set; } + + internal string DebuggerDisplay + { + get + { + return string.Format(CultureInfo.InvariantCulture, "Pusher: {0}, Status: {1}, Duration: {2}", Pusher.Name, Status.ToString(), Duration.TotalMilliseconds); + } + } } } From 564dea58b893507d222eb2815883b9f01615b180 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Mon, 25 Jan 2016 10:26:36 +0200 Subject: [PATCH 08/10] Add missing words --- Octokit/Models/Response/PagesBuild.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit/Models/Response/PagesBuild.cs b/Octokit/Models/Response/PagesBuild.cs index 01bce080ef..dd452b7f10 100644 --- a/Octokit/Models/Response/PagesBuild.cs +++ b/Octokit/Models/Response/PagesBuild.cs @@ -33,7 +33,7 @@ public PagesBuild(string url, PagesBuildStatus status, ApiError error, User push /// public PagesBuildStatus Status { get; protected set; } /// - /// + /// Error details - if there was one. /// public ApiError Error { get; protected set; } /// From ca187df6ab6413cdf0e5ebf6f1130c2d902edf91 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Tue, 26 Jan 2016 10:59:02 +0200 Subject: [PATCH 09/10] Renaming for :kiss: --- Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs | 4 ++-- Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs index 2cbd6d73f0..d62daa706a 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryPagesClient.cs @@ -25,7 +25,7 @@ public interface IObservableRepositoryPagesClient /// See the API documentation for more information. /// /// - IObservable GetAllBuilds(string owner, string repositoryName); + IObservable GetAll(string owner, string repositoryName); /// /// Gets the build metadata for the last build for a given repository /// @@ -35,6 +35,6 @@ public interface IObservableRepositoryPagesClient /// See the API documentation for more information. /// /// - IObservable GetLatestBuild(string owner, string repositoryName); + IObservable GetLatest(string owner, string repositoryName); } } diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs index 6b23365a8e..02adcba642 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -45,7 +45,7 @@ public IObservable Get(string owner, string repositoryName) /// See the API documentation for more information. /// /// - public IObservable GetAllBuilds(string owner, string repositoryName) + public IObservable GetAll(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); @@ -62,7 +62,7 @@ public IObservable GetAllBuilds(string owner, string repositoryName) /// See the API documentation for more information. /// /// - public IObservable GetLatestBuild(string owner, string repositoryName) + public IObservable GetLatest(string owner, string repositoryName) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); From ef06aa4e66b4e2d33687e7ec467a5b4824e56d20 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Tue, 26 Jan 2016 11:14:30 +0200 Subject: [PATCH 10/10] I feel dumb for this one In my defense my machine has been having issues --- Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs index 02adcba642..ebcd3af70f 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryPagesClient.cs @@ -67,7 +67,7 @@ public IObservable GetLatest(string owner, string repositoryName) Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); - return _client.GetLatestBuild(owner, repositoryName).ToObservable(); + return _client.GetLatest(owner, repositoryName).ToObservable(); } } }