package main import ( "fmt" "io" "log" "net/http" "strings" ) // simple test XML const xml string = ` ` var client *http.Client func init_dav_client() { client = &http.Client{} } type SimpleCalDavData struct { DisplayName string Calandars []string } // this makes stalwart assumptions func get_caldav_data(username string, password string) SimpleCalDavData { req, _ := http.NewRequest( "PROPFIND", serverConfig.URL+"/dav/cal/"+convert_username_into_url(username), strings.NewReader(xml), ) req.SetBasicAuth(username, password) req.Header.Set("Depth", "1") req.Header.Set("Content-Type", "application/xml") resp, err := client.Do(req) if err != nil { fmt.Print(err.Error()) } defer resp.Body.Close() _, err = io.ReadAll(resp.Body) if err != nil { log.Fatal(err) } return SimpleCalDavData{ DisplayName: "N/A", Calandars: []string{}, } }