dove

Types

pub opaque type Connection(a)
pub type RequestBody {
  JSON(String)
  PlainText(String)
}

Constructors

  • JSON(String)
  • PlainText(String)
pub type RequestOption(a) {
  Body(RequestBody)
  Headers(List(#(String, String)))
  QueryParams(List(#(String, String)))
  ResponseDecoder(
    fn(dynamic.Dynamic) -> Result(a, List(dynamic.DecodeError)),
  )
}

Constructors

  • Body(RequestBody)
  • Headers(List(#(String, String)))
  • QueryParams(List(#(String, String)))
  • ResponseDecoder(
      fn(dynamic.Dynamic) -> Result(a, List(dynamic.DecodeError)),
    )
pub type ResponseBody(a) {
  Empty
  Raw(String)
  JSONDecoded(a)
  InvalidOrUnexpectedJSON(String, json.DecodeError)
}

Constructors

  • Empty
  • Raw(String)
  • JSONDecoded(a)
  • InvalidOrUnexpectedJSON(String, json.DecodeError)

Functions

pub fn connect(
  host: String,
  port: Int,
  timeout: Int,
) -> Result(Connection(a), Error)
pub fn get_response(
  conn: Connection(a),
  ref: Reference,
) -> Result(Response(ResponseBody(a)), Error)
pub fn receive(
  conn: Connection(a),
  timeout: Int,
) -> Connection(a)
pub fn request(
  conn: Connection(a),
  method: Method,
  path: String,
  options: List(RequestOption(a)),
) -> Result(#(Connection(a), Reference), Error)
Search Document