Implement pagination on Organization Outside Collaborators Client GetAll() method (#1650)

* Reimplement ApiOptions overloads

* Unskip pagination tests and set page sizes correctly
This commit is contained in:
Ryan Gribble
2017-08-10 06:07:18 +10:00
committed by GitHub
parent 635b42d735
commit b0ff506ab3
8 changed files with 535 additions and 10 deletions

View File

@@ -18,6 +18,19 @@ namespace Octokit.Reactive
/// <returns>The users</returns>
IObservable<User> GetAll(string org);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
IObservable<User> GetAll(string org, ApiOptions options);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
@@ -31,6 +44,20 @@ namespace Octokit.Reactive
/// <returns>The users</returns>
IObservable<User> GetAll(string org, OrganizationMembersFilter filter);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="filter">The filter to use when getting the users, <see cref="OrganizationMembersFilter"/></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
IObservable<User> GetAll(string org, OrganizationMembersFilter filter, ApiOptions options);
/// <summary>
/// Removes a user as an outside collaborator from the organization, this will remove them from all repositories
/// within the organization.

View File

@@ -35,7 +35,26 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
return _connection.GetAndFlattenAllPages<User>(ApiUrls.OutsideCollaborators(org), null, AcceptHeaders.OrganizationMembershipPreview);
return GetAll(org, ApiOptions.None);
}
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
public IObservable<User> GetAll(string org, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages<User>(ApiUrls.OutsideCollaborators(org), null, AcceptHeaders.OrganizationMembershipPreview, options);
}
/// <summary>
@@ -53,7 +72,27 @@ namespace Octokit.Reactive
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
return _connection.GetAndFlattenAllPages<User>(ApiUrls.OutsideCollaborators(org, filter), null, AcceptHeaders.OrganizationMembershipPreview);
return GetAll(org, filter, ApiOptions.None);
}
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="filter">The filter to use when getting the users, <see cref="OrganizationMembersFilter"/></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
public IObservable<User> GetAll(string org, OrganizationMembersFilter filter, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages<User>(ApiUrls.OutsideCollaborators(org, filter), null, AcceptHeaders.OrganizationMembershipPreview, options);
}
/// <summary>

View File

@@ -48,6 +48,54 @@ namespace Octokit.Tests.Integration.Clients
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithoutStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1
};
var outsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, options);
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
var outsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, options);
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilter()
{
@@ -66,6 +114,67 @@ namespace Octokit.Tests.Integration.Clients
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilterAndApiOptions()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1
};
var outsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, OrganizationMembersFilter.All, options);
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilterWithStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var firstPageOptions = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
var firstPageOfOutsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, OrganizationMembersFilter.All, firstPageOptions);
var secondPageOptions = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 2
};
var secondPageOfOutsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions);
Assert.Equal(1, firstPageOfOutsideCollaborators.Count);
Assert.Equal(1, secondPageOfOutsideCollaborators.Count);
Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithTwoFactorFilter()
{
@@ -84,6 +193,31 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithTwoFactorFilterAndApiOptions()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1
};
var outsideCollaborators = await _gitHub.Organization
.OutsideCollaborator
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options);
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
}
}
}
public class TheDeleteMethod

View File

