async function requestCalendars(xhr, homeUrl) {
  const ICAL_OBJS = new Set(['VEVENT', 'VFREEBUSY', 'VALARM']);

  const req = this.dav.request.propfind({
    props: [
      { name: 'calendar-description', namespace: this.dav.ns.CALDAV },
      { name: 'calendar-timezone', namespace: this.dav.ns.CALDAV },
      { name: 'calendar-color', namespace: this.dav.ns.CALDAV_APPLE },
      { name: 'displayname', namespace: this.dav.ns.DAV },
      { name: 'getctag', namespace: this.dav.ns.CALENDAR_SERVER },
      { name: 'resourcetype', namespace: this.dav.ns.DAV },
      { name: 'supported-calendar-component-set', namespace: this.dav.ns.CALDAV },
      { name: 'sync-token', namespace: this.dav.ns.DAV },
      { name: 'source', namespace: this.dav.ns.CALENDAR_SERVER },
    ],
    depth: 1,
  });

  const listCalendars = await xhr.send(req, homeUrl);
  // Filter to get only calendar from dav objects
  return listCalendars
    .filter((res) => res.props.resourcetype.includes('calendar') || res.props.resourcetype.includes('subscribed'))
    .filter((res) => {
      const components = res.props.supportedCalendarComponentSet || [];
      return components.reduce((hasObjs, component) => {
        return hasObjs || ICAL_OBJS.has(component);
      }, false);
    })
    .map((res) => {
      logger.info(`CalDAV : Found calendar ${res.props.displayname}`);

      return {
        data: res,
        description: res.props.calendarDescription,
        timezone: res.props.calendarTimezone,
        color: res.props.calendarColor,
        url: res.props.resourcetype.includes('calendar') ? url.resolve(homeUrl, res.href) : res.props.source,
        ctag: res.props.getctag,
        displayName: res.props.displayname,
        components: res.props.supportedCalendarComponentSet,
        type: res.props.resourcetype.includes('calendar') ? 'CALDAV' : 'WEBCAL',
        syncToken: res.props.syncToken,
      };
    });
}
@description Get calendars from caldav server.
@param {object} xhr - Request with dav credentials.
@param {string} homeUrl - Request url.
@returns {Promise} Resolving with list of calendars.
@example
requestCalendars(xhr, homeUrl)