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

endpoints.documented.algebra.Assets.scala Maven / Gradle / Ivy

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

/**
  * Algebra interface for describing assets.
  *
  * This interface is modeled after [[endpoints.algebra.Assets]] but some methods
  * take additional parameters carrying documentation.
  */
trait Assets extends Endpoints {

  /** An HTTP request to retrieve an asset */
  type AssetRequest
  /** The path of the asset */
  type AssetPath
  /** An HTTP response containing an asset */
  type AssetResponse

  /**
    * A [[Path]] that extracts an [[AssetPath]] from all the path segments.
    *
    * Consider the following definition:
    * {{{
    *   val assets = assetsEndpoint(get(path / "assets" / assetsSegments))
    * }}}
    *
    * Then, here is how the following requests are decoded:
    * - `/assets/foo` => `foo`
    * - `/assets/foo/bar` => `foo/bar`
    */
  def assetSegments(name: String): Path[AssetPath]

  /**
    * @param url URL description
    * @return An HTTP endpoint serving assets
    */
  def assetsEndpoint(url: Url[AssetPath], documentation: String, notFoundDocumentation: String): Endpoint[AssetRequest, AssetResponse]

  /** The digests of the assets */
  def digests: Map[String, String]

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy