userver: userver/clients/http/client.hpp Source File
Loading...
Searching...
No Matches
client.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/clients/http/client.hpp
4/// @brief @copybrief clients::http::Client
5
6#ifdef USERVER_TVM2_HTTP_CLIENT
7#error Use clients::Http from clients/http.hpp instead
8#endif
9
10#include <userver/clients/http/request.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace clients::http {
15
16/// @ingroup userver_clients
17///
18/// @brief HTTP client interface that returns a HTTP request builder from
19/// CreateRequest().
20///
21/// Usually retrieved from @ref components::HttpClient component.
22/// You can also create a client manually using @ref clients::http::CreateStandaloneHttpClient()
23///
24/// ## Example usage:
25///
26/// @snippet clients/http/client_test.cpp Sample HTTP Client usage
27class Client {
28public:
29 Client() = default;
30
31 Client(const Client&) = delete;
32 Client(Client&&) = delete;
33 Client& operator=(const Client&) = delete;
34 Client& operator=(Client&&) = delete;
35
36 virtual ~Client();
37
38 /// @brief Returns a HTTP request builder type with some preset values.
39 ///
40 /// @note This method is thread-safe despite being non-const.
41 virtual Request CreateRequest() = 0;
42
43 /// @brief Providing CreateNonSignedRequest() function for the clients::Http alias.
44 ///
45 /// @note This method is thread-safe despite being non-const.
47};
48
49} // namespace clients::http
50
51USERVER_NAMESPACE_END