mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
Add observable methods
This commit is contained in:
@@ -27,6 +27,29 @@ namespace Octokit.Reactive
|
||||
/// <returns></returns>
|
||||
IObservable<User> GetAll(string org);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// List all users who are members of an organization. A member is a user that
|
||||
/// belongs to at least 1 team in the organization.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the authenticated user is also an owner of this organization then both
|
||||
/// concealed and public member will be returned.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the requester is not an owner of the organization the query will be redirected
|
||||
/// to the public members list.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/orgs/members/#members-list">API documentation</a>
|
||||
/// for more information.
|
||||
/// </remarks>
|
||||
/// <param name="org">The login for the organization</param>
|
||||
/// <param name="filter">The filter expression to use</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<User> GetAll(string org, string filter);
|
||||
|
||||
/// <summary>
|
||||
/// List all users who have publicized their membership of the organization.
|
||||
/// </summary>
|
||||
|
||||
@@ -71,5 +71,12 @@ namespace Octokit.Reactive
|
||||
/// <param name="login">The user to check.</param>
|
||||
/// <returns><see langword="true"/> if the user is a member of the team; <see langword="false"/> otherwise.</returns>
|
||||
IObservable<bool> IsMember(int id, string login);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all team's repositories.
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>The team's repositories</returns>
|
||||
public IObservable<Repository> GetRepositories(int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,36 @@ namespace Octokit.Reactive
|
||||
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Members(org));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// List all users who are members of an organization. A member is a user that
|
||||
/// belongs to at least 1 team in the organization.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the authenticated user is also an owner of this organization then both
|
||||
/// concealed and public member will be returned.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the requester is not an owner of the organization the query will be redirected
|
||||
/// to the public members list.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/orgs/members/#members-list">API documentation</a>
|
||||
/// for more information.
|
||||
/// </remarks>
|
||||
/// <param name="org">The login for the organization</param>
|
||||
/// <param name="filter">The filter expression to use</param>
|
||||
/// <returns></returns>
|
||||
public IObservable<User> GetAll(string org, string filter)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(org, "org");
|
||||
Ensure.ArgumentNotNullOrEmptyString(filter, "filter");
|
||||
|
||||
|
||||
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Members(org, filter));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all users who have publicized their membership of the organization.
|
||||
/// </summary>
|
||||
|
||||
@@ -107,5 +107,14 @@ namespace Octokit.Reactive
|
||||
return _client.IsMember(id, login).ToObservable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all team's repositories.
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>The team's repositories</returns>
|
||||
public IObservable<Repository> GetRepositories(int id)
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.TeamRepositories(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||
|
||||
var endpoint = ApiUrls.TeamMember(id, login);
|
||||
return ApiConnection.Connection.Put(endpoint);
|
||||
return ApiConnection.Put(endpoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -150,9 +150,7 @@ namespace Octokit
|
||||
public Task RemoveMember(int id, string login)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||
|
||||
var endpoint = ApiUrls.TeamMember(id, login);
|
||||
return ApiConnection.Delete(endpoint);
|
||||
return ApiConnection.Delete(ApiUrls.TeamMember(id, login));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user