WSRequestHelper

io.cequence.openaiscala.service.ws.WSRequestHelper

Base class for web services with handy GET, POST, and DELETE request builders, and response handling

Attributes

Since:

Jan 2023

Graph
Supertypes
trait WSHelper
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Types

protected type PEP
protected type PT
protected type RichJsResponse = RichResponse[JsValue]
protected type RichResponse[T] = Either[T, (Int, String)]
protected type RichSourceResponse = RichResponse[Source[ByteString, _]]
protected type RichStringResponse = RichResponse[String]

Value members

Concrete methods

protected def createUrl(endpoint: Option[PEP], value: Option[String]): String
protected def execDELETE(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])]): Future[JsValue]
protected def execDELETEWithStatus(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]
protected def execGET(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])]): Future[JsValue]
protected def execGETJsonAux(request: StandaloneWSRequest, endPointForLogging: Option[PEP], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]
protected def execGETStringAux(request: StandaloneWSRequest, endPointForLogging: Option[PEP], acceptableStatusCodes: Seq[Int]): Future[RichStringResponse]
protected def execGETWithStatus(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]
protected def execPOST(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], bodyParams: Seq[(PT, Option[JsValue])]): Future[JsValue]
protected def execPOSTJsonAux[T : BodyWritable](request: StandaloneWSRequest, body: T, endPointForLogging: Option[PEP], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]
protected def execPOSTMultipart(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], fileParams: Seq[(PT, File, Option[String])], bodyParams: Seq[(PT, Option[Any])]): Future[JsValue]

Attributes

fileParams

the third param in a tuple is a display (header) file name

protected def execPOSTMultipartWithStatus(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], fileParams: Seq[(PT, File, Option[String])], bodyParams: Seq[(PT, Option[Any])], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]

Attributes

fileParams

the third param in a tuple is a display (header) file name

protected def execPOSTMultipartWithStatusString(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], fileParams: Seq[(PT, File, Option[String])], bodyParams: Seq[(PT, Option[Any])], acceptableStatusCodes: Seq[Int]): Future[RichStringResponse]

Attributes

fileParams

the third param in a tuple is a display (header) file name

protected def execPOSTSource(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], bodyParams: Seq[(PT, Option[JsValue])]): Future[Source[ByteString, _]]
protected def execPOSTSourceAux[T : BodyWritable](request: StandaloneWSRequest, body: T, endPointForLogging: Option[PEP], acceptableStatusCodes: Seq[Int]): Future[RichSourceResponse]
protected def execPOSTSourceWithStatus(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], bodyParams: Seq[(PT, Option[JsValue])], acceptableStatusCodes: Seq[Int]): Future[RichSourceResponse]
protected def execPOSTStringAux[T : BodyWritable](request: StandaloneWSRequest, body: T, endPointForLogging: Option[PEP], acceptableStatusCodes: Seq[Int]): Future[RichStringResponse]
protected def execPOSTWithStatus(endPoint: PEP, endPointParam: Option[String], params: Seq[(PT, Option[Any])], bodyParams: Seq[(PT, Option[JsValue])], acceptableStatusCodes: Seq[Int]): Future[RichJsResponse]
protected def getWSRequest(endPoint: Option[PEP], endPointParam: Option[String], params: Seq[(String, Any)]): StandaloneWSRequest
protected def getWSRequestOptional(endPoint: Option[PEP], endPointParam: Option[String], params: Seq[(String, Option[Any])]): StandaloneWSRequest
protected def handleErrorResponse[T](response: RichResponse[T]): T
protected def handleNotFoundAndError[T](response: RichResponse[T]): Option[T]
protected def jsonBodyParams(params: (PT, Option[Any])*): Seq[(PT, Option[JsValue])]
protected def paramsAsString(params: Seq[(String, Any)]): String
protected def paramsOptionalAsString(params: Seq[(String, Option[Any])]): String
protected def toOptionalParams(params: Seq[(PT, Any)]): Seq[(PT, Some[Any])]
protected def toStringParams(params: Seq[(PT, Option[Any])]): Seq[(String, Option[Any])]

Inherited methods

def close(): Unit

Attributes

Inherited from:
WSHelper
protected def timeouts: Timeouts

Attributes

Inherited from:
WSHelper

Abstract fields

protected val coreUrl: String

Concrete fields

protected val serviceName: String

Inherited fields

lazy protected val client: StandaloneWSClient

Attributes

Inherited from:
WSHelper

Implicits

Implicits

implicit protected val ec: ExecutionContext

Inherited implicits

implicit protected val materializer: Materializer

Attributes

Inherited from:
WSHelper