@donation-alerts/api
Version:
Interact with Donation Alerts API.
80 lines (79 loc) • 2.19 kB
JavaScript
import { __decorate } from "tslib";
import { DataObject, rawDataSymbol, ReadDocumentation } from '@donation-alerts/common';
/**
* Represents user profile information.
*
* @remarks
* This class provides access to user-related profile data, including unique identifiers,
* display names, email addresses, and authentication tokens for Centrifugo connections.
*/
let DonationAlertsUser = class DonationAlertsUser extends DataObject {
/**
* The unique and unchangeable user identifier.
*
* @returns The user ID as a number.
*/
get id() {
return this[rawDataSymbol].id;
}
/**
* The unique textual code (username) for the user.
*
* @returns The user's unique code as a string.
*/
get code() {
return this[rawDataSymbol].code;
}
/**
* The unique displayed username.
*
* @remarks
* This name is used for display purposes on the platform and can be updated by the user.
*
* @returns The display name as a string.
*/
get name() {
return this[rawDataSymbol].name;
}
/**
* The URL to the personal profile picture.
*
* @returns The URL to the user's avatar as a string.
*/
get avatar() {
return this[rawDataSymbol].avatar;
}
/**
* The email associated with the user's account.
*
* @returns The user's email as a string.
*/
get email() {
return this[rawDataSymbol].email;
}
/**
* Centrifugo connection token.
*
* @remarks
* A token issued to the user for establishing websocket connections via Centrifugo.
*
* @returns The Centrifugo connection token as a string.
*/
get socketConnectionToken() {
return this[rawDataSymbol].socket_connection_token;
}
toJSON() {
return {
id: this.id,
code: this.code,
name: this.name,
avatar: this.avatar,
email: this.email,
socketConnectionToken: this.socketConnectionToken,
};
}
};
DonationAlertsUser = __decorate([
ReadDocumentation('api')
], DonationAlertsUser);
export { DonationAlertsUser };