Skip to content

0xN1nja/gdav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdav

CalDAV and CardDAV client for Gleam

Package Version Hex Docs

This package uses the sans-io approach, meaning it does not send HTTP requests itself, instead it gives you functions for creating HTTP requests for and decoding HTTP responses from a DAV API, and you send the requests with a HTTP client of your choosing.

This HTTP client independence gives you full control over HTTP, and means this library can be used on both the Erlang and JavaScript runtimes.

gleam add gdav@1
import gdav
import gdav/get_all_events
import gleam/hackney

pub fn main() {
  let creds =
    gdav.credentials("http://dav-api-host:port/dav.php")
    |> gdav.with_basic_auth("YOUR_USERNAME", "YOUR_PASSWORD")

  let request =
    get_all_events.request("YOUR_USERNAME", "CALENDAR_NAME")
    |> get_all_events.build(creds)

  let assert Ok(res) = hackney.send(request)

  let assert Ok(calendar_data) = get_all_events.response(res) // a list containing strings of calendar data
}

Further documentation can be found at https://hexdocs.pm/gdav.

About

CalDAV and CardDAV client for Gleam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages