diff --git a/Octokit.Reactive/Clients/IObservableGistsClient.cs b/Octokit.Reactive/Clients/IObservableGistsClient.cs
index 31ea9da5..dbb9b5a0 100644
--- a/Octokit.Reactive/Clients/IObservableGistsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableGistsClient.cs
@@ -91,6 +91,24 @@ namespace Octokit.Reactive
/// Only gists updated at or after this time are returned
IObservable GetAllForUser(string user, DateTimeOffset since);
+ ///
+ /// List gist commits
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-commits
+ ///
+ /// The id of the gist
+ IObservable GetAllCommits(string id);
+
+ ///
+ /// List gist forks
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-forks
+ ///
+ /// The id of the gist
+ IObservable GetAllForks(string id);
+
///
/// Creates a new gist
///
diff --git a/Octokit.Reactive/Clients/ObservableGistsClient.cs b/Octokit.Reactive/Clients/ObservableGistsClient.cs
index 3525b870..f7539fa3 100644
--- a/Octokit.Reactive/Clients/ObservableGistsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableGistsClient.cs
@@ -180,6 +180,34 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages(ApiUrls.UsersGists(user), request.ToParametersDictionary());
}
+ ///
+ /// List gist commits
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-commits
+ ///
+ /// The id of the gist
+ public IObservable GetAllCommits(string id)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(id, "id");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.GistCommits(id));
+ }
+
+ ///
+ /// List gist forks
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-forks
+ ///
+ /// The id of the gist
+ public IObservable GetAllForks(string id)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(id, "id");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.ForkGist(id));
+ }
+
///
/// Edits a gist
///
diff --git a/Octokit.Tests.Integration/Clients/GistsClientTests.cs b/Octokit.Tests.Integration/Clients/GistsClientTests.cs
index 96ba37b3..5b3c0ed0 100644
--- a/Octokit.Tests.Integration/Clients/GistsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/GistsClientTests.cs
@@ -117,4 +117,16 @@ public class GistsClientTests
await _fixture.Delete(createdGist.Id);
}
+
+ [IntegrationTest]
+ public async Task CanGetGistChildren()
+ {
+ // Test History/Commits
+ var commits = await _fixture.GetAllCommits(testGistId);
+ Assert.NotEmpty(commits);
+
+ // Test Forks
+ var forks = await _fixture.GetAllForks(testGistId);
+ Assert.NotEmpty(forks);
+ }
}
diff --git a/Octokit.Tests/Clients/GistsClientTests.cs b/Octokit.Tests/Clients/GistsClientTests.cs
index 7690fd92..9bb21e52 100644
--- a/Octokit.Tests/Clients/GistsClientTests.cs
+++ b/Octokit.Tests/Clients/GistsClientTests.cs
@@ -122,6 +122,44 @@ public class GistsClientTests
}
}
+ public class TheGetChildrenMethods
+ {
+ [Fact]
+ public async Task EnsureNonNullArguments()
+ {
+ var connection = Substitute.For();
+ var client = new GistsClient(connection);
+
+ await Assert.ThrowsAsync(() => client.GetAllCommits(null));
+ await Assert.ThrowsAsync(() => client.GetAllCommits(""));
+
+ await Assert.ThrowsAsync(() => client.GetAllForks(null));
+ await Assert.ThrowsAsync(() => client.GetAllForks(""));
+ }
+
+ [Fact]
+ public void RequestsCorrectGetCommitsUrl()
+ {
+ var connection = Substitute.For();
+ var client = new GistsClient(connection);
+
+ client.GetAllCommits("9257657");
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/9257657/commits"));
+ }
+
+ [Fact]
+ public void RequestsCorrectGetForksUrl()
+ {
+ var connection = Substitute.For();
+ var client = new GistsClient(connection);
+
+ client.GetAllForks("9257657");
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/9257657/forks"));
+ }
+ }
+
public class TheCreateMethod
{
[Fact]
diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj
index fe997745..ea642a3b 100644
--- a/Octokit.Tests/Octokit.Tests.csproj
+++ b/Octokit.Tests/Octokit.Tests.csproj
@@ -179,6 +179,7 @@
+
diff --git a/Octokit.Tests/Reactive/ObservableGistsTests.cs b/Octokit.Tests/Reactive/ObservableGistsTests.cs
new file mode 100644
index 00000000..3057f021
--- /dev/null
+++ b/Octokit.Tests/Reactive/ObservableGistsTests.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using NSubstitute;
+using Octokit;
+using Octokit.Internal;
+using Octokit.Reactive;
+using Octokit.Reactive.Internal;
+using Octokit.Tests.Helpers;
+using Xunit;
+using Xunit.Extensions;
+
+namespace Octokit.Tests.Reactive
+{
+ public class ObservableGistsTests
+ {
+ public class TheGetChildrenMethods
+ {
+ [Fact]
+ public async Task EnsureNonNullArguments()
+ {
+ var client = new ObservableGistsClient(Substitute.For());
+
+ await AssertEx.Throws(async () => await client.GetAllCommits(null));
+ await AssertEx.Throws(async () => await client.GetAllCommits(""));
+
+ await AssertEx.Throws(async () => await client.GetAllForks(null));
+ await AssertEx.Throws(async () => await client.GetAllForks(""));
+ }
+
+ [Fact]
+ public void RequestsCorrectGetCommitsUrl()
+ {
+ var github = Substitute.For();
+ var client = new ObservableGistsClient(github);
+ var expected = new Uri("gists/9257657/commits", UriKind.Relative);
+
+ client.GetAllCommits("9257657");
+
+ github.Connection.Received(1).Get>(expected, Arg.Any>(), null);
+ }
+
+ [Fact]
+ public void RequestsCorrectGetForksUrl()
+ {
+ var github = Substitute.For();
+ var client = new ObservableGistsClient(github);
+ var expected = new Uri("gists/9257657/forks", UriKind.Relative);
+
+ client.GetAllForks("9257657");
+
+ github.Connection.Received(1).Get>(expected, Arg.Any>(), null);
+ }
+ }
+ }
+}
diff --git a/Octokit/Clients/GistsClient.cs b/Octokit/Clients/GistsClient.cs
index 9847690c..96664c66 100644
--- a/Octokit/Clients/GistsClient.cs
+++ b/Octokit/Clients/GistsClient.cs
@@ -196,6 +196,34 @@ namespace Octokit
return ApiConnection.GetAll(ApiUrls.UsersGists(user), request.ToParametersDictionary());
}
+ ///
+ /// List gist commits
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-commits
+ ///
+ /// The id of the gist
+ public Task> GetAllCommits(string id)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(id, "id");
+
+ return ApiConnection.GetAll(ApiUrls.GistCommits(id));
+ }
+
+ ///
+ /// List gist forks
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-forks
+ ///
+ /// The id of the gist
+ public Task> GetAllForks(string id)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(id, "id");
+
+ return ApiConnection.GetAll(ApiUrls.ForkGist(id));
+ }
+
///
/// Edits a gist
///
diff --git a/Octokit/Clients/IGistsClient.cs b/Octokit/Clients/IGistsClient.cs
index c344c576..5ac92298 100644
--- a/Octokit/Clients/IGistsClient.cs
+++ b/Octokit/Clients/IGistsClient.cs
@@ -98,6 +98,24 @@ namespace Octokit
/// Only gists updated at or after this time are returned
Task> GetAllForUser(string user, DateTimeOffset since);
+ ///
+ /// List gist commits
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-commits
+ ///
+ /// The id of the gist
+ Task> GetAllCommits(string id);
+
+ ///
+ /// List gist forks
+ ///
+ ///
+ /// http://developer.github.com/v3/gists/#list-gists-forks
+ ///
+ /// The id of the gist
+ Task> GetAllForks(string id);
+
///
/// Creates a new gist
///
diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs
index f42096ea..fbf71833 100644
--- a/Octokit/Helpers/ApiUrls.cs
+++ b/Octokit/Helpers/ApiUrls.cs
@@ -723,7 +723,7 @@ namespace Octokit
}
///
- /// Returns the for the forks of a given gist.
+ /// Returns the for the forks for the specified gist.
///
/// The id of the gist
public static Uri ForkGist(string id)
@@ -774,6 +774,15 @@ namespace Octokit
return "gists/{0}/comments".FormatUri(gistId);
}
+ ///
+ /// Returns the for the commits for the specified gist.
+ ///
+ /// The id of the gist
+ public static Uri GistCommits(string id)
+ {
+ return "gists/{0}/commits".FormatUri(id);
+ }
+
///
/// Returns the that returns the specified pull request.
///
diff --git a/Octokit/Models/Response/GistChangeStatus.cs b/Octokit/Models/Response/GistChangeStatus.cs
index 7cf1f371..6b5ecce0 100644
--- a/Octokit/Models/Response/GistChangeStatus.cs
+++ b/Octokit/Models/Response/GistChangeStatus.cs
@@ -5,7 +5,7 @@ using System.Globalization;
namespace Octokit
{
///
- /// User by to indicate the level of change.
+ /// Used by to indicate the level of change.
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class GistChangeStatus