caldav/internal/http

Types

A normalized HTTP response used by the internal transport layer.

pub type HttpResponse {
  HttpResponse(
    status: Int,
    headers: List(#(String, String)),
    body: String,
  )
}

Constructors

  • HttpResponse(
      status: Int,
      headers: List(#(String, String)),
      body: String,
    )

Values

pub fn delete(
  client client: types.Client,
  url url: String,
) -> Result(HttpResponse, error.Error)

Sends a DELETE request.

pub fn expect_success(
  response: HttpResponse,
) -> Result(Nil, error.Error)

Validates common successful statuses used by CalDAV operations.

pub fn get(
  client client: types.Client,
  url url: String,
) -> Result(HttpResponse, error.Error)

Sends a GET request.

pub fn propfind(
  client client: types.Client,
  url url: String,
  body body: String,
  depth depth: String,
) -> Result(HttpResponse, error.Error)

Sends a PROPFIND request with the provided XML body and Depth header.

pub fn put(
  client client: types.Client,
  url url: String,
  body body: String,
  content_type content_type: String,
) -> Result(HttpResponse, error.Error)

Sends a PUT request.

pub fn report(
  client client: types.Client,
  url url: String,
  body body: String,
  depth depth: String,
) -> Result(HttpResponse, error.Error)

Sends a REPORT request.

pub fn request(
  client client: types.Client,
  method method: http.Method,
  url url: String,
  headers extra_headers: List(#(String, String)),
  body body: String,
) -> Result(HttpResponse, error.Error)

Sends a raw HTTP request using the current client configuration.

Search Document