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

org.rapaio.jupyter.kernel.message.messages.ShellExecuteReply Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.rapaio.jupyter.kernel.message.messages;

import java.util.Map;

import org.rapaio.jupyter.kernel.core.ExpressionValue;
import org.rapaio.jupyter.kernel.message.ContentType;
import org.rapaio.jupyter.kernel.message.MessageType;

import com.google.gson.annotations.SerializedName;

public record ShellExecuteReply(
        @SerializedName("status") Status status,
        @SerializedName("execution_count") int executionCount,
        @SerializedName("user_expressions") Map evaluatedUserExpr
) implements ContentType {

    public static ShellExecuteReply withOk(int executionCount, Map evaluatedUserExpr) {
        return new ShellExecuteReply(Status.OK, executionCount, evaluatedUserExpr);
    }

    public static ShellExecuteReply withError(int executionCount) {
        return new ShellExecuteReply(Status.ERROR, executionCount, null);
    }

    @Override
    public MessageType type() {
        return MessageType.SHELL_EXECUTE_REPLY;
    }

    public enum Status {
        @SerializedName("ok") OK,
        @SerializedName("error") ERROR
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy