UNPKG

nodesu

Version:
896 lines (284 loc) 15.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Client</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Client</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Client<span class="signature">(apiKey, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Client.html">Client</a>}</span></h2> <div class="class-description">The main osu! API client.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Client"><span class="type-signature"></span>new Client<span class="signature">(apiKey, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="Client.html">Client</a>}</span></h4> <div class="description"> Creates the osu! API client instance. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>apiKey</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">The osu! API key. - available from https://osu.ppy.sh/p/api</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Options for the instance. <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>disableRateLimiting</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last">Disabled ratelimiting through the client instance.</td> </tr> <tr> <td class="name"><code>requestsPerMinute</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> 60 </td> <td class="description last">Requests per minute for the main limiting bucket if ratelimiting is enabled (note that the replay endpoint has a special 10/minute bucket).</td> </tr> <tr> <td class="name"><code>parseData</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last">If data should be parsed into our custom nodesu classes (experimental and could be subject to break).</td> </tr> <tr> <td class="name"><code>baseUrl</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> "https://osu.ppy.sh/api" </td> <td class="description last">osu! API base URL. May be changed for mocking purposes, or for using a rate-limiting proxy.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>user</code></td> <td class="type"> <span class="param-type">UserComponent</span> </td> <td class="description last">The set of functions that are related to the User section.</td> </tr> <tr> <td class="name"><code>beatmaps</code></td> <td class="type"> <span class="param-type">BeatmapComponent</span> </td> <td class="description last">The set of functions that are related to the Beatmap section.</td> </tr> <tr> <td class="name"><code>scores</code></td> <td class="type"> <span class="param-type">ScoresComponent</span> </td> <td class="description last">The set of functions that are related to the Score section.</td> </tr> <tr> <td class="name"><code>replay</code></td> <td class="type"> <span class="param-type">ReplayComponent</span> </td> <td class="description last">The set of functions that are related to the Replay section.</td> </tr> <tr> <td class="name"><code>multi</code></td> <td class="type"> <span class="param-type">MultiComponent</span> </td> <td class="description last">The set of functions that are related to the Multiplayer section.</td> </tr> <tr> <td class="name"><code>apiKey</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The osu! API key in use.</td> </tr> <tr> <td class="name"><code>disableRateLimiting</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Should ratelimiting be used throughout the client instance.</td> </tr> <tr> <td class="name"><code>requestsPerMinute</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">How many requests per minute are allowed if ratelimiting is used.</td> </tr> <tr> <td class="name"><code>parseData</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">If data should be parsed into our custom nodesu classes. (experimental and could be subject to break)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Client.js.html">Client.js</a>, <a href="Client.js.html#line35">line 35</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The osu! API client instance. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Client.html">Client</a></span> </dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="raw"><span class="type-signature"></span>raw<span class="signature">(endpoint, options)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <div class="description"> A direct raw API request with a payload of query string options. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>endpoint</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The API endpoint.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">An object of query string options.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="Client.js.html">Client.js</a>, <a href="Client.js.html#line62">line 62</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The object returned from the API. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Promise.&lt;Object></span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Components.html">Components</a></li><li><a href="module-CustomClasses.html">CustomClasses</a></li><li><a href="module-Enums.html">Enums</a></li><li><a href="module-Errors.html">Errors</a></li></ul><h3>Classes</h3><ul><li><a href="Client.html">Client</a></li><li><a href="module-Components.BeatmapsComponent.html">BeatmapsComponent</a></li><li><a href="module-Components.MultiComponent.html">MultiComponent</a></li><li><a href="module-Components.ReplayComponent.html">ReplayComponent</a></li><li><a href="module-Components.ScoresComponent.html">ScoresComponent</a></li><li><a href="module-Components.UserComponent.html">UserComponent</a></li><li><a href="module-CustomClasses.Beatmap.html">Beatmap</a></li><li><a href="module-CustomClasses.BeatmapScore.html">BeatmapScore</a></li><li><a href="module-CustomClasses.Multi.html">Multi</a></li><li><a href="module-CustomClasses.MultiGame.html">MultiGame</a></li><li><a href="module-CustomClasses.MultiMatch.html">MultiMatch</a></li><li><a href="module-CustomClasses.MultiScore.html">MultiScore</a></li><li><a href="module-CustomClasses.ReplayData.html">ReplayData</a></li><li><a href="module-CustomClasses.Score.html">Score</a></li><li><a href="module-CustomClasses.User.html">User</a></li><li><a href="module-CustomClasses.UserEvent.html">UserEvent</a></li><li><a href="module-CustomClasses.UserScore.html">UserScore</a></li><li><a href="module-Errors.OsuApiError.html">OsuApiError</a></li><li><a href="Requester.html">Requester</a></li></ul><h3>Global</h3><ul><li><a href="global.html#ApprovalStatus">ApprovalStatus</a></li><li><a href="global.html#Converts">Converts</a></li><li><a href="global.html#Genre">Genre</a></li><li><a href="global.html#Language">Language</a></li><li><a href="global.html#LookupType">LookupType</a></li><li><a href="global.html#Mode">Mode</a></li><li><a href="global.html#Mods">Mods</a></li><li><a href="global.html#MultiScoringType">MultiScoringType</a></li><li><a href="global.html#MultiTeam">MultiTeam</a></li><li><a href="global.html#MultiTeamType">MultiTeamType</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a> on Sat Apr 11 2020 14:41:31 GMT+1000 (GMT+10:00) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>