userver: userver/clients/http/form.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 {
15 public:
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,
26 const std::string& content_type);
27
28 void AddBuffer(const std::string& key, const std::string& file_name,
29 const std::shared_ptr<std::string>& buffer);
30 void AddBuffer(const std::string& key, const std::string& file_name,
31 const std::shared_ptr<std::string>& buffer,
32 const std::string& content_type);
33
34 /// @cond
35 // Call of this method will invalidate the form
36 std::unique_ptr<curl::form> GetNative() &&;
37 /// @endcond
38
39 private:
40 std::unique_ptr<curl::form> impl_;
41};
42
43} // namespace clients::http
44
45USERVER_NAMESPACE_END