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

com.sap.cloud.sdk.services.recastai.botresponses.CardResponse Maven / Gradle / Ivy

Go to download

Integration of SAP Conversational AI, aka Recast AI (Beta release, still subject to change - up to discontinuation of module).

There is a newer version: 2.28.0
Show newest version
/*
 * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
 */

package com.sap.cloud.sdk.services.recastai.botresponses;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import com.google.common.annotations.Beta;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * Outermost wrapper for a Card to be send to a conversation.
 */
@Beta
public class CardResponse implements ResponseInterface
{
    @SerializedName( "type" )
    @Expose
    private final String type = "card";

    @SerializedName( "content" )
    @Expose
    private CardContent content;

    /**
     * Constructor to initialise a new card response with existing CardContent object.
     * 
     * @param content
     *            the CardContent object to be sent.
     */
    public CardResponse( @Nonnull final CardContent content )
    {
        this.content = content;
    }

    /**
     * An empty constructor for incremental building.
     */
    public CardResponse()
    {
    }

    /**
     * Returns the current content which would be sent as part of a response.
     * 
     * @return the current CardContent object
     */
    @Nullable
    public CardContent getContent()
    {
        return content;
    }

    /**
     * Function replaces the current CardContent (can be null) with the given one.
     * 
     * @param content
     *            the new CardContent object
     */
    public void setContent( @Nonnull final CardContent content )
    {
        this.content = content;
    }

    /**
     * Returns the type of this response, which can not be altered by the user.
     * 
     * @return a string representation taken from the Recast response types.
     */
    @Nullable
    @Override
    public String getType()
    {
        return type;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy