Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method removeAttachment #81

Open
holgerengels opened this issue Aug 19, 2022 · 0 comments
Open

Add a method removeAttachment #81

holgerengels opened this issue Aug 19, 2022 · 0 comments

Comments

@holgerengels
Copy link

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.
      *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant