-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OCC and OCS Calendar Import/Export
Signed-off-by: SebastianKrupinski <[email protected]>
- Loading branch information
1 parent
f198508
commit b0ee614
Showing
7 changed files
with
164 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
namespace OCP\AppFramework\Http; | ||
|
||
use OCP\AppFramework\Http; | ||
|
||
/** | ||
* Class StreamResponse | ||
* | ||
* @since 31.0.0 | ||
* | ||
* @template-extends Response<int, array<string, mixed>> | ||
*/ | ||
class StreamGeneratorResponse extends Response implements ICallbackResponse { | ||
protected $generator; | ||
|
||
/** | ||
* @since 31.0.0 | ||
* | ||
* @param \Generator $generator the function to call to generate the response | ||
* @param String $contentType http response content type e.g. 'application/json; charset=UTF-8' | ||
* @param int $status http response status | ||
*/ | ||
public function __construct($generator, $contentType, $status = Http::STATUS_OK) { | ||
parent::__construct(); | ||
|
||
$this->generator = $generator; | ||
|
||
$this->setStatus($status); | ||
$this->cacheFor(0); | ||
$this->addHeader('Content-Type', $contentType); | ||
|
||
} | ||
|
||
/** | ||
* Streams content directly to client | ||
* | ||
* @since 31.0.0 | ||
* | ||
* @param IOutput $output a small wrapper that handles output | ||
*/ | ||
public function callback(IOutput $output) { | ||
|
||
foreach ($this->generator as $chunk) { | ||
print($chunk); | ||
flush(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?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 CalendarExportRange { | ||
|
||
public ?int $start = null; | ||
public ?int $count = null; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?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 Generator; | ||
|
||
/** | ||
* ICalendar Interface Extension to export data | ||
* | ||
* @since 31.0.0 | ||
*/ | ||
interface ICalendarExport { | ||
|
||
/** | ||
* Export objects | ||
* | ||
* @since 31.0.0 | ||
* | ||
* @return Generator<\Sabre\VObject\Component\VCalendar> | ||
*/ | ||
public function export(?CalendarExportRange $range = null): Generator; | ||
|
||
} |