Add support for setting the access token.

This commit is contained in:
tastytea 2020-01-10 14:27:00 +01:00
parent c3bb9a20c4
commit f7191d1f3b
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 16 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <cstdint>
#include <string>
#include <string_view>
#include <utility>
namespace mastodonpp
{
@ -29,6 +30,7 @@ namespace mastodonpp
using std::uint64_t;
using std::string;
using std::string_view;
using std::move;
/*!
* @brief Holds the access data of an instance.
@ -87,6 +89,19 @@ public:
return _access_token;
}
/*!
* @brief Set OAuth 2.0 Bearer Access Token.
*
* Sets also the access token for all Connection%s that are initialized
* with this Instance afterwards.
*
* @since 0.1.0
*/
inline void set_access_token(string access_token)
{
_access_token = move(access_token);
}
/*!
* @brief Returns the maximum number of characters per post.
*
@ -113,6 +128,7 @@ public:
*
* @since 0.1.0
*/
[[nodiscard]]
string_view get_proxy() const
{
return _proxy;