@@ -352,6 +352,42 @@ public GitPullRequest getPullRequest(String repositoryName, int pullRequestId) t
352352 return MAPPER .mapJsonResponse (r , GitPullRequest .class );
353353 }
354354
355+ /***
356+ * Retrieve a pull request.
357+ * @param repositoryName The repository name of the pull request's target branch.
358+ * @param pullRequestId The ID of the pull request to retrieve.
359+ * @param includeCommits If true, the pull request will be returned with the associated commits.
360+ * @throws AzDException Default Api Exception handler.
361+ * @return {@link GitPullRequest} object
362+ */
363+ @ Override
364+ public GitPullRequest getPullRequest (String repositoryName , int pullRequestId , boolean includeCommits ) throws AzDException {
365+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
366+ repositoryName , "pullrequests/" + pullRequestId , ApiVersion .GIT , Map .of ("includeCommits" , includeCommits ),
367+ null , null );
368+
369+ return MAPPER .mapJsonResponse (r , GitPullRequest .class );
370+ }
371+
372+ /***
373+ * Retrieve a pull request.
374+ * @param repositoryName The repository name of the pull request's target branch.
375+ * @param pullRequestId The ID of the pull request to retrieve.
376+ * @param includeCommits If true, the pull request will be returned with the associated commits.
377+ * @param includeWorkItemRefs If true, the pull request will be returned with the associated work item references.
378+ * @throws AzDException Default Api Exception handler.
379+ * @return {@link GitPullRequest} object
380+ */
381+ @ Override
382+ public GitPullRequest getPullRequest (String repositoryName , int pullRequestId , boolean includeCommits ,
383+ boolean includeWorkItemRefs ) throws AzDException {
384+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
385+ repositoryName , "pullrequests/" + pullRequestId , ApiVersion .GIT ,
386+ Map .of ("includeCommits" , includeCommits , "includeWorkItemRefs" , includeWorkItemRefs ), null , null );
387+
388+ return MAPPER .mapJsonResponse (r , GitPullRequest .class );
389+ }
390+
355391 /***
356392 * Retrieve a pull request.
357393 * @param pullRequestId The ID of the pull request to retrieve.
@@ -380,6 +416,107 @@ public PullRequests getPullRequests(String repositoryName) throws AzDException {
380416 return MAPPER .mapJsonResponse (r , PullRequests .class );
381417 }
382418
419+ /***
420+ * Retrieve all pull requests from a repository
421+ * @param repositoryName specify the repository name
422+ * @param top The number of pull requests to retrieve.
423+ * @throws AzDException Default Api Exception handler.
424+ * @return {@link PullRequests} object
425+ */
426+ @ Override
427+ public PullRequests getPullRequests (String repositoryName , int top ) throws AzDException {
428+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
429+ repositoryName , "pullrequests" , ApiVersion .GIT , Map .of ("$top" , top ), null , null );
430+
431+ return MAPPER .mapJsonResponse (r , PullRequests .class );
432+ }
433+
434+ /***
435+ * Retrieve all pull requests from a repository
436+ * @param repositoryName specify the repository name
437+ * @param top The number of pull requests to retrieve.
438+ * @param skip The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
439+ * @throws AzDException Default Api Exception handler.
440+ * @return {@link PullRequests} object
441+ */
442+ @ Override
443+ public PullRequests getPullRequests (String repositoryName , int top , int skip ) throws AzDException {
444+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
445+ repositoryName , "pullrequests" , ApiVersion .GIT , Map .of ("$top" , top , "$skip" , skip ), null , null );
446+
447+ return MAPPER .mapJsonResponse (r , PullRequests .class );
448+ }
449+
450+ /***
451+ * Retrieve all pull requests from a repository
452+ * @param repositoryName specify the repository name
453+ * @param top The number of pull requests to retrieve.
454+ * @param skip The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
455+ * @param creatorId If set, search for pull requests that were created by this identity.
456+ * @throws AzDException Default Api Exception handler.
457+ * @return {@link PullRequests} object
458+ */
459+ @ Override
460+ public PullRequests getPullRequests (String repositoryName , int top , int skip , String creatorId ) throws AzDException {
461+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
462+ repositoryName , "pullrequests" , ApiVersion .GIT ,
463+ Map .of ("$top" , top , "$skip" , skip , "searchCriteria.creatorId" , creatorId ), null , null );
464+
465+ return MAPPER .mapJsonResponse (r , PullRequests .class );
466+ }
467+
468+ /***
469+ * Retrieve all pull requests from a repository
470+ * @param repositoryName specify the repository name
471+ * @param includeLinks Whether to include the _links field on the shallow references.
472+ * @throws AzDException Default Api Exception handler.
473+ * @return {@link PullRequests} object
474+ */
475+ @ Override
476+ public PullRequests getPullRequests (String repositoryName , boolean includeLinks ) throws AzDException {
477+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
478+ repositoryName , "pullrequests" , ApiVersion .GIT ,
479+ Map .of ("searchCriteria.includeLinks" , includeLinks ), null , null );
480+
481+ return MAPPER .mapJsonResponse (r , PullRequests .class );
482+ }
483+
484+ /***
485+ * Retrieve all pull requests from a repository
486+ * @param repositoryName specify the repository name
487+ * @param status If set, search for pull requests that are in this state. Defaults to Active if unset.
488+ * @throws AzDException Default Api Exception handler.
489+ * @return {@link PullRequests} object
490+ */
491+ @ Override
492+ public PullRequests getPullRequests (String repositoryName , PullRequestStatus status ) throws AzDException {
493+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
494+ repositoryName , "pullrequests" , ApiVersion .GIT ,
495+ Map .of ("searchCriteria.status" , status ), null , null );
496+
497+ return MAPPER .mapJsonResponse (r , PullRequests .class );
498+ }
499+
500+ /***
501+ * Retrieve all pull requests from a repository
502+ * @param repositoryName specify the repository name
503+ * @param gitPullRequestQueryParameters Property bag of query parameters pertaining to the pull requests.
504+ * @throws AzDException Default Api Exception handler.
505+ * @return {@link PullRequests} object
506+ */
507+ @ Override
508+ public PullRequests getPullRequests (String repositoryName , GitPullRequestQueryParameters gitPullRequestQueryParameters )
509+ throws AzDException {
510+ String r = send (RequestMethod .GET , CONNECTION , GIT , CONNECTION .getProject (), AREA + "/repositories" ,
511+ repositoryName , "pullrequests" , ApiVersion .GIT ,
512+ gitPullRequestQueryParameters != null
513+ ? gitPullRequestQueryParameters .get ()
514+ : new GitPullRequestQueryParameters ().get (),
515+ null , null );
516+
517+ return MAPPER .mapJsonResponse (r , PullRequests .class );
518+ }
519+
383520 /***
384521 * Gets all pull requests from a project. To get the pull requests from
385522 * non-default project you have to call setProject method from {@link Connection}.
0 commit comments