com.sap.cloud.sdk.services.recastai.MessageResponseWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of recast-ai Show documentation
Show all versions of recast-ai Show documentation
Integration of SAP Conversational AI, aka Recast AI
(Beta release, still subject to change - up to discontinuation of module).
/*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.sap.cloud.sdk.services.recastai;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.annotations.Beta;
import com.google.gson.Gson;
import com.sap.cloud.sdk.services.recastai.botresponses.ResponseInterface;
import lombok.NoArgsConstructor;
/**
* Wraps around multiple response objects to send them to a conversation in one single json object. This object is used
* together with RecastMessage.
*
* Be aware that this class is in Beta (as indicated by the annotation) and therefore subject to breaking changes.
*
*/
@Beta
@NoArgsConstructor
public class MessageResponseWrapper
{
private ResponseInterface[] messages;
/**
* This function generates the json representation of this object and returns it as a string to the user.
*
* @return a stringyfied json of this object
*/
@Nullable
public String getResponse()
{
final Gson gson = new Gson();
return gson.toJson(this);
}
/**
* Sets a message array to be sent out.
*
* @param messages
* an array with object followibng the response interface.
*/
public void setMessages( @Nonnull final ResponseInterface[] messages )
{
this.messages = messages;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy