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