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

mn.foreman.api.endpoints.notifications.Notifications Maven / Gradle / Ivy

There is a newer version: 1.78.0
Show newest version
package mn.foreman.api.endpoints.notifications;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.ToString;

import java.time.Instant;
import java.util.List;

/**
 * A {@link Notifications} provides a handler for interacting with the
 * /api/notifications Foreman API endpoint.
 */
public interface Notifications {

    /**
     * Obtains the Discord notifications.
     *
     * @param sinceId        The previously observed id (-1 to disable).
     * @param sinceTimestamp The cutoff date (null to disable).
     *
     * @return The Discord notifications.
     */
    List discord(
            int sinceId,
            Instant sinceTimestamp);

    /**
     * Obtains the Google Chat notifications.
     *
     * @param sinceId        The previously observed id (-1 to disable).
     * @param sinceTimestamp The cutoff date (null to disable).
     *
     * @return The Google Chat notifications.
     */
    List googleChat(
            int sinceId,
            Instant sinceTimestamp);

    /**
     * Obtains the Slack notifications.
     *
     * @param sinceId        The previously observed id (-1 to disable).
     * @param sinceTimestamp The cutoff date (null to disable).
     *
     * @return The Slack notifications.
     */
    List slack(
            int sinceId,
            Instant sinceTimestamp);

    /**
     * Obtains the Telegram notifications.
     *
     * @param sinceId        The previously observed id (-1 to disable).
     * @param sinceTimestamp The cutoff date (null to disable).
     *
     * @return The Telegram notifications.
     */
    List telegram(
            int sinceId,
            Instant sinceTimestamp);

    /** A notification. */
    @JsonIgnoreProperties(ignoreUnknown = true)
    @ToString
    class Notification {

        /** The failing miners. */
        @JsonProperty("failingMiners")
        public List failingMiners;

        /** The notification ID. */
        @JsonProperty("id")
        public int id;

        /** When the notification was published. */
        @JsonProperty("published")
        public Instant published;

        /** The subject. */
        @JsonProperty("subject")
        public String subject;

        /** A miner that is currently failing. */
        @JsonIgnoreProperties(ignoreUnknown = true)
        @ToString
        public static class FailingMiner {

            /** The diagnosis. */
            @JsonProperty("diagnosis")
            public List diagnosis;

            /** The miner's name. */
            @JsonProperty("miner")
            public String miner;

            /** The miner ID. */
            @JsonProperty("minerId")
            public int minerId;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy