Skip to content

Commit

Permalink
fixup! feat: OCC and OCS Calendar Import/Export
Browse files Browse the repository at this point in the history
Signed-off-by: SebastianKrupinski <[email protected]>
  • Loading branch information
SebastianKrupinski committed Jan 18, 2025
1 parent 9454b66 commit 5198d6b
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/dav/lib/CalDAV/CalendarImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
use OCA\DAV\CalDAV\Auth\CustomPrincipalPlugin;
use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer;
use OCP\Calendar\CalendarExportRange;
use OCP\Calendar\CalendarImportSettings;
use OCP\Calendar\Exceptions\CalendarException;
use OCP\Calendar\ICalendarExport;
use OCP\Calendar\ICalendarImport;
use OCP\Calendar\ICalendarIsShared;
use OCP\Calendar\ICalendarIsWritable;
use OCP\Calendar\ICreateFromString;
Expand All @@ -29,7 +31,7 @@
use Sabre\VObject\Reader;
use function Sabre\Uri\split as uriSplit;

class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIsWritable, ICalendarIsShared, ICalendarExport {
class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIsWritable, ICalendarIsShared, ICalendarImport, ICalendarExport {
public function __construct(
private Calendar $calendar,
/** @var array<string, mixed> */
Expand Down Expand Up @@ -282,4 +284,18 @@ public function export(?CalendarExportRange $range = null): Generator {
}
}

/**
* Import objects
*
* @since 31.0.0
*
*/
public function import(CalendarImportSettings $settings, VCalendar ...$vObjects): void {

foreach ($vObjects as $vObject) {

}

}

}
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,13 @@
'OCP\\Cache\\CappedMemoryCache' => $baseDir . '/lib/public/Cache/CappedMemoryCache.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => $baseDir . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\CalendarExportRange' => $baseDir . '/lib/public/Calendar/CalendarExportRange.php',
'OCP\\Calendar\\CalendarImportSettings' => $baseDir . '/lib/public/Calendar/CalendarImportSettings.php',
'OCP\\Calendar\\Exceptions\\CalendarException' => $baseDir . '/lib/public/Calendar/Exceptions/CalendarException.php',
'OCP\\Calendar\\IAvailabilityResult' => $baseDir . '/lib/public/Calendar/IAvailabilityResult.php',
'OCP\\Calendar\\ICalendar' => $baseDir . '/lib/public/Calendar/ICalendar.php',
'OCP\\Calendar\\ICalendarEventBuilder' => $baseDir . '/lib/public/Calendar/ICalendarEventBuilder.php',
'OCP\\Calendar\\ICalendarExport' => $baseDir . '/lib/public/Calendar/ICalendarExport.php',
'OCP\\Calendar\\ICalendarImport' => $baseDir . '/lib/public/Calendar/ICalendarImport.php',
'OCP\\Calendar\\ICalendarIsShared' => $baseDir . '/lib/public/Calendar/ICalendarIsShared.php',
'OCP\\Calendar\\ICalendarIsWritable' => $baseDir . '/lib/public/Calendar/ICalendarIsWritable.php',
'OCP\\Calendar\\ICalendarProvider' => $baseDir . '/lib/public/Calendar/ICalendarProvider.php',
Expand Down
2 changes: 2 additions & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,13 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Cache\\CappedMemoryCache' => __DIR__ . '/../../..' . '/lib/public/Cache/CappedMemoryCache.php',
'OCP\\Calendar\\BackendTemporarilyUnavailableException' => __DIR__ . '/../../..' . '/lib/public/Calendar/BackendTemporarilyUnavailableException.php',
'OCP\\Calendar\\CalendarExportRange' => __DIR__ . '/../../..' . '/lib/public/Calendar/CalendarExportRange.php',
'OCP\\Calendar\\CalendarImportSettings' => __DIR__ . '/../../..' . '/lib/public/Calendar/CalendarImportSettings.php',
'OCP\\Calendar\\Exceptions\\CalendarException' => __DIR__ . '/../../..' . '/lib/public/Calendar/Exceptions/CalendarException.php',
'OCP\\Calendar\\IAvailabilityResult' => __DIR__ . '/../../..' . '/lib/public/Calendar/IAvailabilityResult.php',
'OCP\\Calendar\\ICalendar' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendar.php',
'OCP\\Calendar\\ICalendarEventBuilder' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarEventBuilder.php',
'OCP\\Calendar\\ICalendarExport' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarExport.php',
'OCP\\Calendar\\ICalendarImport' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarImport.php',
'OCP\\Calendar\\ICalendarIsShared' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarIsShared.php',
'OCP\\Calendar\\ICalendarIsWritable' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarIsWritable.php',
'OCP\\Calendar\\ICalendarProvider' => __DIR__ . '/../../..' . '/lib/public/Calendar/ICalendarProvider.php',
Expand Down
25 changes: 25 additions & 0 deletions lib/public/Calendar/CalendarImportSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Calendar;

/**
* Calendar Export Limit Range
*
* @since 31.0.0
*/
class CalendarImportSettings {

public string $format = 'ical';
public bool $supersede = false;
public bool $emitEvent = false;
public bool $emitITip = false;
public int $bulk = 32;
public int $validate = 1; // 0 - no validation, 1 - validate and repair, 2 - validate and skip

}
30 changes: 30 additions & 0 deletions lib/public/Calendar/ICalendarImport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Calendar;

use OCP\Calendar\CalendarImportSettings;
use Sabre\VObject\Component\VCalendar;

/**
* ICalendar Interface Extension to import data
*
* @since 31.0.0
*/
interface ICalendarImport {

/**
* Import objects
*
* @since 31.0.0
*
* @param VCalendar $vObjects
*/
public function import(CalendarImportSettings $settings, VCalendar ...$vObjects): void;

}

0 comments on commit 5198d6b

Please sign in to comment.