SystemOne

com.softinio.verdict4s.SystemOne
object SystemOne

Driving the protocol with no effect system at all.

verdict4s-core carries only cats-core, circe and Iron: no effect type, no HTTP client, no fs2. That is what this object is for. Render a request to JSON, send it with whatever HTTP client you already have, and parse the reply back into typed answers:

val body = SystemOne.render(request)
val text = myHttpClient.post(SystemOne.evaluateUrl, body) // your code
val evaluation = SystemOne.parse(text)

This is the path for Twitter Future, for Akka or Pekko HTTP, for sttp, and for a plain blocking client — anything without a lawful cats-effect instance. If you do have one, verdict4s-client is less work.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
SystemOne.type

Members list

Value members

Concrete methods

def authorization(apiKey: ApiKey): String

The Authorization header value for a key.

The Authorization header value for a key.

Attributes

def headers(apiKey: ApiKey): List[(String, String)]

The headers every request needs, as plain pairs.

The headers every request needs, as plain pairs.

Attributes

Parse a successful response body into typed answers.

Parse a successful response body into typed answers.

Attributes

def parseAsk[Q <: Tuple](ask: Ask[Q], body: String): Either[Verdict4sError, Answers[Q]]

Parse a response and project it through the questions that produced it.

Parse a response and project it through the questions that produced it.

Attributes

def parseError(status: Int, body: String, headers: Map[String, String] = ...): Api

Turn an unsuccessful response into a typed error.

Turn an unsuccessful response into a typed error.

Value parameters

body

the raw body, which need not be JSON

headers

the response headers, for the request id and Retry-After

status

the HTTP status code

Attributes

Parse the models endpoint's response, unwrapping its models envelope.

Parse the models endpoint's response, unwrapping its models envelope.

Attributes

Render a request as the JSON to send.

Render a request as the JSON to send.

Attributes

def renderAsk[Q <: Tuple, S : Encoder](ask: Ask[Q], state: S, model: Model = ...): Either[Verdict4sError, String]

Build and render in one step, reporting every problem at once.

Build and render in one step, reporting every problem at once.

SystemOne.renderAsk(Ask(q1, q2), state, Model.JevLatest)

Attributes

Render a request indented, for logs and documentation.

Render a request indented, for logs and documentation.

Attributes

Concrete fields

Where to POST an evaluation, using the default base URL.

Where to POST an evaluation, using the default base URL.

Attributes

Where to GET the list of available models.

Where to GET the list of available models.

Attributes