Medical Imaging Interaction Toolkit  2023.12.99-101158b3
Medical Imaging Interaction Toolkit
mitkRESTClient.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkRESTClient_h
14 #define mitkRESTClient_h
15 
16 #include <MitkRESTExports.h>
17 #include <cpprest/http_client.h>
18 
19 namespace mitk
20 {
22  {
23  public:
24  using http_request = web::http::http_request;
25  RESTClient();
26  ~RESTClient();
27 
36  pplx::task<web::json::value> Get(const web::uri &uri, const std::map<utility::string_t, utility::string_t> headers);
37 
48  pplx::task<web::json::value> Get(const web::uri &uri,
49  const utility::string_t &filePath,
50  const std::map<utility::string_t, utility::string_t> headers);
51 
61  pplx::task<web::json::value> Put(const web::uri &uri, const web::json::value *content);
62 
73  pplx::task<web::json::value> Post(const web::uri &uri,
74  const web::json::value *content,
75  const std::map<utility::string_t, utility::string_t> headers);
76 
87  pplx::task<web::json::value> Post(const web::uri &uri,
88  const std::vector<unsigned char> *content,
89  const std::map<utility::string_t, utility::string_t> headers);
90 
91  private:
96  http_request InitRequest(const std::map<utility::string_t, utility::string_t> headers);
97 
98  void CheckResponseContentType(web::http::http_response &response);
99 
100  pplx::task<web::json::value> ExecutePost(const web::uri &uri, http_request request);
101  web::http::client::http_client_config m_ClientConfig;
102  };
103 } // namespace mitk
104 
105 #endif
MITKREST_EXPORT
#define MITKREST_EXPORT
Definition: MitkRESTExports.h:15
MitkRESTExports.h
mitk::RESTClient::http_request
web::http::http_request http_request
Definition: mitkRESTClient.h:24
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::MitkMultilabelIOMimeTypes::Get
MITKMULTILABELIO_EXPORT std::vector< CustomMimeType * > Get()
mitk::RESTClient
Definition: mitkRESTClient.h:21