Skip to content

PHP Calendar API: Write support #20154

Open

Description

@georgehrke

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;
}

Activity

  1. georgehrke commented on Mar 25, 2020

    @georgehrke
    MemberAuthor

    also ref #17129

  2. georgehrke commented on Mar 25, 2020

    @georgehrke
    MemberAuthor

    cc @rullzer for feature planning :)

  3. georgehrke commented on Mar 25, 2020

    @georgehrke
    Author
  4. georgehrke commented on Mar 25, 2020

    @georgehrke
    MemberAuthor

    @tcitworld Who else needed write-access to the calendar?

  5. tcitworld commented on Mar 25, 2020

    @tcitworld
    Member

    I can think of

  6. tcitworld commented on Mar 26, 2020

    @tcitworld
    Member

    Added workflow engine to use cases.

  7. rotdrop commented on Oct 6, 2020

    @rotdrop
    Contributor

    FYI, have updated @tcitworld merge request #20178, re-basing it to the current master and fixing the failing merge checks, see #23234. Would be "nice to have" for polishing cafevdb.

  8. rotdrop commented on Oct 6, 2020

    @rotdrop
    Contributor

    Concerning use cases: cafevdb shares several objects among the members of the executive board of an orchestra. Shared events (rehearsals/concerts/meetings) are of course an important component.

  9. tbmatuka commented on Oct 30, 2020

    @tbmatuka

    I have a use-case where I would need to add/update events for all users via the API. We have a self-hosted mail server and would like to automatically import any .ics file that users receive. The mail server side is simple and we have it ready, but importing the events into Nextcloud is our current problem.

    Does the current state of the implementation support using a single API key to manage calendars for all users?

  10. seyfeb commented on Nov 5, 2020

    @seyfeb
  11. tcitworld commented on Feb 16, 2021

    @tcitworld
  12. tcitworld commented on Mar 21, 2021

    @tcitworld
  13. ChristophWurst commented on Jul 29, 2021

    @ChristophWurst
    Member

    I would like to note that we should possibly include the user ID as argument of the APIs. Having the user as context makes the APIs usable for calendars of other users as well, and when there is no user context (background job, occ).

  14. ChristophWurst commented on Oct 12, 2021

    @ChristophWurst
    Member

    @miaulalala will implement the creation part of new events. To avoid leading sabre types in the public API she will add a create method that takes the calendar object name and the calendar object data as string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions