1#ifndef CPR_BEARER_H
2#define CPR_BEARER_H
3
4#include <curl/curlver.h>
5#include <string>
6
7#include <utility>
8
9namespace cpr {
10
11// Only supported with libcurl >= 7.61.0.
12// As an alternative use SetHeader and add the token manually.
13#if LIBCURL_VERSION_NUM >= 0x073D00
14class Bearer {
15 public:
16 // NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
17 Bearer(std::string token) : token_string_{std::move(token)} {}
18 Bearer(const Bearer& other) = default;
19 Bearer(Bearer&& old) noexcept = default;
20 virtual ~Bearer() noexcept;
21
22 Bearer& operator=(Bearer&& old) noexcept = default;
23 Bearer& operator=(const Bearer& other) = default;
24
25 virtual const char* GetToken() const noexcept;
26
27 protected:
28 std::string token_string_;
29};
30#endif
31
32} // namespace cpr
33
34#endif
35