NotesApi.java 20.80 KiB
package org.gitlab4j.api;
import java.util.Date;
import java.util.List;
import java.util.stream.Stream;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
import org.gitlab4j.api.models.Note;
public class NotesApi extends AbstractApi {
    public NotesApi(GitLabApi gitLabApi) {
        super(gitLabApi);
    /**
     * Get a list of the issues's notes.
     * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre>
     * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
     * @param issueIid the issue ID to get the notes for
     * @return a list of the issues's notes
     * @throws GitLabApiException if any exception occurs
     * @deprecated As of release 4.7.0, replaced by {@link #getIssueNotes(Object, Long)}
    @Deprecated
    public List<Note> getNotes(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
        return (getIssueNotes(projectIdOrPath, issueIid));
    /**
     * Get a list of the issue's notes using the specified page and per page settings.
     * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre>
     * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
     * @param issueIid the issue IID to get the notes for
     * @param page the page to get
     * @param perPage the number of notes per page
     * @return the list of notes in the specified range
     * @throws GitLabApiException if any exception occurs
     * @deprecated As of release 4.7.0, replaced by {@link #getIssueNotes(Object, Long, int, int)}
    @Deprecated
    public List<Note> getNotes(Object projectIdOrPath, Long issueIid, int page, int perPage) throws GitLabApiException {
        return (getIssueNotes(projectIdOrPath, issueIid, page, perPage));
    /**
     * Get a Pager of issues's notes.
     * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre>
     * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
     * @param issueIid the issue IID to get the notes for
     * @param itemsPerPage the number of notes per page
     * @return the list of notes in the specified range
     * @throws GitLabApiException if any exception occurs
     * @deprecated As of release 4.7.0, replaced by {@link #getIssueNotes(Object, Long, int)}
    @Deprecated
    public Pager<Note> getNotes(Object projectIdOrPath, Long issueIid, int itemsPerPage) throws GitLabApiException {
        return (getIssueNotes(projectIdOrPath, issueIid, itemsPerPage));
    /**
     * Get a list of the issues's notes.
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
* * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param issueIid the issue ID to get the notes for * @return a list of the issues's notes * @throws GitLabApiException if any exception occurs */ public List<Note> getIssueNotes(Object projectIdOrPath, Long issueIid) throws GitLabApiException { return (getIssueNotes(projectIdOrPath, issueIid, getDefaultPerPage()).all()); } /** * Get a list of the issue's notes using the specified page and per page settings. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param issueIid the issue IID to get the notes for * @param page the page to get * @param perPage the number of notes per page * @return the list of notes in the specified range * @throws GitLabApiException if any exception occurs */ public List<Note> getIssueNotes(Object projectIdOrPath, Long issueIid, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes"); return (response.readEntity(new GenericType<List<Note>>() {})); } /** * Get a Pager of issues's notes. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param issueIid the issue IID to get the notes for * @param itemsPerPage the number of notes per page * @return the list of notes in the specified range * @throws GitLabApiException if any exception occurs */ public Pager<Note> getIssueNotes(Object projectIdOrPath, Long issueIid, int itemsPerPage) throws GitLabApiException { return (new Pager<Note>(this, Note.class, itemsPerPage, null, "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes")); } /** * Get a Stream of the issues's notes. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param issueIid the issue ID to get the notes for * @return a Stream of the issues's notes * @throws GitLabApiException if any exception occurs */ public Stream<Note> getIssueNotesStream(Object projectIdOrPath, Long issueIid) throws GitLabApiException { return (getIssueNotes(projectIdOrPath, issueIid, getDefaultPerPage()).stream()); } /** * Get the specified issues's note. * * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance * @param issueIid the issue IID to get the notes for * @param noteId the ID of the Note to get * @return a Note instance for the specified IDs * @throws GitLabApiException if any exception occurs */ public Note getIssueNote(Object projectIdOrPath, Long issueIid, Long noteId) throws GitLabApiException {