Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

# 6.0.4
- Added support for Pull Request Iterations in **GitApi**.

# 6.0.3

- Fixes issues:
Expand Down
2 changes: 1 addition & 1 deletion azd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.hkarthik7</groupId>
<artifactId>azd</artifactId>
<version>6.0.3</version>
<version>6.0.4</version>
<packaging>jar</packaging>

<name>azd</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,14 @@ public PullRequestReviewersRequestBuilder reviewers() {
public PullRequestStatusRequestBuilder statuses() {
return new PullRequestStatusRequestBuilder(organizationUrl, accessTokenCredential);
}

/**
* Provides functionality to manage Pull request iterations Api.
*
* @return PullRequestIterationsBuilder {@link PullRequestIterationsBuilder}
*/
public PullRequestIterationsBuilder iterations() {
return new PullRequestIterationsBuilder(organizationUrl, accessTokenCredential);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.azd.git.pullrequest;

import org.azd.abstractions.BaseRequestBuilder;
import org.azd.authentication.AccessTokenCredential;
import org.azd.common.ApiVersion;
import org.azd.exceptions.AzDException;
import org.azd.git.types.GitPullRequestIteration;
import org.azd.git.types.GitPullRequestIterations;

import java.util.concurrent.CompletableFuture;

public class PullRequestIterationsBuilder extends BaseRequestBuilder {

public PullRequestIterationsBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential) {
super(organizationUrl, accessTokenCredential, "git", "4e080c62-fa21-4fbc-8fef-2a10a2b38049", ApiVersion.GIT);
}

public CompletableFuture<GitPullRequestIteration> getAsync(String repositoryId, int pullRequestId, int iterationId) throws AzDException {
return builder()
.serviceEndpoint("repositoryId", repositoryId)
.serviceEndpoint("pullRequestId", pullRequestId)
.serviceEndpoint("iterationId", iterationId)
.build()
.executeAsync(GitPullRequestIteration.class);
}

public CompletableFuture<GitPullRequestIterations> listAsync(String repositoryId, int pullRequestId) throws AzDException {
return builder()
.serviceEndpoint("repositoryId", repositoryId)
.serviceEndpoint("pullRequestId", pullRequestId)
.build()
.executeAsync(GitPullRequestIterations.class);
}

public GitPullRequestIteration get(String repositoryId, int pullRequestId, int iterationId) throws AzDException {
return builder()
.serviceEndpoint("repositoryId", repositoryId)
.serviceEndpoint("pullRequestId", pullRequestId)
.serviceEndpoint("iterationId", iterationId)
.build()
.execute(GitPullRequestIteration.class);
}

public GitPullRequestIterations list(String repositoryId, int pullRequestId) throws AzDException {
return builder()
.serviceEndpoint("repositoryId", repositoryId)
.serviceEndpoint("pullRequestId", pullRequestId)
.build()
.execute(GitPullRequestIterations.class);
}
}
34 changes: 34 additions & 0 deletions azd/src/main/java/org/azd/git/types/GitPullRequestChange.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.azd.git.types;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.azd.abstractions.serializer.SerializableEntity;
import org.azd.enums.VersionControlChangeType;

public class GitPullRequestChange extends SerializableEntity {
@JsonProperty("changeId")
public int changeId;

@JsonProperty("changeTrackingId")
public int changeTrackingId;

@JsonProperty("changeType")
public VersionControlChangeType changeType;

@JsonProperty("item")
public String item;

@JsonProperty("newContent")
public ItemContent newContent;

@JsonProperty("newContentTemplate")
public GitTemplate newContentTemplate;

@JsonProperty("originalPath")
public String originalPath;

@JsonProperty("sourceServerItem")
public String sourceServerItem;

@JsonProperty("url")
public String url;
}
233 changes: 233 additions & 0 deletions azd/src/main/java/org/azd/git/types/GitPullRequestIteration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
package org.azd.git.types;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.azd.abstractions.serializer.SerializableEntity;
import org.azd.common.types.ReferenceLinks;
import org.azd.test.types.IdentityRef;

public class GitPullRequestIteration extends SerializableEntity {

/**
* A collection of related REST reference links..
**/
@JsonProperty("_links")
private ReferenceLinks links;

/**
* Author of the pull request iteration.
**/
@JsonProperty("author")
private IdentityRef author;

/**
* Changes included with the pull request iteration.
*/
@JsonProperty("changeList")
private GitPullRequestChange changeList;

/**
* The commits included with the pull request iteration.
*/
@JsonProperty("commits")
private GitCommitRef[] commits;

/**
* The first common Git commit of the source and target refs.
*/
@JsonProperty("commonRefCommit")
private GitCommitRef commonRefCommit;

/**
* The creation date of the pull request iteration.
**/
@JsonProperty("createdDate")
private String createdDate;

/**
* Description of the pull request iteration.
**/
@JsonProperty("description")
private String description;

/**
* Indicates if the Commits property contains a truncated list of commits in this pull request iteration.
**/
@JsonProperty("hasMoreCommits")
private boolean hasMoreCommits;

/**
* ID of the pull request iteration. Iterations are created as a result of creating and pushing updates to a pull request.
**/
@JsonProperty("id")
private int id;

/**
* If the iteration reason is Retarget, this is the refName of the new target
**/
@JsonProperty("newTargetRefName")
private String newTargetRefName;

/**
* If the iteration reason is Retarget, this is the original target refName
**/
@JsonProperty("oldTargetRefName")
private String oldTargetRefName;

/**
* The Git push information associated with this pull request iteration.
*/
@JsonProperty("push")
private GitPushRef push;

/**
* The reason for which the pull request iteration was created.
*/
@JsonProperty("reason")
private IterationReason reason;

/**
* The source Git commit of this iteration.
*/
@JsonProperty("sourceRefCommit")
private GitCommitRef sourceRefCommit;

/**
* The target Git commit of this iteration.
*/
@JsonProperty("targetRefCommit")
private GitCommitRef targetRefCommit;

/**
* The updated date of the pull request iteration.
*/
@JsonProperty("updatedDate")
private String updatedDate;

public ReferenceLinks getLinks() {
return links;
}

public void setLinks(ReferenceLinks links) {
this.links = links;
}

public IdentityRef getAuthor() {
return author;
}

public void setAuthor(IdentityRef author) {
this.author = author;
}

public GitPullRequestChange getChangeList() {
return changeList;
}

public void setChangeList(GitPullRequestChange changeList) {
this.changeList = changeList;
}

public GitCommitRef[] getCommits() {
return commits;
}

public void setCommits(GitCommitRef[] commits) {
this.commits = commits;
}

public GitCommitRef getCommonRefCommit() {
return commonRefCommit;
}

public void setCommonRefCommit(GitCommitRef commonRefCommit) {
this.commonRefCommit = commonRefCommit;
}

public String getCreatedDate() {
return createdDate;
}

public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public boolean isHasMoreCommits() {
return hasMoreCommits;
}

public void setHasMoreCommits(boolean hasMoreCommits) {
this.hasMoreCommits = hasMoreCommits;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getNewTargetRefName() {
return newTargetRefName;
}

public void setNewTargetRefName(String newTargetRefName) {
this.newTargetRefName = newTargetRefName;
}

public String getOldTargetRefName() {
return oldTargetRefName;
}

public void setOldTargetRefName(String oldTargetRefName) {
this.oldTargetRefName = oldTargetRefName;
}

public GitPushRef getPush() {
return push;
}

public void setPush(GitPushRef push) {
this.push = push;
}

public IterationReason getReason() {
return reason;
}

public void setReason(IterationReason reason) {
this.reason = reason;
}

public GitCommitRef getSourceRefCommit() {
return sourceRefCommit;
}

public void setSourceRefCommit(GitCommitRef sourceRefCommit) {
this.sourceRefCommit = sourceRefCommit;
}

public GitCommitRef getTargetRefCommit() {
return targetRefCommit;
}

public void setTargetRefCommit(GitCommitRef targetRefCommit) {
this.targetRefCommit = targetRefCommit;
}

public String getUpdatedDate() {
return updatedDate;
}

public void setUpdatedDate(String updatedDate) {
this.updatedDate = updatedDate;
}
}
20 changes: 20 additions & 0 deletions azd/src/main/java/org/azd/git/types/GitPullRequestIterations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.azd.git.types;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.azd.abstractions.serializer.SerializableEntity;

import java.util.List;

public class GitPullRequestIterations extends SerializableEntity {

@JsonProperty("value")
private List<GitPullRequestIteration> iterations;

public List<GitPullRequestIteration> getIterations() {
return iterations;
}

public void setIterations(List<GitPullRequestIteration> iterations) {
this.iterations = iterations;
}
}
Loading