userver: userver/clients/http/form.hpp Source File
Loading...
Searching...
No Matches
form.hpp
1#pragma once
2
3#include <memory>
4#include <string>
5
6USERVER_NAMESPACE_BEGIN
7
8namespace curl {
9class form;
10} // namespace curl
11
12namespace clients::http {
13
14class Form final {
15public:
16 Form();
17 ~Form();
18
19 Form(const Form&) = delete;
20 Form(Form&&) noexcept;
21 Form& operator=(const Form&) = delete;
22 Form& operator=(Form&&) noexcept;
23
24 void AddContent(std::string_view key, std::string_view content);
25 void AddContent(std::string_view key, std::string_view content, const std::string& content_type);
26
27 void AddBuffer(const std::string& key, const std::string& file_name, const std::shared_ptr<std::string>& buffer);
28 void AddBuffer(
29 const std::string& key,
30 const std::string& file_name,
31 const std::shared_ptr<std::string>& buffer,
32 const std::string& content_type
33 );
34
35 /// @cond
36 // Call of this method will invalidate the form
37 std::unique_ptr<curl::form> GetNative() &&;
38 /// @endcond
39
40private:
41 std::unique_ptr<curl::form> impl_;
42};
43
44} // namespace clients::http
45
46USERVER_NAMESPACE_END