diff Resources/Orthanc/Plugins/Samples/Common/OrthancPluginConnection.cpp @ 69:d529d9ce3c7e

cache for DicomPyramidInstance
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Nov 2016 21:56:07 +0100
parents a59fdb848a7b
children 319b8c45c231
line wrap: on
line diff
--- a/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginConnection.cpp	Fri Nov 25 21:18:46 2016 +0100
+++ b/Resources/Orthanc/Plugins/Samples/Common/OrthancPluginConnection.cpp	Fri Nov 25 21:56:07 2016 +0100
@@ -58,7 +58,7 @@
   {
     OrthancPlugins::MemoryBuffer buffer(context_);
 
-    if (!buffer.RestApiPost(uri, body.c_str(), body.size(), false))
+    if (buffer.RestApiPost(uri, body.c_str(), body.size(), false))
     {
       buffer.ToString(result);
     }
@@ -67,4 +67,32 @@
       ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
     }
   }
+
+
+  void OrthancPluginConnection::RestApiPut(std::string& result,
+                                           const std::string& uri,
+                                           const std::string& body)
+  {
+    OrthancPlugins::MemoryBuffer buffer(context_);
+
+    if (buffer.RestApiPut(uri, body.c_str(), body.size(), false))
+    {
+      buffer.ToString(result);
+    }
+    else
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+    }
+  }
+
+
+  void OrthancPluginConnection::RestApiDelete(const std::string& uri)
+  {
+    OrthancPlugins::MemoryBuffer buffer(context_);
+
+    if (!::OrthancPlugins::RestApiDelete(context_, uri, false))
+    {
+      ORTHANC_PLUGINS_THROW_EXCEPTION(OrthancPluginErrorCode_UnknownResource);
+    }
+  }
 }