mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-02 02:45:32 +00:00
add GetMembership endpoint which supports new behaviour
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#if NET_45
|
||||
using System;
|
||||
#if NET_45
|
||||
using System.Collections.Generic;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
@@ -94,6 +95,7 @@ namespace Octokit
|
||||
/// <param name="id">The team to check.</param>
|
||||
/// <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>
|
||||
[Obsolete("Use GetMembership(id, login) as this will report on pending requests")]
|
||||
Task<bool> IsMember(int id, string login);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#if NET_45
|
||||
|
||||
using System;
|
||||
#if NET_45
|
||||
using System.Collections.Generic;
|
||||
#endif
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Octokit.Models.Response;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
@@ -67,6 +69,23 @@ namespace Octokit
|
||||
return ApiConnection.GetAll<User>(endpoint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all members of the given team.
|
||||
/// </summary>
|
||||
/// <param name="id">The team identifier</param>
|
||||
/// <param name="login">The username to query</param>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/orgs/teams/#list-team-members
|
||||
/// </remarks>
|
||||
/// <returns>A list of the team's member <see cref="User"/>s.</returns>
|
||||
public Task<TeamMembership> GetMembership(int id, string login)
|
||||
{
|
||||
var endpoint = ApiUrls.TeamMember(id, login);
|
||||
|
||||
return ApiConnection.Get<TeamMembership>(endpoint);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns newly created <see cref="Team" /> for the current org.
|
||||
/// </summary>
|
||||
@@ -168,6 +187,7 @@ namespace Octokit
|
||||
/// <param name="id">The team to check.</param>
|
||||
/// <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>
|
||||
[Obsolete("Use GetMembership(id, login) as this will report on pending requests")]
|
||||
public async Task<bool> IsMember(int id, string login)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Octokit.Models.Response
|
||||
{
|
||||
public enum TeamMembership
|
||||
{
|
||||
NotFound = 0,
|
||||
Pending = 1,
|
||||
Active = 2
|
||||
}
|
||||
}
|
||||
@@ -222,6 +222,7 @@
|
||||
<Compile Include="Models\Response\SearchResult.cs" />
|
||||
<Compile Include="Models\Response\SearchUsersResult.cs" />
|
||||
<Compile Include="Models\Response\Subscription.cs" />
|
||||
<Compile Include="Models\Response\TeamMembership.cs" />
|
||||
<Compile Include="Models\Response\ThreadSubscription.cs" />
|
||||
<Compile Include="Models\Response\TreeItem.cs" />
|
||||
<Compile Include="Models\Response\TreeResponse.cs" />
|
||||
|
||||
Reference in New Issue
Block a user