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

de.bytefish.fcmjava.requests.data.DataUnicastMessage Maven / Gradle / Ivy

There is a newer version: 2.5
Show newest version
// Copyright (c) Philipp Wagner. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

package de.bytefish.fcmjava.requests.data;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.bytefish.fcmjava.model.options.FcmMessageOptions;
import de.bytefish.fcmjava.requests.FcmUnicastMessage;
import de.bytefish.fcmjava.requests.notification.NotificationPayload;

public class DataUnicastMessage extends FcmUnicastMessage {

    private final Object data;
    private final NotificationPayload notification;

    public DataUnicastMessage(FcmMessageOptions options, String to, Object data) {
        this(options, to, data, null);
    }

    public DataUnicastMessage(FcmMessageOptions options, String to, Object data, NotificationPayload notification) {
        super(options, to);

        this.data = data;
        this.notification = notification;
    }

    @Override
    @JsonProperty("data")
    public Object getPayload() {
        return data;
    }


    @JsonProperty("notification")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public NotificationPayload getNotificationPayload() {
        return this.notification;
    }

}