Beispiel #1
0
        public Task <IReadOnlyList <PullRequest> > GetAllForRepository(long repositoryId, PullRequestRequest request, ApiOptions options)
        {
            Ensure.ArgumentNotNull(request, nameof(request));
            Ensure.ArgumentNotNull(options, nameof(options));

            return(ApiConnection.GetAll <PullRequest>(ApiUrls.PullRequests(repositoryId),
                                                      request.ToParametersDictionary(), AcceptHeaders.DraftPullRequestApiPreview, options));
        }
        public void ReturnsDefaultValuesForDefaultRequest()
        {
            var request = new PullRequestRequest();

            var parameters = request.ToParametersDictionary();

            Assert.Equal("open", parameters["state"]);
        }
Beispiel #3
0
        /// <summary>
        /// Query pull requests for the repository based on criteria
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/pulls/#list-pull-requests
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="request">Used to filter and sort the list of pull requests returned</param>
        /// <param name="options">Options for changing the API response</param>
        public Task <IReadOnlyList <PullRequest> > GetAllForRepository(long repositoryId, PullRequestRequest request, ApiOptions options)
        {
            Ensure.ArgumentNotNull(request, "request");
            Ensure.ArgumentNotNull(options, "options");

            return(ApiConnection.GetAll <PullRequest>(ApiUrls.PullRequests(repositoryId),
                                                      request.ToParametersDictionary(), options));
        }
        /// <summary>
        /// Query pull requests for the repository based on criteria
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/pulls/#list-pull-requests
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="request">Used to filter and sort the list of pull requests returned</param>
        /// <returns>A <see cref="IReadOnlyList{PullRequest}"/> of <see cref="PullRequest"/>s which match the criteria</returns>
        public Task <IReadOnlyList <PullRequest> > GetForRepository(string owner, string name, PullRequestRequest request)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(request, "request");

            return(ApiConnection.GetAll <PullRequest>(ApiUrls.PullRequests(owner, name),
                                                      request.ToParametersDictionary()));
        }
        /// <summary>
        /// Query pull requests for the repository based on criteria
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/pulls/#list-pull-requests
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="request">Used to filter and sort the list of pull requests returned</param>
        /// <returns>A <see cref="IReadOnlyList{PullRequest}"/> of <see cref="PullRequest"/>s which match the criteria</returns>
        public Task<IReadOnlyList<PullRequest>> GetForRepository(string owner, string name, PullRequestRequest request)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(request, "request");

            return ApiConnection.GetAll<PullRequest>(ApiUrls.PullRequests(owner, name),
                request.ToParametersDictionary());
        }
Beispiel #6
0
        public Task <IReadOnlyList <PullRequest> > GetAllForRepository(string owner, string name, PullRequestRequest 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 <PullRequest>(ApiUrls.PullRequests(owner, name),
                                                      request.ToParametersDictionary(), AcceptHeaders.DraftPullRequestApiPreview, options));
        }
        public void ContainsSetValues()
        {
            var request = new PullRequestRequest
            {
                State = ItemStateFilter.Closed,
                Head = "user:ref-name",
                Base = "fake_base_branch"
            };

            var parameters = request.ToParametersDictionary();

            Assert.Equal("closed", parameters["state"]);
            Assert.Equal("user:ref-name", parameters["head"]);
            Assert.Equal("fake_base_branch", parameters["base"]);
        }
        /// <summary>
        /// Query pull requests for the repository based on criteria
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/pulls/#list-pull-requests
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="request">Used to filter and sort the list of pull requests returned</param>
        /// <param name="options">Options for changing the API response</param>
        public Task<IReadOnlyList<PullRequest>> GetAllForRepository(long repositoryId, PullRequestRequest request, ApiOptions options)
        {
            Ensure.ArgumentNotNull(request, "request");
            Ensure.ArgumentNotNull(options, "options");

            return ApiConnection.GetAll<PullRequest>(ApiUrls.PullRequests(repositoryId),
                request.ToParametersDictionary(), options);
        }