mastodon-cpp
0.17.0
|
Child of Mastodon::API with abstract methods. More...
#include <easy.hpp>
Classes | |
class | Account |
Class to hold accounts. More... | |
class | Application |
Class to hold applications. More... | |
class | Attachment |
Class to hold attachments. More... | |
class | Card |
Class to hold cards. More... | |
class | Context |
Class to hold contexts. More... | |
class | Emoji |
Class to hold emojis. More... | |
class | Entity |
Base class for all entities. More... | |
class | Instance |
Class to hold instances. More... | |
class | Link |
Class to hold the Link -header. More... | |
class | List |
Class to hold lists. More... | |
class | Mention |
Class to hold mentions. More... | |
class | Notification |
Class to hold notifications. More... | |
class | PushSubscription |
Class to hold push subscriptions. More... | |
class | Relationship |
Class to hold relationships. More... | |
class | Report |
Class to hold reports. More... | |
class | Results |
Class to hold results. More... | |
class | Status |
Class to hold statuses. More... | |
class | Tag |
Class to hold tags. More... | |
Public Types | |
enum | event_type { Update, Notification, Delete, Undefined } |
Describes the event type. | |
enum | visibility_type { Direct, Private, Unlisted, Public, Undefined } |
Describes visibility of toots. | |
enum | attachment_type { Image, Video, Gifv, Unknown, Undefined } |
Describes the attachment type. | |
enum | card_type { Link, Photo, Video, Rich, Undefined } |
Describes the card type. | |
enum | notification_type { Mention, Reblog, Favourite, Follow, Undefined } |
Describes the notification type. | |
typedef std::pair< event_type, string > | stream_event |
Used for stream events. | |
typedef std::map< Easy::notification_type, bool > | alertmap |
Map of 'notification type' and 'push is requested or not'. More... | |
Public Types inherited from Mastodon::API | |
enum | v1 { accounts_id, accounts_verify_credentials, accounts_id_followers, accounts_id_following, accounts_id_statuses, accounts_relationships, accounts_search, blocks, domain_blocks, favourites, follow_requests, instance, custom_emojis, lists, accounts_id_lists, lists_id_accounts, lists_id, mutes, notifications, notifications_id, reports, search, statuses_id, statuses_id_context, statuses_id_card, statuses_id_reblogged_by, statuses_id_favourited_by, timelines_home, timelines_public, timelines_tag_hashtag, timelines_list_list_id, accounts_update_credentials, accounts_id_follow, accounts_id_unfollow, accounts_id_block, accounts_id_unblock, accounts_id_mute, accounts_id_unmute, apps, follow_requests_id_authorize, follow_requests_id_reject, follows, media, notifications_clear, notifications_dismiss, statuses, statuses_id_reblog, statuses_id_unreblog, statuses_id_favourite, statuses_id_unfavourite, statuses_id_pin, statuses_id_unpin, statuses_id_mute, statuses_id_unmute, media_id, streaming_user, streaming_public, streaming_public_local, streaming_hashtag, streaming_list, push_subscription } |
A list of all API calls. More... | |
enum | v2 { search } |
typedef std::map< string, std::vector< string > > | parametermap |
Used for passing parameters. More... | |
Public Member Functions | |
Easy (const string &instance, const string &access_token) | |
Constructs a new Easy object. More... | |
const Link | get_link () const |
Gets the links from the last answer. | |
const Status | send_toot (const Status &status, uint_fast16_t error=0) |
Sends a toot. More... | |
Public Member Functions inherited from Mastodon::API | |
API (const string &instance, const string &access_token) | |
Constructs a new API object. More... | |
const void | set_useragent (const string &useragent) |
Sets the useragent. Default is mastodon-cpp/version. More... | |
const string | get_useragent () const |
Gets the useragent. More... | |
const string | get_instance () const |
Returns the instance. More... | |
const uint_fast16_t | register_app1 (const string &client_name, const string &redirect_uri, const string &scopes, const string &website, string &client_id, string &client_secret, string &url) |
Register application, step 1/2. More... | |
const uint_fast16_t | register_app1 (const string &instance, const string &client_name, const string &redirect_uri, const string &scopes, const string &website, string &client_id, string &client_secret, string &url) |
const uint_fast16_t | register_app2 (const string &client_id, const string &client_secret, const string &redirect_uri, const string &code, string &access_token) |
Register application, step 2/2. More... | |
const uint_fast16_t | register_app2 (const string &instance, const string &client_id, const string &client_secret, const string &redirect_uri, const string &code, string &access_token) |
const string | get_header (const string &header) const |
Gets the header from the last answer. More... | |
bool | exceptions (const bool &value) |
Turn exceptions on or off. Defaults to off. More... | |
const bool | exceptions () const |
Returns true if exceptions are turned on, false otherwise. | |
const void | set_proxy (const string &proxy, const string &userpw="") |
Sets the proxy. More... | |
const void | get_proxy (string &proxy, string &userpw) const |
For internal use. More... | |
const uint_fast16_t | get (const Mastodon::API::v1 &call, string &answer) |
Make a GET request which doesn't require parameters. More... | |
const uint_fast16_t | get (const Mastodon::API::v1 &call, const parametermap ¶meters, string &answer) |
Make a GET request which requires parameters. More... | |
const uint_fast16_t | get (const Mastodon::API::v2 &call, const parametermap ¶meters, string &answer) |
Make a GET request which requires parameters. More... | |
const uint_fast16_t | get (const string &call, string &answer) |
Make a custom GET request. More... | |
const uint_fast16_t | get (const Mastodon::API::v1 &call, const string &argument, string &answer) |
const uint_fast16_t | get (const Mastodon::API::v1 &call, const string &argument, const parametermap ¶meters, string &answer) |
const uint_fast16_t | get_stream (const Mastodon::API::v1 &call, const parametermap ¶meters, string &answer, std::unique_ptr< Mastodon::API::http > &ptr) |
Make a streaming GET request. More... | |
const uint_fast16_t | get_stream (const Mastodon::API::v1 &call, string &answer, std::unique_ptr< Mastodon::API::http > &ptr) |
Make a streaming GET request. More... | |
const uint_fast16_t | get_stream (const string &call, string &answer, std::unique_ptr< Mastodon::API::http > &ptr) |
Make a streaming GET request. More... | |
const uint_fast16_t | get_stream (const Mastodon::API::v1 &call, const string &argument, string &answer, std::unique_ptr< Mastodon::API::http > &ptr) |
const uint_fast16_t | patch (const Mastodon::API::v1 &call, const parametermap ¶meters, string &answer) |
Make a PATCH request. More... | |
const uint_fast16_t | post (const Mastodon::API::v1 &call, string &answer) |
Make a POST request which doesn't require parameters. More... | |
const uint_fast16_t | post (const Mastodon::API::v1 &call, const parametermap ¶meters, string &answer) |
Make a POST request which requires parameters. More... | |
const uint_fast16_t | post (const string &call, const parametermap ¶meters, string &answer) |
Make a custom POST request. More... | |
const uint_fast16_t | post (const Mastodon::API::v1 &call, const string &argument, string &answer) |
const uint_fast16_t | post (const Mastodon::API::v1 &call, const string &argument, const parametermap ¶meters, string &answer) |
const uint_fast16_t | put (const Mastodon::API::v1 &call, const parametermap ¶meters, string &answer) |
Make a PUT request which requires a parameters. More... | |
const uint_fast16_t | put (const string &call, const parametermap ¶meters, string &answer) |
Make a custom PUT request. More... | |
const uint_fast16_t | put (const Mastodon::API::v1 &call, const string &argument, const parametermap ¶meters, string &answer) |
const uint_fast16_t | del (const Mastodon::API::v1 &call, const parametermap ¶meters) |
Make a DELETE request which requires parameters. More... | |
const uint_fast16_t | del (const string &call, const parametermap ¶meters, string &answer) |
Make a custom DELETE request. More... | |
const uint_fast16_t | del (const Mastodon::API::v1 &call, const string &argument) |
const uint_fast16_t | del (const Mastodon::API::v1 &call, const string &argument, const parametermap ¶meters) |
Static Public Member Functions | |
static const std::vector< string > | json_array_to_vector (const string &json) |
Turns a JSON array into a vector of strings. More... | |
static const std::vector< stream_event > | parse_stream (const std::string &streamdata) |
Split stream into a vector of events. More... | |
static const string | strtime_utc (const system_clock::time_point &timepoint, const string &format) |
Converts a time_point to a string. More... | |
static const string | strtime_local (const system_clock::time_point &timepoint, const string &format) |
See strtime_utc. More... | |
Static Public Member Functions inherited from Mastodon::API | |
static const string | urlencode (const string &str) |
Percent-encodes a string. This is done automatically, unless you make a custom request. More... | |
static const string | unescape_html (const string &html) |
Replaces HTML entities with UTF-8 characters. More... | |
Static Protected Member Functions | |
static const string | strtime (const system_clock::time_point &timepoint, const string &format, const bool &utc) |
Child of Mastodon::API with abstract methods.
typedef std::map<Easy::notification_type, bool> Mastodon::Easy::alertmap |
Map of 'notification type' and 'push is requested or not'.
Used in PushSubscription::alerts().
|
explicit |
Constructs a new Easy object.
To register your application, leave access_token blank and call register_app1() and register_app2().
instance | The hostname of your instance |
access_token | The access token |
|
static |
Turns a JSON array into a vector of strings.
json | JSON string holding the array |
|
static |
Split stream into a vector of events.
streamdata | Data from get_stream() |
const Easy::Status Easy::send_toot | ( | const Status & | status, |
uint_fast16_t | error = 0 |
||
) |
Sends a toot.
status | The status to send |
error | Error code. If the URL has permanently changed, 13 is returned and answer is set to the new URL. |
|
static |
|
static |
Converts a time_point to a string.
The return value can not exceed 1023 chars.
timepoint | The timepoint |
format | The format of the string, same as with strftime . |
Example: