added GetAllForCurrent to find teams for the current user

This commit is contained in:
Brendan Forster
2015-05-22 14:44:25 +09:30
parent 609c44e923
commit dbd48d7a90
5 changed files with 46 additions and 0 deletions
@@ -31,6 +31,14 @@ namespace Octokit.Reactive
/// <returns>A list of the orgs's teams <see cref="Team"/>s.</returns>
IObservable<Team> GetAll(string org);
/// <summary>
/// Returns all <see cref="Team" />s for the current user.
/// </summary>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A list of the user's <see cref="Team"/>s.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<Team> GetAllForCurrent();
/// <summary>
/// Returns all members of the given team.
/// </summary>
@@ -51,6 +51,16 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Team>(ApiUrls.OrganizationTeams(org));
}
/// <summary>
/// Returns all <see cref="Team" />s for the current user.
/// </summary>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A list of the user's <see cref="Team"/>s.</returns>
public IObservable<Team> GetAllForCurrent()
{
return _connection.GetAndFlattenAllPages<Team>(ApiUrls.UserTeams());
}
/// <summary>
/// Returns all members of the given team.
/// </summary>
+7
View File
@@ -34,6 +34,13 @@ namespace Octokit
/// <returns>A list of the orgs's teams <see cref="Team"/>s.</returns>
Task<IReadOnlyList<Team>> GetAll(string org);
/// <summary>
/// Returns all <see cref="Team" />s for the current user.
/// </summary>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A list of the user's <see cref="Team"/>s.</returns>
Task<IReadOnlyList<Team>> GetAllForCurrent();
/// <summary>
/// Returns all members of the given team.
/// </summary>
+11
View File
@@ -52,6 +52,17 @@ namespace Octokit
return ApiConnection.GetAll<Team>(endpoint);
}
/// <summary>
/// Returns all <see cref="Team" />s for the current user.
/// </summary>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A list of the user's <see cref="Team"/>s.</returns>
public Task<IReadOnlyList<Team>> GetAllForCurrent()
{
var endpoint = ApiUrls.UserTeams();
return ApiConnection.GetAll<Team>(endpoint);
}
/// <summary>
/// Returns all members of the given team.
/// </summary>
+10
View File
@@ -1148,6 +1148,16 @@ namespace Octokit
return "orgs/{0}/teams".FormatUri(organization);
}
/// <summary>
/// Returns the <see cref="Uri"/> to discover teams
/// for the current user
/// </summary>
/// <returns></returns>
public static Uri UserTeams()
{
return "user/teams".FormatUri();
}
/// <summary>
/// Returns the <see cref="Uri"/> for teams
/// use for getting, updating, or deleting a <see cref="Team"/>.