@@ -46,6 +46,52 @@ namespace Octokit.Tests.Integration.Reactive
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithoutStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1
};
var outsideCollaborators = await _client
.GetAll(Helper.Organization, options).ToList();
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
var outsideCollaborators = await _client
.GetAll(Helper.Organization, options).ToList();
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilter()
{
@@ -63,6 +109,64 @@ namespace Octokit.Tests.Integration.Reactive
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilterAndApiOptions()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1
};
var outsideCollaborators = await _client
.GetAll(Helper.Organization, OrganizationMembersFilter.All, options).ToList();
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithAllFilterWithStart()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var firstPageOptions = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
var firstPageOfOutsideCollaborators = await _client
.GetAll(Helper.Organization, OrganizationMembersFilter.All, firstPageOptions).ToList();
var secondPageOptions = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 2
};
var secondPageOfOutsideCollaborators = await _client
.GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions).ToList();
Assert.Equal(1, firstPageOfOutsideCollaborators.Count);
Assert.Equal(1, secondPageOfOutsideCollaborators.Count);
Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithTwoFactorFilter()
{
@@ -80,6 +184,30 @@ namespace Octokit.Tests.Integration.Reactive
Assert.Equal("alfhenrik-test-2", outsideCollaborators[0].Login);
}
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfOutsideCollaboratorsWithTwoFactorFilterAndApiOptions()
{
var repoName = Helper.MakeNameWithTimestamp("public-repo");
using (var context = await _gitHub.CreateRepositoryContext(Helper.Organization, new NewRepository(repoName)))
{
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, _fixtureCollaborator);
await _gitHub.Repository.Collaborator.Add(context.RepositoryOwner, context.RepositoryName, "alfhenrik");
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1
};
var outsideCollaborators = await _client
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options).ToList();
Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count);
Assert.Equal("alfhenrik-test-2", outsideCollaborators[0].Login);
}
}
}
public class TheDeleteMethod

View File

@@ -26,7 +26,25 @@ namespace Octokit.Tests.Clients
client.GetAll("org");
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators"), null, "application/vnd.github.korra-preview+json");
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators"), null, "application/vnd.github.korra-preview+json", Args.ApiOptions);
}
[Fact]
public void RequestsTheCorrectUrlWithApiOptions()
{
var connection = Substitute.For<IApiConnection>();
var client = new OrganizationOutsideCollaboratorsClient(connection);
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
client.GetAll("org", options);
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators"), null, "application/vnd.github.korra-preview+json", options);
}
[Fact]
@@ -37,10 +55,17 @@ namespace Octokit.Tests.Clients
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, ApiOptions.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("org", null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All, ApiOptions.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("org", OrganizationMembersFilter.All, null));
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll(""));
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", ApiOptions.None));
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All));
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All, ApiOptions.None));
}
[Fact]
@@ -51,7 +76,25 @@ namespace Octokit.Tests.Clients
client.GetAll("org", OrganizationMembersFilter.All);
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"), null, "application/vnd.github.korra-preview+json");
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"), null, "application/vnd.github.korra-preview+json", Args.ApiOptions);
}
[Fact]
public void AllFilterRequestsTheCorrectUrlWithApiOptions()
{
var connection = Substitute.For<IApiConnection>();
var client = new OrganizationOutsideCollaboratorsClient(connection);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
client.GetAll("org", OrganizationMembersFilter.All, options);
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"), null, "application/vnd.github.korra-preview+json", options);
}
[Fact]
@@ -62,7 +105,25 @@ namespace Octokit.Tests.Clients
client.GetAll("org", OrganizationMembersFilter.TwoFactorAuthenticationDisabled);
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"), null, "application/vnd.github.korra-preview+json");
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"), null, "application/vnd.github.korra-preview+json", Args.ApiOptions);
}
[Fact]
public void TwoFactorFilterRequestsTheCorrectUrlWithApiOptions()
{
var connection = Substitute.For<IApiConnection>();
var client = new OrganizationOutsideCollaboratorsClient(connection);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
client.GetAll("org", OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options);
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"), null, "application/vnd.github.korra-preview+json", options);
}
}

View File

