Skip to content

Commit 65da884

Browse files
committed
Add the "internal" flag to NotesApi
1 parent 2d9a588 commit 65da884

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

src/main/java/org/gitlab4j/api/NotesApi.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public Note getIssueNote(Object projectIdOrPath, Long issueIid, Long noteId) thr
152152
* @throws GitLabApiException if any exception occurs
153153
*/
154154
public Note createIssueNote(Object projectIdOrPath, Long issueIid, String body) throws GitLabApiException {
155-
return (createIssueNote(projectIdOrPath, issueIid, body, null));
155+
return (createIssueNote(projectIdOrPath, issueIid, body, null, false));
156156
}
157157

158158
/**
@@ -166,10 +166,28 @@ public Note createIssueNote(Object projectIdOrPath, Long issueIid, String body)
166166
* @throws GitLabApiException if any exception occurs
167167
*/
168168
public Note createIssueNote(Object projectIdOrPath, Long issueIid, String body, Date createdAt) throws GitLabApiException {
169+
return (createIssueNote(projectIdOrPath, issueIid, body, null, false)); }
170+
171+
/**
172+
* Create a issues's note.
173+
*
174+
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
175+
* @param issueIid the issue IID to create the notes for
176+
* @param body the content of note
177+
* @param createdAt the created time of note
178+
* @param internal whether the note shall be marked 'internal'
179+
* @return the created Note instance
180+
* @throws GitLabApiException if any exception occurs
181+
*/
182+
public Note createIssueNote(Object projectIdOrPath, Long issueIid, String body, Date createdAt, boolean internal) throws GitLabApiException {
169183

170184
GitLabApiForm formData = new GitLabApiForm()
171185
.withParam("body", body, true)
172-
.withParam("created_at", createdAt);
186+
.withParam("created_at", createdAt)
187+
;
188+
if (internal) {
189+
formData.withParam("internal", "true");
190+
}
173191
Response response = post(Response.Status.CREATED, formData,
174192
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes");
175193
return (response.readEntity(Note.class));

src/main/java/org/gitlab4j/api/models/Note.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public String toString() {
9898
private Boolean resolvable;
9999
private Participant resolvedBy;
100100
private Date resolvedAt;
101+
private Boolean internal;
101102
private Type type;
102103

103104
private Position position;
@@ -270,7 +271,15 @@ public void setPosition(Position position) {
270271
this.position = position;
271272
}
272273

273-
@Override
274+
public Boolean getInternal() {
275+
return internal;
276+
}
277+
278+
public void setInternal(Boolean internal) {
279+
this.internal = internal;
280+
}
281+
282+
@Override
274283
public String toString() {
275284
return (JacksonJson.toJsonString(this));
276285
}

0 commit comments

Comments
 (0)