/// <summary> /// Gets all the collaborators on a repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The id of the repository</param> /// <param name="request">Used to request and filter a list of repository collaborators</param> /// <param name="options">Options for changing the API response</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public IObservable <User> GetAll(long repositoryId, RepositoryCollaboratorListRequest request, ApiOptions options) { Ensure.ArgumentNotNull(request, nameof(request)); Ensure.ArgumentNotNull(options, nameof(options)); return(_connection.GetAndFlattenAllPages <User>(ApiUrls.RepoCollaborators(repositoryId), request.ToParametersDictionary(), options)); }
public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId() { var expectedUrl = string.Format("repositories/{0}/collaborators", repositoryId); var request = new RepositoryCollaboratorListRequest(); _client.GetAll(repositoryId, request); _githubClient.Connection.Received(1) .Get <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "all"), null); request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Direct }; _client.GetAll(repositoryId, request); _githubClient.Connection.Received(1) .Get <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "direct"), null); request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Outside }; _client.GetAll(repositoryId, request); _githubClient.Connection.Received(1) .Get <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "outside"), null); }
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 <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "all"), null); request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Direct }; _client.GetAll(owner, name, request); _githubClient.Connection.Received(1) .Get <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "direct"), null); // PageCount is setted => none of options in dictionary request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Outside }; _client.GetAll(owner, name, request); _githubClient.Connection.Received(1) .Get <List <User> >(Arg.Is <Uri>(u => u.ToString() == expectedUrl), Arg.Is <IDictionary <string, string> >(d => d["affiliation"] == "outside"), null); }
/// <summary> /// Gets all the collaborators on a repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information. /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="request">Used to request and filter a list of repository collaborators</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public IObservable <User> 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)); }
/// <summary> /// Gets all the collaborators on a repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information. /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="request">Used to request and filter a list of repository collaborators</param> /// <param name="options">Options for changing the API response</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public IObservable <User> 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 <User>(ApiUrls.RepoCollaborators(owner, name), request.ToParametersDictionary(), options)); }
public void RequestsCorrectUrlWithCollaboratorFilterAndRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepoCollaboratorsClient(connection); var request = new RepositoryCollaboratorListRequest(); client.GetAll(1, request); connection.Received() .GetAll <User>( Arg.Is <Uri>(u => u.ToString() == "repositories/1/collaborators"), Arg.Is <Dictionary <string, string> >(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 <User>( Arg.Is <Uri>(u => u.ToString() == "repositories/1/collaborators"), Arg.Is <Dictionary <string, string> >(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 <User>( Arg.Is <Uri>(u => u.ToString() == "repositories/1/collaborators"), Arg.Is <Dictionary <string, string> >(d => d["affiliation"] == "outside"), "application/vnd.github.hellcat-preview+json", Args.ApiOptions); }
public void RequestsCorrectUrlWithCollaboratorFilter() { var connection = Substitute.For <IApiConnection>(); var client = new RepoCollaboratorsClient(connection); var request = new RepositoryCollaboratorListRequest(); client.GetAll("owner", "test", request); connection.Received() .GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/test/collaborators"), Arg.Is <Dictionary <string, string> >(d => d["affiliation"] == "all"), Args.ApiOptions); request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Direct }; client.GetAll("owner", "test", request); connection.Received() .GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/test/collaborators"), Arg.Is <Dictionary <string, string> >(d => d["affiliation"] == "direct"), Args.ApiOptions); request = new RepositoryCollaboratorListRequest { Affiliation = CollaboratorAffiliation.Outside }; client.GetAll("owner", "test", request); connection.Received() .GetAll <User>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/test/collaborators"), Arg.Is <Dictionary <string, string> >(d => d["affiliation"] == "outside"), Args.ApiOptions); }
/// <summary> /// Gets all the collaborators on a repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/collaborators/#list">API documentation</a> for more information. /// </remarks> /// <param name="repositoryId">The id of the repository</param> /// <param name="request">Used to request and filter a list of repository collaborators</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public IObservable <User> GetAll(long repositoryId, RepositoryCollaboratorListRequest request) { Ensure.ArgumentNotNull(request, nameof(request)); return(GetAll(repositoryId, request, ApiOptions.None)); }