label('Importadresse: iCal-Export des externen Portals') ->helperText('Im Vermieterbereich des Portals unter „Kalender exportieren“. Leer lassen, wenn das Portal keinen Kalender anbietet.') ->url() ->password() ->revealable() ->maxLength(2048), ]; } public function canImport(Channel $channel): bool { return filled($channel->setting('import_url')); } public function fetchOccupations(Channel $channel): array { return $this->parser->parse($this->fetchCalendar($channel)); } /** @return array{events: list, calendar: array} */ public function fetchDocument(Channel $channel): array { return $this->parser->parseDocument($this->fetchCalendar($channel)); } private function fetchCalendar(Channel $channel): string { $url = preg_replace('#^webcals?://#i', 'https://', (string) $channel->setting('import_url')); try { $response = Http::timeout(20) ->retry(2, 1000) ->withHeaders(['Accept' => 'text/calendar']) ->get($url) ->throw(); } catch (ConnectionException|RequestException $exception) { throw new ChannelSyncException('Kalender konnte nicht abgerufen werden. Netzwerkverbindung und Portaladresse prüfen.', previous: $exception); } return $response->body(); } }