AwardEmojiApi.java 22.83 KiB
package org.gitlab4j.api;
import java.util.List;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.models.AwardEmoji;
/**
 * This class implements the client side API for the GitLab Award Emoji API calls.
 * @see <a href="https://docs.gitlab.com/ce/api/award_emoji.html">GitLab Award Emoji API Documentaion</a>
 * @since v4.8.31
public class AwardEmojiApi extends AbstractApi {
    public AwardEmojiApi(GitLabApi gitLabApi) {
        super(gitLabApi);
    /**
     * Get a list of award emoji for the specified issue.
     * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/award_emoji</code></pre>
     * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
     * @param issueIid the issue IID to get the award emojis for
     * @return a list of AwardEmoji for the specified issue
     * @throws GitLabApiException if any exception occurs
    public List<AwardEmoji> getIssueAwardEmojis(Object projectIdOrPath, Long issueIid) throws GitLabApiException {
        Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()),
                "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji");
        return response.readEntity(new GenericType<List<AwardEmoji>>() {});
    /**
     *  Get a list of award emoji for the specified merge request.
     * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/award_emoji</code></pre>
     * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
     * @param mergeRequestIid the merge request IID to get the award emojis for
     * @return a list of AwardEmoji for the specified merge request
     * @throws GitLabApiException if any exception occurs
    public List<AwardEmoji> getMergeRequestAwardEmojis(Object projectIdOrPath, Long mergeRequestIid) throws GitLabApiException {
        Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()),
                "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji");
        return response.readEntity(new GenericType<List<AwardEmoji>>() {});
    /**
     *  Get a list of award emoji for the specified snippet.
     * <pre><code>GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/award_emoji</code></pre>
     * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
     * @param snippetId the snippet ID to get the award emojis for
     * @return a list of AwardEmoji for the specified snippet
     * @throws GitLabApiException if any exception occurs
    public List<AwardEmoji> getSnippetAwardEmojis(Object projectIdOrPath, Long snippetId) throws GitLabApiException {
        Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()),
                "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji");
        return response.readEntity(new GenericType<List<AwardEmoji>>() {});
    /**
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
* Get a list of award emoji for the specified issue note. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to get the award emojis for * @return a list of AwardEmoji for the specified note * @throws GitLabApiException if any exception occurs */ public List<AwardEmoji> getIssueNoteAwardEmojis(Object projectIdOrPath, Long issueIid, Long noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId, "award_emoji"); return response.readEntity(new GenericType<List<AwardEmoji>>() {}); } /** * Get a list of award emoji for the specified issue note. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to get the award emojis for * @return a list of AwardEmoji for the specified note * @throws GitLabApiException if any exception occurs */ public List<AwardEmoji> getNoteAwardEmojis(Object projectIdOrPath, Long issueIid, Long noteId) throws GitLabApiException { return getIssueNoteAwardEmojis(projectIdOrPath, issueIid, noteId); } /** * Get a list of award emoji for the specified merge request note. * * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID of the merge request that owns the note * @param noteId the note ID to get the award emojis for * @return a list of AwardEmoji for the specified note * @throws GitLabApiException if any exception occurs */ public List<AwardEmoji> getMergeRequestNoteAwardEmojis(Object projectIdOrPath, Long mergeRequestIid, Long noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId, "award_emoji"); return response.readEntity(new GenericType<List<AwardEmoji>>() {}); } /** * Get the specified award emoji for the specified issue. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID to get the award emoji for * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji getIssueAwardEmoji(Object projectIdOrPath, Long issueIid, Long awardId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji", awardId); return (response.readEntity(AwardEmoji.class)); } /** * Get the specified award emoji for the specified merge request. * * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id</code></pre> *
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID to get the award emoji for * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji getMergeRequestAwardEmoji(Object projectIdOrPath, Long mergeRequestIid, Long awardId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji", awardId); return (response.readEntity(AwardEmoji.class)); } /** * Get the specified award emoji for the specified snippet. * * <pre><code>GitLab Endpoint: GET /projects/:id/snippets/:snippet_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param snippetId the snippet ID to get the award emoji for * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji getSnippetAwardEmoji(Object projectIdOrPath, Long snippetId, Long awardId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId); return (response.readEntity(AwardEmoji.class)); } /** * Get the specified award emoji for the specified issue note. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to get the award emoji from * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji getIssueNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, Long awardId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId, "award_emoji", awardId); return (response.readEntity(AwardEmoji.class)); } /** * Get the specified award emoji for the specified issue note. * * <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to get the award emoji from * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs * @deprecated use {@link #getIssueNoteAwardEmoji(Object, Long, Long, Long)} instead */ @Deprecated public AwardEmoji getNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, Long awardId) throws GitLabApiException { return getIssueNoteAwardEmoji(projectIdOrPath, issueIid, noteId, awardId); } /** * Get the specified award emoji for the specified merge request note. * * <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji/:award_id</code></pre> *
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
* @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID of the merge request that owns the note * @param noteId the note ID to get the award emoji from * @param awardId the ID of the award emoji to get * @return an AwardEmoji instance for the specified award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji getMergeRequestNoteAwardEmoji(Object projectIdOrPath, Long mergeRequestIid, Long noteId, Long awardId) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(1, getDefaultPerPage()), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId, "award_emoji", awardId); return (response.readEntity(AwardEmoji.class)); } /** * Add an award emoji for the specified issue. * * <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji addIssueAwardEmoji(Object projectIdOrPath, Long issueIid, String name) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("name", name, true); Response response = post(Response.Status.CREATED, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji"); return (response.readEntity(AwardEmoji.class)); } /** * Add an award emoji to the specified merge request. * * <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji addMergeRequestAwardEmoji(Object projectIdOrPath, Long mergeRequestIid, String name) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("name", name, true); Response response = post(Response.Status.CREATED, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji"); return (response.readEntity(AwardEmoji.class)); } /** * Add an award emoji to the specified snippet. * * <pre><code>GitLab Endpoint: POST /projects/:id/snippets/:snippet_id/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param snippetId the snippet ID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji addSnippetAwardEmoji(Object projectIdOrPath, Long snippetId, String name) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("name", name, true); Response response = post(Response.Status.CREATED, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji"); return (response.readEntity(AwardEmoji.class)); } /** * Add an award emoji for the specified issue note. *
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
* <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/notes/:noteId/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji addIssueNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, String name) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("name", name, true); Response response = post(Response.Status.CREATED, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId, "award_emoji"); return (response.readEntity(AwardEmoji.class)); } /** * Add an award emoji for the specified issue note. * * <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/notes/:noteId/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID of the issue that owns the note * @param noteId the note ID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs * @deprecated use {@link #addIssueNoteAwardEmoji(Object, Long, Long, String)} */ @Deprecated public AwardEmoji addNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, String name) throws GitLabApiException { return addIssueNoteAwardEmoji(projectIdOrPath, issueIid, noteId, name); } /** * Add an award emoji for the specified merge request note. * * <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/notes/:noteId/award_emoji</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID of the merge request that owns the note * @param noteId the note ID to add the award emoji to * @param name the name of the award emoji to add * @return an AwardEmoji instance for the added award emoji * @throws GitLabApiException if any exception occurs */ public AwardEmoji addMergeRequestAwardEmoji(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId, String name) throws GitLabApiException { GitLabApiForm form = new GitLabApiForm().withParam("name", name, true); Response response = post(Response.Status.CREATED, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId, "award_emoji"); return (response.readEntity(AwardEmoji.class)); } /** * Delete an award emoji from the specified issue. * * <pre><code>GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID to delete the award emoji from * @param awardId the ID of the award emoji to delete * @throws GitLabApiException if any exception occurs */ public void deleteIssueAwardEmoji(Object projectIdOrPath, Long issueIid, Long awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji", awardId); } /** * Delete an award emoji from the specified merge request.
351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
* * <pre><code>GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID to delete the award emoji from * @param awardId the ID of the award emoji to delete * @throws GitLabApiException if any exception occurs */ public void deleteMergeRequestAwardEmoji(Object projectIdOrPath, Long mergeRequestIid, Long awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "award_emoji", awardId); } /** * Delete an award emoji from the specified snippet. * * <pre><code>GitLab Endpoint: DELETE /projects/:id/snippets/:snippet_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param snippetId the snippet ID to delete the award emoji from * @param awardId the ID of the award emoji to delete * @throws GitLabApiException if any exception occurs */ public void deleteSnippetAwardEmoji(Object projectIdOrPath, Long snippetId, Long awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "award_emoji", awardId); } /** * Delete an award emoji from the specified issue note. * * <pre><code>GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID that owns the note * @param noteId the note ID of the note to delete the award emoji from * @param awardId the ID of the award emoji to delete * @throws GitLabApiException if any exception occurs */ public void deleteIssueNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, Long awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId, "award_emoji", awardId); } /** * Delete an award emoji from the specified issue note. * * <pre><code>GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid/notes/:note_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param issueIid the issue IID that owns the note * @param noteId the note ID of the note to delete the award emoji from * @param awardId the ID of the award emoji to delete * @throws GitLabApiException if any exception occurs * @deprecated use {@link #deleteIssueNoteAwardEmoji(Object, Long, Long, Long)} instead */ @Deprecated public void deleteNoteAwardEmoji(Object projectIdOrPath, Long issueIid, Long noteId, Long awardId) throws GitLabApiException { deleteIssueNoteAwardEmoji(projectIdOrPath, issueIid, noteId, awardId); } /** * Delete an award emoji from the specified merge request note. * * <pre><code>GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/notes/:note_id/award_emoji/:award_id</code></pre> * * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path * @param mergeRequestIid the merge request IID of the merge request that owns the note * @param noteId the note ID of the note to delete the award emoji from * @param awardId the ID of the award emoji to delete
421422423424425426427428
* @throws GitLabApiException if any exception occurs */ public void deleteMergeRequestNoteAwardEmoji(Object projectIdOrPath, Long mergeRequestIid, Long noteId, Long awardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId, "award_emoji", awardId); } }