diff --git a/Octokit.Reactive/Clients/IObservableStarredClient.cs b/Octokit.Reactive/Clients/IObservableStarredClient.cs
index 63dd4e352b..a1c5c9f67f 100644
--- a/Octokit.Reactive/Clients/IObservableStarredClient.cs
+++ b/Octokit.Reactive/Clients/IObservableStarredClient.cs
@@ -13,6 +13,15 @@ public interface IObservableStarredClient
/// A of s starring the passed repository
IObservable GetAllStargazers(string owner, string name);
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ IObservable GetAllStargazersWithTimestamps(string owner, string name);
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -22,6 +31,15 @@ public interface IObservableStarredClient
///
IObservable GetAllForCurrent();
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ IObservable GetAllForCurrentWithTimestamps();
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -33,6 +51,17 @@ public interface IObservableStarredClient
///
IObservable GetAllForCurrent(StarredRequest request);
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ IObservable GetAllForCurrentWithTimestamps(StarredRequest request);
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -41,6 +70,16 @@ public interface IObservableStarredClient
/// A starred by the specified user
IObservable GetAllForUser(string user);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ IObservable GetAllForUserWithTimestamps(string user);
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -50,6 +89,18 @@ public interface IObservableStarredClient
/// A starred by the specified user
IObservable GetAllForUser(string user, StarredRequest request);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ IObservable GetAllForUserWithTimestamps(string user, StarredRequest request);
+
///
/// Check if a repository is starred by the current authenticated user
///
diff --git a/Octokit.Reactive/Clients/ObservableStarredClient.cs b/Octokit.Reactive/Clients/ObservableStarredClient.cs
index d03911e12f..9f09031fcb 100644
--- a/Octokit.Reactive/Clients/ObservableStarredClient.cs
+++ b/Octokit.Reactive/Clients/ObservableStarredClient.cs
@@ -32,6 +32,21 @@ public IObservable GetAllStargazers(string owner, string name)
return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name));
}
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ public IObservable GetAllStargazersWithTimestamps(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -44,6 +59,18 @@ public IObservable GetAllForCurrent()
return _connection.GetAndFlattenAllPages(ApiUrls.Starred());
}
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ public IObservable GetAllForCurrentWithTimestamps()
+ {
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -61,6 +88,23 @@ public IObservable GetAllForCurrent(StarredRequest request)
return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary());
}
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public IObservable GetAllForCurrentWithTimestamps(StarredRequest request)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Starred(), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -74,6 +118,21 @@ public IObservable GetAllForUser(string user)
return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user));
}
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ public IObservable GetAllForUserWithTimestamps(string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the (ies) starred by the specified user
///
@@ -90,6 +149,25 @@ public IObservable GetAllForUser(string user, StarredRequest request
return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary());
}
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public IObservable GetAllForUserWithTimestamps(string user, StarredRequest request)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(request, "request");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Check if a repository is starred by the current authenticated user
///
diff --git a/Octokit.Tests.Integration/Clients/StarredClientTests.cs b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
new file mode 100644
index 0000000000..e55880e83a
--- /dev/null
+++ b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
@@ -0,0 +1,35 @@
+using System;
+using Octokit.Tests.Integration.Helpers;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Octokit.Tests.Integration.Clients
+{
+ public class StarredClientTests
+ {
+ private readonly IGitHubClient _client;
+ private readonly IStarredClient _fixture;
+
+ public StarredClientTests()
+ {
+ _client = Helper.GetAuthenticatedClient();
+ _fixture = _client.Activity.Starring;
+ }
+
+ [IntegrationTest]
+ public async Task CanCreateAndRetrieveStarsWithTimestamps()
+ {
+ using (var context = await _client.CreateRepositoryContext("public-repo"))
+ {
+ await _fixture.RemoveStarFromRepo(context.RepositoryOwner, context.RepositoryName);
+ await _fixture.StarRepo(context.RepositoryOwner, context.RepositoryName);
+ var currentUser = await _client.User.Current();
+ var userStars = await _fixture.GetAllStargazersWithTimestamps(context.RepositoryOwner, context.RepositoryName);
+ var userStar = userStars.SingleOrDefault(x => x.User.Id == currentUser.Id);
+ Assert.NotNull(userStar);
+ Assert.True(DateTimeOffset.UtcNow.Subtract(userStar.StarredAt) < TimeSpan.FromMinutes(5));
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index 0f8192e909..b2cd9b6c12 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -96,6 +96,7 @@
+
diff --git a/Octokit/Clients/IStarredClient.cs b/Octokit/Clients/IStarredClient.cs
index 1110dbb737..d93b632d20 100644
--- a/Octokit/Clients/IStarredClient.cs
+++ b/Octokit/Clients/IStarredClient.cs
@@ -20,6 +20,15 @@ public interface IStarredClient
/// A of s starring the passed repository.
Task> GetAllStargazers(string owner, string name);
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ Task> GetAllStargazersWithTimestamps(string owner, string name);
+
///
/// Retrieves all of the starred (ies) for the current user.
///
@@ -29,6 +38,15 @@ public interface IStarredClient
///
Task> GetAllForCurrent();
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ Task> GetAllForCurrentWithTimestamps();
+
///
/// Retrieves all of the starred (ies) for the current user.
///
@@ -39,7 +57,18 @@ public interface IStarredClient
/// sorted according to the passed request parameters.
///
Task> GetAllForCurrent(StarredRequest request);
-
+
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ Task> GetAllForCurrentWithTimestamps(StarredRequest request);
+
///
/// Retrieves all of the (ies) starred by the specified user.
///
@@ -50,6 +79,16 @@ public interface IStarredClient
///
Task> GetAllForUser(string user);
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ Task> GetAllForUserWithTimestamps(string user);
+
///
/// Retrieves all of the (ies) starred by the specified user.
///
@@ -58,6 +97,18 @@ public interface IStarredClient
/// Thrown if the client is not authenticated.
/// A starred by the specified user.
Task> GetAllForUser(string user, StarredRequest request);
+
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ Task> GetAllForUserWithTimestamps(string user, StarredRequest request);
///
/// Check if a repository is starred by the current authenticated user.
diff --git a/Octokit/Clients/StarredClient.cs b/Octokit/Clients/StarredClient.cs
index 73f42a7a88..1ed20dcd92 100644
--- a/Octokit/Clients/StarredClient.cs
+++ b/Octokit/Clients/StarredClient.cs
@@ -35,6 +35,21 @@ public Task> GetAllStargazers(string owner, string name)
return ApiConnection.GetAll(ApiUrls.Stargazers(owner, name));
}
+ ///
+ /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// Thrown if the client is not authenticated.
+ /// A of s starring the passed repository with star creation timestamps.
+ public Task> GetAllStargazersWithTimestamps(string owner, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ return ApiConnection.GetAll(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the starred (ies) for the current user.
///
@@ -47,6 +62,18 @@ public Task> GetAllForCurrent()
return ApiConnection.GetAll(ApiUrls.Starred());
}
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current authenticated user with star creation timestamps.
+ ///
+ public Task> GetAllForCurrentWithTimestamps()
+ {
+ return ApiConnection.GetAll(ApiUrls.Starred(), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the starred (ies) for the current user.
///
@@ -65,6 +92,24 @@ public Task> GetAllForCurrent(StarredRequest request)
return ApiConnection.GetAll(ApiUrls.Starred(), request.ToParametersDictionary());
}
+ ///
+ /// Retrieves all of the starred (ies) for the current user with star creation timestamps.
+ ///
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the current user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters",
+ Justification = "But i think i do need star-specific request parameters")]
+ public Task> GetAllForCurrentWithTimestamps(StarredRequest request)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+
+ return ApiConnection.GetAll(ApiUrls.Starred(), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the (ies) starred by the specified user.
///
@@ -80,6 +125,21 @@ public Task> GetAllForUser(string user)
return ApiConnection.GetAll(ApiUrls.StarredByUser(user));
}
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A (ies) starred by the specified user with star creation timestamps.
+ ///
+ public Task> GetAllForUserWithTimestamps(string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return ApiConnection.GetAll(ApiUrls.StarredByUser(user), null, AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Retrieves all of the (ies) starred by the specified user.
///
@@ -96,6 +156,25 @@ public Task> GetAllForUser(string user, StarredRequest
return ApiConnection.GetAll(ApiUrls.StarredByUser(user), request.ToParametersDictionary());
}
+ ///
+ /// Retrieves all of the (ies) starred by the specified user with star creation timestamps.
+ ///
+ /// The login of the user
+ /// Star-specific request parameters that sort the results
+ /// Thrown if the client is not authenticated.
+ ///
+ /// A of (ies) starred by the specified user,
+ /// sorted according to the passed request parameters and with star creation timestamps.
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
+ public Task> GetAllForUserWithTimestamps(string user, StarredRequest request)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(request, "request");
+
+ return ApiConnection.GetAll(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), AcceptHeaders.StarCreationTimestamps);
+ }
+
///
/// Check if a repository is starred by the current authenticated user.
///
diff --git a/Octokit/Helpers/AcceptHeaders.cs b/Octokit/Helpers/AcceptHeaders.cs
index 425782a8da..387b5ed59f 100644
--- a/Octokit/Helpers/AcceptHeaders.cs
+++ b/Octokit/Helpers/AcceptHeaders.cs
@@ -11,6 +11,8 @@ public static class AcceptHeaders
public const string LicensesApiPreview = "application/vnd.github.drax-preview+json";
public const string ProtectedBranchesApiPreview = "application/vnd.github.loki-preview+json";
+
+ public const string StarCreationTimestamps = "application/vnd.github.v3.star+json";
}
}
\ No newline at end of file
diff --git a/Octokit/Models/Response/RepositoryStar.cs b/Octokit/Models/Response/RepositoryStar.cs
new file mode 100644
index 0000000000..bb5e21b8ba
--- /dev/null
+++ b/Octokit/Models/Response/RepositoryStar.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+
+namespace Octokit
+{
+ ///
+ /// Represents additional information about a star (such as creation time)
+ ///
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class RepositoryStar
+ {
+ public RepositoryStar() { }
+
+ public RepositoryStar(DateTimeOffset starredAt, Repository repo)
+ {
+ StarredAt = starredAt;
+ Repo = repo;
+ }
+
+ ///
+ /// The date the star was created.
+ ///
+ public DateTimeOffset StarredAt { get; protected set; }
+
+ ///
+ /// The repository associated with the star.
+ ///
+ public Repository Repo { get; protected set; }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ return string.Format(CultureInfo.InvariantCulture, Repo.DebuggerDisplay);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Models/Response/UserStar.cs b/Octokit/Models/Response/UserStar.cs
new file mode 100644
index 0000000000..610401ce47
--- /dev/null
+++ b/Octokit/Models/Response/UserStar.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+
+namespace Octokit
+{
+ ///
+ /// Represents additional information about a star (such as creation time)
+ ///
+ [DebuggerDisplay("{DebuggerDisplay,nq}")]
+ public class UserStar
+ {
+ public UserStar() { }
+
+ public UserStar(DateTimeOffset starredAt, User user)
+ {
+ StarredAt = starredAt;
+ User = user;
+ }
+
+ ///
+ /// The date the star was created.
+ ///
+ public DateTimeOffset StarredAt { get; protected set; }
+
+ ///
+ /// The user associated with the star.
+ ///
+ public User User { get; protected set; }
+
+ internal string DebuggerDisplay
+ {
+ get
+ {
+ return string.Format(CultureInfo.InvariantCulture, User.DebuggerDisplay);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj
index 3b4d98aecf..de77f1dfcd 100644
--- a/Octokit/Octokit-Mono.csproj
+++ b/Octokit/Octokit-Mono.csproj
@@ -414,6 +414,8 @@
+
+
\ No newline at end of file
diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj
index 83b337ac6a..502e33b4d6 100644
--- a/Octokit/Octokit-MonoAndroid.csproj
+++ b/Octokit/Octokit-MonoAndroid.csproj
@@ -421,6 +421,8 @@
+
+
\ No newline at end of file
diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj
index 79d05bde5d..2bd57a091e 100644
--- a/Octokit/Octokit-Monotouch.csproj
+++ b/Octokit/Octokit-Monotouch.csproj
@@ -417,6 +417,8 @@
+
+
diff --git a/Octokit/Octokit-Portable.csproj b/Octokit/Octokit-Portable.csproj
index b1ac0d7072..5201b8b065 100644
--- a/Octokit/Octokit-Portable.csproj
+++ b/Octokit/Octokit-Portable.csproj
@@ -411,6 +411,8 @@
+
+
diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj
index 11a51e179e..55722aa63b 100644
--- a/Octokit/Octokit-netcore45.csproj
+++ b/Octokit/Octokit-netcore45.csproj
@@ -418,6 +418,8 @@
+
+
diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj
index 3bd8bb7a7c..86b00534ff 100644
--- a/Octokit/Octokit.csproj
+++ b/Octokit/Octokit.csproj
@@ -430,6 +430,8 @@
+
+