diff --git a/Octokit.Tests/Clients/WatchedClientTests.cs b/Octokit.Tests/Clients/WatchedClientTests.cs index 804b6901..27ad95df 100644 --- a/Octokit.Tests/Clients/WatchedClientTests.cs +++ b/Octokit.Tests/Clients/WatchedClientTests.cs @@ -31,7 +31,7 @@ namespace Octokit.Tests.Clients client.GetAllForCurrent(); - connection.Received().GetAll(endpoint); + connection.Received().GetAll(endpoint, Arg.Any()); } } @@ -46,7 +46,7 @@ namespace Octokit.Tests.Clients client.GetAllForUser("banana"); - connection.Received().GetAll(endpoint); + connection.Received().GetAll(endpoint, Arg.Any()); } } @@ -61,7 +61,7 @@ namespace Octokit.Tests.Clients client.GetAllWatchers("fight", "club"); - connection.Received().GetAll(endpoint); + connection.Received().GetAll(endpoint, Arg.Any()); } } diff --git a/Octokit/Clients/IWatchedClient.cs b/Octokit/Clients/IWatchedClient.cs index 32aa2756..c42a2848 100644 --- a/Octokit/Clients/IWatchedClient.cs +++ b/Octokit/Clients/IWatchedClient.cs @@ -21,6 +21,16 @@ namespace Octokit /// A of s watching the passed repository. Task> GetAllWatchers(string owner, string name); + /// + /// Retrieves all of the watchers for the passed repository. + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// A of s watching the passed repository. + Task> GetAllWatchers(string owner, string name, ApiOptions options); + /// /// Retrieves all of the watched (ies) for the current user. /// @@ -31,6 +41,17 @@ namespace Octokit [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] Task> GetAllForCurrent(); + /// + /// Retrieves all of the watched (ies) for the current user. + /// + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// + /// A of (ies) watched by the current authenticated user. + /// + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] + Task> GetAllForCurrent(ApiOptions options); + /// /// Retrieves all of the (ies) watched by the specified user. /// @@ -41,6 +62,17 @@ namespace Octokit /// Task> GetAllForUser(string user); + /// + /// Retrieves all of the (ies) watched by the specified user. + /// + /// The login of the user + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// + /// A (ies) watched by the specified user. + /// + Task> GetAllForUser(string user, ApiOptions options); + /// /// Check if a repository is watched by the current authenticated user. /// diff --git a/Octokit/Clients/WatchedClient.cs b/Octokit/Clients/WatchedClient.cs index e406696a..e6ba1dee 100644 --- a/Octokit/Clients/WatchedClient.cs +++ b/Octokit/Clients/WatchedClient.cs @@ -33,7 +33,24 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return ApiConnection.GetAll(ApiUrls.Watchers(owner, name)); + return GetAllWatchers(owner, name, ApiOptions.None); + } + + /// + /// Retrieves all of the watchers for the passed repository. + /// + /// The owner of the repository + /// The name of the repository + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// A of s watching the passed repository. + public Task> GetAllWatchers(string owner, string name, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNull(options, "options"); + + return ApiConnection.GetAll(ApiUrls.Watchers(owner, name), options); } /// @@ -45,7 +62,22 @@ namespace Octokit /// public Task> GetAllForCurrent() { - return ApiConnection.GetAll(ApiUrls.Watched()); + return GetAllForCurrent(ApiOptions.None); + } + + /// + /// Retrieves all of the watched (ies) for the current user. + /// + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// + /// A of (ies) watched by the current authenticated user. + /// + public Task> GetAllForCurrent(ApiOptions options) + { + Ensure.ArgumentNotNull(options, "options"); + + return ApiConnection.GetAll(ApiUrls.Watched(), options); } /// @@ -60,7 +92,24 @@ namespace Octokit { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return ApiConnection.GetAll(ApiUrls.WatchedByUser(user)); + return GetAllForUser(user, ApiOptions.None); + } + + /// + /// Retrieves all of the (ies) watched by the specified user. + /// + /// The login of the user + /// Options for changing API's response. + /// Thrown if the client is not authenticated. + /// + /// A (ies) watched by the specified user. + /// + public Task> GetAllForUser(string user, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(user, "user"); + Ensure.ArgumentNotNull(options, "options"); + + return ApiConnection.GetAll(ApiUrls.WatchedByUser(user), options); } ///