C++ wrapper for the Mastodon API.
This repository has been archived on 2020-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
tastytea 4f7e4583fd
Added compiling instructions
2018-01-13 16:32:43 +01:00
src fixed README; fixed debug output 2018-01-13 16:17:58 +01:00
.gitignore Parameter support, added documentation. 2018-01-13 01:41:30 +01:00
CMakeLists.txt Added compiling instructions 2018-01-13 16:32:43 +01:00
Doxyfile Parameter support, added documentation. 2018-01-13 01:41:30 +01:00
LICENSE initial commit 2018-01-09 12:36:05 +01:00
README.md Added compiling instructions 2018-01-13 16:32:43 +01:00
build.sh Parameter support, added documentation. 2018-01-13 01:41:30 +01:00
build_doc.sh Parameter support, added documentation. 2018-01-13 01:41:30 +01:00

README.md

mastodon-cpp is a C++ wrapper for the Mastodon API. The aim is to be as simple as possible. The library takes care of the network stuff. You submit a query and get the raw JSON. All versions below 1.0.0 (SOVERSION 0) are considered insecure, unstable and can change any time.

Install

Dependencies

  • Tested OS: Linux
  • C++ compiler (tested: gcc 6.4)
  • cmake (tested: 3.9.6)
  • boost (tested: 1.63.0)
  • Optional: doxygen (tested: 1.8.13)

Get sourcecode

Development version

git clone https://github.com/tastytea/mastodon-cpp.git

Compile

mkdir build
cd build/
cmake ..
make

If you want to compile a debug build, use cmake -DCMAKE_BUILD_TYPE=Debug .. instead.

Usage

The reference can be generated with build_doc.sh, if doxygen is installed. Or just look in src/mastodon-cpp.hpp. There is an example in src/example.

Compiling your project

After you did a make install, a project consisting of one file can be compiled as follows:

g++ -std=c++14 -lmastodon-cpp -lboost_system -lssl -lcrypto example.cpp

Error codes

Code Explanation
0 No error
1 Invalid call
2 Not implemented
16 Connection failed
17 TLS error
18 Invalid response from server
100 - 999 HTTP status codes
65535 Unknown exception

If you use a debug build, you get more verbose error messages.

TODO

  • Version 0.1.0
    • Implement all GET calls
    • Usable error handling
    • Network stuff
    • Comprehensive example
  • Version 0.2.0
    • Implement all PATCH calls
    • Implement all POST calls
    • Implement all DELETE calls
  • Version 0.3.0
    • Handle HTTP statuses 301 & 302
  • Later
    • Escape user input
    • Asynchronous I/O

Status of implementation

  • GET /api/v1/accounts/:id
  • GET /api/v1/accounts/verify_credentials
  • PATCH /api/v1/accounts/update_credentials
  • GET /api/v1/accounts/:id/followers
  • GET /api/v1/accounts/:id/following
  • GET /api/v1/accounts/:id/statuses
  • POST /api/v1/accounts/:id/follow
  • POST /api/v1/accounts/:id/unfollow
  • POST /api/v1/accounts/:id/block
  • POST /api/v1/accounts/:id/unblock
  • POST /api/v1/accounts/:id/mute
  • POST /api/v1/accounts/:id/unmute
  • GET /api/v1/accounts/relationships
  • GET /api/v1/accounts/search
  • POST /api/v1/apps
  • GET /api/v1/blocks
  • GET /api/v1/domain_blocks
  • POST /api/v1/domain_blocks
  • DELETE /api/v1/domain_blocks
  • GET /api/v1/favourites
  • GET /api/v1/follow_requests
  • POST /api/v1/follow_requests/:id/authorize
  • POST /api/v1/follow_requests/:id/reject
  • POST /api/v1/follows
  • GET /api/v1/instance
  • GET /api/v1/custom_emojis
  • GET /api/v1/lists
  • GET /api/v1/accounts/:id/lists
  • GET /api/v1/lists/:id/accounts
  • GET /api/v1/lists/:id
  • POST /api/v1/lists
  • PUT /api/v1/lists/:id
  • DELETE /api/v1/lists/:id
  • POST /api/v1/lists/:id/accounts
  • DELETE /api/v1/lists/:id/accounts
  • POST /api/v1/media
  • GET /api/v1/mutes
  • GET /api/v1/notifications
  • GET /api/v1/notifications/:id
  • POST /api/v1/notifications/clear
  • POST /api/v1/notifications/dismiss
  • GET /api/v1/reports
  • POST /api/v1/reports
  • GET /api/v1/search
  • GET /api/v1/statuses/:id
  • GET /api/v1/statuses/:id/context
  • GET /api/v1/statuses/:id/card
  • GET /api/v1/statuses/:id/reblogged_by
  • GET /api/v1/statuses/:id/favourited_by
  • POST /api/v1/statuses
  • DELETE /api/v1/statuses/:id
  • POST /api/v1/statuses/:id/reblog
  • POST /api/v1/statuses/:id/unreblog
  • POST /api/v1/statuses/:id/favourite
  • POST /api/v1/statuses/:id/unfavourite
  • POST /api/v1/statuses/:id/pin
  • POST /api/v1/statuses/:id/unpin
  • POST /api/v1/statuses/:id/mute
  • POST /api/v1/statuses/:id/unmute
  • GET /api/v1/timelines/home
  • GET /api/v1/timelines/public
  • GET /api/v1/timelines/tag/:hashtag
  • GET /api/v1/timelines/list/:list_id

Full reference

Copyright

Copyright © 2018 tastytea <tastytea@tastytea.de>.
License GPLv3: GNU GPL version 3 <https://www.gnu.org/licenses/gpl-3.0.html>.
This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.