@@ -31,7 +31,28 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators"),
null,
Args.EmptyDictionary,
"application/vnd.github.korra-preview+json");
}
[Fact]
public void RequestsTheCorrectUrlWithApiOptions()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableOrganizationOutsideCollaboratorsClient(gitHubClient);
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
client.GetAll("org", options);
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators"),
Arg.Is<IDictionary<string, string>>(d => d.Count == 2),
"application/vnd.github.korra-preview+json");
}
@@ -43,10 +64,17 @@ namespace Octokit.Tests.Reactive
Assert.Throws<ArgumentNullException>(() => client.GetAll(null));
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, ApiOptions.None));
Assert.Throws<ArgumentNullException>(() => client.GetAll("org", null));
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All));
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, OrganizationMembersFilter.All, ApiOptions.None));
Assert.Throws<ArgumentNullException>(() => client.GetAll("org", OrganizationMembersFilter.All, null));
Assert.Throws<ArgumentException>(() => client.GetAll(""));
Assert.Throws<ArgumentException>(() => client.GetAll("", ApiOptions.None));
Assert.Throws<ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All));
Assert.Throws<ArgumentException>(() => client.GetAll("", OrganizationMembersFilter.All, ApiOptions.None));
}
[Fact]
@@ -59,7 +87,28 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"),
null,
Args.EmptyDictionary,
"application/vnd.github.korra-preview+json");
}
[Fact]
public void AllFilterRequestsTheCorrectUrlWithApiOptions()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableOrganizationOutsideCollaboratorsClient(gitHubClient);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
client.GetAll("org", OrganizationMembersFilter.All, options);
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=all"),
Arg.Is<IDictionary<string, string>>(d => d.Count == 2),
"application/vnd.github.korra-preview+json");
}
@@ -73,7 +122,28 @@ namespace Octokit.Tests.Reactive
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"),
null,
Args.EmptyDictionary,
"application/vnd.github.korra-preview+json");
}
[Fact]
public void TwoFactorFilterRequestsTheCorrectUrlWithApiOptions()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableOrganizationOutsideCollaboratorsClient(gitHubClient);
var options = new ApiOptions
{
PageSize = 1,
PageCount = 1,
StartPage = 1
};
client.GetAll("org", OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options);
gitHubClient.Connection.Received(1).Get<List<User>>(
Arg.Is<Uri>(u => u.ToString() == "orgs/org/outside_collaborators?filter=2fa_disabled"),
Arg.Is<IDictionary<string, string>>(d => d.Count == 2),
"application/vnd.github.korra-preview+json");
}
}

View File

@@ -17,6 +17,19 @@ namespace Octokit
/// <returns>The users</returns>
Task<IReadOnlyList<User>> GetAll(string org);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
Task<IReadOnlyList<User>> GetAll(string org, ApiOptions options);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
@@ -30,6 +43,20 @@ namespace Octokit
/// <returns>The users</returns>
Task<IReadOnlyList<User>> GetAll(string org, OrganizationMembersFilter filter);
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="filter">The filter to use when getting the users, <see cref="OrganizationMembersFilter"/></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
Task<IReadOnlyList<User>> GetAll(string org, OrganizationMembersFilter filter, ApiOptions options);
/// <summary>
/// Removes a user as an outside collaborator from the organization, this will remove them from all repositories
/// within the organization.

View File

@@ -36,7 +36,26 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
return ApiConnection.GetAll<User>(ApiUrls.OutsideCollaborators(org), null, AcceptHeaders.OrganizationMembershipPreview);
return GetAll(org, ApiOptions.None);
}
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
public Task<IReadOnlyList<User>> GetAll(string org, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll<User>(ApiUrls.OutsideCollaborators(org), null, AcceptHeaders.OrganizationMembershipPreview, options);
}
/// <summary>
@@ -54,7 +73,27 @@ namespace Octokit
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
return ApiConnection.GetAll<User>(ApiUrls.OutsideCollaborators(org, filter), null, AcceptHeaders.OrganizationMembershipPreview);
return GetAll(org, filter, ApiOptions.None);
}
/// <summary>
/// List all users who are outside collaborators of an organization. An outside collaborator is a user that
/// is not a member of the organization.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators">API documentation</a>
/// for more information.
/// </remarks>
/// <param name="org">The login for the organization</param>
/// <param name="filter">The filter to use when getting the users, <see cref="OrganizationMembersFilter"/></param>
/// <param name="options">Options for changing the API response</param>
/// <returns>The users</returns>
public Task<IReadOnlyList<User>> GetAll(string org, OrganizationMembersFilter filter, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
Ensure.ArgumentNotNull(options, nameof(options));
return ApiConnection.GetAll<User>(ApiUrls.OutsideCollaborators(org, filter), null, AcceptHeaders.OrganizationMembershipPreview, options);
}
/// <summary>