1 #ifndef CPR_RESPONSE_H
2 #define CPR_RESPONSE_H
3 
4 #include <cassert>
5 #include <cstdint>
6 #include <curl/curl.h>
7 #include <memory>
8 #include <string>
9 #include <utility>
10 #include <vector>
11 
12 #include "cpr/cookies.h"
13 #include "cpr/cprtypes.h"
14 #include "cpr/error.h"
15 #include "cpr/ssl_options.h"
16 #include "cpr/util.h"
17 
18 namespace cpr {
19 
20 class Response {
21   private:
22     std::shared_ptr<CurlHolder> curl_{nullptr};
23 
24   public:
25     // Ignored here since libcurl uses a long for this.
26     // NOLINTNEXTLINE(google-runtime-int)
27     long status_code{};
28     std::string text{};
29     Header header{};
30     Url url{};
31     double elapsed{};
32     Cookies cookies{};
33     Error error{};
34     std::string raw_header{};
35     std::string status_line{};
36     std::string reason{};
37     cpr_off_t uploaded_bytes{};
38     cpr_off_t downloaded_bytes{};
39     // Ignored here since libcurl uses a long for this.
40     // NOLINTNEXTLINE(google-runtime-int)
41     long redirect_count{};
42 
43     Response() = default;
44     Response(std::shared_ptr<CurlHolder> curl, std::string&& p_text, std::string&& p_header_string,
45              Cookies&& p_cookies, Error&& p_error);
46     std::vector<std::string> GetCertInfo();
47     Response(const Response& other) = default;
48     Response(Response&& old) noexcept = default;
49     ~Response() noexcept = default;
50 
51     Response& operator=(Response&& old) noexcept = default;
52     Response& operator=(const Response& other) = default;
53 };
54 } // namespace cpr
55 
56 #endif
57