CleverCloud / warp10-scala-client

Warp10 Scala client which is using Pekko HTTP or Streams.
Other
5 stars 3 forks source link

Feature request: support any stack content #245

Closed miton18 closed 2 months ago

miton18 commented 2 months ago

Because a WarpScript exection can return a stack of any elements (GTS, but also, maps, lists, primitives) It could be helpful to support some generic here. Furthermore, in a stack each element can be of different type

This is what I have in mind

def exec(script: WarpScript): Future[Stack] 

trait Stack {
  gef get[T](index: Int)(implicit io.circe.Decoder[T]): Either[String, T]
}

The purpose of get() is to retrieve the Nth stack element and use some kind of circe decoder to parse it into T This way, I can, for exempe, get[String](0) to get a string I had set on top of the stack

KannarFr commented 2 months ago

LGTM but keep in mind that it's Scala 3 #implicits.