Skip to content

Commit

Permalink
Add ApiOption overloads to methods on IFollowersClient (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTh3D3v authored and shiftkey committed Apr 11, 2016
1 parent 43f6cfe commit 750aed6
Show file tree
Hide file tree
Showing 8 changed files with 633 additions and 18 deletions.
43 changes: 43 additions & 0 deletions Octokit.Reactive/Clients/IObservableFollowersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ public interface IObservableFollowersClient
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<User> GetAllForCurrent();

/// <summary>
/// List the authenticated user’s followers
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-followers-of-a-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the authenticated user.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<User> GetAllForCurrent(ApiOptions options);

/// <summary>
/// List a user’s followers
/// </summary>
Expand All @@ -26,6 +37,17 @@ public interface IObservableFollowersClient
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the passed user.</returns>
IObservable<User> GetAll(string login);

/// <summary>
/// List a user’s followers
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <param name="login">The login name for the user</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-followers-of-a-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the passed user.</returns>
IObservable<User> GetAll(string login, ApiOptions options);

/// <summary>
/// List who the authenticated user is following
/// </summary>
Expand All @@ -36,6 +58,16 @@ public interface IObservableFollowersClient
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<User> GetAllFollowingForCurrent();

/// <summary>
/// List who the authenticated user is following
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
IObservable<User> GetAllFollowingForCurrent(ApiOptions options);

/// <summary>
/// List who a user is following
/// </summary>
Expand All @@ -46,6 +78,17 @@ public interface IObservableFollowersClient
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
IObservable<User> GetAllFollowing(string login);

/// <summary>
/// List who a user is following
/// </summary>
/// <param name="login">The login name of the user</param>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
IObservable<User> GetAllFollowing(string login, ApiOptions options);

/// <summary>
/// Check if the authenticated user follows another user
/// </summary>
Expand Down
72 changes: 68 additions & 4 deletions Octokit.Reactive/Clients/ObservableFollowersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ public ObservableFollowersClient(IGitHubClient client)
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the authenticated user.</returns>
public IObservable<User> GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Followers());
return GetAllForCurrent(ApiOptions.None);
}

/// <summary>
/// List the authenticated user’s followers
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-followers-of-a-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the authenticated user.</returns>
public IObservable<User> GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Followers(), options);
}

/// <summary>
Expand All @@ -46,7 +61,24 @@ public IObservable<User> GetAll(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Followers(login));
return GetAll(login, ApiOptions.None);
}

/// <summary>
/// List a user’s followers
/// </summary>
/// <param name="login">The login name for the user</param>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-followers-of-a-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the passed user.</returns>
public IObservable<User> GetAll(string login, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Followers(login), options);
}

/// <summary>
Expand All @@ -58,7 +90,22 @@ public IObservable<User> GetAll(string login)
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
public IObservable<User> GetAllFollowingForCurrent()
{
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following());
return GetAllFollowingForCurrent(ApiOptions.None);
}

/// <summary>
/// List who the authenticated user is following
/// </summary>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
public IObservable<User> GetAllFollowingForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following(), options);
}

/// <summary>
Expand All @@ -73,7 +120,24 @@ public IObservable<User> GetAllFollowing(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following(login));
return GetAllFollowing(login, ApiOptions.None);
}

/// <summary>
/// List who a user is following
/// </summary>
/// <param name="login">The login name of the user</param>
/// <param name="options">Options for changing the API response</param>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
/// </remarks>
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
public IObservable<User> GetAllFollowing(string login, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following(login), options);
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<Compile Include="Reactive\Enterprise\ObservableEnterpriseLicenseClientTests.cs" />
<Compile Include="Reactive\Enterprise\ObservableEnterpriseSearchIndexingClientTests.cs" />
<Compile Include="Reactive\Enterprise\ObservableEnterpriseOrganizationClientTests.cs" />
<Compile Include="Reactive\ObservableFollowersClientTests.cs" />
<Compile Include="Reactive\ObservableRepositoryDeployKeysClientTests.cs" />
<Compile Include="Reactive\ObservableAssigneesClientTests.cs" />
<Compile Include="Reactive\ObservableAuthorizationsClientTests.cs" />
Expand Down
Loading

0 comments on commit 750aed6

Please sign in to comment.