From 9ac2914c7d9c153c6d8839c5404b15c79824477a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20H=C3=BCbner?= Date: Thu, 10 Dec 2015 11:13:03 +0100 Subject: [PATCH] Added support to remove attachment --- src/main/java/net/rcarz/jiraclient/Issue.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/net/rcarz/jiraclient/Issue.java b/src/main/java/net/rcarz/jiraclient/Issue.java index d049a9b..d831df1 100644 --- a/src/main/java/net/rcarz/jiraclient/Issue.java +++ b/src/main/java/net/rcarz/jiraclient/Issue.java @@ -838,6 +838,26 @@ public class Issue extends Resource { } } + /** + * Removes an attachments. + * + * @param attachmentId attachment id to remove + * + * @throws JiraException when the attachment removal fails + */ + public void removeAttachment(String attachmentId) throws JiraException { + + if (attachmentId == null) { + throw new NullPointerException("attachmentId may not be null"); + } + + try { + restclient.delete(getBaseUri() + "attachment/" + attachmentId); + } catch (Exception ex) { + throw new JiraException("Failed remove attachment " + attachmentId, ex); + } + } + /** * Adds a comment to this issue. *