mastodonpp/docs/classmastodonpp_1_1Connection.html
2020-01-08 11:33:19 +01:00

251 lines
20 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::Connection Class 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.0.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>
<!-- 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 id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacemastodonpp.html">mastodonpp</a></li><li class="navelem"><a class="el" href="classmastodonpp_1_1Connection.html">Connection</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classmastodonpp_1_1Connection-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">mastodonpp::Connection Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Represents a connection to an instance. Used for requests.
<a href="classmastodonpp_1_1Connection.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="connection_8hpp_source.html">mastodonpp/connection.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for mastodonpp::Connection:</div>
<div class="dyncontent">
<div class="center">
<img src="classmastodonpp_1_1Connection.png" usemap="#mastodonpp::Connection_map" alt=""/>
<map id="mastodonpp::Connection_map" name="mastodonpp::Connection_map">
<area href="classmastodonpp_1_1CURLWrapper.html" title="Handles the details of network connections." alt="mastodonpp::CURLWrapper" shape="rect" coords="0,0,166,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ac5fedffbd59686c26b1e44a7a96c216a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1Connection.html#ac5fedffbd59686c26b1e44a7a96c216a">Connection</a> (<a class="el" href="classmastodonpp_1_1Instance.html">Instance</a> &amp;instance)</td></tr>
<tr class="memdesc:ac5fedffbd59686c26b1e44a7a96c216a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new <a class="el" href="classmastodonpp_1_1Connection.html" title="Represents a connection to an instance. Used for requests.">Connection</a> object. <a href="classmastodonpp_1_1Connection.html#ac5fedffbd59686c26b1e44a7a96c216a">More...</a><br /></td></tr>
<tr class="separator:ac5fedffbd59686c26b1e44a7a96c216a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a048b38d07a5cd90ad939257bd554a860"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1Connection.html#a048b38d07a5cd90ad939257bd554a860">get</a> (const <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f">API::endpoint_type</a> &amp;endpoint)</td></tr>
<tr class="memdesc:a048b38d07a5cd90ad939257bd554a860"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a HTTP GET call. <a href="classmastodonpp_1_1Connection.html#a048b38d07a5cd90ad939257bd554a860">More...</a><br /></td></tr>
<tr class="separator:a048b38d07a5cd90ad939257bd554a860"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8466753749a01803ce616bc45f6e7a1c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1Connection.html#a8466753749a01803ce616bc45f6e7a1c">get</a> (const string_view &amp;endpoint)</td></tr>
<tr class="memdesc:a8466753749a01803ce616bc45f6e7a1c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a HTTP GET call. <a href="classmastodonpp_1_1Connection.html#a8466753749a01803ce616bc45f6e7a1c">More...</a><br /></td></tr>
<tr class="separator:a8466753749a01803ce616bc45f6e7a1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classmastodonpp_1_1CURLWrapper"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classmastodonpp_1_1CURLWrapper')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classmastodonpp_1_1CURLWrapper.html">mastodonpp::CURLWrapper</a></td></tr>
<tr class="memitem:a736572303fbec7a307514e611e6a468c inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">CURLWrapper</a> ()</td></tr>
<tr class="memdesc:a736572303fbec7a307514e611e6a468c inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes curl and sets up connection. <a href="classmastodonpp_1_1CURLWrapper.html#a736572303fbec7a307514e611e6a468c">More...</a><br /></td></tr>
<tr class="separator:a736572303fbec7a307514e611e6a468c inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51ff58f1038ea1d6c8d327b5f261ae39 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a51ff58f1038ea1d6c8d327b5f261ae39">CURLWrapper</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=default</td></tr>
<tr class="memdesc:a51ff58f1038ea1d6c8d327b5f261ae39 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a51ff58f1038ea1d6c8d327b5f261ae39">More...</a><br /></td></tr>
<tr class="separator:a51ff58f1038ea1d6c8d327b5f261ae39 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1969bc0fb2e104d896c606b38f3199e7 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a1969bc0fb2e104d896c606b38f3199e7">CURLWrapper</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=default</td></tr>
<tr class="memdesc:a1969bc0fb2e104d896c606b38f3199e7 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a1969bc0fb2e104d896c606b38f3199e7">More...</a><br /></td></tr>
<tr class="separator:a1969bc0fb2e104d896c606b38f3199e7 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a350f7061c9cb54cb5992ae983db3fc19 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">~CURLWrapper</a> () noexcept</td></tr>
<tr class="memdesc:a350f7061c9cb54cb5992ae983db3fc19 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cleans up curl and connection. <a href="classmastodonpp_1_1CURLWrapper.html#a350f7061c9cb54cb5992ae983db3fc19">More...</a><br /></td></tr>
<tr class="separator:a350f7061c9cb54cb5992ae983db3fc19 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ab0da0f9186df2bdbf65189df57aeaf inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a9ab0da0f9186df2bdbf65189df57aeaf">operator=</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=default</td></tr>
<tr class="memdesc:a9ab0da0f9186df2bdbf65189df57aeaf inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#a9ab0da0f9186df2bdbf65189df57aeaf">More...</a><br /></td></tr>
<tr class="separator:a9ab0da0f9186df2bdbf65189df57aeaf inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab516c58e5887eedc4b3b475c8faa060a inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#ab516c58e5887eedc4b3b475c8faa060a">operator=</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=default</td></tr>
<tr class="memdesc:ab516c58e5887eedc4b3b475c8faa060a inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#ab516c58e5887eedc4b3b475c8faa060a">More...</a><br /></td></tr>
<tr class="separator:ab516c58e5887eedc4b3b475c8faa060a inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b7aaf03245a0730eeb464802168aded inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">CURL *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">get_curl_easy_handle</a> ()</td></tr>
<tr class="memdesc:a2b7aaf03245a0730eeb464802168aded inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns pointer to the CURL easy handle. <a href="classmastodonpp_1_1CURLWrapper.html#a2b7aaf03245a0730eeb464802168aded">More...</a><br /></td></tr>
<tr class="separator:a2b7aaf03245a0730eeb464802168aded inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pro_methods_classmastodonpp_1_1CURLWrapper"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_classmastodonpp_1_1CURLWrapper')"><img src="closed.png" alt="-"/>&#160;Protected Member Functions inherited from <a class="el" href="classmastodonpp_1_1CURLWrapper.html">mastodonpp::CURLWrapper</a></td></tr>
<tr class="memitem:a6a0c0ff6e894e43cdb5df9dd8b55c785 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a6a0c0ff6e894e43cdb5df9dd8b55c785">make_request</a> (const <a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> &amp;method, const string_view &amp;uri)</td></tr>
<tr class="memdesc:a6a0c0ff6e894e43cdb5df9dd8b55c785 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a request. <a href="classmastodonpp_1_1CURLWrapper.html#a6a0c0ff6e894e43cdb5df9dd8b55c785">More...</a><br /></td></tr>
<tr class="separator:a6a0c0ff6e894e43cdb5df9dd8b55c785 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Represents a connection to an instance. Used for requests. </p>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ac5fedffbd59686c26b1e44a7a96c216a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac5fedffbd59686c26b1e44a7a96c216a">&#9670;&nbsp;</a></span>Connection()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">mastodonpp::Connection::Connection </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmastodonpp_1_1Instance.html">Instance</a> &amp;&#160;</td>
<td class="paramname"><em>instance</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Construct a new <a class="el" href="classmastodonpp_1_1Connection.html" title="Represents a connection to an instance. Used for requests.">Connection</a> object. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">instance</td><td>An <a class="el" href="classmastodonpp_1_1Instance.html" title="Holds the access data of an instance.">Instance</a> with the access data.</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; : _instance{instance}</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; , _baseuri{instance.get_baseuri()}</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;{}</div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a048b38d07a5cd90ad939257bd554a860"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a048b38d07a5cd90ad939257bd554a860">&#9670;&nbsp;</a></span>get() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a> mastodonpp::Connection::get </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f">API::endpoint_type</a> &amp;&#160;</td>
<td class="paramname"><em>endpoint</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Make a HTTP GET call. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">endpoint</td><td>Endpoint as <a class="el" href="classmastodonpp_1_1API.html#a66d340a2e61c4254feb79f17f6773e4f" title="Type for endpoints. Can be API::v1, API::v2, API::oauth, API::other or API::pleroma.">API::endpoint_type</a>, for example: <code>mastodonpp::API::v1::instance</code>.</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;{</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a6a0c0ff6e894e43cdb5df9dd8b55c785">make_request</a>(</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; http_method::GET,</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keywordtype">string</span>(_baseuri).append(API{endpoint}.to_string_view()));</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a8466753749a01803ce616bc45f6e7a1c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8466753749a01803ce616bc45f6e7a1c">&#9670;&nbsp;</a></span>get() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structmastodonpp_1_1answer__type.html">answer_type</a> mastodonpp::Connection::get </td>
<td>(</td>
<td class="paramtype">const string_view &amp;&#160;</td>
<td class="paramname"><em>endpoint</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Make a HTTP GET call. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">endpoint</td><td>Endpoint as string, for example: "/api/v1/instance".</td></tr>
</table>
</dd>
</dl>
<dl class="section since"><dt>Since</dt><dd>0.1.0 </dd></dl>
<div class="fragment"><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;{</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classmastodonpp_1_1CURLWrapper.html#a6a0c0ff6e894e43cdb5df9dd8b55c785">make_request</a>(http_method::GET, <span class="keywordtype">string</span>(_baseuri).append(endpoint));</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;}</div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/<a class="el" href="connection_8hpp_source.html">connection.hpp</a></li>
<li>src/connection.cpp</li>
</ul>
</div><!-- contents -->
<div class="ttc" id="aclassmastodonpp_1_1CURLWrapper_html_a6a0c0ff6e894e43cdb5df9dd8b55c785"><div class="ttname"><a href="classmastodonpp_1_1CURLWrapper.html#a6a0c0ff6e894e43cdb5df9dd8b55c785">mastodonpp::CURLWrapper::make_request</a></div><div class="ttdeci">answer_type make_request(const http_method &amp;method, const string_view &amp;uri)</div><div class="ttdoc">Make a request.</div><div class="ttdef"><b>Definition:</b> curl_wrapper.cpp:60</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>