const { DAVClient } = require('tsdav');

async function test() {
  const client = new DAVClient({
    serverUrl: 'https://ds.martin-bierschenk.de:91/caldav/martin',
    credentials: {
      username: 'martin',
      password: 'DS916-MB-ImC.2019',
    },
    authMethod: 'Basic',
    defaultAccountType: 'caldav',
  });
  
  await client.login();
  console.log("Logged in:", client.account);
  const calendars = await client.fetchCalendars();
  console.log('Calendars count:', calendars.length);
  calendars.forEach((c, idx) => {
    console.log(`\nCalendar ${idx + 1}:`, c.displayName);
    console.log('url:', c.url);
    console.log('components:', c.components);
  });
}

test().catch(console.error);
