This commit is contained in:
tastytea 2018-06-07 22:47:19 +02:00
parent 36279a26f4
commit 68eb111665
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
1 changed files with 0 additions and 253 deletions

View File

@ -1,253 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mastodon-cpp: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">mastodon-cpp
&#160;<span id="projectnumber">0.15.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">mastodon-cpp Documentation</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><b>mastodon-cpp</b> is a C++ wrapper for the Mastodon API. The library takes care of the network stuff. You submit a query and get the raw JSON. You can then put that JSON into easy to use classes.</p>
<p><a href="https://schlomp.space/tastytea/mastodon-cpp/milestones">TODO-list</a></p>
<h1>Usage</h1>
<p>The HTML reference can be generated with <code>build_doc.sh</code>, if doxygen is installed. It is also available at <a href="https://tastytea.github.io/mastodon-cpp/docs/annotated.html">tastytea.github.io/mastodon-cpp/</a>. There are <a href="https://schlomp.space/tastytea/mastodon-cpp/src/branch/master/examples">examples</a> in <code>examples/</code>.</p>
<h2>Upgrading from below 0.13.0</h2>
<ul>
<li>You have to recompile all applications linking against this library.</li>
<li>We use a mutex now to guard the string that is being written to. You can get a reference to it with <code><a class="el" href="classMastodon_1_1API_1_1http.html#a73b74ebe9fb2d6a38a1ab8946abbb4f3" title="Gets the mutex guarding the string that is written to. ">Mastodon::API::http::get_mutex()</a></code> (see examples 9 and 13 for more info). This is only relevant for streams.</li>
</ul>
<h2>Upgrading from below 0.10.0</h2>
<p><code><a class="el" href="classMastodon_1_1API.html#ac0a88999575530651306f10c0a5d4abb" title="Make a GET request which doesn&#39;t require parameters. ">Mastodon::API::get</a></code>, <code>::get_stream</code>, <code>::post</code>, <code>::put</code> and <code>::del</code> don't take <code>std::string</code> as parameter to API-calls anymore, only <code>parametermap</code>s. The old behaviour is still supported but is deprecated and will be removed in version 1.0.0.</p>
<h2>Upgrading from below 0.7.0</h2>
<p>Your projects will break, sorry. Here are the important changes:</p>
<ul>
<li>The header location has changed. They are now in <code>mastodon-cpp/</code>.</li>
<li>Specific network error messages have been replaced by 15, "Network error". You can get the exceptions from curlpp with <code>Mastodon::API::exceptions(true)</code>.</li>
</ul>
<h2>Most basic example</h2>
<div class="fragment"><div class="line">{C++}</div><div class="line">#include &lt;iostream&gt;</div><div class="line">#include &lt;string&gt;</div><div class="line">#include &lt;mastodon-cpp/mastodon-cpp.hpp&gt;</div><div class="line"></div><div class="line">int main()</div><div class="line">{</div><div class="line"> Mastodon::API masto(&quot;social.example.com&quot;, &quot;auth_token&quot;);</div><div class="line"> std::string answer;</div><div class="line"> masto.get(Mastodon::API::v1::accounts_verify_credentials, answer);</div><div class="line"> std::cout &lt;&lt; answer &lt;&lt; &#39;\n&#39;;</div><div class="line">}</div></div><!-- fragment --><h2>Another simple example</h2>
<p>Using the <code>Easy</code>-class.</p>
<div class="fragment"><div class="line">{C++}</div><div class="line">#include &lt;iostream&gt;</div><div class="line">#include &lt;string&gt;</div><div class="line">#include &lt;vector&gt;</div><div class="line">#include &lt;mastodon-cpp/mastodon-cpp.hpp&gt;</div><div class="line">#include &lt;mastodon-cpp/easy/all.hpp&gt;</div><div class="line"></div><div class="line">using Mastodon::Easy;</div><div class="line"></div><div class="line">int main()</div><div class="line">{</div><div class="line"> Easy masto(&quot;social.example&quot;, &quot;&quot;);</div><div class="line"> std::string answer;</div><div class="line"> masto.get(Mastodon::API::v1::timelines_public, answer);</div><div class="line"></div><div class="line"> for (const std::string &amp;str : Easy::json_array_to_vector(answer))</div><div class="line"> {</div><div class="line"> Easy::Status status(str);</div><div class="line"> std::cout &lt;&lt; &quot; &quot; &lt;&lt; status.account().acct() &lt;&lt; &quot; wrote:\n&quot;;</div><div class="line"> std::cout &lt;&lt; status.content() &lt;&lt; &#39;\n&#39;;</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><h2>Compiling your project</h2>
<p>A project consisting of one file can be compiled as follows: </p><pre class="fragment">g++ -std=c++14 -lmastodon-cpp example.cpp
</pre><h2>Error codes</h2>
<p>mastodon-cpp will never use error codes below 11, except 0.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadRight">Code </th><th class="markdownTableHeadLeft">Explanation </th></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">0 </td><td class="markdownTableBodyLeft">No error </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">11 </td><td class="markdownTableBodyLeft">Invalid call </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">12 </td><td class="markdownTableBodyLeft">Not implemented </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">13 </td><td class="markdownTableBodyLeft">URL changed (HTTP 301 or 308) </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">14 </td><td class="markdownTableBodyLeft">Aborted by user </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">15 </td><td class="markdownTableBodyLeft">Network error (curlpp exception) </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">~~20~~ </td><td class="markdownTableBodyLeft">~~Failed to connect~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">~~21~~ </td><td class="markdownTableBodyLeft">~~Couldn't resolve host~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">~~22~~ </td><td class="markdownTableBodyLeft">~~Network is unreachable~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">~~23~~ </td><td class="markdownTableBodyLeft">~~Transfer interrupted~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">~~24~~ </td><td class="markdownTableBodyLeft">~~SSL error~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">~~25~~ </td><td class="markdownTableBodyLeft">~~Timeout~~ </td></tr>
<tr class="markdownTableBody" class="markdownTableRowOdd">
<td class="markdownTableBodyRight">100 - 999 </td><td class="markdownTableBodyLeft">HTTP status codes </td></tr>
<tr class="markdownTableBody" class="markdownTableRowEven">
<td class="markdownTableBodyRight">65535 </td><td class="markdownTableBodyLeft">Unknown error </td></tr>
</table>
<p>If you use a debug build, you get more verbose error messages. Errors 20-25 are no longer in use (since 0.8.9).</p>
<h2>Useful links</h2>
<ul>
<li>https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md "Mastodon API reference"</li>
<li>https://github.com/tootsuite/documentation/blob/master/Using-the-API/Streaming-API.md "Mastodon streaming API reference"</li>
</ul>
<h1>Install</h1>
<h2>Packages</h2>
<p>Every <a href="https://github.com/tastytea/mastodon-cpp/releases">release</a> includes packages for the package managers of Gentoo, Debian and Red Hat.</p>
<h3>Gentoo</h3>
<p>Put the ebuild into your <a href="https://wiki.gentoo.org/wiki/Custom_repository">local overlay</a> and run <code>ebuild &lt;ebuild path&gt; manifest</code>. Install with <code>emerge mastodon-cpp</code>.</p>
<p>Or <a href="https://wiki.gentoo.org/wiki/Eselect/Repository">add my repository</a> and install it from there. </p><pre class="fragment">eselect repository add tastytea git https://git.tastytea.de/repos/overlay-tastytea.git
echo 'dev-cpp/mastodon-cpp ~amd64' &gt;&gt; /etc/portage/package.keywords/mastodon-cpp
emaint sync -r tastytea
emerge -a dev-cpp/mastodon-cpp
</pre><h3>DEB and RPM</h3>
<p>Prebuilt DEB and RPM packages for x86_64(amd64) are provided with each release. These packages are automatically built and not tested. Install with <code>dpkg -i</code> or <code>rpm -i</code>, respectively.</p>
<p>To use the DEB package on stretch, you will need <a href="https://packages.debian.org/de/libcurlpp0">libcurlpp0</a> from buster or jessie.</p>
<h2>From source</h2>
<h3>Dependencies</h3>
<ul>
<li>Tested OS: Linux</li>
<li>C++ compiler (tested: gcc 6.4 / 5.4, clang 5.0)</li>
<li><a href="https://cmake.org/">cmake</a> (tested: 3.9.6)</li>
<li><a href="https://curl.haxx.se/">libcurl</a> (tested: 7.58.0 / 7.35.0)</li>
<li><a href="http://www.curlpp.org/">curlpp</a> (tested: 0.8.1 / 0.7.3)</li>
<li>Optional<ul>
<li>Easy interface &amp; Examples: <a href="https://github.com/open-source-parsers/jsoncpp">jsoncpp</a> (tested: 1.8.1 / 1.7.2)</li>
<li>Documentation: <a href="https://www.stack.nl/~dimitri/doxygen/">doxygen</a> (tested: 1.8.13)</li>
<li>DEB package: <a href="https://packages.qa.debian.org/dpkg">dpkg</a> (tested: 1.19.0.5)</li>
<li>RPM package: <a href="http://www.rpm.org">rpm</a> (tested: 4.11.0.1)</li>
</ul>
</li>
</ul>
<h3>Get sourcecode</h3>
<h4>Release</h4>
<p>Download the current release at <a href="https://github.com/tastytea/mastodon-cpp/releases">GitHub</a>.</p>
<h4>Development version</h4>
<p><a href="https://travis-ci.org/tastytea/mastodon-cpp"></a> </p><pre class="fragment">git clone https://schlomp.space/tastytea/mastodon-cpp.git
</pre><h3>Compile</h3>
<pre class="fragment">mkdir build
cd build/
cmake ..
make
</pre><p>cmake options:</p>
<ul>
<li><code>-DCMAKE_BUILD_TYPE=Debug</code> for a debug build</li>
<li><code>-DWITHOUT_EASY=ON</code> to not build the Easy abstractions and to get rid of the jsoncpp-dependency (not recommended)</li>
<li><code>-DWITH_EXAMPLES=ON</code> if you want to compile the examples</li>
<li><code>-DWITH_TESTS=ON</code> if you want to compile the tests</li>
<li><code>-DWITH_DOC=ON</code> if you want to compile the HTML reference</li>
<li><code>-DWITH_DEB=ON</code> if you want to be able to generate a deb-package</li>
<li><code>-DWITH_RPM=ON</code> if you want to be able to generate an rpm-package</li>
</ul>
<p>You can run the tests with <code>ctest ..</code> inside the build directory. To install, run <code>make install</code>.</p>
<h3>Packages</h3>
<h4>Gentoo</h4>
<p>Put the ebuild from <code>packages/gentoo</code> into your <a href="https://wiki.gentoo.org/wiki/Custom_repository">local overlay</a> and rename it to match the desired version or use the live-ebuild (<code>mastodon-cpp-9999.ebuild</code>) to install the development version.</p>
<h4>DEB and RPM</h4>
<p>Compile with <code>-DWITH_DEB=ON</code> or <code>-DWITH_RPM=ON</code>. Run <code>make package</code> from the build directory to generate a DEB/RPM package.</p>
<h4>Other</h4>
<p>Run <code>make package</code> from the build directory to generate a tar.gz archive.</p>
<h1>Status of implementation</h1>
<p>Feature complete as of Mastodon 2.4.0</p>
<ul>
<li>[x] GET /api/v1/accounts/:id</li>
<li>[x] GET /api/v1/accounts/verify_credentials</li>
<li>[x] PATCH /api/v1/accounts/update_credentials</li>
<li>[x] GET /api/v1/accounts/:id/followers</li>
<li>[x] GET /api/v1/accounts/:id/following</li>
<li>[x] GET /api/v1/accounts/:id/statuses</li>
<li>[x] POST /api/v1/accounts/:id/follow</li>
<li>[x] POST /api/v1/accounts/:id/unfollow</li>
<li>[x] POST /api/v1/accounts/:id/block</li>
<li>[x] POST /api/v1/accounts/:id/unblock</li>
<li>[x] POST /api/v1/accounts/:id/mute</li>
<li>[x] POST /api/v1/accounts/:id/unmute</li>
<li>[x] GET /api/v1/accounts/relationships</li>
<li>[x] GET /api/v1/accounts/search</li>
<li>[x] POST /api/v1/apps</li>
<li>[x] GET /api/v1/blocks</li>
<li>[x] GET /api/v1/domain_blocks</li>
<li>[x] POST /api/v1/domain_blocks</li>
<li>[x] DELETE /api/v1/domain_blocks</li>
<li>[x] GET /api/v1/favourites</li>
<li>[x] GET /api/v1/follow_requests</li>
<li>[x] POST /api/v1/follow_requests/:id/authorize</li>
<li>[x] POST /api/v1/follow_requests/:id/reject</li>
<li>[x] POST /api/v1/follows</li>
<li>[x] GET /api/v1/instance</li>
<li>[x] GET /api/v1/custom_emojis</li>
<li>[x] GET /api/v1/lists</li>
<li>[x] GET /api/v1/accounts/:id/lists</li>
<li>[x] GET /api/v1/lists/:id/accounts</li>
<li>[x] GET /api/v1/lists/:id</li>
<li>[x] POST /api/v1/lists</li>
<li>[x] PUT /api/v1/lists/:id</li>
<li>[x] DELETE /api/v1/lists/:id</li>
<li>[x] POST /api/v1/lists/:id/accounts</li>
<li>[x] DELETE /api/v1/lists/:id/accounts</li>
<li>[x] POST /api/v1/media</li>
<li>[x] PUT /api/v1/media/:id</li>
<li>[x] GET /api/v1/mutes</li>
<li>[x] GET /api/v1/notifications</li>
<li>[x] GET /api/v1/notifications/:id</li>
<li>[x] POST /api/v1/notifications/clear</li>
<li>[x] POST /api/v1/notifications/dismiss</li>
<li>[x] GET /api/v1/reports</li>
<li>[x] POST /api/v1/reports</li>
<li>[x] GET /api/v1/search</li>
<li>[x] GET /api/v1/statuses/:id</li>
<li>[x] GET /api/v1/statuses/:id/context</li>
<li>[x] GET /api/v1/statuses/:id/card</li>
<li>[x] GET /api/v1/statuses/:id/reblogged_by</li>
<li>[x] GET /api/v1/statuses/:id/favourited_by</li>
<li>[x] POST /api/v1/statuses</li>
<li>[x] DELETE /api/v1/statuses/:id</li>
<li>[x] POST /api/v1/statuses/:id/reblog</li>
<li>[x] POST /api/v1/statuses/:id/unreblog</li>
<li>[x] POST /api/v1/statuses/:id/favourite</li>
<li>[x] POST /api/v1/statuses/:id/unfavourite</li>
<li>[x] POST /api/v1/statuses/:id/pin</li>
<li>[x] POST /api/v1/statuses/:id/unpin</li>
<li>[x] POST /api/v1/statuses/:id/mute</li>
<li>[x] POST /api/v1/statuses/:id/unmute</li>
<li>[x] GET /api/v1/timelines/home</li>
<li>[x] GET /api/v1/timelines/public</li>
<li>[x] GET /api/v1/timelines/tag/:hashtag</li>
<li>[x] GET /api/v1/timelines/list/:list_id</li>
<li>[x] GET /api/v1/streaming/user</li>
<li>[x] GET /api/v1/streaming/public</li>
<li>[x] GET /api/v1/streaming/public/local</li>
<li>[x] GET /api/v1/streaming/hashtag</li>
<li>[x] GET /api/v1/streaming/list</li>
<li>[x] POST /api/v1/push/subscription</li>
<li>[x] GET /api/v1/push/subscription</li>
<li>[x] PUT /api/v1/push/subscription</li>
<li>[x] DELETE /api/v1/push/subscription</li>
</ul>
<h1>Copyright</h1>
<pre class="fragment">Copyright © 2018 tastytea &lt;tastytea@tastytea.de&gt;.
License GPLv3: GNU GPL version 3 &lt;https://www.gnu.org/licenses/gpl-3.0.html&gt;.
This program comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.</pre> </div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>