Gazebo Fuel_tools

API Reference

9.1.0
RestClient.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_FUEL_TOOLS_RESTCLIENT_HH_
18 #define GZ_FUEL_TOOLS_RESTCLIENT_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include "gz/fuel_tools/Export.hh"
27 
28 #ifdef _WIN32
29 // Disable warning C4251 which is triggered by
30 // std::string
31 #pragma warning(push)
32 #pragma warning(disable: 4251)
33 #endif
34 
35 namespace gz::fuel_tools
36 {
38  struct GZ_FUEL_TOOLS_VISIBLE RestResponse
39  {
41  // cppcheck-suppress unusedStructMember
42  public: int statusCode = 0;
43 
45  public: std::string data = "";
46 
51  };
52 
54  class GZ_FUEL_TOOLS_VISIBLE Rest
55  {
57  public: Rest() = default;
58 
83  public: virtual RestResponse Request(const HttpMethod _method,
84  const std::string &_url,
85  const std::string &_version,
86  const std::string &_path,
87  const std::vector<std::string> &_queryStrings,
88  const std::vector<std::string> &_headers,
89  const std::string &_data,
92 
95  public: void SetUserAgent(const std::string &_agent);
96 
99  public: const std::string &UserAgent() const;
100 
102  private: std::string userAgent;
103  };
104 } // namespace gz::fuel_tools
105 
106 #ifdef _MSC_VER
107 #pragma warning(pop)
108 #endif
109 
110 #endif // GZ_FUEL_TOOLS_RESTCLIENT_HH_