Skip to content

Add a method removeAttachment #81

@holgerengels

Description

@holgerengels

Hi, could you please add this method to CouchDbClientBase.java

Index: src/main/java/org/lightcouch/CouchDbClientBase.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/org/lightcouch/CouchDbClientBase.java b/src/main/java/org/lightcouch/CouchDbClientBase.java
--- a/src/main/java/org/lightcouch/CouchDbClientBase.java	(revision c65454f7851681f527d791ac6eefd221c914a06a)
+++ b/src/main/java/org/lightcouch/CouchDbClientBase.java	(revision 44b99c82255cee5a8c6fd959693f2919e64b185e)
@@ -507,6 +507,22 @@
         return put(uri, in, contentType);
     }
 
+    /**
+     * removes an attachment from an existing document given a document id and revision and the attachment name
+     *
+     * @param name The attachment name.
+     * @param docId The document id to remove the attachment from
+     * @param docRev The document revision to remove the attachment from
+     * @return {@link Response}
+     */
+    public Response removeAttachment(String name, String docId, String docRev) {
+        assertNotEmpty(name, "name");
+        assertNotEmpty(docId, "docId");
+        assertNotEmpty(docRev, "docRev");
+        final URI uri = buildUri(getDBUri()).pathEncoded(docId).path("/").path(name).query("rev", docRev).build();
+        return delete(uri);
+    }
+
     /**
      * Invokes an Update Handler.
      *

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions