using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
namespace Octokit
{
///
/// A client for GitHub's User Followers API
///
///
/// See the Followers API documentation for more information.
///
public class FollowersClient : ApiClient, IFollowersClient
{
///
/// Initializes a new GitHub User Followers API client.
///
/// An API connection
public FollowersClient(IApiConnection apiConnection) : base(apiConnection)
{
}
///
/// List the authenticated user’s followers
///
///
/// See the API documentation for more information.
///
/// A of s that follow the authenticated user.
public Task> GetAllForCurrent()
{
return GetAllForCurrent(ApiOptions.None);
}
///
/// List the authenticated user’s followers
///
/// Options for changing the API response
///
/// See the API documentation for more information.
///
/// A of s that follow the authenticated user.
public Task> GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll(ApiUrls.Followers(),options);
}
///
/// List a user’s followers
///
/// The login name for the user
///
/// See the API documentation for more information.
///
/// A of s that follow the passed user.
public Task> GetAll(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
return GetAll(login, ApiOptions.None);
}
///
/// List a user’s followers
///
/// The login name for the user
/// Options for changing the API response
///
/// See the API documentation for more information.
///
/// A of s that follow the passed user.
public Task> GetAll(string login, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll(ApiUrls.Followers(login), options);
}
///
/// List who the authenticated user is following
///
///
/// See the API documentation for more information.
///
/// A of s that the authenticated user follows.
public Task> GetAllFollowingForCurrent()
{
return GetAllFollowingForCurrent(ApiOptions.None);
}
///
/// List who the authenticated user is following
///
/// Options for changing the API response
///
/// See the API documentation for more information.
///
/// A of s that the authenticated user follows.
public Task> GetAllFollowingForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll(ApiUrls.Following(), options);
}
///
/// List who a user is following
///
/// The login name of the user
///
/// See the API documentation for more information.
///
/// A of s that the passed user follows.
public Task> GetAllFollowing(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
return GetAllFollowing(login, ApiOptions.None);
}
///
/// List who a user is following
///
/// The login name of the user
/// Options for changing the API response
///
/// See the API documentation for more information.
///
/// A of s that the passed user follows.
public Task> GetAllFollowing(string login, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
Ensure.ArgumentNotNull(options, "options");
return ApiConnection.GetAll(ApiUrls.Following(login), options);
}
///
/// Check if the authenticated user follows another user
///
/// The login name of the other user
///
/// See the API documentation for more information.
///
/// A bool representing the success of the operation.
public async Task IsFollowingForCurrent(string following)
{
Ensure.ArgumentNotNullOrEmptyString(following, "following");
try
{
var response = await Connection.Get