All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.twitch4j.pubsub.domain.CharityDonationData Maven / Gradle / Ivy

There is a newer version: 1.23.0
Show newest version
package com.github.twitch4j.pubsub.domain;

import com.github.twitch4j.common.util.DonationAmount;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.util.Optional;

@Data
@Setter(AccessLevel.PRIVATE)
public class CharityDonationData {

    private String campaignId;

    private String campaignCurrency = "USD";

    private Long donationTotal;

    private Long goalTarget;

    public DonationAmount getTotal() {
        return new DonationAmount(donationTotal, 2, campaignCurrency);
    }

    public Optional getTarget() {
        return Optional.ofNullable(goalTarget)
            .filter(l -> l > 0)
            .map(target -> new DonationAmount(target, 2, campaignCurrency));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy