diff --git a/docs/annotated.html b/docs/annotated.html index dc096d1..63cb03b 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -3,7 +3,7 @@ - + mastodonpp: Class List @@ -31,10 +31,10 @@ - + @@ -70,22 +70,20 @@ $(function() {
Here are the classes, structs, unions and interfaces with brief descriptions:
[detail level 123]
- - + + - - - - - + + + + +
 NmastodonppC++ wrapper for the Mastodon API
 Canswer_typeReturn type for Requests
 CAPIHolds API endpoints
 CAPIHolds API endpoints
 Cevent_typeA stream event
 CConnectionRepresents a connection to an instance. Used for requests
 CCURLExceptionException for libcurl errors
 CCURLWrapperHandles the details of network connections
 Cevent_typeA stream event
 CInstanceHolds the access data of an instance
 CObtainTokenSimplifies obtaining an OAuth 2.0 Bearer Access Token
 CCURLWrapperHandles the details of network connections
 CCURLExceptionException for libcurl errors
 CInstanceHolds the access data of an instance
 CObtainTokenSimplifies obtaining an OAuth 2.0 Bearer Access Token
 Canswer_typeReturn type for Requests
diff --git a/docs/api_8hpp_source.html b/docs/api_8hpp_source.html index 5a5a5cf..e8ed7a4 100644 --- a/docs/api_8hpp_source.html +++ b/docs/api_8hpp_source.html @@ -3,7 +3,7 @@ - + mastodonpp: include/api.hpp Source File @@ -31,10 +31,10 @@ - + @@ -359,23 +359,21 @@ $(function() {
351 
352 } // namespace mastodonpp
353 
-
354 #endif // MASTODONPP_API_HPP
- -
mastodonpp::API::v2
v2
An enumeration of all v2 API endpoints.
Definition: api.hpp:211
-
mastodonpp::API::oauth
oauth
An enumeration of all oauth API endpoints.
Definition: api.hpp:223
-
mastodonpp::API::to_string_view
string_view to_string_view() const
Convert endpoint_type to std::string_view.
Definition: api.hpp:342
-
mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.hpp:24
-
mastodonpp::API
Holds API endpoints.
Definition: api.hpp:40
-
mastodonpp::API::pleroma
pleroma
An enumeration of all pleroma API endpoints.
Definition: api.hpp:252
+
354 #endif // MASTODONPP_API_HPP
+
mastodonpp::API
Holds API endpoints.
Definition: api.hpp:41
+
mastodonpp::API::pleroma
pleroma
An enumeration of all pleroma API endpoints.
Definition: api.hpp:253
+
mastodonpp::API::oauth
oauth
An enumeration of all oauth API endpoints.
Definition: api.hpp:224
+
mastodonpp::API::v2
v2
An enumeration of all v2 API endpoints.
Definition: api.hpp:212
mastodonpp::API::endpoint_type
variant< v1, v2, oauth, other, pleroma > endpoint_type
Type for endpoints. Can be API::v1, API::v2, API::oauth, API::other or API::pleroma.
Definition: api.hpp:325
-
mastodonpp::API::v1
v1
An enumeration of all v1 API endpoints.
Definition: api.hpp:50
-
mastodonpp::API::other
other
An enumeration of all other API endpoints.
Definition: api.hpp:239
+
mastodonpp::API::to_string_view
string_view to_string_view() const
Convert endpoint_type to std::string_view.
Definition: api.hpp:342
+
mastodonpp::API::other
other
An enumeration of all other API endpoints.
Definition: api.hpp:240
+
mastodonpp::API::v1
v1
An enumeration of all v1 API endpoints.
Definition: api.hpp:51
mastodonpp::API::API
API(const endpoint_type &endpoint)
Constructs an API object. You should never need this.
Definition: api.cpp:22
+
mastodonpp
C++ wrapper for the Mastodon API.
Definition: api.hpp:25
+ diff --git a/docs/classes.html b/docs/classes.html index 9ec305f..544a101 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Index @@ -31,10 +31,10 @@ - + @@ -67,41 +67,28 @@ $(function() {
Class Index
-
a | c | e | i | o
- - - - - - - - - - - - - - - - - - - - - -
  a  
-
  c  
-
CURLWrapper (mastodonpp)   
  i  
-
  e  
-
answer_type (mastodonpp)   Connection (mastodonpp)   Instance (mastodonpp)   
API (mastodonpp)   CURLException (mastodonpp)   event_type (mastodonpp)   
  o  
-
Instance::ObtainToken (mastodonpp)   
-
a | c | e | i | o
+
A | C | E | I | O
+
+
+
A
+
answer_type (mastodonpp)
API (mastodonpp)
+
+
C
+
Connection (mastodonpp)
CURLException (mastodonpp)
CURLWrapper (mastodonpp)
+
+
E
+
event_type (mastodonpp)
+
+
I
+
Instance (mastodonpp)
+
+
O
+
Instance::ObtainToken (mastodonpp)
+
diff --git a/docs/classmastodonpp_1_1API-members.html b/docs/classmastodonpp_1_1API-members.html index 5e57b7e..6782c52 100644 --- a/docs/classmastodonpp_1_1API-members.html +++ b/docs/classmastodonpp_1_1API-members.html @@ -3,7 +3,7 @@ - + mastodonpp: Member List @@ -31,10 +31,10 @@ - + @@ -85,9 +85,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1API.html b/docs/classmastodonpp_1_1API.html index 2e50e95..0179820 100644 --- a/docs/classmastodonpp_1_1API.html +++ b/docs/classmastodonpp_1_1API.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::API Class Reference @@ -31,10 +31,10 @@ - + @@ -83,246 +83,246 @@ $(function() { - - - - - @@ -796,9 +796,7 @@ Public Member Functions diff --git a/docs/classmastodonpp_1_1CURLException-members.html b/docs/classmastodonpp_1_1CURLException-members.html index ce5609b..431ab22 100644 --- a/docs/classmastodonpp_1_1CURLException-members.html +++ b/docs/classmastodonpp_1_1CURLException-members.html @@ -3,7 +3,7 @@ - +mastodonpp: Member List @@ -31,10 +31,10 @@

Public Types

enum  v1 {
-  apps, -apps_verify_credentials, -accounts, -accounts_verify_credentials, -
-  accounts_update_credentials, -accounts_id, -accounts_id_statuses, -accounts_id_followers, -
-  accounts_id_following, -accounts_id_lists, -accounts_id_identity_proofs, -accounts_id_follow, -
-  accounts_id_unfollow, -accounts_id_block, -accounts_id_unblock, -accounts_id_mute, -
-  accounts_id_unmute, -accounts_id_pin, -accounts_id_unpin, -accounts_relationships, -
-  accounts_search, -bookmarks, -favourites, -mutes, -
-  blocks, -domain_blocks, -filters, -filters_id, -
-  reports, -follow_requests, -follow_requests_id_authorize, -follow_requests_id_reject, -
-  endorsements, -featured_tags, -featured_tags_id, -featured_tags_suggestions, -
-  preferences, -suggestions, -suggestions_account_id, -statuses, -
-  statuses_id, -statuses_id_context, -statuses_id_reblogged_by, -statuses_id_favourited_by, -
-  statuses_id_favourite, -statuses_id_unfavourite, -statuses_id_reblog, -statuses_id_unreblog, -
-  statuses_id_bookmark, -statuses_id_unbookmark, -statuses_id_mute, -statuses_id_unmute, -
-  statuses_id_pin, -statuses_id_unpin, -media, -media_id, -
-  polls_id, -polls_id_votes, -scheduled_statuses, -scheduled_statuses_id, -
-  timelines_public, -timelines_tag_hashtag, -timelines_home, -timelines_list_list_id, -
-  conversations, -conversations_id, -conversations_id_read, -lists, -
-  lists_id, -lists_id_accounts, -markers, -streaming_health, -
-  streaming_user, -streaming_public, -streaming_public_local, -streaming_hashtag, -
-  streaming_hashtag_local, -streaming_list, -streaming_direct, -notifications, -
-  notifications_id, -notifications_clear, -notifications_id_dismiss, -push_subscription, -
-  instance, -instance_peers, -instance_activity, -trends, -
-  directory, -custom_emojis, -admin_accounts, -admin_accounts_id, -
-  admin_accounts_account_id_action, -admin_accounts_id_approve, -admin_accounts_id_reject, -admin_accounts_id_enable, -
-  admin_accounts_id_unsilence, -admin_accounts_id_unsuspend, -admin_reports, -admin_reports_id, -
-  admin_reports_id_assign_to_self, -admin_reports_id_unassign, -admin_reports_id_resolve, -admin_reports_id_reopen, -
-  pleroma_notifications_read, -pleroma_accounts_id_subscribe, -pleroma_accounts_id_unsubscribe, -pleroma_accounts_id_favourites, -
-  pleroma_accounts_update_avatar, -pleroma_accounts_update_banner, -pleroma_accounts_update_background, -pleroma_accounts_confirmation_resend, -
-  pleroma_mascot, -pleroma_conversations_id_statuses, -pleroma_conversations_id, -pleroma_conversations_id_read, -
-  pleroma_accounts_id_scrobbles, -pleroma_scrobble, -pleroma_statuses_id_reactions_emoji, -pleroma_statuses_id_reactions +
enum class  v1 {
+  apps +, apps_verify_credentials +, accounts +, accounts_verify_credentials +,
+  accounts_update_credentials +, accounts_id +, accounts_id_statuses +, accounts_id_followers +,
+  accounts_id_following +, accounts_id_lists +, accounts_id_identity_proofs +, accounts_id_follow +,
+  accounts_id_unfollow +, accounts_id_block +, accounts_id_unblock +, accounts_id_mute +,
+  accounts_id_unmute +, accounts_id_pin +, accounts_id_unpin +, accounts_relationships +,
+  accounts_search +, bookmarks +, favourites +, mutes +,
+  blocks +, domain_blocks +, filters +, filters_id +,
+  reports +, follow_requests +, follow_requests_id_authorize +, follow_requests_id_reject +,
+  endorsements +, featured_tags +, featured_tags_id +, featured_tags_suggestions +,
+  preferences +, suggestions +, suggestions_account_id +, statuses +,
+  statuses_id +, statuses_id_context +, statuses_id_reblogged_by +, statuses_id_favourited_by +,
+  statuses_id_favourite +, statuses_id_unfavourite +, statuses_id_reblog +, statuses_id_unreblog +,
+  statuses_id_bookmark +, statuses_id_unbookmark +, statuses_id_mute +, statuses_id_unmute +,
+  statuses_id_pin +, statuses_id_unpin +, media +, media_id +,
+  polls_id +, polls_id_votes +, scheduled_statuses +, scheduled_statuses_id +,
+  timelines_public +, timelines_tag_hashtag +, timelines_home +, timelines_list_list_id +,
+  conversations +, conversations_id +, conversations_id_read +, lists +,
+  lists_id +, lists_id_accounts +, markers +, streaming_health +,
+  streaming_user +, streaming_public +, streaming_public_local +, streaming_hashtag +,
+  streaming_hashtag_local +, streaming_list +, streaming_direct +, notifications +,
+  notifications_id +, notifications_clear +, notifications_id_dismiss +, push_subscription +,
+  instance +, instance_peers +, instance_activity +, trends +,
+  directory +, custom_emojis +, admin_accounts +, admin_accounts_id +,
+  admin_accounts_account_id_action +, admin_accounts_id_approve +, admin_accounts_id_reject +, admin_accounts_id_enable +,
+  admin_accounts_id_unsilence +, admin_accounts_id_unsuspend +, admin_reports +, admin_reports_id +,
+  admin_reports_id_assign_to_self +, admin_reports_id_unassign +, admin_reports_id_resolve +, admin_reports_id_reopen +,
+  pleroma_notifications_read +, pleroma_accounts_id_subscribe +, pleroma_accounts_id_unsubscribe +, pleroma_accounts_id_favourites +,
+  pleroma_accounts_update_avatar +, pleroma_accounts_update_banner +, pleroma_accounts_update_background +, pleroma_accounts_confirmation_resend +,
+  pleroma_mascot +, pleroma_conversations_id_statuses +, pleroma_conversations_id +, pleroma_conversations_id_read +,
+  pleroma_accounts_id_scrobbles +, pleroma_scrobble +, pleroma_statuses_id_reactions_emoji +, pleroma_statuses_id_reactions
}
 An enumeration of all v1 API endpoints. More...
 
enum  v2 { search +
enum class  v2 { search }
 An enumeration of all v2 API endpoints. More...
 
enum  oauth { authorize, -token, -revoke +
enum class  oauth { authorize +, token +, revoke }
 An enumeration of all oauth API endpoints. More...
 
enum  other { proofs, -oembed +
enum class  other { proofs +, oembed }
 An enumeration of all other API endpoints. More...
 
enum  pleroma {
-  admin_users, -admin_users_follow, -admin_users_unfollow, -admin_users_nickname_toggle_activation, -
-  admin_users_tag, -admin_users_nickname_permission_group, -admin_users_nickname_permission_group_permission_group, -admin_users_permission_group_permission_group, -
-  admin_users_activate, -admin_users_deactivate, -admin_users_nickname_or_id, -admin_users_nickname_or_id_statuses, -
-  admin_instances_instance_statuses, -admin_statuses, -admin_relay, -admin_users_invite_token, -
-  admin_users_invites, -admin_users_revoke_invite, -admin_users_email_invite, -admin_users_nickname_password_reset, -
-  admin_users_nickname_update_credentials, -admin_users_force_password_reset, -admin_reports, -admin_grouped_reports, -
-  admin_reports_id, -admin_reports_id_notes, -admin_reports_report_id_notes_id, -admin_statuses_id, -
-  admin_restart, -admin_config, -admin_config_descriptions, -admin_moderation_log, -
-  admin_reload_emoji, -admin_users_confirm_email, -admin_users_resend_confirm_email, -admin_stats, -
-  admin_users_nickname, -admin_users_nickname_activation_status, -admin_reports_id_respond, -admin_config_migrate_to_db, -
-  admin_config_migrate_from_db, -emoji, -follow_import, -captcha, -
-  delete_account, -disable_account, -notification_settings, -healthcheck, -
-  change_email, -emoji_packs, -emoji_packs_name, -emoji_packs_name_update_file, -
-  emoji_packs_name_update_metadata, -emoji_packs_download_from, -emoji_packs_list_from, -emoji_packs_name_download_shared, -
+
enum class  pleroma {
+  admin_users +, admin_users_follow +, admin_users_unfollow +, admin_users_nickname_toggle_activation +,
+  admin_users_tag +, admin_users_nickname_permission_group +, admin_users_nickname_permission_group_permission_group +, admin_users_permission_group_permission_group +,
+  admin_users_activate +, admin_users_deactivate +, admin_users_nickname_or_id +, admin_users_nickname_or_id_statuses +,
+  admin_instances_instance_statuses +, admin_statuses +, admin_relay +, admin_users_invite_token +,
+  admin_users_invites +, admin_users_revoke_invite +, admin_users_email_invite +, admin_users_nickname_password_reset +,
+  admin_users_nickname_update_credentials +, admin_users_force_password_reset +, admin_reports +, admin_grouped_reports +,
+  admin_reports_id +, admin_reports_id_notes +, admin_reports_report_id_notes_id +, admin_statuses_id +,
+  admin_restart +, admin_config +, admin_config_descriptions +, admin_moderation_log +,
+  admin_reload_emoji +, admin_users_confirm_email +, admin_users_resend_confirm_email +, admin_stats +,
+  admin_users_nickname +, admin_users_nickname_activation_status +, admin_reports_id_respond +, admin_config_migrate_to_db +,
+  admin_config_migrate_from_db +, emoji +, follow_import +, captcha +,
+  delete_account +, disable_account +, notification_settings +, healthcheck +,
+  change_email +, emoji_packs +, emoji_packs_name +, emoji_packs_name_update_file +,
+  emoji_packs_name_update_metadata +, emoji_packs_download_from +, emoji_packs_list_from +, emoji_packs_name_download_shared +,
  account_register
}
- + @@ -82,9 +82,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1CURLException.html b/docs/classmastodonpp_1_1CURLException.html index 20e415f..19ffbac 100644 --- a/docs/classmastodonpp_1_1CURLException.html +++ b/docs/classmastodonpp_1_1CURLException.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::CURLException Class Reference @@ -31,10 +31,10 @@ - + @@ -83,19 +83,19 @@ $(function() {
Inheritance diagram for mastodonpp::CURLException:
-
Inheritance graph
- +
Inheritance graph
+ - +
[legend]
Collaboration diagram for mastodonpp::CURLException:
-
Collaboration graph
- +
Collaboration graph
+ - +
[legend]
@@ -163,6 +163,7 @@ Public Attributes
28  : error_code{error}
29  , _message{move(message)}
30 {}
+
const CURLcode error_code
The error code returned by libcurl.
Definition: exceptions.hpp:73
@@ -313,12 +314,9 @@ Public Attributes
  • src/exceptions.cpp
  • -
    mastodonpp::CURLException::error_code
    const CURLcode error_code
    The error code returned by libcurl.
    Definition: exceptions.hpp:73
    diff --git a/docs/classmastodonpp_1_1CURLException__coll__graph.map b/docs/classmastodonpp_1_1CURLException__coll__graph.map index b8950d2..4857760 100644 --- a/docs/classmastodonpp_1_1CURLException__coll__graph.map +++ b/docs/classmastodonpp_1_1CURLException__coll__graph.map @@ -1,4 +1,4 @@ - + diff --git a/docs/classmastodonpp_1_1CURLException__coll__graph.md5 b/docs/classmastodonpp_1_1CURLException__coll__graph.md5 index 4187d87..13b739a 100644 --- a/docs/classmastodonpp_1_1CURLException__coll__graph.md5 +++ b/docs/classmastodonpp_1_1CURLException__coll__graph.md5 @@ -1 +1 @@ -25e8154595e8766a560eb0097f22d57e \ No newline at end of file +48f58419457baf79d17e561a02011ab2 \ No newline at end of file diff --git a/docs/classmastodonpp_1_1CURLException__coll__graph.png b/docs/classmastodonpp_1_1CURLException__coll__graph.png index d197460..f99413b 100644 Binary files a/docs/classmastodonpp_1_1CURLException__coll__graph.png and b/docs/classmastodonpp_1_1CURLException__coll__graph.png differ diff --git a/docs/classmastodonpp_1_1CURLException__inherit__graph.map b/docs/classmastodonpp_1_1CURLException__inherit__graph.map index b8950d2..4857760 100644 --- a/docs/classmastodonpp_1_1CURLException__inherit__graph.map +++ b/docs/classmastodonpp_1_1CURLException__inherit__graph.map @@ -1,4 +1,4 @@ - + diff --git a/docs/classmastodonpp_1_1CURLException__inherit__graph.md5 b/docs/classmastodonpp_1_1CURLException__inherit__graph.md5 index 4187d87..13b739a 100644 --- a/docs/classmastodonpp_1_1CURLException__inherit__graph.md5 +++ b/docs/classmastodonpp_1_1CURLException__inherit__graph.md5 @@ -1 +1 @@ -25e8154595e8766a560eb0097f22d57e \ No newline at end of file +48f58419457baf79d17e561a02011ab2 \ No newline at end of file diff --git a/docs/classmastodonpp_1_1CURLException__inherit__graph.png b/docs/classmastodonpp_1_1CURLException__inherit__graph.png index d197460..f99413b 100644 Binary files a/docs/classmastodonpp_1_1CURLException__inherit__graph.png and b/docs/classmastodonpp_1_1CURLException__inherit__graph.png differ diff --git a/docs/classmastodonpp_1_1CURLWrapper-members.html b/docs/classmastodonpp_1_1CURLWrapper-members.html index cf5e9a1..8bb9927 100644 --- a/docs/classmastodonpp_1_1CURLWrapper-members.html +++ b/docs/classmastodonpp_1_1CURLWrapper-members.html @@ -3,7 +3,7 @@ - +mastodonpp: Member List @@ -31,10 +31,10 @@
    - + @@ -95,9 +95,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1CURLWrapper.html b/docs/classmastodonpp_1_1CURLWrapper.html index 8f39743..f4cf9cf 100644 --- a/docs/classmastodonpp_1_1CURLWrapper.html +++ b/docs/classmastodonpp_1_1CURLWrapper.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::CURLWrapper Class Reference @@ -31,10 +31,10 @@ - + @@ -84,8 +84,8 @@ $(function() {
    Inheritance diagram for mastodonpp::CURLWrapper:
    -
    Inheritance graph
    - +
    Inheritance graph
    + @@ -95,10 +95,10 @@ Inheritance diagram for mastodonpp::CURLWrapper:
    Collaboration diagram for mastodonpp::CURLWrapper:
    -
    Collaboration graph
    - - - +
    Collaboration graph
    + + +
    [legend]
    @@ -690,7 +690,7 @@ Protected Attributes
    248  _curl_buffer_error};
    249  }
    250 
    -
    251 #if (LIBCURL_VERSION_NUM < 0x073d00) // libcurl < 7.61.0.
    +
    251 #if (LIBCURL_VERSION_NUM < 0x073d00) // libcurl < 7.61.0.
    252 # define CURLAUTH_BEARER CURLAUTH_ANY
    253 #endif
    254 
    @@ -897,6 +897,10 @@ Protected Attributes
    225  set_useragent(useragent);
    226  }
    227 }
    +
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    +
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    +
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    +
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    @@ -976,15 +980,9 @@ Protected Attributes
  • src/curl_wrapper.cpp
  • -
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    -
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    -
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    -
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    diff --git a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.map b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.map index 9964216..b512a78 100644 --- a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.map +++ b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.map @@ -1,4 +1,4 @@ - - + + diff --git a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.md5 b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.md5 index 0e1a091..302ab69 100644 --- a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.md5 +++ b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.md5 @@ -1 +1 @@ -74da8499ad512429f659687634c6bdba \ No newline at end of file +d679e886765e375ea66b1de60e891a4b \ No newline at end of file diff --git a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.png b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.png index 8f5e578..450da5e 100644 Binary files a/docs/classmastodonpp_1_1CURLWrapper__coll__graph.png and b/docs/classmastodonpp_1_1CURLWrapper__coll__graph.png differ diff --git a/docs/classmastodonpp_1_1Connection-members.html b/docs/classmastodonpp_1_1Connection-members.html index 1cd29b9..75aa1e2 100644 --- a/docs/classmastodonpp_1_1Connection-members.html +++ b/docs/classmastodonpp_1_1Connection-members.html @@ -3,7 +3,7 @@ - +mastodonpp: Member List @@ -31,10 +31,10 @@
    - + @@ -113,9 +113,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1Connection.html b/docs/classmastodonpp_1_1Connection.html index 3f50495..8ca3ea5 100644 --- a/docs/classmastodonpp_1_1Connection.html +++ b/docs/classmastodonpp_1_1Connection.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::Connection Class Reference @@ -31,10 +31,10 @@ - + @@ -82,8 +82,8 @@ $(function() {
    Inheritance diagram for mastodonpp::Connection:
    -
    Inheritance graph
    - +
    Inheritance graph
    + @@ -91,11 +91,11 @@ Inheritance diagram for mastodonpp::Connection:
    Collaboration diagram for mastodonpp::Connection:
    -
    Collaboration graph
    - - - - +
    Collaboration graph
    + + + +
    [legend]
    @@ -261,6 +261,7 @@ Additional Inherited Members
    91  {
    92  _instance.copy_connection_properties(*this);
    93  }
    +
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    @@ -378,6 +379,7 @@ Additional Inherited Members
    281  {
    282  CURLWrapper::cancel_stream();
    283  }
    +
    void cancel_stream()
    Cancel the stream.
    Definition: curl_wrapper.hpp:209
    @@ -416,6 +418,7 @@ Additional Inherited Members
    255  {
    256  return del(endpoint, {});
    257  }
    +
    answer_type del(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP DELETE call with parameters.
    Definition: connection.cpp:62
    @@ -458,6 +461,7 @@ Additional Inherited Members
    65  return make_request(http_method::DELETE, endpoint_to_uri(endpoint),
    66  parameters);
    67 }
    +
    mastodonpp::CURLWrapper::make_request
    answer_type make_request(const http_method &method, string uri, const parametermap &parameters)
    Make a HTTP request.
    Definition: curl_wrapper.cpp:80
    @@ -497,6 +501,7 @@ Additional Inherited Members
    148  {
    149  return get(endpoint, {});
    150  }
    +
    answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP GET call with parameters.
    Definition: connection.cpp:34
    @@ -593,6 +598,8 @@ Additional Inherited Members
    106  _buffer_mutex.unlock();
    107  return events;
    108 }
    +
    mastodonpp::CURLWrapper::get_buffer
    string & get_buffer()
    Returns a reference to the buffer libcurl writes into.
    Definition: curl_wrapper.hpp:195
    +
    mastodonpp::CURLWrapper::_buffer_mutex
    mutex _buffer_mutex
    Mutex for get_buffer a.k.a. _curl_buffer_body.
    Definition: curl_wrapper.hpp:175
    @@ -717,6 +724,7 @@ Additional Inherited Members
    207  {
    208  return patch(endpoint, {});
    209  }
    +
    answer_type patch(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PATCH call with parameters.
    Definition: connection.cpp:48
    @@ -797,6 +805,7 @@ Additional Inherited Members
    183  {
    184  return post(endpoint, {});
    185  }
    +
    answer_type post(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP POST call with parameters.
    Definition: connection.cpp:41
    @@ -884,6 +893,7 @@ Additional Inherited Members
    231  {
    232  return put(endpoint, {});
    233  }
    +
    answer_type put(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PUT call with parameters.
    Definition: connection.cpp:55
    @@ -934,21 +944,9 @@ Additional Inherited Members
  • src/connection.cpp
  • -
    mastodonpp::Connection::get
    answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP GET call with parameters.
    Definition: connection.cpp:34
    -
    mastodonpp::CURLWrapper::_buffer_mutex
    mutex _buffer_mutex
    Mutex for get_buffer a.k.a. _curl_buffer_body.
    Definition: curl_wrapper.hpp:175
    -
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    -
    mastodonpp::Connection::put
    answer_type put(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PUT call with parameters.
    Definition: connection.cpp:55
    -
    mastodonpp::CURLWrapper::get_buffer
    string & get_buffer()
    Returns a reference to the buffer libcurl writes into.
    Definition: curl_wrapper.hpp:195
    -
    mastodonpp::Connection::del
    answer_type del(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP DELETE call with parameters.
    Definition: connection.cpp:62
    -
    mastodonpp::Connection::patch
    answer_type patch(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PATCH call with parameters.
    Definition: connection.cpp:48
    -
    mastodonpp::Connection::post
    answer_type post(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP POST call with parameters.
    Definition: connection.cpp:41
    -
    mastodonpp::CURLWrapper::make_request
    answer_type make_request(const http_method &method, string uri, const parametermap &parameters)
    Make a HTTP request.
    Definition: curl_wrapper.cpp:80
    -
    mastodonpp::CURLWrapper::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: curl_wrapper.hpp:209
    diff --git a/docs/classmastodonpp_1_1Connection__coll__graph.map b/docs/classmastodonpp_1_1Connection__coll__graph.map index b9c4223..5a538da 100644 --- a/docs/classmastodonpp_1_1Connection__coll__graph.map +++ b/docs/classmastodonpp_1_1Connection__coll__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/docs/classmastodonpp_1_1Connection__coll__graph.md5 b/docs/classmastodonpp_1_1Connection__coll__graph.md5 index c0bb852..990f974 100644 --- a/docs/classmastodonpp_1_1Connection__coll__graph.md5 +++ b/docs/classmastodonpp_1_1Connection__coll__graph.md5 @@ -1 +1 @@ -3413bde6f691b0d72a0bb8cd434f4b20 \ No newline at end of file +84b275bd8fad382f79b305e8ea98e48f \ No newline at end of file diff --git a/docs/classmastodonpp_1_1Connection__coll__graph.png b/docs/classmastodonpp_1_1Connection__coll__graph.png index 6edfdef..d414a11 100644 Binary files a/docs/classmastodonpp_1_1Connection__coll__graph.png and b/docs/classmastodonpp_1_1Connection__coll__graph.png differ diff --git a/docs/classmastodonpp_1_1Instance-members.html b/docs/classmastodonpp_1_1Instance-members.html index 48c9293..86c194d 100644 --- a/docs/classmastodonpp_1_1Instance-members.html +++ b/docs/classmastodonpp_1_1Instance-members.html @@ -3,7 +3,7 @@ - +mastodonpp: Member List @@ -31,10 +31,10 @@
    - + @@ -108,9 +108,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1Instance.html b/docs/classmastodonpp_1_1Instance.html index fbc9336..d448da4 100644 --- a/docs/classmastodonpp_1_1Instance.html +++ b/docs/classmastodonpp_1_1Instance.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::Instance Class Reference @@ -31,10 +31,10 @@ - + @@ -83,8 +83,8 @@ $(function() {
    Inheritance diagram for mastodonpp::Instance:
    -
    Inheritance graph
    - +
    Inheritance graph
    + @@ -92,11 +92,11 @@ Inheritance diagram for mastodonpp::Instance:
    Collaboration diagram for mastodonpp::Instance:
    -
    Collaboration graph
    - - - - +
    Collaboration graph
    + + + +
    [legend]
    @@ -641,6 +641,7 @@ Additional Inherited Members
    138  _access_token = access_token;
    139  CURLWrapper::set_access_token(access_token);
    140  }
    +
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    @@ -677,6 +678,7 @@ Additional Inherited Members
    200  _cainfo = path;
    201  CURLWrapper::set_cainfo(path);
    202  }
    +
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    @@ -720,6 +722,7 @@ Additional Inherited Members
    162  _proxy = proxy;
    163  CURLWrapper::set_proxy(proxy);
    164  }
    +
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    @@ -756,6 +759,7 @@ Additional Inherited Members
    214  _useragent = useragent;
    215  CURLWrapper::set_useragent(useragent);
    216  }
    +
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    @@ -763,15 +767,9 @@ Additional Inherited Members
  • include/instance.hpp
  • -
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    -
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    -
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    -
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    diff --git a/docs/classmastodonpp_1_1Instance_1_1ObtainToken-members.html b/docs/classmastodonpp_1_1Instance_1_1ObtainToken-members.html index 2030eac..b98274b 100644 --- a/docs/classmastodonpp_1_1Instance_1_1ObtainToken-members.html +++ b/docs/classmastodonpp_1_1Instance_1_1ObtainToken-members.html @@ -3,7 +3,7 @@ - +mastodonpp: Member List @@ -31,10 +31,10 @@
    - + @@ -98,9 +98,7 @@ $(function() { diff --git a/docs/classmastodonpp_1_1Instance_1_1ObtainToken.html b/docs/classmastodonpp_1_1Instance_1_1ObtainToken.html index 5741acc..2cf9e7a 100644 --- a/docs/classmastodonpp_1_1Instance_1_1ObtainToken.html +++ b/docs/classmastodonpp_1_1Instance_1_1ObtainToken.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp::Instance::ObtainToken Class Reference @@ -31,10 +31,10 @@ - + @@ -82,8 +82,8 @@ $(function() {
    Inheritance diagram for mastodonpp::Instance::ObtainToken:
    -
    Inheritance graph
    - +
    Inheritance graph
    + @@ -91,11 +91,11 @@ Inheritance diagram for mastodonpp::Instance::ObtainToken:
    Collaboration diagram for mastodonpp::Instance::ObtainToken:
    -
    Collaboration graph
    - - - - +
    Collaboration graph
    + + + +
    [legend]
    @@ -193,6 +193,8 @@ Additional Inherited Members
    std::cout << "Success!\n";
    }
    }
    +
    mastodonpp::Instance::ObtainToken
    Simplifies obtaining an OAuth 2.0 Bearer Access Token.
    Definition: instance.hpp:249
    +
    mastodonpp::Instance
    Holds the access data of an instance.
    Definition: instance.hpp:49
    Since
    0.3.0

    Constructor & Destructor Documentation

    @@ -226,6 +228,7 @@ Additional Inherited Members
    259  {
    260  _instance.copy_connection_properties(*this);
    261  }
    +
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    @@ -312,14 +315,9 @@ Additional Inherited Members
  • include/instance.hpp
  • -
    mastodonpp::Instance::ObtainToken
    Simplifies obtaining an OAuth 2.0 Bearer Access Token.
    Definition: instance.hpp:248
    -
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    -
    mastodonpp::Instance
    Holds the access data of an instance.
    Definition: instance.hpp:48
    diff --git a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.map b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.map index 958d604..5e04fa9 100644 --- a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.map +++ b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.md5 b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.md5 index f3f0895..f4086de 100644 --- a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.md5 +++ b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.md5 @@ -1 +1 @@ -696cf3156559ddcbf9d5c4069eb5d1f3 \ No newline at end of file +dda5415c4036a2d04dbbe2b8fe2eef3e \ No newline at end of file diff --git a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.png b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.png index 735515c..02cd2b3 100644 Binary files a/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.png and b/docs/classmastodonpp_1_1Instance_1_1ObtainToken__coll__graph.png differ diff --git a/docs/classmastodonpp_1_1Instance__coll__graph.map b/docs/classmastodonpp_1_1Instance__coll__graph.map index fe52c29..7dbc336 100644 --- a/docs/classmastodonpp_1_1Instance__coll__graph.map +++ b/docs/classmastodonpp_1_1Instance__coll__graph.map @@ -1,5 +1,5 @@ - - - + + + diff --git a/docs/classmastodonpp_1_1Instance__coll__graph.md5 b/docs/classmastodonpp_1_1Instance__coll__graph.md5 index 3926d15..2c4340d 100644 --- a/docs/classmastodonpp_1_1Instance__coll__graph.md5 +++ b/docs/classmastodonpp_1_1Instance__coll__graph.md5 @@ -1 +1 @@ -99560aa00861efc418109099442105cc \ No newline at end of file +7cce97d6ee5f0591bb64e3cb7f1e5f8a \ No newline at end of file diff --git a/docs/classmastodonpp_1_1Instance__coll__graph.png b/docs/classmastodonpp_1_1Instance__coll__graph.png index ec1e193..f9a56d9 100644 Binary files a/docs/classmastodonpp_1_1Instance__coll__graph.png and b/docs/classmastodonpp_1_1Instance__coll__graph.png differ diff --git a/docs/connection_8hpp_source.html b/docs/connection_8hpp_source.html index 32409c5..791c1cd 100644 --- a/docs/connection_8hpp_source.html +++ b/docs/connection_8hpp_source.html @@ -3,7 +3,7 @@ - +mastodonpp: include/connection.hpp Source File @@ -31,10 +31,10 @@
    - + @@ -122,22 +122,22 @@ $(function() {
    80 public:
    88  explicit Connection(const Instance &instance)
    89  : _instance{instance}
    -
    90  , _baseuri{instance.get_baseuri()}
    +
    90  , _baseuri{instance.get_baseuri()}
    91  {
    92  _instance.copy_connection_properties(*this);
    93  }
    94 
    -
    100  Connection(const Connection &other) = default;
    +
    100  Connection(const Connection &other) = default;
    101 
    -
    103  Connection(Connection &&other) noexcept = delete;
    +
    103  Connection(Connection &&other) noexcept = delete;
    104 
    -
    106  ~Connection() noexcept override = default;
    +
    106  ~Connection() noexcept override = default;
    107 
    -
    109  Connection &operator=(const Connection &other) = delete;
    +
    109  Connection &operator=(const Connection &other) = delete;
    110 
    -
    112  Connection &operator=(Connection &&other) noexcept = delete;
    +
    112  Connection &operator=(Connection &&other) noexcept = delete;
    113 
    -
    132  [[nodiscard]] answer_type get(const endpoint_variant &endpoint,
    +
    132  [[nodiscard]] answer_type get(const endpoint_variant &endpoint,
    133  const parametermap &parameters);
    134 
    147  [[nodiscard]] inline answer_type get(const endpoint_variant &endpoint)
    @@ -196,40 +196,39 @@ $(function() {
    292 
    293 } // namespace mastodonpp
    294 
    -
    295 #endif // MASTODONPP_CONNECTION_HPP
    - -
    mastodonpp::Connection::get
    answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP GET call with parameters.
    Definition: connection.cpp:34
    -
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    -
    mastodonpp::Connection::Connection
    Connection(const Instance &instance)
    Construct a new Connection object.
    Definition: connection.hpp:88
    -
    mastodonpp::event_type::type
    string type
    The type of the event.
    Definition: connection.hpp:62
    -
    mastodonpp::Connection::post
    answer_type post(const endpoint_variant &endpoint)
    Make a HTTP POST call.
    Definition: connection.hpp:182
    -
    mastodonpp::parametermap
    map< string_view, variant< string_view, vector< string_view > >> parametermap
    std::map of parameters for API calls.
    Definition: types.hpp:64
    -
    mastodonpp::Connection::put
    answer_type put(const endpoint_variant &endpoint)
    Make a HTTP PUT call.
    Definition: connection.hpp:230
    -
    mastodonpp::event_type::data
    string data
    The payload.
    Definition: connection.hpp:65
    -
    mastodonpp::Instance::get_baseuri
    string_view get_baseuri() const noexcept
    Returns the base URI.
    Definition: instance.hpp:113
    -
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:24
    -
    mastodonpp::Connection::patch
    answer_type patch(const endpoint_variant &endpoint)
    Make a HTTP PATCH call.
    Definition: connection.hpp:206
    -
    mastodonpp::Connection::put
    answer_type put(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PUT call with parameters.
    Definition: connection.cpp:55
    -
    mastodonpp::Connection::get_new_events
    vector< event_type > get_new_events()
    Get new stream events.
    Definition: connection.cpp:79
    -
    mastodonpp::Connection::~Connection
    ~Connection() noexcept override=default
    Destructor.
    -
    mastodonpp::Connection::del
    answer_type del(const endpoint_variant &endpoint)
    Make a HTTP DELETE call.
    Definition: connection.hpp:254
    -
    mastodonpp::Connection::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: connection.hpp:280
    -
    mastodonpp::Connection::del
    answer_type del(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP DELETE call with parameters.
    Definition: connection.cpp:62
    -
    mastodonpp::event_type
    A stream event.
    Definition: connection.hpp:52
    -
    mastodonpp::answer_type
    Return type for Requests.
    Definition: types.hpp:79
    -
    mastodonpp::Connection::patch
    answer_type patch(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PATCH call with parameters.
    Definition: connection.cpp:48
    -
    mastodonpp::Instance
    Holds the access data of an instance.
    Definition: instance.hpp:48
    -
    mastodonpp::Connection::post
    answer_type post(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP POST call with parameters.
    Definition: connection.cpp:41
    -
    mastodonpp::Connection
    Represents a connection to an instance. Used for requests.
    Definition: connection.hpp:78
    -
    mastodonpp::CURLWrapper
    Handles the details of network connections.
    Definition: curl_wrapper.hpp:57
    -
    mastodonpp::endpoint_variant
    variant< API::endpoint_type, string_view > endpoint_variant
    An endpoint. Either API::endpoint_type or std::string_view.
    Definition: connection.hpp:43
    -
    mastodonpp::Connection::get_new_stream_contents
    string get_new_stream_contents()
    Copy new stream contents and delete the “original”.
    Definition: connection.cpp:69
    +
    295 #endif // MASTODONPP_CONNECTION_HPP
    +
    mastodonpp::CURLWrapper
    Handles the details of network connections.
    Definition: curl_wrapper.hpp:58
    mastodonpp::CURLWrapper::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: curl_wrapper.hpp:209
    +
    mastodonpp::Connection
    Represents a connection to an instance. Used for requests.
    Definition: connection.hpp:79
    +
    mastodonpp::Connection::get_new_stream_contents
    string get_new_stream_contents()
    Copy new stream contents and delete the “original”.
    Definition: connection.cpp:69
    +
    mastodonpp::Connection::del
    answer_type del(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP DELETE call with parameters.
    Definition: connection.cpp:62
    +
    mastodonpp::Connection::patch
    answer_type patch(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PATCH call with parameters.
    Definition: connection.cpp:48
    +
    mastodonpp::Connection::del
    answer_type del(const endpoint_variant &endpoint)
    Make a HTTP DELETE call.
    Definition: connection.hpp:254
    +
    mastodonpp::Connection::~Connection
    ~Connection() noexcept override=default
    Destructor.
    +
    mastodonpp::Connection::patch
    answer_type patch(const endpoint_variant &endpoint)
    Make a HTTP PATCH call.
    Definition: connection.hpp:206
    +
    mastodonpp::Connection::get_new_events
    vector< event_type > get_new_events()
    Get new stream events.
    Definition: connection.cpp:79
    +
    mastodonpp::Connection::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: connection.hpp:280
    +
    mastodonpp::Connection::Connection
    Connection(const Connection &other)=default
    Copy constructor. A new CURLWrapper is constructed.
    +
    mastodonpp::Connection::put
    answer_type put(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP PUT call with parameters.
    Definition: connection.cpp:55
    +
    mastodonpp::Connection::put
    answer_type put(const endpoint_variant &endpoint)
    Make a HTTP PUT call.
    Definition: connection.hpp:230
    +
    mastodonpp::Connection::post
    answer_type post(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP POST call with parameters.
    Definition: connection.cpp:41
    +
    mastodonpp::Connection::get
    answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP GET call with parameters.
    Definition: connection.cpp:34
    +
    mastodonpp::Connection::Connection
    Connection(const Instance &instance)
    Construct a new Connection object.
    Definition: connection.hpp:88
    +
    mastodonpp::Connection::Connection
    Connection(Connection &&other) noexcept=delete
    Move constructor.
    +
    mastodonpp::Connection::post
    answer_type post(const endpoint_variant &endpoint)
    Make a HTTP POST call.
    Definition: connection.hpp:182
    +
    mastodonpp::Instance
    Holds the access data of an instance.
    Definition: instance.hpp:49
    +
    mastodonpp::Instance::copy_connection_properties
    void copy_connection_properties(CURLWrapper &curlwrapper) const
    Set the properties of the connection of the calling class up.
    Definition: instance.hpp:90
    +
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    mastodonpp::endpoint_variant
    variant< API::endpoint_type, string_view > endpoint_variant
    An endpoint. Either API::endpoint_type or std::string_view.
    Definition: connection.hpp:43
    +
    mastodonpp::parametermap
    map< string_view, variant< string_view, vector< string_view > >> parametermap
    std::map of parameters for API calls.
    Definition: types.hpp:64
    +
    mastodonpp::answer_type
    Return type for Requests.
    Definition: types.hpp:80
    +
    mastodonpp::event_type
    A stream event.
    Definition: connection.hpp:53
    +
    mastodonpp::event_type::type
    string type
    The type of the event.
    Definition: connection.hpp:62
    +
    mastodonpp::event_type::data
    string data
    The payload.
    Definition: connection.hpp:65
    + diff --git a/docs/curl__wrapper_8hpp_source.html b/docs/curl__wrapper_8hpp_source.html index f8f1989..85c4d0e 100644 --- a/docs/curl__wrapper_8hpp_source.html +++ b/docs/curl__wrapper_8hpp_source.html @@ -3,7 +3,7 @@ - + mastodonpp: include/curl_wrapper.hpp Source File @@ -31,10 +31,10 @@ - + @@ -120,15 +120,15 @@ $(function() {
    71 
    77  CURLWrapper(const CURLWrapper &);
    78 
    -
    80  CURLWrapper(CURLWrapper &&other) noexcept = delete;
    +
    80  CURLWrapper(CURLWrapper &&other) noexcept = delete;
    81 
    91  virtual ~CURLWrapper() noexcept;
    92 
    -
    94  CURLWrapper &operator=(const CURLWrapper &other) = delete;
    +
    94  CURLWrapper &operator=(const CURLWrapper &other) = delete;
    95 
    -
    97  CURLWrapper &operator=(CURLWrapper &&other) noexcept = delete;
    +
    97  CURLWrapper &operator=(CURLWrapper &&other) noexcept = delete;
    98 
    -
    108  inline CURL *get_curl_easy_handle()
    +
    108  inline CURL *get_curl_easy_handle()
    109  {
    110  return _connection;
    111  }
    @@ -233,34 +233,32 @@ $(function() {
    371 
    372 } // namespace mastodonpp
    373 
    -
    374 #endif // MASTODONPP_CURL_WRAPPER_HPP
    - -
    mastodonpp::http_method
    http_method
    The HTTP method.
    Definition: curl_wrapper.hpp:39
    -
    mastodonpp::CURLWrapper::_buffer_mutex
    mutex _buffer_mutex
    Mutex for get_buffer a.k.a. _curl_buffer_body.
    Definition: curl_wrapper.hpp:175
    -
    mastodonpp::CURLWrapper::CURLWrapper
    CURLWrapper()
    Initializes curl and sets up connection.
    Definition: curl_wrapper.cpp:58
    -
    mastodonpp::CURLWrapper::get_curl_easy_handle
    CURL * get_curl_easy_handle()
    Returns pointer to the CURL easy handle.
    Definition: curl_wrapper.hpp:108
    -
    mastodonpp::parametermap
    map< string_view, variant< string_view, vector< string_view > >> parametermap
    std::map of parameters for API calls.
    Definition: types.hpp:64
    -
    mastodonpp::CURLWrapper::unescape_url
    string unescape_url(const string_view url) const
    URL decodes the given string.
    Definition: curl_wrapper.hpp:146
    -
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:24
    -
    mastodonpp::CURLWrapper::get_buffer
    string & get_buffer()
    Returns a reference to the buffer libcurl writes into.
    Definition: curl_wrapper.hpp:195
    -
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    -
    mastodonpp::answer_type
    Return type for Requests.
    Definition: types.hpp:79
    -
    mastodonpp::parameterpair
    pair< string_view, variant< string_view, vector< string_view > >> parameterpair
    A single parameter of a parametermap.
    Definition: types.hpp:72
    -
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    -
    mastodonpp::CURLWrapper::operator=
    CURLWrapper & operator=(const CURLWrapper &other)=delete
    Copy assignment operator.
    -
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    -
    mastodonpp::CURLWrapper
    Handles the details of network connections.
    Definition: curl_wrapper.hpp:57
    -
    mastodonpp::CURLWrapper::make_request
    answer_type make_request(const http_method &method, string uri, const parametermap &parameters)
    Make a HTTP request.
    Definition: curl_wrapper.cpp:80
    -
    mastodonpp::CURLWrapper::~CURLWrapper
    virtual ~CURLWrapper() noexcept
    Cleans up curl and connection.
    Definition: curl_wrapper.cpp:68
    -
    mastodonpp::CURLWrapper::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: curl_wrapper.hpp:209
    -
    mastodonpp::CURLWrapper::escape_url
    string escape_url(const string_view url) const
    URL encodes the given string.
    Definition: curl_wrapper.hpp:125
    -
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    +
    374 #endif // MASTODONPP_CURL_WRAPPER_HPP
    +
    mastodonpp::CURLWrapper
    Handles the details of network connections.
    Definition: curl_wrapper.hpp:58
    mastodonpp::CURLWrapper::setup_connection_properties
    void setup_connection_properties(string_view proxy, string_view access_token, string_view cainfo, string_view useragent)
    Set some properties of the connection.
    Definition: curl_wrapper.cpp:203
    +
    mastodonpp::CURLWrapper::get_buffer
    string & get_buffer()
    Returns a reference to the buffer libcurl writes into.
    Definition: curl_wrapper.hpp:195
    +
    mastodonpp::CURLWrapper::escape_url
    string escape_url(const string_view url) const
    URL encodes the given string.
    Definition: curl_wrapper.hpp:125
    +
    mastodonpp::CURLWrapper::set_proxy
    virtual void set_proxy(string_view proxy)
    Set the proxy to use.
    Definition: curl_wrapper.cpp:229
    +
    mastodonpp::CURLWrapper::get_curl_easy_handle
    CURL * get_curl_easy_handle()
    Returns pointer to the CURL easy handle.
    Definition: curl_wrapper.hpp:108
    +
    mastodonpp::CURLWrapper::~CURLWrapper
    virtual ~CURLWrapper() noexcept
    Cleans up curl and connection.
    Definition: curl_wrapper.cpp:68
    +
    mastodonpp::CURLWrapper::CURLWrapper
    CURLWrapper(CURLWrapper &&other) noexcept=delete
    Move constructor.
    +
    mastodonpp::CURLWrapper::CURLWrapper
    CURLWrapper()
    Initializes curl and sets up connection.
    Definition: curl_wrapper.cpp:58
    +
    mastodonpp::CURLWrapper::cancel_stream
    void cancel_stream()
    Cancel the stream.
    Definition: curl_wrapper.hpp:209
    +
    mastodonpp::CURLWrapper::set_access_token
    void set_access_token(string_view access_token)
    Set OAuth 2.0 Bearer Access Token.
    Definition: curl_wrapper.cpp:240
    +
    mastodonpp::CURLWrapper::make_request
    answer_type make_request(const http_method &method, string uri, const parametermap &parameters)
    Make a HTTP request.
    Definition: curl_wrapper.cpp:80
    +
    mastodonpp::CURLWrapper::set_useragent
    virtual void set_useragent(string_view useragent)
    Sets the User-Agent.
    Definition: curl_wrapper.cpp:276
    +
    mastodonpp::CURLWrapper::unescape_url
    string unescape_url(const string_view url) const
    URL decodes the given string.
    Definition: curl_wrapper.hpp:146
    +
    mastodonpp::CURLWrapper::set_cainfo
    virtual void set_cainfo(string_view path)
    Set path to Certificate Authority (CA) bundle.
    Definition: curl_wrapper.cpp:266
    +
    mastodonpp::CURLWrapper::_buffer_mutex
    mutex _buffer_mutex
    Mutex for get_buffer a.k.a. _curl_buffer_body.
    Definition: curl_wrapper.hpp:175
    +
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    mastodonpp::parameterpair
    pair< string_view, variant< string_view, vector< string_view > >> parameterpair
    A single parameter of a parametermap.
    Definition: types.hpp:72
    +
    mastodonpp::http_method
    http_method
    The HTTP method.
    Definition: curl_wrapper.hpp:40
    +
    mastodonpp::parametermap
    map< string_view, variant< string_view, vector< string_view > >> parametermap
    std::map of parameters for API calls.
    Definition: types.hpp:64
    +
    mastodonpp::answer_type
    Return type for Requests.
    Definition: types.hpp:80
    + diff --git a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html index 983fd12..db4f613 100644 --- a/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -3,7 +3,7 @@ - + mastodonpp: src Directory Reference @@ -31,10 +31,10 @@ - + @@ -74,9 +74,7 @@ $(function() { diff --git a/docs/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/dir_d44c64559bbebec7f509842c48db8b23.html index b077267..5fc075d 100644 --- a/docs/dir_d44c64559bbebec7f509842c48db8b23.html +++ b/docs/dir_d44c64559bbebec7f509842c48db8b23.html @@ -3,7 +3,7 @@ - + mastodonpp: include Directory Reference @@ -31,10 +31,10 @@ - + @@ -74,9 +74,7 @@ $(function() { diff --git a/docs/doxygen.css b/docs/doxygen.css index 73ecbb2..ffbff02 100644 --- a/docs/doxygen.css +++ b/docs/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.17 */ +/* The standard CSS for doxygen 1.9.1 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -66,7 +66,7 @@ p.startli, p.startdd { margin-top: 2px; } -th p.starttd, p.intertd, p.endtd { +th p.starttd, th p.intertd, th p.endtd { font-size: 100%; font-weight: 700; } @@ -103,30 +103,96 @@ caption { } span.legend { - font-size: 70%; - text-align: center; -} - -h3.version { - font-size: 90%; - text-align: center; -} - -div.qindex, div.navtab{ - background-color: #EBEFF6; - border: 1px solid #A3B4D7; + font-size: 70%; text-align: center; } -div.qindex, div.navpath { - width: 100%; - line-height: 140%; +h3.version { + font-size: 90%; + text-align: center; } div.navtab { - margin-right: 15px; + border-right: 1px solid #A3B4D7; + padding-right: 15px; + text-align: right; + line-height: 110%; } +div.navtab table { + border-spacing: 0; +} + +td.navtab { + padding-right: 6px; + padding-left: 6px; +} +td.navtabHL { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL a, td.navtabHL a:visited { + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +a.navtab { + font-weight: bold; +} + +div.qindex{ + text-align: center; + width: 100%; + line-height: 140%; + font-size: 130%; + color: #A0A0A0; +} + +dt.alphachar{ + font-size: 180%; + font-weight: bold; +} + +.alphachar a{ + color: black; +} + +.alphachar a:hover, .alphachar a:visited{ + text-decoration: none; +} + +.classindex dl { + padding: 25px; + column-count:1 +} + +.classindex dd { + display:inline-block; + margin-left: 50px; + width: 90%; + line-height: 1.15em; +} + +.classindex dl.odd { + background-color: #F8F9FC; +} + +@media(min-width: 1120px) { + .classindex dl { + column-count:2 + } +} + +@media(min-width: 1320px) { + .classindex dl { + column-count:3 + } +} + + /* @group Link Styling */ a { @@ -143,17 +209,6 @@ a:hover { text-decoration: underline; } -a.qindex { - font-weight: bold; -} - -a.qindexHL { - font-weight: bold; - background-color: #9CAFD4; - color: #FFFFFF; - border: 1px double #869DCA; -} - .contents a.qindexHL:visited { color: #FFFFFF; } @@ -1358,10 +1413,12 @@ dl.citelist dt { font-weight:bold; margin-right:10px; padding:5px; + text-align:right; + width:52px; } dl.citelist dd { - margin:2px 0; + margin:2px 0 2px 72px; padding:5px 0; } @@ -1424,6 +1481,12 @@ div.toc li.level4 { margin-left: 45px; } +span.emoji { + /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html + * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; + */ +} + .PageDocRTL-title div.toc li.level1 { margin-left: 0 !important; margin-right: 0; @@ -1661,47 +1724,6 @@ tr.heading h2 { /* @group Markdown */ -/* -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.markdownTable td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -table.markdownTableHead tr { -} - -table.markdownTableBodyLeft td, table.markdownTable th { - border: 1px solid #2D4068; - padding: 3px 7px 2px; -} - -th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { - background-color: #374F7F; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -th.markdownTableHeadLeft { - text-align: left -} - -th.markdownTableHeadRight { - text-align: right -} - -th.markdownTableHeadCenter { - text-align: center -} -*/ - table.markdownTable { border-collapse:collapse; margin-top: 4px; diff --git a/docs/doxygen.svg b/docs/doxygen.svg new file mode 100644 index 0000000..d42dad5 --- /dev/null +++ b/docs/doxygen.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/dynsections.js b/docs/dynsections.js index ea0a7b3..3174bd7 100644 --- a/docs/dynsections.js +++ b/docs/dynsections.js @@ -1,25 +1,26 @@ /* - @licstart The following is the entire license notice for the - JavaScript code in this file. + @licstart The following is the entire license notice for the JavaScript code in this file. - Copyright (C) 1997-2017 by Dimitri van Heesch + The MIT License (MIT) - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + Copyright (C) 1997-2020 by Dimitri van Heesch - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. - @licend The above is the entire license notice - for the JavaScript code in this file + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file */ function toggleVisibility(linkObj) { diff --git a/docs/example01_instance_info_8cpp-example.html b/docs/example01_instance_info_8cpp-example.html index feb5c3e..25e39f9 100644 --- a/docs/example01_instance_info_8cpp-example.html +++ b/docs/example01_instance_info_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example01_instance_info.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,98 @@ $(function() {
    example01_instance_info.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Print information about an instance (/api/v1/instance).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 1)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance.
    +
    masto::Instance instance{args[1], {}};
    +
    +
    // Get maximum allowed characters per post.
    +
    const auto max_chars{instance.get_max_chars()};
    +
    cout << "Maximum characters per post: " << max_chars << "\n\n";
    +
    +
    // Initialize a Connection.
    +
    masto::Connection connection{instance};
    +
    +
    // Get information about the instance.
    +
    masto::answer_type answer{connection.get(masto::API::v1::instance)};
    +
    if (answer)
    +
    {
    +
    cout << answer << endl;
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example02_streaming_8cpp-example.html b/docs/example02_streaming_8cpp-example.html index 5d62f25..c88fba8 100644 --- a/docs/example02_streaming_8cpp-example.html +++ b/docs/example02_streaming_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example02_streaming.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,122 @@ $(function() {
    example02_streaming.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Print new public events (/api/v1/streaming/public).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <chrono>
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <thread>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using namespace std::chrono_literals;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::thread;
    +
    using std::to_string;
    +
    using std::vector;
    +
    using std::this_thread::sleep_for;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 1)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance.
    +
    masto::Instance instance{args[1], {}};
    +
    +
    // Initialize a Connection.
    +
    masto::Connection connection{instance};
    +
    +
    // Find out if the streaming service is fine.
    +
    auto answer{connection.get(masto::API::v1::streaming_health)};
    +
    if (answer && answer.body == "OK")
    +
    {
    +
    // Make a thread, get all public events.
    +
    // clang-format off
    +
    thread stream_thread{[&]
    +
    {
    +
    // clang-format on
    +
    answer = connection.get(masto::API::v1::streaming_public);
    +
    }};
    +
    +
    // Print new events every 2 seconds, for 10 seconds.
    +
    for (auto counter{0}; counter < 5; ++counter)
    +
    {
    +
    sleep_for(2s);
    +
    for (const auto &event : connection.get_new_events())
    +
    {
    +
    // Print type of event and the beginning of the data.
    +
    cout << event.type << ": " << event.data.substr(0, 70)
    +
    << " …" << endl;
    +
    }
    +
    }
    +
    +
    // Cancel the stream, …
    +
    connection.cancel_stream();
    +
    // … and wait for the thread.
    +
    stream_thread.join();
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example03_post_status_8cpp-example.html b/docs/example03_post_status_8cpp-example.html index 4d002d4..6498731 100644 --- a/docs/example03_post_status_8cpp-example.html +++ b/docs/example03_post_status_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example03_post_status.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,101 @@ $(function() {
    example03_post_status.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Post a status (/api/v1/status).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 2)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname> <access token>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance and a Connection.
    +
    masto::Instance instance{args[1], args[2]};
    +
    masto::Connection connection{instance};
    +
    +
    // Set up the parameters.
    +
    constexpr auto poll_seconds{60 * 60 * 24 * 2}; // 2 days.
    +
    const masto::parametermap parameters{{"status", "How is the weather?"},
    +
    {"poll[options]",
    +
    vector<string_view>{"Nice",
    +
    "not nice"}},
    +
    {"poll[expires_in]",
    +
    to_string(poll_seconds)}};
    +
    +
    // Post the status.
    +
    auto answer{connection.post(masto::API::v1::statuses, parameters)};
    +
    if (answer)
    +
    {
    +
    cout << "Successfully posted a status.\n";
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example04_post_with_attachment_8cpp-example.html b/docs/example04_post_with_attachment_8cpp-example.html index b9ba47a..a171eb2 100644 --- a/docs/example04_post_with_attachment_8cpp-example.html +++ b/docs/example04_post_with_attachment_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example04_post_with_attachment.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,111 @@ $(function() {
    example04_post_with_attachment.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Post a status (/api/v1/status) with an attachment (/api/v1/media).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 3)
    +
    {
    +
    cerr << "Usage: " << args[0]
    +
    << " <instance hostname> <access token> <file>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance and a Connection.
    +
    masto::Instance instance{args[1], args[2]};
    +
    masto::Connection connection{instance};
    +
    const string_view filename{args[3]};
    +
    +
    // Create attachment.
    +
    auto answer{connection.post(masto::API::v1::media,
    +
    {{"file", string("@file:") += filename},
    +
    {"description", "Test."}})};
    +
    +
    // Get the ID of the attachment.
    +
    // You normally would use a JSON parser, of course. I don't use one
    +
    // because I don't want to add a dependency just for an example.
    +
    const auto pos{answer.body.find(R"("id":")") + 6};
    +
    const auto endpos{answer.body.find(R"(",)", pos)};
    +
    const auto media_id{answer.body.substr(pos, endpos - pos)};
    +
    cout << "Attachment has ID: " << media_id << endl;
    +
    +
    // Post the status. Note that “media_ids” always has to be a vector.
    +
    answer = connection.post(masto::API::v1::statuses,
    +
    {{"status", "Attachment test."},
    +
    {"media_ids",
    +
    vector<string_view>{media_id}}});
    +
    if (answer)
    +
    {
    +
    cout << "Successfully posted " << filename << ".\n";
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example05_update_notification_settings_8cpp-example.html b/docs/example05_update_notification_settings_8cpp-example.html index 2b7a84e..0ac722a 100644 --- a/docs/example05_update_notification_settings_8cpp-example.html +++ b/docs/example05_update_notification_settings_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example05_update_notification_settings.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,99 @@ $(function() {
    example05_update_notification_settings.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Update notification settings (/api/pleroma/notification_settings).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 2)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname> <access token>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance and a Connection.
    +
    masto::Instance instance{args[1], args[2]};
    +
    masto::Connection connection{instance};
    +
    +
    // Update the settings.
    +
    const auto answer{
    +
    connection.put(masto::API::pleroma::notification_settings,
    +
    {
    +
    {"followers", "true"},
    +
    {"follows", "true"},
    +
    {"remote", "true"},
    +
    {"local", "true"},
    +
    })};
    +
    if (answer)
    +
    {
    +
    cout << answer << endl;
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example06_update_name_8cpp-example.html b/docs/example06_update_name_8cpp-example.html index ce5d394..087b2fa 100644 --- a/docs/example06_update_name_8cpp-example.html +++ b/docs/example06_update_name_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example06_update_name.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,96 @@ $(function() {
    example06_update_name.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Update account display name settings (/api/v1/accounts/update_credentials).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 3)
    +
    {
    +
    cerr << "Usage: " << args[0]
    +
    << " <instance hostname> <access token> <name>\n";
    +
    return 1;
    +
    }
    +
    const auto name{args[3]};
    +
    +
    try
    +
    {
    +
    // Initialize an Instance and a Connection.
    +
    masto::Instance instance{args[1], args[2]};
    +
    masto::Connection connection{instance};
    +
    +
    // Update the settings.
    +
    const auto answer{
    +
    connection.patch(masto::API::v1::accounts_update_credentials,
    +
    {{"display_name", name}})};
    +
    if (answer)
    +
    {
    +
    cout << "Successfully changed display name.\n";
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example07_delete_status_8cpp-example.html b/docs/example07_delete_status_8cpp-example.html index ab2e5c5..15a0777 100644 --- a/docs/example07_delete_status_8cpp-example.html +++ b/docs/example07_delete_status_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example07_delete_status.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,113 @@ $(function() {
    example07_delete_status.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Post a status (/api/v1/status), then delete it (/api/v1/statuses/:id).
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <chrono>
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <thread>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using namespace std::chrono_literals;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    using std::this_thread::sleep_for;
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 2)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname> <access token>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize an Instance and a Connection.
    +
    masto::Instance instance{args[1], args[2]};
    +
    masto::Connection connection{instance};
    +
    +
    // Post a status.
    +
    auto answer{connection.post(masto::API::v1::statuses,
    +
    {{"status", "Delete me."}})};
    +
    if (answer)
    +
    {
    +
    cout << "Successfully posted a status.\n";
    +
    +
    // Get the ID of the post.
    +
    // You normally would use a JSON parser, of course. I don't use one
    +
    // because I don't want to add a dependency just for an example.
    +
    const auto pos{answer.body.rfind(R"("id":")") + 6};
    +
    const auto endpos{answer.body.find(R"(",)", pos)};
    +
    const auto id{answer.body.substr(pos, endpos - pos)};
    +
    cout << "Post has ID: " << id << endl;
    +
    cout << "Waiting 10 seconds…\n";
    +
    sleep_for(10s);
    +
    +
    answer = connection.del(masto::API::v1::statuses_id, {{"id", id}});
    +
    if (answer)
    +
    {
    +
    cout << "Successfully deleted the status.\n";
    +
    }
    +
    }
    +
    else
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code)
    +
    << ": " << answer.error_message << endl;
    +
    }
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example08_obtain_token_8cpp-example.html b/docs/example08_obtain_token_8cpp-example.html index 689899f..f9a0a34 100644 --- a/docs/example08_obtain_token_8cpp-example.html +++ b/docs/example08_obtain_token_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example08_obtain_token.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,128 @@ $(function() {
    example08_obtain_token.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Obtain an access token and verify that it works.
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    #include <cstdlib>
    +
    #include <iostream>
    +
    #include <string>
    +
    #include <string_view>
    +
    #include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using std::cerr;
    +
    using std::cin;
    +
    using std::cout;
    +
    using std::endl;
    +
    using std::exit;
    +
    using std::string;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    void handle_error(const masto::answer_type &answer);
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 1)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize Instance and Instance::ObtainToken.
    +
    masto::Instance instance{args[1], {}};
    +
    masto::Instance::ObtainToken token{instance};
    +
    +
    // Create an “Application” (/api/v1/apps),
    +
    // and get URI for the authorization code (/oauth/authorize).
    +
    // NOTE: Mastodon only needs read:accounts for verify_credentials but
    +
    // Pleroma needs the full read scope.
    +
    auto answer{token.step_1("Testclient", "read write:favourites",
    +
    "https://example.com/")};
    +
    if (!answer)
    +
    {
    +
    handle_error(answer);
    +
    }
    +
    +
    cout << "Please visit " << answer << "\nand paste the code here: ";
    +
    string code;
    +
    cin >> code;
    +
    +
    // Obtain the token (/oauth/token).
    +
    answer = token.step_2(code);
    +
    if (!answer)
    +
    {
    +
    handle_error(answer);
    +
    }
    +
    +
    cout << "Your access token is: " << answer << endl;
    +
    +
    // Test if the token works.
    +
    masto::Connection connection{instance};
    +
    answer = connection.get(masto::API::v1::apps_verify_credentials);
    +
    if (!answer)
    +
    {
    +
    handle_error(answer);
    +
    }
    +
    +
    cout << answer << endl;
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << endl;
    +
    }
    +
    +
    return 0;
    +
    }
    +
    +
    void handle_error(const masto::answer_type &answer)
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << endl;
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code) << ": "
    +
    << answer.error_message << endl;
    +
    }
    +
    +
    exit(1);
    +
    }
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/example09_nlohmann_json_8cpp-example.html b/docs/example09_nlohmann_json_8cpp-example.html index 0441e44..01c015a 100644 --- a/docs/example09_nlohmann_json_8cpp-example.html +++ b/docs/example09_nlohmann_json_8cpp-example.html @@ -3,7 +3,7 @@ - + mastodonpp: example09_nlohmann_json.cpp @@ -31,10 +31,10 @@ - + @@ -67,12 +67,156 @@ $(function() {
    example09_nlohmann_json.cpp
    -
    +
    /* This file is part of mastodonpp.
    +
    * Copyright © 2020 tastytea <tastytea@tastytea.de>
    +
    *
    +
    * Permission to use, copy, modify, and/or distribute this software for any
    +
    * purpose with or without fee is hereby granted.
    +
    *
    +
    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    +
    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    +
    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
    +
    * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    +
    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    +
    * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    +
    * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    +
    */
    +
    +
    // Get the last 4 public statuses of an instance and process them with
    +
    // nlohmann-json. <https://github.com/nlohmann/json>
    +
    +
    #if __has_include("mastodonpp.hpp")
    +
    # include "mastodonpp.hpp" // We're building mastodonpp.
    +
    #else
    +
    # include <mastodonpp/mastodonpp.hpp> // We're building outside mastodonpp.
    +
    #endif
    +
    +
    // Don't compile if nlohmann-json can't be found.
    +
    #if __has_include(<nlohmann/json.hpp>)
    +
    # include <nlohmann/json.hpp>
    +
    +
    # include <cstdlib>
    +
    # include <iostream>
    +
    # include <string>
    +
    # include <string_view>
    +
    # include <vector>
    +
    +
    namespace masto = mastodonpp;
    +
    using json = nlohmann::json;
    +
    using std::cerr;
    +
    using std::cout;
    +
    using std::exit;
    +
    using std::string_view;
    +
    using std::to_string;
    +
    using std::vector;
    +
    +
    void handle_error(const masto::answer_type &answer);
    +
    +
    int main(int argc, char *argv[])
    +
    {
    +
    const vector<string_view> args(argv, argv + argc);
    +
    if (args.size() <= 1)
    +
    {
    +
    cerr << "Usage: " << args[0] << " <instance hostname>\n";
    +
    return 1;
    +
    }
    +
    +
    try
    +
    {
    +
    // Initialize Instance and Connection.
    +
    masto::Instance instance{args[1], {}};
    +
    masto::Connection connection{instance};
    +
    +
    // Get the last 4 public statuses of the instance.
    +
    auto answer{connection.get(masto::API::v1::timelines_public,
    +
    {{"limit", "4"}, {"local", "true"}})};
    +
    if (answer)
    +
    {
    +
    // Parse JSON string.
    +
    auto statuses{json::parse(answer.body)};
    +
    for (const auto &status : statuses)
    +
    {
    +
    // Extract the info we want and print it.
    +
    const auto acct{status["account"]["acct"].get<string_view>()};
    +
    const auto content{status["content"].get<string_view>()};
    +
    const auto id{status["id"].get<string_view>()};
    +
    cout << acct << " wrote status " << id << ": \n";
    +
    cout << " " << content.substr(0, 76) << " …\n";
    +
    +
    // Print tags if there are any.
    +
    const auto tags{status["tags"]};
    +
    if (!tags.empty())
    +
    {
    +
    cout << " Tags: ";
    +
    for (const auto &tag : tags)
    +
    {
    +
    cout << '#' << tag["name"].get<string_view>() << " ";
    +
    }
    +
    cout << '\n';
    +
    }
    +
    +
    // Print the number of attachments.
    +
    const auto n_attachments{status["media_attachments"].size()};
    +
    if (n_attachments > 0)
    +
    {
    +
    cout << " " << n_attachments << " attachment";
    +
    if (n_attachments > 1)
    +
    {
    +
    cout << "s";
    +
    }
    +
    cout << ".\n";
    +
    }
    +
    }
    +
    }
    +
    else
    +
    {
    +
    handle_error(answer);
    +
    }
    +
    }
    +
    catch (const masto::CURLException &e)
    +
    {
    +
    // Only libcurl errors that are not network errors will be thrown.
    +
    // There went probably something wrong with the initialization.
    +
    cerr << e.what() << '\n';
    +
    }
    +
    catch (const nlohmann::detail::exception &e)
    +
    {
    +
    cerr << "JSON exception: " << e.what() << '\n';
    +
    }
    +
    }
    +
    +
    void handle_error(const masto::answer_type &answer)
    +
    {
    +
    if (answer.curl_error_code == 0)
    +
    {
    +
    // If it is no libcurl error, it must be an HTTP error.
    +
    cerr << "HTTP status: " << answer.http_status << '\n';
    +
    }
    +
    else
    +
    {
    +
    // Network errors like “Couldn't resolve host.”.
    +
    cerr << "libcurl error " << to_string(answer.curl_error_code) << ": "
    +
    << answer.error_message << '\n';
    +
    }
    +
    +
    exit(1);
    +
    }
    +
    +
    #else
    +
    +
    # include <iostream>
    +
    int main()
    +
    {
    +
    std::cout << "Example could not be compiled "
    +
    "because nlohmann-json was not found.\n";
    +
    }
    +
    +
    #endif // __has_include(<nlohmann/json.hpp>)
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    +
    diff --git a/docs/examples.html b/docs/examples.html index ec3eef8..15ca967 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -3,7 +3,7 @@ - + mastodonpp: Examples @@ -31,10 +31,10 @@ - + @@ -90,9 +90,7 @@ $(function() { diff --git a/docs/exceptions_8hpp_source.html b/docs/exceptions_8hpp_source.html index 3a8e0c1..c75a237 100644 --- a/docs/exceptions_8hpp_source.html +++ b/docs/exceptions_8hpp_source.html @@ -3,7 +3,7 @@ - + mastodonpp: include/exceptions.hpp Source File @@ -31,10 +31,10 @@ - + @@ -124,18 +124,16 @@ $(function() {
    86 
    87 } // namespace mastodonpp
    88 
    -
    89 #endif // MASTODONPP_EXCEPTIONS_HPP
    - +
    89 #endif // MASTODONPP_EXCEPTIONS_HPP
    +
    mastodonpp::CURLException
    Exception for libcurl errors.
    Definition: exceptions.hpp:41
    mastodonpp::CURLException::error_code
    const CURLcode error_code
    The error code returned by libcurl.
    Definition: exceptions.hpp:73
    -
    mastodonpp::CURLException
    Exception for libcurl errors.
    Definition: exceptions.hpp:40
    -
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:24
    mastodonpp::CURLException::what
    const char * what() const noexcept override
    Returns the error code, message and error buffer.
    Definition: exceptions.cpp:44
    mastodonpp::CURLException::CURLException
    CURLException(const CURLcode &error, string message)
    Constructor with error code and message.
    Definition: exceptions.cpp:27
    +
    mastodonpp
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    + diff --git a/docs/files.html b/docs/files.html index 2671c46..ace5c9f 100644 --- a/docs/files.html +++ b/docs/files.html @@ -3,7 +3,7 @@ - + mastodonpp: File List @@ -31,10 +31,10 @@ - + @@ -85,9 +85,7 @@ $(function() { diff --git a/docs/functions.html b/docs/functions.html index 6f50188..faf923c 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members @@ -31,10 +31,10 @@ - + @@ -92,7 +92,7 @@ $(function() { , mastodonpp::CURLWrapper
  • Connection() -: mastodonpp::Connection +: mastodonpp::Connection
  • copy_connection_properties() : mastodonpp::Instance @@ -114,7 +114,7 @@ $(function() { : mastodonpp::event_type
  • del() -: mastodonpp::Connection +: mastodonpp::Connection
  • @@ -224,7 +224,7 @@ $(function() {
  • operator=() : mastodonpp::Connection -, mastodonpp::CURLWrapper +, mastodonpp::CURLWrapper , mastodonpp::Instance
  • other @@ -247,7 +247,7 @@ $(function() { : mastodonpp::answer_type
  • put() -: mastodonpp::Connection +: mastodonpp::Connection
  • @@ -329,9 +329,7 @@ $(function() { diff --git a/docs/functions_enum.html b/docs/functions_enum.html index 8b7d514..4ae6f20 100644 --- a/docs/functions_enum.html +++ b/docs/functions_enum.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members - Enumerations @@ -31,10 +31,10 @@ - + @@ -83,9 +83,7 @@ $(function() { diff --git a/docs/functions_func.html b/docs/functions_func.html index 7b3cf99..ca6afa0 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members - Functions @@ -31,10 +31,10 @@ - + @@ -87,7 +87,7 @@ $(function() { : mastodonpp::CURLException
  • CURLWrapper() -: mastodonpp::CURLWrapper +: mastodonpp::CURLWrapper
  • @@ -179,8 +179,8 @@ $(function() {
  • operator=() : mastodonpp::Connection -, mastodonpp::CURLWrapper -, mastodonpp::Instance +, mastodonpp::CURLWrapper +, mastodonpp::Instance
  • @@ -190,7 +190,7 @@ $(function() { : mastodonpp::Connection
  • post() -: mastodonpp::Connection +: mastodonpp::Connection
  • prev() : mastodonpp::answer_type @@ -265,9 +265,7 @@ $(function() { diff --git a/docs/functions_rela.html b/docs/functions_rela.html index 80f2559..e4cf2c4 100644 --- a/docs/functions_rela.html +++ b/docs/functions_rela.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members - Related Functions @@ -31,10 +31,10 @@ - + @@ -71,9 +71,7 @@ $(function() { diff --git a/docs/functions_type.html b/docs/functions_type.html index 21f4184..fd4dabc 100644 --- a/docs/functions_type.html +++ b/docs/functions_type.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members - Typedefs @@ -31,10 +31,10 @@ - + @@ -71,9 +71,7 @@ $(function() { diff --git a/docs/functions_vars.html b/docs/functions_vars.html index f31d4d7..a0a1b94 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Members - Variables @@ -31,10 +31,10 @@ - + @@ -95,9 +95,7 @@ $(function() { diff --git a/docs/graph_legend.html b/docs/graph_legend.html index 09fbcb5..997746e 100644 --- a/docs/graph_legend.html +++ b/docs/graph_legend.html @@ -3,7 +3,7 @@ - + mastodonpp: Graph Legend @@ -31,10 +31,10 @@ - + @@ -130,9 +130,7 @@ A yellow dashed arrow denotes a relation between a template instance and the tem diff --git a/docs/helpers_8hpp_source.html b/docs/helpers_8hpp_source.html index e8a5ef5..193d3e3 100644 --- a/docs/helpers_8hpp_source.html +++ b/docs/helpers_8hpp_source.html @@ -3,7 +3,7 @@ - + mastodonpp: include/helpers.hpp Source File @@ -31,10 +31,10 @@ - + @@ -103,15 +103,13 @@ $(function() {
    46 
    47 } // namespace mastodonpp
    48 
    -
    49 #endif // MASTODONPP_HELPERS_HPP
    - +
    49 #endif // MASTODONPP_HELPERS_HPP
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25
    string unescape_html(string html)
    Replaces HTML entities with UTF-8 characters.
    Definition: helpers.cpp:39
    -
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:24
    + diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 6c57132..32bf2d2 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -3,7 +3,7 @@ - + mastodonpp: Class Hierarchy @@ -31,10 +31,10 @@ - + @@ -85,9 +85,7 @@ This inheritance list is sorted roughly, but not completely, alphabetically: diff --git a/docs/index.html b/docs/index.html index b71d52e..c2bfcb0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - + mastodonpp: mastodonpp Reference @@ -31,10 +31,10 @@ - + @@ -74,6 +74,7 @@ Using the library

    Use it in your CMake project like this:

    find_package(mastodonpp REQUIRED CONFIG)
    target_link_libraries(MyProject mastodonpp::mastodonpp)
    +
    C++ wrapper for the Mastodon API.
    Definition: api.hpp:25

    Or compile your code with g++ $(pkg-config --cflags --libs mastodonpp).

    Since we use C++17 features in the headers of this library, your program needs to be compiled as C++17 or higher too.

    @@ -95,6 +96,10 @@ Example

    std::cout << answer << std::endl;
    }
    }
    +
    Represents a connection to an instance. Used for requests.
    Definition: connection.hpp:79
    +
    answer_type get(const endpoint_variant &endpoint, const parametermap &parameters)
    Make a HTTP GET call with parameters.
    Definition: connection.cpp:34
    +
    Holds the access data of an instance.
    Definition: instance.hpp:49
    +
    uint64_t get_max_chars() noexcept
    Returns the maximum number of characters per post.

    Input