Documentation update, saving access_token

This commit is contained in:
tastytea 2018-02-11 12:26:42 +01:00
parent d11273ddc0
commit 8222ff6da1
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
4 changed files with 13 additions and 6 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.7)
include(GNUInstallDirs)
project (mastodon-cpp
VERSION 0.2.13
VERSION 0.2.14
LANGUAGES CXX
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

View File

@ -98,8 +98,7 @@ const std::uint16_t API::http::request_sync(const method &meth,
answer = oss.str();
}
else if (ret == 301 || ret == 308)
{
// Moved Permanently or Permanent Redirect
{ // Moved Permanently or Permanent Redirect
// FIXME: The new URL should be passed back somehow
answer = oss.str();
}
@ -111,6 +110,7 @@ const std::uint16_t API::http::request_sync(const method &meth,
catch (curlpp::RuntimeError &e)
{
cerr << "RUNTIME ERROR: " << e.what() << std::endl;
return 0xffff;
}
catch (curlpp::LogicError &e)

View File

@ -225,6 +225,7 @@ const std::uint16_t API::register_app2(const string &instance,
std::regex_search(answer, match, retoken);
access_token = match[1].str();
_access_token = access_token;
return 0;
}

View File

@ -30,6 +30,8 @@
* @example example3_mastocron.cpp
* @example example4_update_credentials.cpp
* @example example5_follow_unfollow.cpp
* @example example6_toot_delete-toot.cpp
* @example example7_register_app.cpp
*/
namespace Mastodon
{
@ -133,9 +135,11 @@ public:
/*!
* @brief Constructs a new API object.
*
* To register your application, leave access_token blank and call
* register_app1() and register_app2().
*
* @param instance The hostname of your instance
* @param access_token Your access token. You have to generate it
* manually for now.
* @param access_token Your access token.
*/
explicit API(const std::string &instance,
const std::string &access_token);
@ -194,6 +198,8 @@ public:
/*!
* @brief Register application, step 2/2
*
* The access token will be used in all subsequent calls.
*
* @param instance
* @param client_id
@ -457,7 +463,7 @@ public:
private:
const std::string _instance;
const std::string _access_token;
std::string _access_token;
std::string _useragent;
/*!