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.
mastodon-cpp/README.md

148 lines
4.8 KiB
Markdown
Raw Normal View History

**mastodon-cpp** is a C++ wrapper for the Mastodon API. The aim is to be as simple as possible.
2018-01-09 22:12:11 +01:00
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.
2018-01-06 21:33:52 +01:00
# Install
2018-01-06 21:33:52 +01:00
## Dependencies
2018-01-06 21:33:52 +01:00
* Tested OS: Linux
* C++ compiler (tested: gcc 6.4)
* [cmake](https://cmake.org/) (tested: 3.9.6)
* [boost](http://www.boost.org/) (tested: 1.63.0)
* Optional: [doxygen](https://www.stack.nl/~dimitri/doxygen/) (tested: 1.8.13)
2018-01-06 21:33:52 +01:00
## Get sourcecode
2018-01-06 21:33:52 +01:00
### Development version
2018-01-13 16:07:00 +01:00
git clone https://github.com/tastytea/mastodon-cpp.git
2018-01-06 21:33:52 +01:00
## Compile
2018-01-06 21:33:52 +01:00
mkdir build
cd build/
cmake ..
make
2018-01-13 16:07:00 +01:00
If you want to compile a debug build, use `cmake -DCMAKE_BUILD_TYPE=Debug ..`
instead.
2018-01-06 21:33:52 +01:00
# 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`.
2018-01-06 21:33:52 +01:00
2018-01-13 16:32:43 +01:00
## 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.
2018-01-09 22:12:11 +01:00
# TODO
2018-01-09 22:12:11 +01:00
* Version 0.1.0
2018-01-13 16:07:00 +01:00
* [x] Implement all GET calls
* [x] Usable error handling
2018-01-09 22:12:11 +01:00
* [x] Network stuff
* [x] Comprehensive example
2018-01-09 22:12:11 +01:00
* Version 0.2.0
2018-01-13 16:07:00 +01:00
* [ ] Implement all PATCH calls
* [ ] Implement all POST calls
* [ ] Implement all DELETE calls
* Version 0.3.0
2018-01-13 16:07:00 +01:00
* [ ] Handle HTTP statuses 301 & 302
2018-01-13 19:03:10 +01:00
* [ ] Support registering as an application
2018-01-09 22:12:11 +01:00
* Later
* [ ] Escape user input
* [ ] Asynchronous I/O
2018-01-09 22:12:11 +01:00
## Status of implementation
2018-01-09 22:12:11 +01:00
* [x] GET /api/v1/accounts/:id
* [x] GET /api/v1/accounts/verify_credentials
2018-01-06 21:33:52 +01:00
* [ ] PATCH /api/v1/accounts/update_credentials
2018-01-09 22:12:11 +01:00
* [x] GET /api/v1/accounts/:id/followers
* [x] GET /api/v1/accounts/:id/following
* [x] GET /api/v1/accounts/:id/statuses
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/accounts/:id/follow
* [ ] POST /api/v1/accounts/:id/unfollow
2018-01-09 22:12:11 +01:00
* [ ] POST /api/v1/accounts/:id/block
* [ ] POST /api/v1/accounts/:id/unblock
* [ ] POST /api/v1/accounts/:id/mute
* [ ] POST /api/v1/accounts/:id/unmute
* [x] GET /api/v1/accounts/relationships
* [x] GET /api/v1/accounts/search
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/apps
* [x] GET /api/v1/blocks
* [x] GET /api/v1/domain_blocks
* [ ] POST /api/v1/domain_blocks
* [ ] DELETE /api/v1/domain_blocks
* [x] GET /api/v1/favourites
* [x] GET /api/v1/follow_requests
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/follow_requests/:id/authorize
* [ ] POST /api/v1/follow_requests/:id/reject
* [ ] POST /api/v1/follows
* [x] GET /api/v1/instance
* [x] GET /api/v1/custom_emojis
* [x] GET /api/v1/lists
* [x] GET /api/v1/accounts/:id/lists
* [x] GET /api/v1/lists/:id/accounts
* [x] 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
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/media
* [x] GET /api/v1/mutes
* [x] GET /api/v1/notifications
* [x] GET /api/v1/notifications/:id
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/notifications/clear
* [ ] POST /api/v1/notifications/dismiss
* [x] GET /api/v1/reports
2018-01-06 21:33:52 +01:00
* [ ] POST /api/v1/reports
* [x] GET /api/v1/search
* [x] GET /api/v1/statuses/:id
* [x] GET /api/v1/statuses/:id/context
* [x] GET /api/v1/statuses/:id/card
* [x] GET /api/v1/statuses/:id/reblogged_by
* [x] GET /api/v1/statuses/:id/favourited_by
2018-01-06 21:33:52 +01:00
* [ ] 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
* [x] GET /api/v1/timelines/home
* [x] GET /api/v1/timelines/public
* [x] GET /api/v1/timelines/tag/:hashtag
* [x] GET /api/v1/timelines/list/:list_id
[Full reference](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)
2018-01-06 21:33:52 +01:00
# Copyright
2018-01-09 22:12:11 +01:00
Copyright © 2018 tastytea <tastytea@tastytea.de>.
2018-01-06 21:33:52 +01:00
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.