27 #include <unordered_map>
29 #include <oatpp/core/macro/codegen.hpp>
30 #include <oatpp/network/Address.hpp>
31 #include <oatpp/web/client/ApiClient.hpp>
33 #include "Environment.hpp"
38 #include OATPP_CODEGEN_BEGIN(ApiClient)
40 class Client :
public oatpp::web::client::ApiClient
43 Client(
const oatpp::network::Address &address);
45 static std::shared_ptr<Client> createShared(
46 const oatpp::network::Address &address)
48 return std::make_shared<Client>(address);
53 API_CALL(
"GET",
"devices", getDevices);
55 API_CALL(
"GET",
"devices/types", getDevicesTypes);
57 API_CALL(
"GET",
"api-docs/ui", getSwaggerUi);
62 BODY_DTO(Float64, position));
63 API_CALL(
"POST",
"axis/{id}/position", postAxisPosition);
65 API_CALL(
"GET",
"alias", getAliasList);
66 API_CALL(
"GET",
"alias/{id}", getAlias);
67 API_CALL(
"PUT",
"alias/{id}", putAlias, BODY_DTO(String, target));
68 API_CALL(
"DELETE",
"alias/{id}", deleteAlias);
70 std::shared_ptr<Response> put(
71 const std::string &path,
72 const oatpp::Void &body,
73 const std::unordered_map<oatpp::String, oatpp::String> &pathParams =
74 std::unordered_map<oatpp::String, oatpp::String>{});
76 std::shared_ptr<Response> post(
77 const std::string &path,
78 const oatpp::Void &body,
79 const std::unordered_map<oatpp::String, oatpp::String> &pathParams =
80 std::unordered_map<oatpp::String, oatpp::String>{});
82 std::shared_ptr<Response> get(
83 const std::string &path,
84 const std::unordered_map<oatpp::String, oatpp::String> &queryParams =
85 std::unordered_map<oatpp::String, oatpp::String>{},
86 const std::unordered_map<oatpp::String, oatpp::String> &pathParams =
87 std::unordered_map<oatpp::String, oatpp::String>{});
89 std::shared_ptr<Response> del(
90 const std::string &path,
91 const std::unordered_map<oatpp::String, oatpp::String> &queryParams =
92 std::unordered_map<oatpp::String, oatpp::String>{},
93 const std::unordered_map<oatpp::String, oatpp::String> &pathParams =
94 std::unordered_map<oatpp::String, oatpp::String>{});
97 T readBody(
const std::shared_ptr<Response> &res)
99 return res->readBodyToDto<T>(m_objectMapper);
102 inline std::shared_ptr<oatpp::data::mapping::ObjectMapper> &getObjectMapper()
104 return m_objectMapper;
108 Environment::Shared m_env{Environment::instance()};
111 #include OATPP_CODEGEN_END(ApiClient)
main motion-lib namespace