diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..5edb4061 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..5d91a4e1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +# Description + + + +# Before submitting a PR: + +- [ ] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details. +- [ ] Add JavaDocs and other comments as appropriate. Consider including links in comments to relevant documentation on https://docs.github.com/en/rest . +- [ ] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details. +- [ ] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI. +- [ ] Push your changes to a branch other than `main`. You will create your PR from that branch. + +# When creating a PR: + +- [ ] Fill in the "Description" above with clear summary of the changes. This includes: + - [ ] If this PR fixes one or more issues, include "Fixes #" lines for each issue. + - [ ] Provide links to relevant documentation on https://docs.github.com/en/rest where possible. +- [ ] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario." +- [ ] Enable "Allow edits from maintainers". diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..1bc6f8e6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "monthly" + time: "02:00" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + time: "02:00" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..f0e6a133 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,20 @@ +name-template: 'v$NEXT_MINOR_VERSION 🌈' +tag-template: 'java-gitlab-api-$NEXT_MINOR_VERSION' +version-template: '$MAJOR.$MINOR' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml new file mode 100644 index 00000000..a467c686 --- /dev/null +++ b/.github/workflows/maven-build.yml @@ -0,0 +1,48 @@ +name: CI + +on: + push: + branches: + - master + - '!/refs/heads/dependabot/*' + +# this is required by spotless for JDK 16+ +env: + JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" + +jobs: + build: + name: build-only (Java ${{ matrix.java }}) + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + java: [ 11 ] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'zulu' + cache: 'maven' + - name: Maven Install (skipTests) + env: + MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }} + run: mvn -B clean install -DskipTests --file pom.xml + publish: + runs-on: ubuntu-18.04 + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: 'adopt' + - name: Publish package + run: mvn --batch-mode deploy -DskipTests --file pom.xml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..dd2b63fb --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,16 @@ + +name: Release Drafter + +on: + push: + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-18.04 + steps: + - name: Release Drafter + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index a245c85b..d1754395 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 group = "org.gitlab" -version = "4.1.2-SNAPSHOT" +version = "4.1.3-QREVIEW" repositories { mavenLocal() diff --git a/pom.xml b/pom.xml index 902f0424..705f73e4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.gitlab java-gitlab-api - 4.1.2-SNAPSHOT + 4.1.3-QREVIEW Gitlab Java API Wrapper A Java wrapper for the Gitlab Git Hosting Server API @@ -57,16 +57,24 @@ - scm:git:ssh://github.com/timols/java-gitlab-api.git - scm:git:ssh://git@github.com/timols/java-gitlab-api.git - https://github.com/timols/java-gitlab-api + scm:git:ssh://github.com/skylandsoft/java-gitlab-api.git + scm:git:ssh://git@github.com/skylandsoft/java-gitlab-api.git + https://github.com/skylandsoft/java-gitlab-api Github - https://github.com/timols/java-gitlab-api/issues + https://github.com/skylandsoft/java-gitlab-api/issues + + + github + GitHub Packages + https://maven.pkg.github.com/skylandsoft/java-gitlab-api + + + 1.8 1.8 @@ -222,26 +230,7 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - + diff --git a/src/main/java/org/gitlab/api/GitlabAPI.java b/src/main/java/org/gitlab/api/GitlabAPI.java index c0c88fa7..12d516ca 100644 --- a/src/main/java/org/gitlab/api/GitlabAPI.java +++ b/src/main/java/org/gitlab/api/GitlabAPI.java @@ -1862,7 +1862,7 @@ public List getAllNotes(GitlabMergeRequest mergeRequest) { * @throws IOException on a GitLab api call error */ public GitlabDiscussion getDiscussion(GitlabMergeRequest mergeRequest, - int discussionId) throws IOException { + String discussionId) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId; @@ -2031,7 +2031,7 @@ private void checkRequiredCreateDiscussionArguments(String body, * @throws IOException on a GitLab api call error */ public GitlabDiscussion resolveDiscussion(GitlabMergeRequest mergeRequest, - int discussionId, boolean resolved) throws IOException { + String discussionId, boolean resolved) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId; @@ -2051,7 +2051,7 @@ public GitlabDiscussion resolveDiscussion(GitlabMergeRequest mergeRequest, * @throws IOException on a GitLab api call error */ public GitlabNote addDiscussionNote(GitlabMergeRequest mergeRequest, - int discussionId, String body) throws IOException { + String discussionId, String body) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId + @@ -2071,7 +2071,7 @@ public GitlabNote addDiscussionNote(GitlabMergeRequest mergeRequest, * @return The modified note object. * @throws IOException on a GitLab api call error */ - public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, int discussionId, + public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, String discussionId, int noteId, String body, Boolean resolved) throws IOException { boolean bodyHasValue = false; if (body != null && !body.isEmpty()) { @@ -2100,7 +2100,7 @@ public GitlabNote modifyDiscussionNote(GitlabMergeRequest mergeRequest, int disc * @return The deleted note object. * @throws IOException on a GitLab api call error */ - public void deleteDiscussionNote(GitlabMergeRequest mergeRequest, int discussionId, int noteId) throws IOException { + public void deleteDiscussionNote(GitlabMergeRequest mergeRequest, String discussionId, int noteId) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL + "/" + discussionId + @@ -2532,7 +2532,11 @@ public List getProjectHooks(GitlabProject project) throws IOE } public GitlabProjectHook getProjectHook(GitlabProject project, String hookId) throws IOException { - String tailUrl = GitlabProject.URL + "/" + project.getId() + GitlabProjectHook.URL + "/" + hookId; + return getProjectHook(project.getId(), hookId); + } + + public GitlabProjectHook getProjectHook(Serializable projectId, String hookId) throws IOException { + String tailUrl = GitlabProject.URL + "/" + projectId + GitlabProjectHook.URL + "/" + hookId; return retrieve().to(tailUrl, GitlabProjectHook.class); } diff --git a/src/main/java/org/gitlab/api/models/GitlabDiscussion.java b/src/main/java/org/gitlab/api/models/GitlabDiscussion.java index 5b4b6887..6bd8a67b 100644 --- a/src/main/java/org/gitlab/api/models/GitlabDiscussion.java +++ b/src/main/java/org/gitlab/api/models/GitlabDiscussion.java @@ -52,7 +52,7 @@ public String getId() { * @return The notes contained in this discussion. */ public List getNotes() { - return Collections.unmodifiableList(notes); + return notes; } /** diff --git a/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java b/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java index 11d037e5..f1fba490 100644 --- a/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java +++ b/src/main/java/org/gitlab/api/models/GitlabMergeRequest.java @@ -20,6 +20,7 @@ public class GitlabMergeRequest { private boolean merged; private GitlabUser author; private GitlabUser assignee; + private List assignees; private GitlabMilestone milestone; private String[] labels; @@ -223,6 +224,14 @@ public void setAssignee(GitlabUser assignee) { this.assignee = assignee; } + public List getAssignees() { + return assignees; + } + + public void setAssignees(final List assignees) { + this.assignees = assignees; + } + public String getState() { return state; } diff --git a/src/main/java/org/gitlab/api/models/GitlabNote.java b/src/main/java/org/gitlab/api/models/GitlabNote.java index 39eda597..21d4b3b1 100644 --- a/src/main/java/org/gitlab/api/models/GitlabNote.java +++ b/src/main/java/org/gitlab/api/models/GitlabNote.java @@ -15,6 +15,7 @@ public class GitlabNote { private boolean system; private boolean upvote; private boolean downvote; + private GitlabNotePosition position; @JsonProperty("created_at") private Date createdAt; @@ -82,4 +83,12 @@ public boolean isDownvote() { public void setDownvote(boolean downvote) { this.downvote = downvote; } + + public GitlabNotePosition getPosition() { + return position; + } + + public void setPosition(final GitlabNotePosition position) { + this.position = position; + } } diff --git a/src/main/java/org/gitlab/api/models/GitlabNotePosition.java b/src/main/java/org/gitlab/api/models/GitlabNotePosition.java new file mode 100644 index 00000000..357b30e9 --- /dev/null +++ b/src/main/java/org/gitlab/api/models/GitlabNotePosition.java @@ -0,0 +1,93 @@ +package org.gitlab.api.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class GitlabNotePosition { + @JsonProperty("base_sha") + private String baseSha; + + @JsonProperty("start_sha") + private String startSha; + + @JsonProperty("head_sha") + private String headSha; + + @JsonProperty("old_path") + private String oldPath; + + @JsonProperty("new_path") + private String newPath; + + @JsonProperty("position_type") + private String positionType; + + @JsonProperty("old_line") + private Integer oldLine; + + @JsonProperty("new_line") + private Integer newLine; + + public String getBaseSha() { + return baseSha; + } + + public void setBaseSha(final String baseSha) { + this.baseSha = baseSha; + } + + public String getStartSha() { + return startSha; + } + + public void setStartSha(final String startSha) { + this.startSha = startSha; + } + + public String getHeadSha() { + return headSha; + } + + public void setHeadSha(final String headSha) { + this.headSha = headSha; + } + + public String getOldPath() { + return oldPath; + } + + public void setOldPath(final String oldPath) { + this.oldPath = oldPath; + } + + public String getNewPath() { + return newPath; + } + + public void setNewPath(final String newPath) { + this.newPath = newPath; + } + + public String getPositionType() { + return positionType; + } + + public void setPositionType(final String positionType) { + this.positionType = positionType; + } + + public Integer getOldLine() { + return oldLine; + } + + public void setOldLine(final Integer oldLine) { + this.oldLine = oldLine; + } + + public Integer getNewLine() { + return newLine; + } + + public void setNewLine(final Integer newLine) { + this.newLine = newLine; + } +}