UNPKG

extra-life-ts

Version:
187 lines (183 loc) 6.94 kB
interface Result<T> { totalRecords?: number; data: T; } type Operators = 'LIKE' | '>' | '>=' | '<' | '<=' | '='; interface WhereArguments<T> { fieldName: T extends undefined ? never : T; operator: Operators; term: string | number; } interface Options<T, IncludedFields extends keyof T | undefined = keyof T> { limit?: number; page?: number; orderBy?: `${Exclude<keyof T, symbol>} ${'DESC' | 'ASC'}`; where?: WhereArguments<IncludedFields>; } type ResourceTypes = 'activity' | 'badges' | 'donations' | 'donors' | 'incentives' | 'milestones' | 'participants'; type ActivityType = 'donation' | 'participantBadge' | 'teamBadge'; interface Activity { amount?: number; createdDateUTC: string; imageURL: string; isIncentive?: boolean; message?: string; title?: string; type: ActivityType; } interface Participant { avatarImageURL: string; createdDateUTC: string; displayName: string; eventID: number; eventName: string; fundraisingGoal: number; hasActivityTracking: boolean; isCustomAvatarImage: boolean; isTeamCaptain?: boolean; isTeamCoCaptain?: boolean; links: { donate: string; page: string; stream?: string; facebookFundraiser?: string; }; numDonations: number; numIncentives: number; numMilestones: number; participantID: number; participantTypeCode: string; /** * So far the strings I've found here are: * A = CoCaptain * C = Captain * I = Individual * T = Team */ role: string; streamingChannel?: string; streamingPlatform?: string; streamIsEnabled?: boolean; streamIsLive?: boolean; sumDonations: number; sumPledges: number; teamID?: number; teamName?: string; } interface TeamParticipant extends Participant { isTeamCaptain: boolean; isTeamCoCaptain: boolean; teamID: number; teamName: string; } interface Badge { description: string; title: string; unlockedDateUTC: string; badgeImageURL: string; badgeCode: string; } interface Donor { avatarImageURL: string; displayName: string; donorID: number; modifiedDateUTC: string; numDonations: number; recipientImageURL: string; sumDonations: number; } interface Donation { amount: number; avatarImageURL: string; createdDateUTC: string; displayName?: string; donationID: string; donorID: string; eventID: number; isRegFee: boolean; links: { recipient: string; }; message?: string | null; donorIsRecipient?: boolean; participantID: number; recipientName: string; recipientImageURL: string; teamID: number; } interface Incentive { amount: number; description: string; endDateUTC?: string; incentiveID: string; incentiveImageURL: string; isActive: boolean; links: { donate: string; }; /** If not present, the quantity is unlimited */ quantity: number; /** If not present, the quantity is unlimited and the quantity claimed is zero */ quantityClaimed: number; startDateUTC?: string; } interface Milestone { description: string; endDateUTC?: string; fundraisingGoal: number; isActive: boolean; isComplete?: boolean; links?: { donate: string; }; milestoneID: string; startDateUTC?: string; } interface Team { avatarImageURL: string; captainDisplayName: string; createdDateUTC: string; eventID: number; eventName: string; fundraisingGoal: number; hasActivityTracking: boolean; hasTeamOnlyDonations: boolean; isCustomAvatarImage: boolean; links: { stream?: string; page: string; }; name: string; numDonations: number; numParticipants: number; sourceTeamID: number; streamingChannel: string; streamingPlatform: string; streamIsEnabled: boolean; streamIsLive: boolean; sumDonations: number; sumPledges: number; teamID: number; } type GetActivityOptions = Options<Activity>; type GetBadgesOptions = Options<Badge, Exclude<keyof Badge, 'badgeImageUrl'>>; type GetDonationsOptions = Options<Donation>; type GetDonorsOptions = Options<Donor>; type GetIncentivesOptions = Options<Incentive, Exclude<keyof Incentive, 'incentiveImageURL' | 'links'>>; type GetMilestonesOptions = Options<Milestone>; type GetTeamParticipantsOptions = Options<TeamParticipant, Exclude<keyof TeamParticipant, 'links' | 'teamName' | 'eventName'>>; type AllOptions = GetActivityOptions | GetBadgesOptions | GetDonationsOptions | GetDonorsOptions | GetIncentivesOptions | GetMilestonesOptions | GetTeamParticipantsOptions; declare const getParticipant: (participantID: string | number) => Promise<Result<Participant>>; declare const getParticipantActivity: (participantID: string | number, opts?: GetActivityOptions) => Promise<Result<Activity[]>>; declare const getParticipantBadges: (participantID: string | number, opts?: GetBadgesOptions) => Promise<Result<Badge[]>>; declare const getParticipantDonations: (participantID: string | number, opts?: GetDonationsOptions) => Promise<Result<Donation[]>>; declare const getParticipantDonors: (participantID: string | number, opts?: GetDonorsOptions) => Promise<Result<Donor[]>>; declare const getParticipantIncentives: (participantID: string | number, opts?: GetIncentivesOptions) => Promise<Result<Incentive[]>>; declare const getParticipantMilestones: (participantID: string | number, opts?: GetMilestonesOptions) => Promise<Result<Milestone[]>>; declare const getTeam: (teamID: string | number) => Promise<Result<Team>>; declare const getTeamParticipants: (teamId: string | number, opts?: GetTeamParticipantsOptions) => Promise<Result<TeamParticipant[]>>; declare const getTeamActivity: (teamID: string | number, opts?: GetActivityOptions) => Promise<Result<Activity[]>>; declare const getTeamBadges: (teamID: string | number, opts?: GetBadgesOptions) => Promise<Result<Badge[]>>; declare const getTeamDonations: (teamID: string | number, opts?: GetDonationsOptions) => Promise<Result<Donation[]>>; declare const getTeamDonors: (teamID: string | number, opts?: GetDonorsOptions) => Promise<Result<Donor[]>>; export { type Activity, type ActivityType, type AllOptions, type Badge, type Donation, type Donor, type GetActivityOptions, type GetBadgesOptions, type GetDonationsOptions, type GetDonorsOptions, type GetIncentivesOptions, type GetMilestonesOptions, type GetTeamParticipantsOptions, type Incentive, type Milestone, type Options, type Participant, type ResourceTypes, type Result, type Team, type TeamParticipant, type WhereArguments, getParticipant, getParticipantActivity, getParticipantBadges, getParticipantDonations, getParticipantDonors, getParticipantIncentives, getParticipantMilestones, getTeam, getTeamActivity, getTeamBadges, getTeamDonations, getTeamDonors, getTeamParticipants };