nodesu
Version:
a node.js osu! api wrapper
113 lines (90 loc) • 5.42 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: struct/User.js</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">Source: struct/User.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';
const UserEvent = require('./UserEvent');
/**
* User class.
* @memberof module:CustomClasses
* @property {Number} id User's ID [alias: userId]
* @property {String} username Username [alias: name]
* @property {Date} joinDate Date the user registered on osu!
* @property {Number} count300
* @property {Number} count100
* @property {Number} count50
* @property {Number} playcount
* @property {Number} rankedScore
* @property {Number} totalScore
* @property {Number} ppRank [alias: rank]
* @property {Number} level
* @property {Number} ppRaw [alias: pp]
* @property {Number} accuracy
* @property {Number} countRankSS
* @property {Number} countRankS
* @property {Number} countRankA
* @property {Number} country
* @property {Number} totalSecondsPlayed [alias: playTime]
* @property {Number} ppCountryRank [alias: countryRank]
* @property {UserEvent[]} events Array of user events
*/
class User {
constructor(data) {
this.id = Number(data.user_id);
this.username = data.username;
this.joinDate = new Date(data.join_date + ' GMT');
this.count300 = Number(data.count300);
this.count100 = Number(data.count100);
this.count50 = Number(data.count50);
this.playcount = Number(data.playcount);
this.rankedScore = Number(data.ranked_score);
this.totalScore = Number(data.total_score);
this.ppRank = Number(data.pp_rank);
this.level = Number(data.level);
this.ppRaw = Number(data.pp_raw);
this.accuracy = Number(data.accuracy);
this.countRankSS = Number(data.count_rank_ss);
this.countRankS = Number(data.count_rank_s);
this.countRankA = Number(data.count_rank_a);
this.country = data.country;
this.totalSecondsPlayed = Number(data.totalSecondsPlayed);
this.ppCountryRank = Number(data.pp_country_rank);
this.events = data.events.map(d => new UserEvent(d));
}
get userId() { return this.id; }
get name() { return this.username; }
get rank() { return this.ppRank; }
get pp() { return this.ppRaw; }
get countryRank() { return this.ppCountryRank; }
get playTime() { return this.totalSecondsPlayed; }
}
module.exports = User;
</code></pre>
</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>