jove.notebook.Protocol.scala Maven / Gradle / Ivy
The newest version!
package jove.notebook
import argonaut._, Argonaut._, Shapeless._
object Protocol {
case class Cluster(profile: String, profile_dir: String, status: String, n: String)
sealed trait Model
case class DirectoryModel(
`type`: String, // directory
content: List[Model],
format: Option[String],
name: String,
path: String,
last_modified: String,
created: String,
mimetype: Option[String],
writable: Boolean
) extends Model
case class FileModel(
`type`: String, // file
content: String,
format: Option[String],
name: String,
path: String,
last_modified: String,
created: String,
mimetype: Option[String],
writable: Boolean
) extends Model
case class NotebookModel(
`type`: String, // notebook
content: Json,
format: Option[String],
name: String,
path: String,
last_modified: String,
created: String,
mimetype: Option[String],
writable: Boolean
) extends Model
case class CheckPoint(
id: String,
last_modified: String
)
implicit val directoryModelEncodeJson =
implicitly[EncodeJson[DirectoryModel]]
implicit val notebookModelEncodeJson: EncodeJson[NotebookModel] =
EncodeJson.derive[NotebookModel]
implicit val modelEncodeJson: EncodeJson[Model] = EncodeJson[Model] {
case m: DirectoryModel => m.asJson
case m: FileModel => m.asJson
case m: NotebookModel => notebookModelEncodeJson(m)
}
case class KernelSpec(name: String, display_name: String)
case class KernelSpecs(default: String, kernelspecs: Map[String, KernelSpec])
object Session {
case class Notebook(path: String)
case class Kernel(id: String, name: String)
}
case class Session(id: String, notebook: Session.Notebook, kernel: Session.Kernel)
case class Kernel(id: String, name: String)
}