nextcloud / nextcloud/server

PHP Calendar API: Write support

Open
#20,154 14 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop feature: caldav feature: dav standardization technical debt
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

OCP\Calendar\IManager is currently only providing a read-only API.
This is drastically limiting the number of use-cases, forcing app-developers to use the CalDAV interface via javascript, if they desire write-support for the user's calendar.

Nextcloud should provide a PHP api with write-support for the user's calendar.

Due to it's simple design, our current API is limited to read-only. Adding write-support to the existing API is not possible. This is mostly caused by the structure of events.
They are returned as a very simple key-value array. Some information from the ICS is already lost when the conversion takes place. Converting modified key-value arrays back to ICS could possibly lead to data-loss.


Original proposition

Proposal:

  1. Deprecate \OCP\Calendar\IManager and \OCP\Calendar\ICalendar with Nextcloud 20 and remove with Nextcloud 23.

  • Implement \OCP\Calendar\IManagerV2:
interface \OCP\Calendar\IManagerV2{
        public function isEnabled():bool;
        public function getCalendars():ICalendarV2[];
        public function getCalendar(string $key):?ICalendarV2;
        public function search(string $pattern, array $searchProperties=[], array $options=[], int $limit=null, int $offset=null)?ICalendarObjectV2[];
        public function registerCalendar(ICalendarV2 $calendar):void;
        public function unregisterCalendar(ICalendarV2 $calendar):void;
        public function register(\Closure $callable):void;
        public function clear():void;
}
  • Implement \OCP\Calendar\ICalendarV2:
interface \OCP\Calendar\ICalendarV2{
	public function getKey():string;
	public function getDisplayName():?string;
	public function getDisplayColor():?string;
        public function isWriteable():bool;
        public function getByUri(string $uri):?ICalendarObjectV2;
        public function search(string $pattern, array $searchProperties=[], array $options=[], int $limit=null, int $offset=null)?ICalendarObjectV2[];
        public function create(\Sabre\VObject\VCalendar $vObject):ICalendarObjectV2;
}
  • Implement \OCP\Calendar\ICalendarObjectV2:
interface \OCP\Calendar\ICalendarObjectV2{
        public function getCalendarKey():string;
        public function getUri():string;
        public function getVObject():\Sabre\VObject\VCalendar;
        public function update():void;
        public function delete():void;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OCP\Calendar\IManager and proposed IManagerV2, ICalendarV2, and ICalendarObjectV2 entry points, then read the linked write-support documentation. Creation is already checked off; completion requires defining and implementing update and delete support while preserving ICS data, with the documentation kept consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.