Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 {
21  class MITKREST_EXPORT RESTClient
22  {
23  public:
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 
47  pplx::task<web::json::value> Get(const web::uri &uri,
48  const utility::string_t &filePath,
49  const std::map<utility::string_t, utility::string_t> headers);
50 
60  pplx::task<web::json::value> Put(const web::uri &uri, const web::json::value *content);
61 
72  pplx::task<web::json::value> Post(const web::uri &uri,
73  const web::json::value *content,
74  const std::map<utility::string_t, utility::string_t> headers);
75 
86  pplx::task<web::json::value> Post(const web::uri &uri,
87  const std::vector<unsigned char> *content,
88  const std::map<utility::string_t, utility::string_t> headers);
89 
90  private:
95  http_request InitRequest(const std::map<utility::string_t, utility::string_t> headers);
96 
97  void CheckResponseContentType(web::http::http_response &response);
98 
99  pplx::task<web::json::value> ExecutePost(const web::uri &uri, http_request request);
100  web::http::client::http_client_config m_ClientConfig;
101  };
102 } // namespace mitk
103 
104 #endif
web::http::http_request http_request
DataCollection - Class to facilitate loading/accessing structured data.
web::http::http_response http_response
web::http::http_request http_request