dove

Types

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

Constructors

  • JSON(String)
  • EmptyRequestBody
  • PlainText(String)
pub type RequestOption(a) {
  JSONDecoder(
    fn(dynamic.Dynamic) -> Result(a, List(dynamic.DecodeError)),
  )
}

Constructors

  • JSONDecoder(
      fn(dynamic.Dynamic) -> Result(a, List(dynamic.DecodeError)),
    )
pub type ResponseBody(a) {
  Raw(String)
  JSONDecoded(a)
  EmptyResponseBody
  InvalidOrUnexpectedJSON(String, json.DecodeError)
}

Constructors

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

Functions

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