UNPKG

@donation-alerts/api

Version:
111 lines 3.33 kB
import { DataObject, type DonationAlertsOutputCurrency } from '@donation-alerts/common'; /** * Type of the alert. Always `Donations` in this case. */ export type DonationNameType = 'Donations'; /** * The message type for donations. * * @remarks * The message can either be a plain text message (`text`) or a message containing audio (`audio`). */ export type DonationMessageType = 'text' | 'audio'; /** @internal */ export interface DonationAlertsDonationData { id: number; name: DonationNameType; username: string; message_type: DonationMessageType; message: string; amount: number; currency: DonationAlertsOutputCurrency; is_shown: 0 | 1; created_at: string; shown_at: string | null; } /** * Represents a donation received through Donation Alerts as a plain JavaScript object. */ export interface DonationAlertsDonationJson { id: number; name: DonationNameType; username: string; messageType: DonationMessageType; message: string; amount: number; currency: DonationAlertsOutputCurrency; isShown: boolean; creationDate: Date; showDate: Date | null; } /** * Represents a donation received through Donation Alerts. * * @remarks * This class provides detailed information about a donation, including user details, donation amount, message, * currency, and timestamps for creation and display. */ export declare class DonationAlertsDonation extends DataObject<DonationAlertsDonationData, DonationAlertsDonationJson> { /** * The unique identifier for the donation alert. */ get id(): number; /** * The type of the alert. * * @remarks * Always returns `Donations` in this context. */ get name(): DonationNameType; /** * The username of the donor. * * @remarks * This is the name that the user who sent the donation chose to display publicly. */ get username(): string; /** * The type of the message accompanying the donation. * * @remarks * Possible values: * - `text` — A plain text message sent with the donation. * - `audio` — A message that includes an audio component. */ get messageType(): DonationMessageType; /** * The message sent by the donor along with the donation. */ get message(): string; /** * The donated amount. */ get amount(): number; /** * The currency of the donated amount. * * @remarks * This value represents the currency code in ISO 4217 format (e.g., `USD`, `EUR`, `RUB`). */ get currency(): DonationAlertsOutputCurrency; /** * Indicates whether the alert was shown in the streamer's widget. * * @returns `true` if the donation alert has been displayed; otherwise, `false`. */ get isShown(): boolean; /** * The date and time when the donation was received. * * @returns A `Date` object representing the donation creation time. */ get creationDate(): Date; /** * The date and time when the alert was shown on the streamer's widget. * * @returns A `Date` object if the alert was shown; `null` otherwise. */ get showDate(): Date | null; toJSON(): DonationAlertsDonationJson; } //# sourceMappingURL=donation-alerts-donation.d.ts.map