mastodonpp/docs/index.html
2020-01-14 23:20:02 +01:00

125 lines
8.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mastodonpp: mastodonpp Reference</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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.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">mastodonpp
&#160;<span id="projectnumber">0.3.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<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('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">mastodonpp Reference </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="using"></a>
Using the library</h1>
<p>Include <a class="el" href="mastodonpp_8hpp_source.html">mastodonpp.hpp</a>, which then includes all other headers.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;mastodonpp/mastodonpp.hpp&gt;</span></div>
</div><!-- fragment --><p>Use it in your CMake project like this:</p>
<div class="fragment"><div class="line">find_package(<a class="code" href="namespacemastodonpp.html">mastodonpp</a> REQUIRED CONFIG)</div>
<div class="line">target_link_libraries(MyProject mastodonpp::mastodonpp)</div>
</div><!-- fragment --><p>Or compile your code with <code>g++ $(pkg-config --cflags --libs mastodonpp)</code>.</p>
<h2><a class="anchor" id="example"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;mastodonpp/mastodonpp.hpp&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main()</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="classmastodonpp_1_1Instance.html">mastodonpp::Instance</a> instance{<span class="stringliteral">&quot;example.com&quot;</span>, <span class="stringliteral">&quot;&quot;</span>};</div>
<div class="line"> std::cout &lt;&lt; <span class="stringliteral">&quot;Maximum characters per post: &quot;</span></div>
<div class="line"> &lt;&lt; instance.<a class="code" href="classmastodonpp_1_1Instance.html#a3d9f535570e6083b7f37b3c5e42c08dd">get_max_chars</a>() &lt;&lt; std::endl;</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="classmastodonpp_1_1Connection.html">mastodonpp::Connection</a> connection{instance};</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> answer{connection.<a class="code" href="classmastodonpp_1_1Connection.html#ade24a99769313ee15c406d97e9543cba">get</a>(mastodonpp::API::v1::instance)};</div>
<div class="line"> <span class="keywordflow">if</span> (answer)</div>
<div class="line"> {</div>
<div class="line"> std::cout &lt;&lt; answer &lt;&lt; std::endl;</div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="input"></a>
Input</h2>
<ul>
<li>All text input is expected to be UTF-8.</li>
<li>To send a file, use “<code>@file:</code>” followed by the file name as value in the <a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a>.</li>
</ul>
<h1><a class="anchor" id="exceptions"></a>
Exceptions</h1>
<p>Any unrecoverable libcurl error will be thrown as a <a class="el" href="classmastodonpp_1_1CURLException.html" title="Exception for libcurl errors.">mastodonpp::CURLException</a>. Network errors will not be thrown, but reported via the return value.</p>
<h1><a class="anchor" id="thread_safety"></a>
Thread safety</h1>
<p>The first time you construct an <a class="el" href="classmastodonpp_1_1Instance.html">Instance </a> or <a class="el" href="classmastodonpp_1_1Connection.html">Connection </a>, <a href="https://curl.haxx.se/libcurl/c/curl_global_init.html">curl_global_init(3)</a> is called. When the last <a class="el" href="classmastodonpp_1_1Instance.html">Instance </a> or <a class="el" href="classmastodonpp_1_1Connection.html">Connection </a> is destroyed, <a href="https://curl.haxx.se/libcurl/c/curl_global_cleanup.html">curl_global_cleanup(3)</a> is called. Both are not thread safe.</p>
<p>Do not make 2 requests with the same <a class="el" href="classmastodonpp_1_1Connection.html">Connection </a> at the same time. You can create as many <a class="el" href="classmastodonpp_1_1Connection.html">Connection</a>s as you want from one <a class="el" href="classmastodonpp_1_1Instance.html">Instance</a>.</p>
<p>If you are using libcurl with OpenSSL before 1.1.0, please read <a href="https://curl.haxx.se/libcurl/c/threadsafe.html">libcurl-thread(3)</a>. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<div class="ttc" id="aclassmastodonpp_1_1Connection_html_ade24a99769313ee15c406d97e9543cba"><div class="ttname"><a href="classmastodonpp_1_1Connection.html#ade24a99769313ee15c406d97e9543cba">mastodonpp::Connection::get</a></div><div class="ttdeci">answer_type get(const endpoint_variant &amp;endpoint, const parametermap &amp;parameters)</div><div class="ttdoc">Make a HTTP GET call with parameters.</div><div class="ttdef"><b>Definition:</b> connection.cpp:34</div></div>
<div class="ttc" id="anamespacemastodonpp_html"><div class="ttname"><a href="namespacemastodonpp.html">mastodonpp</a></div><div class="ttdoc">C++ wrapper for the Mastodon API.</div><div class="ttdef"><b>Definition:</b> api.cpp:19</div></div>
<div class="ttc" id="aclassmastodonpp_1_1Instance_html_a3d9f535570e6083b7f37b3c5e42c08dd"><div class="ttname"><a href="classmastodonpp_1_1Instance.html#a3d9f535570e6083b7f37b3c5e42c08dd">mastodonpp::Instance::get_max_chars</a></div><div class="ttdeci">uint64_t get_max_chars() noexcept</div><div class="ttdoc">Returns the maximum number of characters per post.</div></div>
<div class="ttc" id="aclassmastodonpp_1_1Instance_html"><div class="ttname"><a href="classmastodonpp_1_1Instance.html">mastodonpp::Instance</a></div><div class="ttdoc">Holds the access data of an instance.</div><div class="ttdef"><b>Definition:</b> instance.hpp:45</div></div>
<div class="ttc" id="aclassmastodonpp_1_1Connection_html"><div class="ttname"><a href="classmastodonpp_1_1Connection.html">mastodonpp::Connection</a></div><div class="ttdoc">Represents a connection to an instance. Used for requests.</div><div class="ttdef"><b>Definition:</b> connection.hpp:75</div></div>
<!-- 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.16
</small></address>
</body>
</html>