diff --git a/Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs b/Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs index 49deeb9874..6618e1594a 100644 --- a/Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepoCollaboratorsClient.cs @@ -54,6 +54,54 @@ public interface IObservableRepoCollaboratorsClient /// Options for changing the API response /// Thrown when a general API error occurs. IObservable GetAll(long repositoryId, ApiOptions options); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + IObservable GetAll(string owner, string name, RepositoryCollaboratorListRequest request); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + IObservable GetAll(long repositoryId, RepositoryCollaboratorListRequest request); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + IObservable GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + IObservable GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options); /// /// Checks if a user is a collaborator on a repository. diff --git a/Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs b/Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs index 719d8614bc..c81c4f89a7 100644 --- a/Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepoCollaboratorsClient.cs @@ -74,7 +74,7 @@ public IObservable GetAll(string owner, string name, ApiOptions options) Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); - return _connection.GetAndFlattenAllPages(ApiUrls.RepoCollaborators(owner, name), options); + return GetAll(owner, name, new RepositoryCollaboratorListRequest(), options); } /// @@ -89,8 +89,82 @@ public IObservable GetAll(string owner, string name, ApiOptions options) public IObservable GetAll(long repositoryId, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAll(repositoryId, new RepositoryCollaboratorListRequest(), options); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + public IObservable GetAll(string owner, string name, RepositoryCollaboratorListRequest request) + { + Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); + Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); + Ensure.ArgumentNotNull(request, nameof(request)); + + return GetAll(owner, name, request, ApiOptions.None); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + public IObservable GetAll(long repositoryId, RepositoryCollaboratorListRequest request) + { + Ensure.ArgumentNotNull(request, nameof(request)); + + return GetAll(repositoryId, request, ApiOptions.None); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + public IObservable GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); + Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); + Ensure.ArgumentNotNull(request, nameof(request)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return _connection.GetAndFlattenAllPages(ApiUrls.RepoCollaborators(owner, name), request.ToParametersDictionary(), AcceptHeaders.NestedTeamsPreview, options); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + public IObservable GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options) + { + Ensure.ArgumentNotNull(request, nameof(request)); + Ensure.ArgumentNotNull(options, nameof(options)); - return _connection.GetAndFlattenAllPages(ApiUrls.RepoCollaborators(repositoryId), options); + return _connection.GetAndFlattenAllPages(ApiUrls.RepoCollaborators(repositoryId), request.ToParametersDictionary(), AcceptHeaders.NestedTeamsPreview, options); } /// diff --git a/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs b/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs index edd87c8944..52ddb25ba6 100644 --- a/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs +++ b/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs @@ -33,7 +33,11 @@ public void RequestsCorrectUrl() client.GetAll("owner", "test"); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), Args.ApiOptions); + connection.Received().GetAll( + Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), + Arg.Any>(), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); } [Fact] @@ -44,7 +48,11 @@ public void RequestsCorrectUrlWithRepositoryId() client.GetAll(1); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/collaborators"), Args.ApiOptions); + connection.Received().GetAll( + Arg.Is(u => u.ToString() == "repositories/1/collaborators"), + Arg.Any>(), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); } [Fact] @@ -63,7 +71,53 @@ public void RequestsCorrectUrlWithApiOptions() client.GetAll("owner", "test", options); connection.Received() - .GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), options); + .GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), + Arg.Any>(), + "application/vnd.github.hellcat-preview+json", + options); + } + + [Fact] + public void RequestsCorrectUrlWithCollaboratorFilter() + { + var connection = Substitute.For(); + var client = new RepoCollaboratorsClient(connection); + + var request = new RepositoryCollaboratorListRequest(); + + client.GetAll("owner", "test", request); + + connection.Received() + .GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), + Arg.Is>(d => d["affiliation"] == "all"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Direct + }; + + client.GetAll("owner", "test", request); + + connection.Received() + .GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), + Arg.Is>(d => d["affiliation"] == "direct"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Outside + }; + + client.GetAll("owner", "test", request); + + connection.Received() + .GetAll(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators"), + Arg.Is>(d => d["affiliation"] == "outside"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); } [Fact] @@ -82,7 +136,57 @@ public void RequestsCorrectUrlWithApiOptionsAndRepositoryId() client.GetAll(1, options); connection.Received() - .GetAll(Arg.Is(u => u.ToString() == "repositories/1/collaborators"), options); + .GetAll( + Arg.Is(u => u.ToString() == "repositories/1/collaborators"), + Arg.Any>(), + "application/vnd.github.hellcat-preview+json", + options); + } + + [Fact] + public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId() + { + var connection = Substitute.For(); + var client = new RepoCollaboratorsClient(connection); + + var request = new RepositoryCollaboratorListRequest(); + + client.GetAll(1, request); + + connection.Received() + .GetAll( + Arg.Is(u => u.ToString() == "repositories/1/collaborators"), + Arg.Is>(d => d["affiliation"] == "all"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Direct + }; + + client.GetAll(1, request); + + connection.Received() + .GetAll( + Arg.Is(u => u.ToString() == "repositories/1/collaborators"), + Arg.Is>(d => d["affiliation"] == "direct"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Outside + }; + + client.GetAll(1, request); + + connection.Received() + .GetAll( + Arg.Is(u => u.ToString() == "repositories/1/collaborators"), + Arg.Is>(d => d["affiliation"] == "outside"), + "application/vnd.github.hellcat-preview+json", + Args.ApiOptions); } [Fact] @@ -97,9 +201,11 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.GetAll(null, "test", ApiOptions.None)); await Assert.ThrowsAsync(() => client.GetAll("owner", null, ApiOptions.None)); - await Assert.ThrowsAsync(() => client.GetAll("owner", "test", null)); + await Assert.ThrowsAsync(() => client.GetAll("owner", "test", options: null)); + await Assert.ThrowsAsync(() => client.GetAll("owner", "test", request: null)); - await Assert.ThrowsAsync(() => client.GetAll(1, null)); + await Assert.ThrowsAsync(() => client.GetAll(1, options: null)); + await Assert.ThrowsAsync(() => client.GetAll(1, request: null)); } } diff --git a/Octokit.Tests/Reactive/ObservableRepoCollaboratorsClientTests.cs b/Octokit.Tests/Reactive/ObservableRepoCollaboratorsClientTests.cs index 57d2231981..9eceeadcf6 100644 --- a/Octokit.Tests/Reactive/ObservableRepoCollaboratorsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepoCollaboratorsClientTests.cs @@ -39,8 +39,10 @@ public void EnsuresNonNullArguments() { Assert.Throws(() => _client.GetAll(null, name)); Assert.Throws(() => _client.GetAll(owner, null)); - Assert.Throws(() => _client.GetAll(owner, name, null)); - Assert.Throws(() => _client.GetAll(repositoryId, null)); + Assert.Throws(() => _client.GetAll(owner, name, options: null)); + Assert.Throws(() => _client.GetAll(repositoryId, options: null)); + Assert.Throws(() => _client.GetAll(owner, name, request: null)); + Assert.Throws(() => _client.GetAll(repositoryId, request: null)); } [Fact] @@ -67,8 +69,8 @@ public void RequestsCorrectUrl() _client.GetAll(owner, name); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), - Arg.Any()); + Arg.Is>(dictionary => dictionary.Count == 1), + "application/vnd.github.hellcat-preview+json"); } [Fact] @@ -79,8 +81,8 @@ public void RequestsCorrectUrlWithRepositoryId() _client.GetAll(repositoryId); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), - Arg.Any()); + Arg.Is>(dictionary => dictionary.Count == 1), + "application/vnd.github.hellcat-preview+json"); } [Fact] @@ -99,8 +101,8 @@ public void RequestsCorrectUrlWithApiOptions() _client.GetAll(owner, name, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 2), - null); + Arg.Is>(dictionary => dictionary.Count == 3), + "application/vnd.github.hellcat-preview+json"); // StartPage is setted => only 1 option (StartPage) in dictionary options = new ApiOptions @@ -111,8 +113,8 @@ public void RequestsCorrectUrlWithApiOptions() _client.GetAll(owner, name, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 1), - null); + Arg.Is>(dictionary => dictionary.Count == 2), + "application/vnd.github.hellcat-preview+json"); // PageCount is setted => none of options in dictionary options = new ApiOptions @@ -123,8 +125,45 @@ public void RequestsCorrectUrlWithApiOptions() _client.GetAll(owner, name, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), - null); + Arg.Is>(dictionary => dictionary.Count == 1), + "application/vnd.github.hellcat-preview+json"); + } + + [Fact] + public void RequestsCorrectUrlWithCollaboratorFilter() + { + var expectedUrl = string.Format("repos/{0}/{1}/collaborators", owner, name); + + var request = new RepositoryCollaboratorListRequest(); + + _client.GetAll(owner, name, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "all"), + "application/vnd.github.hellcat-preview+json"); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Direct + }; + + _client.GetAll(owner, name, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "direct"), + "application/vnd.github.hellcat-preview+json"); + + // PageCount is setted => none of options in dictionary + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Outside + }; + + _client.GetAll(owner, name, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "outside"), + "application/vnd.github.hellcat-preview+json"); } [Fact] @@ -143,8 +182,8 @@ public void RequestsCorrectUrlWithApiOptionsAndRepositoryId() _client.GetAll(repositoryId, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 2), - null); + Arg.Is>(dictionary => dictionary.Count == 3), + "application/vnd.github.hellcat-preview+json"); // StartPage is setted => only 1 option (StartPage) in dictionary options = new ApiOptions @@ -155,8 +194,8 @@ public void RequestsCorrectUrlWithApiOptionsAndRepositoryId() _client.GetAll(repositoryId, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 1), - null); + Arg.Is>(dictionary => dictionary.Count == 2), + "application/vnd.github.hellcat-preview+json"); // PageCount is setted => none of options in dictionary options = new ApiOptions @@ -167,8 +206,44 @@ public void RequestsCorrectUrlWithApiOptionsAndRepositoryId() _client.GetAll(repositoryId, options); _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), - null); + Arg.Is>(dictionary => dictionary.Count == 1), + "application/vnd.github.hellcat-preview+json"); + } + + [Fact] + public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId() + { + var expectedUrl = string.Format("repositories/{0}/collaborators", repositoryId); + + var request = new RepositoryCollaboratorListRequest(); + + _client.GetAll(repositoryId, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "all"), + "application/vnd.github.hellcat-preview+json"); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Direct + }; + + _client.GetAll(repositoryId, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "direct"), + "application/vnd.github.hellcat-preview+json"); + + request = new RepositoryCollaboratorListRequest + { + Affiliation = CollaboratorAffiliation.Outside + }; + + _client.GetAll(repositoryId, request); + _githubClient.Connection.Received(1) + .Get>(Arg.Is(u => u.ToString() == expectedUrl), + Arg.Is>(d => d["affiliation"] == "outside"), + "application/vnd.github.hellcat-preview+json"); } } diff --git a/Octokit/Clients/IRepoCollaboratorsClient.cs b/Octokit/Clients/IRepoCollaboratorsClient.cs index 2986795f54..b8f62f313b 100644 --- a/Octokit/Clients/IRepoCollaboratorsClient.cs +++ b/Octokit/Clients/IRepoCollaboratorsClient.cs @@ -54,6 +54,54 @@ public interface IRepoCollaboratorsClient /// Options for changing the API response /// Thrown when a general API error occurs. Task> GetAll(long repositoryId, ApiOptions options); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + Task> GetAll(string owner, string name, RepositoryCollaboratorListRequest request); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + Task> GetAll(long repositoryId, RepositoryCollaboratorListRequest request); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + Task> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options); + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + Task> GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options); /// /// Checks if a user is a collaborator on a repository. diff --git a/Octokit/Clients/RepoCollaboratorsClient.cs b/Octokit/Clients/RepoCollaboratorsClient.cs index fd3afe2a9a..de9850d108 100644 --- a/Octokit/Clients/RepoCollaboratorsClient.cs +++ b/Octokit/Clients/RepoCollaboratorsClient.cs @@ -66,7 +66,7 @@ public Task> GetAll(string owner, string name, ApiOptions op Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.RepoCollaborators(owner, name), options); + return GetAll(owner, name, new RepositoryCollaboratorListRequest(), options); } /// @@ -81,8 +81,83 @@ public Task> GetAll(string owner, string name, ApiOptions op public Task> GetAll(long repositoryId, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAll(repositoryId, new RepositoryCollaboratorListRequest(), options); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + public Task> GetAll(string owner, string name, RepositoryCollaboratorListRequest request) + { + Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); + Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); + Ensure.ArgumentNotNull(request, nameof(request)); + + return GetAll(owner, name, request, ApiOptions.None); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Thrown when a general API error occurs. + public Task> GetAll(long repositoryId, RepositoryCollaboratorListRequest request) + { + Ensure.ArgumentNotNull(request, nameof(request)); + + return GetAll(repositoryId, request, ApiOptions.None); + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + public Task> GetAll(string owner, string name, RepositoryCollaboratorListRequest request, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); + Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); + Ensure.ArgumentNotNull(request, nameof(request)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return ApiConnection.GetAll(ApiUrls.RepoCollaborators(owner, name), request.ToParametersDictionary(), AcceptHeaders.NestedTeamsPreview, options); + + } + + /// + /// Gets all the collaborators on a repository. + /// + /// + /// See the API documentation for more information. + /// + /// The id of the repository + /// Used to request and filter a list of repository collaborators + /// Options for changing the API response + /// Thrown when a general API error occurs. + public Task> GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options) + { + Ensure.ArgumentNotNull(request, nameof(request)); + Ensure.ArgumentNotNull(options, nameof(options)); - return ApiConnection.GetAll(ApiUrls.RepoCollaborators(repositoryId), options); + return ApiConnection.GetAll(ApiUrls.RepoCollaborators(repositoryId), request.ToParametersDictionary(), AcceptHeaders.NestedTeamsPreview, options); } /// diff --git a/Octokit/Models/Request/RepositoryCollaboratorListRequest.cs b/Octokit/Models/Request/RepositoryCollaboratorListRequest.cs new file mode 100644 index 0000000000..c5fe0682df --- /dev/null +++ b/Octokit/Models/Request/RepositoryCollaboratorListRequest.cs @@ -0,0 +1,57 @@ +using System.Diagnostics; +using System.Globalization; +using Octokit.Internal; + +namespace Octokit +{ + /// + /// Used to request and filter a list of repository collaborators + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class RepositoryCollaboratorListRequest : RequestParameters + { + /// + /// Initializes a new instance of the class. + /// + public RepositoryCollaboratorListRequest() + { + Affiliation = CollaboratorAffiliation.All; // Default in accordance with the documentation + } + + /// + /// Gets or sets the collaborator affiliation property. + /// + /// + /// The collaborator affiliation + /// + public CollaboratorAffiliation Affiliation { get; set; } + + internal string DebuggerDisplay + { + get { return string.Format(CultureInfo.InvariantCulture, "Affiliation: {0}", Affiliation); } + } + } + + /// + /// The collaborator affiliation + /// + public enum CollaboratorAffiliation + { + /// + /// All collaborators the authenticated user can see. + /// + [Parameter(Value = "all")] + All, + /// + /// All collaborators with permissions to an organization-owned repository, + /// regardless of organization membership status. + /// + [Parameter(Value = "direct")] + Direct, + /// + /// All outside collaborators of an organization-owned repository. + /// + [Parameter(Value = "outside")] + Outside + } +}