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

endpoints.documented.openapi.Responses.scala Maven / Gradle / Ivy

There is a newer version: 0.10.1
Show newest version
package endpoints
package documented
package openapi

/**
  * Interpreter for [[algebra.Responses]]
  */
trait Responses
  extends algebra.Responses {

  type Response[A] = List[DocumentedResponse]

  /**
    * @param status Response status code (e.g. 200)
    * @param documentation Human readable documentation
    * @param content Map that associates each possible content-type (e.g. “text/html”) with a [[MediaType]] description
    */
  case class DocumentedResponse(status: Int, documentation: String, content: Map[String, MediaType])

  def emptyResponse(documentation: String): Response[Unit] = DocumentedResponse(200, documentation, Map.empty) :: Nil

  def textResponse(documentation: String): Response[String] = DocumentedResponse(200, documentation, Map("text/plain" -> MediaType(None))) :: Nil

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy