UNPKG

@donation-alerts/events

Version:
74 lines 2.58 kB
import { DataObject } from '@donation-alerts/common'; import { DonationAlertsPollOption, type DonationAlertsPollOptionData, DonationAlertsPollOptionJson } from './donation-alerts-poll-option'; /** * The type of a poll, which determines the way the winner is calculated: * - `count`: The winner is the option with the most number of donations. * - `sum`: The winner is the option with the highest total sum of donations. */ export type DonationAlertsPollType = 'count' | 'sum'; /** @internal */ export interface DonationAlertsPollUpdateEventData { id: number; is_active: 0 | 1; title: string; allow_user_options: 0 | 1; type: DonationAlertsPollType; options: DonationAlertsPollOptionData[]; } /** * Represents an updated poll object from Donation Alerts as a plain JavaScript object. */ export interface DonationAlertsPollUpdateEventJson { id: number; isActive: boolean; title: string; allowUserOptions: boolean; type: DonationAlertsPollType; options: DonationAlertsPollOptionJson[]; } /** * Represents an updated poll object from Donation Alerts. * * @remarks * This class provides access to key properties of a poll, including its options * and configuration details. It also indicates whether the poll is active or not. */ export declare class DonationAlertsPollUpdateEvent extends DataObject<DonationAlertsPollUpdateEventData, DonationAlertsPollUpdateEventJson> { /** * The unique identifier of the poll. */ get id(): number; /** * Indicates whether the poll is currently active. * * @returns `true` if the poll is active, otherwise `false`. */ get isActive(): boolean; /** * The title of the poll. */ get title(): string; /** * Indicates whether donors are allowed to add custom options to the poll. * * @returns `true` if custom options are allowed, otherwise `false`. */ get allowUserOptions(): boolean; /** * The type of the poll, determining how the winner is calculated. * * @remarks * - `count`: The option with the most donations wins. * - `sum`: The option with the highest total donation sum wins. */ get type(): DonationAlertsPollType; /** * The list of available options for the poll. * * @remarks * Each option is represented as an instance of {@link DonationAlertsPollOption}. */ get options(): DonationAlertsPollOption[]; toJSON(): DonationAlertsPollUpdateEventJson; } //# sourceMappingURL=donation-alerts-poll-update-event.d.ts.map