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

io.sphere.sdk.subscriptions.Payload Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.subscriptions;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.sphere.sdk.annotations.ResourceValue;
import io.sphere.sdk.messages.UserProvidedIdentifiers;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.projects.Project;

import javax.annotation.Nullable;

/**
 * Common interface for all subscription payloads.
 *
 * @param  the resource type
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "notificationType", visible = true)
@JsonSubTypes({
        @JsonSubTypes.Type(value = MessageSubscriptionPayload.class, name  = "Message"),
        @JsonSubTypes.Type(value = ResourceCreatedPayload.class, name  = "ResourceCreated"),
        @JsonSubTypes.Type(value = ResourceUpdatedPayload.class, name  = "ResourceUpdated"),
        @JsonSubTypes.Type(value = ResourceDeletedPayload.class, name  = "ResourceDeleted")})
@ResourceValue
public interface Payload {
    /**
     * The key of the project. Useful if the same queue is filled from multiple projects.
     *
     * @return the project key {@link Project#getKey()}
     */
    String getProjectKey();

    /**
     * Identifies the payload.
     *
     * @return the payload type
     */
    String getNotificationType();

    /**
     * A reference to the resource that triggered this delivery.
     *
     * @return the reference to the resource that triggered this delivery
     */
    Reference getResource();

    @Nullable
    UserProvidedIdentifiers getResourceUserProvidedIdentifiers();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy