stackexchange-api
Version:
A Node.js wrapper for the StackExchange API
29 lines (28 loc) • 1.91 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ShallowUser_1 = require("./ShallowUser");
/**
* The equivalent of [Type badge](https://api.stackexchange.com/docs/types/badge).<br>
* This object represents a Badge on a [Stack Exchange site](https://stackexchange.com/sites).<br>
* Some Badges, like "Autobiographer", are held in common across all Stack Exchange sites. Others, like most tag badges, vary on a site by site basis.<br>
* Remember that ids are never guaranteed to be the same between sites, even if a Badge exists on both sites.
*/
class Badge {
constructor(badge) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
this.awardCount = (_b = (_a = badge) === null || _a === void 0 ? void 0 : _a.award_count, (_b !== null && _b !== void 0 ? _b : null));
this.badgeId = (_d = (_c = badge) === null || _c === void 0 ? void 0 : _c.badge_id, (_d !== null && _d !== void 0 ? _d : null));
this.badgeType = (_f = (_e = badge) === null || _e === void 0 ? void 0 : _e.badge_type, (_f !== null && _f !== void 0 ? _f : null));
this.description = (_h = (_g = badge) === null || _g === void 0 ? void 0 : _g.description, (_h !== null && _h !== void 0 ? _h : null));
this.link = (_k = (_j = badge) === null || _j === void 0 ? void 0 : _j.link, (_k !== null && _k !== void 0 ? _k : null));
this.name = (_m = (_l = badge) === null || _l === void 0 ? void 0 : _l.name, (_m !== null && _m !== void 0 ? _m : null));
this.rank = (_p = (_o = badge) === null || _o === void 0 ? void 0 : _o.rank, (_p !== null && _p !== void 0 ? _p : null));
if (typeof ((_q = badge) === null || _q === void 0 ? void 0 : _q.user) === 'undefined') {
this.user = null;
}
else {
this.user = new ShallowUser_1.ShallowUser(badge.user);
}
}
}
exports.Badge = Badge;