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

278 lines
29 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::Instance::ObtainToken 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.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>
<!-- 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_1Instance.html">Instance</a></li><li class="navelem"><a class="el" href="classmastodonpp_1_1Instance_1_1ObtainToken.html">ObtainToken</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_1Instance_1_1ObtainToken-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">mastodonpp::Instance::ObtainToken Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Simplifies obtaining an OAuth 2.0 Bearer Access Token.
<a href="classmastodonpp_1_1Instance_1_1ObtainToken.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="instance_8hpp_source.html">instance.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for mastodonpp::Instance::ObtainToken:</div>
<div class="dyncontent">
<div class="center">
<img src="classmastodonpp_1_1Instance_1_1ObtainToken.png" usemap="#mastodonpp::Instance::ObtainToken_map" alt=""/>
<map id="mastodonpp::Instance::ObtainToken_map" name="mastodonpp::Instance::ObtainToken_map">
<area href="classmastodonpp_1_1CURLWrapper.html" title="Handles the details of network connections." alt="mastodonpp::CURLWrapper" shape="rect" coords="0,0,209,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:aa834d9be223856e5711b0e14d9b92eed"><td class="memItemLeft" align="right" valign="top"><a id="aa834d9be223856e5711b0e14d9b92eed"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ObtainToken</b> (<a class="el" href="classmastodonpp_1_1Instance.html">Instance</a> &amp;instance)</td></tr>
<tr class="separator:aa834d9be223856e5711b0e14d9b92eed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5bd5d631e2fbb186a9df66d2ac3f5402"><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_1Instance_1_1ObtainToken.html#a5bd5d631e2fbb186a9df66d2ac3f5402">step_1</a> (string_view client_name, string_view scopes, string_view website)</td></tr>
<tr class="memdesc:a5bd5d631e2fbb186a9df66d2ac3f5402"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an application via <code>/api/v1/apps</code>. <a href="classmastodonpp_1_1Instance_1_1ObtainToken.html#a5bd5d631e2fbb186a9df66d2ac3f5402">More...</a><br /></td></tr>
<tr class="separator:a5bd5d631e2fbb186a9df66d2ac3f5402"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addda7f4e1ca4200235764707478f6d51"><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_1Instance_1_1ObtainToken.html#addda7f4e1ca4200235764707478f6d51">step_2</a> (string_view code)</td></tr>
<tr class="memdesc:addda7f4e1ca4200235764707478f6d51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a token via <code>/oauth/token</code>. <a href="classmastodonpp_1_1Instance_1_1ObtainToken.html#addda7f4e1ca4200235764707478f6d51">More...</a><br /></td></tr>
<tr class="separator:addda7f4e1ca4200235764707478f6d51"><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:a108929a9985c76a8e2cd1f531ac6d321 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#a108929a9985c76a8e2cd1f531ac6d321">CURLWrapper</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=delete</td></tr>
<tr class="memdesc:a108929a9985c76a8e2cd1f531ac6d321 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a108929a9985c76a8e2cd1f531ac6d321">More...</a><br /></td></tr>
<tr class="separator:a108929a9985c76a8e2cd1f531ac6d321 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d79b9a4525ac4b4b8954ccc794af0f9 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#a4d79b9a4525ac4b4b8954ccc794af0f9">CURLWrapper</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=delete</td></tr>
<tr class="memdesc:a4d79b9a4525ac4b4b8954ccc794af0f9 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move constructor. <a href="classmastodonpp_1_1CURLWrapper.html#a4d79b9a4525ac4b4b8954ccc794af0f9">More...</a><br /></td></tr>
<tr class="separator:a4d79b9a4525ac4b4b8954ccc794af0f9 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:a5f29b7f4d0b58f70bc96f362cdaa4d0a 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#a5f29b7f4d0b58f70bc96f362cdaa4d0a">operator=</a> (const <a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;other)=delete</td></tr>
<tr class="memdesc:a5f29b7f4d0b58f70bc96f362cdaa4d0a inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#a5f29b7f4d0b58f70bc96f362cdaa4d0a">More...</a><br /></td></tr>
<tr class="separator:a5f29b7f4d0b58f70bc96f362cdaa4d0a inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a506cb49c00a63ef4b9d51d0d52c203dc 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#a506cb49c00a63ef4b9d51d0d52c203dc">operator=</a> (<a class="el" href="classmastodonpp_1_1CURLWrapper.html">CURLWrapper</a> &amp;&amp;other) noexcept=delete</td></tr>
<tr class="memdesc:a506cb49c00a63ef4b9d51d0d52c203dc inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move assignment operator. <a href="classmastodonpp_1_1CURLWrapper.html#a506cb49c00a63ef4b9d51d0d52c203dc">More...</a><br /></td></tr>
<tr class="separator:a506cb49c00a63ef4b9d51d0d52c203dc 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>
<tr class="memitem:a11a543a0821a275dfce1ad7a0e68b17f inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">escape_url</a> (const string_view url) const</td></tr>
<tr class="memdesc:a11a543a0821a275dfce1ad7a0e68b17f inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">URL encodes the given string. <a href="classmastodonpp_1_1CURLWrapper.html#a11a543a0821a275dfce1ad7a0e68b17f">More...</a><br /></td></tr>
<tr class="separator:a11a543a0821a275dfce1ad7a0e68b17f inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aed6d09b5c32d71276a851ddf321b5891 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">unescape_url</a> (const string_view url) const</td></tr>
<tr class="memdesc:aed6d09b5c32d71276a851ddf321b5891 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">URL decodes the given string . <a href="classmastodonpp_1_1CURLWrapper.html#aed6d09b5c32d71276a851ddf321b5891">More...</a><br /></td></tr>
<tr class="separator:aed6d09b5c32d71276a851ddf321b5891 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0059ecb78b53c4b3c941b19f8dc897f7 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">setup_connection_properties</a> (string_view proxy, string_view access_token, string_view cainfo, string_view useragent)</td></tr>
<tr class="memdesc:a0059ecb78b53c4b3c941b19f8dc897f7 inherit pub_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set some properties of the connection. <a href="classmastodonpp_1_1CURLWrapper.html#a0059ecb78b53c4b3c941b19f8dc897f7">More...</a><br /></td></tr>
<tr class="separator:a0059ecb78b53c4b3c941b19f8dc897f7 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:adc8808c3fad5397176f6755b09ee0be6 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#adc8808c3fad5397176f6755b09ee0be6">make_request</a> (const <a class="el" href="namespacemastodonpp.html#a7d60fc71ad0fb1fbd467b37fe1f1f100">http_method</a> &amp;method, string uri, const <a class="el" href="namespacemastodonpp.html#af8b3b89118adeccc71c54dfd36c987f6">parametermap</a> &amp;parameters)</td></tr>
<tr class="memdesc:adc8808c3fad5397176f6755b09ee0be6 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make a HTTP request. <a href="classmastodonpp_1_1CURLWrapper.html#adc8808c3fad5397176f6755b09ee0be6">More...</a><br /></td></tr>
<tr class="separator:adc8808c3fad5397176f6755b09ee0be6 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04b3919cfb38716c5a032337e442db95 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">string &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">get_buffer</a> ()</td></tr>
<tr class="memdesc:a04b3919cfb38716c5a032337e442db95 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the buffer libcurl writes into. <a href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95">More...</a><br /></td></tr>
<tr class="separator:a04b3919cfb38716c5a032337e442db95 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a892a4fc3d048798fa8e2584545b91861 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">cancel_stream</a> ()</td></tr>
<tr class="memdesc:a892a4fc3d048798fa8e2584545b91861 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cancel the stream. <a href="classmastodonpp_1_1CURLWrapper.html#a892a4fc3d048798fa8e2584545b91861">More...</a><br /></td></tr>
<tr class="separator:a892a4fc3d048798fa8e2584545b91861 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1564a42794ef7a9d170b725063ef504d inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">set_proxy</a> (string_view proxy)</td></tr>
<tr class="memdesc:a1564a42794ef7a9d170b725063ef504d inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the proxy to use. <a href="classmastodonpp_1_1CURLWrapper.html#a1564a42794ef7a9d170b725063ef504d">More...</a><br /></td></tr>
<tr class="separator:a1564a42794ef7a9d170b725063ef504d inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a229cf9eae6bd03adfc2fdfdff62d88 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#a7a229cf9eae6bd03adfc2fdfdff62d88">set_access_token</a> (const string_view access_token)</td></tr>
<tr class="memdesc:a7a229cf9eae6bd03adfc2fdfdff62d88 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set OAuth 2.0 Bearer Access Token. <a href="classmastodonpp_1_1CURLWrapper.html#a7a229cf9eae6bd03adfc2fdfdff62d88">More...</a><br /></td></tr>
<tr class="separator:a7a229cf9eae6bd03adfc2fdfdff62d88 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3f2bd4dea7c289d590fe19889360444 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">set_cainfo</a> (string_view path)</td></tr>
<tr class="memdesc:af3f2bd4dea7c289d590fe19889360444 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set path to Certificate Authority (CA) bundle. <a href="classmastodonpp_1_1CURLWrapper.html#af3f2bd4dea7c289d590fe19889360444">More...</a><br /></td></tr>
<tr class="separator:af3f2bd4dea7c289d590fe19889360444 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3b1445f9b94b1f7677d3cac6d538612 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top"><a id="ae3b1445f9b94b1f7677d3cac6d538612"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>set_useragent</b> (string_view useragent)</td></tr>
<tr class="separator:ae3b1445f9b94b1f7677d3cac6d538612 inherit pro_methods_classmastodonpp_1_1CURLWrapper"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pro_attribs_classmastodonpp_1_1CURLWrapper"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_classmastodonpp_1_1CURLWrapper')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="classmastodonpp_1_1CURLWrapper.html">mastodonpp::CURLWrapper</a></td></tr>
<tr class="memitem:aeb3171d955832b8062dc02b4ac67d195 inherit pro_attribs_classmastodonpp_1_1CURLWrapper"><td class="memItemLeft" align="right" valign="top">mutex&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">buffer_mutex</a></td></tr>
<tr class="memdesc:aeb3171d955832b8062dc02b4ac67d195 inherit pro_attribs_classmastodonpp_1_1CURLWrapper"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mutex for <a class="el" href="classmastodonpp_1_1CURLWrapper.html#a04b3919cfb38716c5a032337e442db95" title="Returns a reference to the buffer libcurl writes into.">get_buffer</a> a.k.a. _curl_buffer_body. <a href="classmastodonpp_1_1CURLWrapper.html#aeb3171d955832b8062dc02b4ac67d195">More...</a><br /></td></tr>
<tr class="separator:aeb3171d955832b8062dc02b4ac67d195 inherit pro_attribs_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>Simplifies obtaining an OAuth 2.0 Bearer Access Token. </p>
<ul>
<li>Create an <a class="el" href="classmastodonpp_1_1Instance.html#a04dc593589b69f9f71c4acecb39d995a" title="Construct a new Instance object.">Instance()</a> and initialize this class with it.</li>
<li>Call <a class="el" href="classmastodonpp_1_1Instance_1_1ObtainToken.html#a5bd5d631e2fbb186a9df66d2ac3f5402" title="Creates an application via /api/v1/apps.">step_1()</a> to get the URI your user has to visit.</li>
<li>Get the authorization code from your user.</li>
<li>Call <a class="el" href="classmastodonpp_1_1Instance_1_1ObtainToken.html#addda7f4e1ca4200235764707478f6d51" title="Creates a token via /oauth/token.">step_2()</a> with the code.</li>
</ul>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="classmastodonpp_1_1Instance.html">mastodonpp::Instance</a> instance(<span class="stringliteral">&quot;example.com&quot;</span>, {});</div>
<div class="line"><a class="code" href="classmastodonpp_1_1Instance_1_1ObtainToken.html">mastodonpp::Instance::ObtainToken</a> token(instance);</div>
<div class="line"><span class="keyword">auto</span> answer{token.step1(<span class="stringliteral">&quot;Good program&quot;</span>, <span class="stringliteral">&quot;read:blocks read:mutes&quot;</span>, <span class="stringliteral">&quot;&quot;</span>)};</div>
<div class="line"><span class="keywordflow">if</span> (answer)</div>
<div class="line">{</div>
<div class="line"> std::cout &lt;&lt; <span class="stringliteral">&quot;Please visit &quot;</span> &lt;&lt; answer &lt;&lt; <span class="stringliteral">&quot;\nand paste the code: &quot;</span>;</div>
<div class="line"> std::string code;</div>
<div class="line"> std::cin &gt;&gt; code;</div>
<div class="line"> answer = access_token{token.step2(code)};</div>
<div class="line"> <span class="keywordflow">if</span> (answer)</div>
<div class="line"> {</div>
<div class="line"> std::cout &lt;&lt; <span class="stringliteral">&quot;Success!\n&quot;</span>;</div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment --><dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a5bd5d631e2fbb186a9df66d2ac3f5402"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5bd5d631e2fbb186a9df66d2ac3f5402">&#9670;&nbsp;</a></span>step_1()</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::Instance::ObtainToken::step_1 </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>client_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>scopes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>website</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates an application via <code>/api/v1/apps</code>. </p>
<p>The <code>body</code> of the returned <a class="el" href="structmastodonpp_1_1answer__type.html">answer </a> contains only the URI, not the whole JSON response.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">client_name</td><td>The name of your application. </td></tr>
<tr><td class="paramname">scopes</td><td>Space separated list of scopes. Defaults to “read” if empty. </td></tr>
<tr><td class="paramname">website</td><td>The URI to the homepage of your application. Can be an empty string.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The URI your user has to visit.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
</div>
</div>
<a id="addda7f4e1ca4200235764707478f6d51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#addda7f4e1ca4200235764707478f6d51">&#9670;&nbsp;</a></span>step_2()</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::Instance::ObtainToken::step_2 </td>
<td>(</td>
<td class="paramtype">string_view&#160;</td>
<td class="paramname"><em>code</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a token via <code>/oauth/token</code>. </p>
<p>The <code>body</code> of the returned <a class="el" href="structmastodonpp_1_1answer__type.html">answer </a> contains only the access token, not the whole JSON response.</p>
<p>The access token will be set in the parent <a class="el" href="classmastodonpp_1_1Instance.html" title="Holds the access data of an instance.">Instance</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">code</td><td>The authorization code you got from the user.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The access token.</dd></dl>
<dl class="section since"><dt>Since</dt><dd>0.3.0 </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/<a class="el" href="instance_8hpp_source.html">instance.hpp</a></li>
</ul>
</div><!-- contents -->
<div class="ttc" id="aclassmastodonpp_1_1Instance_1_1ObtainToken_html"><div class="ttname"><a href="classmastodonpp_1_1Instance_1_1ObtainToken.html">mastodonpp::Instance::ObtainToken</a></div><div class="ttdoc">Simplifies obtaining an OAuth 2.0 Bearer Access Token.</div><div class="ttdef"><b>Definition:</b> instance.hpp:226</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>
<!-- 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>