AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
client.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2020 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <string>
23#include <optional>
24
25#include "rest/clientIface.hpp"
26#include "rest/request.hpp"
27
28
29namespace anch::rest {
30
31 class WebClient {
32 // Attributes +
33 private:
36
38 std::optional<std::string> _basePath;
39 // Attributes -
40
41 // Constructors +
42 public:
49 WebClient(anch::rest::ClientIface& client, std::optional<std::string> basePath = std::optional<std::string>());
50 // Constructors -
51
52 // Destructor +
53 public:
57 virtual ~WebClient();
58 // Destructor -
59
60 // Methods +
61 public:
72 template<typename... P>
74 GET(anch::rest::Request& request, P... params);
75
86 template<typename... P>
88 GET(const std::string& path, P... params);
89
100 template<typename... P>
102 POST(anch::rest::Request& request, P... params);
103
114 template<typename... P>
116 PUT(anch::rest::Request& request, P... params);
117
128 template<typename... P>
130 PATCH(anch::rest::Request& request, P... params);
131
142 template<typename... P>
144 DELETE(anch::rest::Request& request, P... params);
145
156 template<typename... P>
158 DELETE(const std::string& path, P... params);
159
170 template<typename... P>
172 HEAD(anch::rest::Request& request, P... params);
173
184 template<typename... P>
186 HEAD(const std::string& path, P... params);
187
198 template<typename... P>
200 OPTIONS(anch::rest::Request& request, P... params);
201
212 template<typename... P>
214 OPTIONS(const std::string& path, P... params);
215
226 template<typename... P>
228 CONNECT(anch::rest::Request& request, P... params);
229
240 template<typename... P>
242 CONNECT(const std::string& path, P... params);
243
254 template<typename... P>
256 TRACE(const std::string& path, P... params);
257 // Methods -
258
259 };
260
261} // anch::rest
262
263#include "rest/impl/client.hpp"
HTTP client interface.
Definition clientIface.hpp:38
HTTP request.
Definition request.hpp:43
HTTP response.
Definition response.hpp:45
anch::rest::Response PUT(anch::rest::Request &request, P... params)
anch::rest::Response DELETE(const std::string &path, P... params)
anch::rest::Response PATCH(anch::rest::Request &request, P... params)
anch::rest::Response GET(const std::string &path, P... params)
anch::rest::Response CONNECT(anch::rest::Request &request, P... params)
anch::rest::Response GET(anch::rest::Request &request, P... params)
anch::rest::Response HEAD(const std::string &path, P... params)
WebClient(anch::rest::ClientIface &client, std::optional< std::string > basePath=std::optional< std::string >())
anch::rest::Response TRACE(const std::string &path, P... params)
anch::rest::Response HEAD(anch::rest::Request &request, P... params)
anch::rest::Response CONNECT(const std::string &path, P... params)
anch::rest::Response POST(anch::rest::Request &request, P... params)
anch::rest::Response OPTIONS(const std::string &path, P... params)
anch::rest::Response DELETE(anch::rest::Request &request, P... params)
anch::rest::Response OPTIONS(anch::rest::Request &request, P... params)