Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Introduce public calendar api #11461

Closed
wants to merge 1 commit into from
Closed

Conversation

DeepDiver1975
Copy link
Member

We need a public api in ownCloud core to access available calendars.

The basic design of the api follows the contacts manager approach which is in place for quite some time now.

There are basically 3 pieces involved:

  • the manager - holding all calendars
  • the calendar - holding events and tasks
  • the event/task

Please review the api design! THX

@karlitschek @MorrisJobke @georgehrke @Raydiation @PVince81 @schiesbn @butonic THX

* 'from' : defines the starting point in time for the query
* 'to' : defines the end
*
* @return array of events/tasks which are arrays of key-value-pairs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

events/journals/tasks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using recurrenceIds one UID might contain multiple VEvent blocks. This might cause problems when using a simple key-value pair structure

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see - can you please post some sample data? Let's see if we find an nice abstraction - THX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THX - so the true unique id is a combination of UID and RECURRENCE-ID ??

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the unique id used by caldav is the uri. In most cases the uri equals the uid, but that's not always the case. The caldav standard says that all objects with the same uid have to be stored in the same resource. So the example I posted would be stored in one single db row.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay - we better mimic the behavior in this case - THX

* @param \OCP\Calendar\ICalendar $calendar
* @return void
*/
function registerCalendar(\OCP\Calendar\ICalendar $calendar);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe \OCP\ICalendar, it's also \OCP\IAddressBook, not \OCP\Contacts\IAddressBook

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware of this inconsistency ... let me fix this

@PVince81
Copy link
Contributor

Would it be better if in the future apps are able to register generic managers ?
So far we always need to add specific interfaces in core for calendar, contacts, etc.

If we had something like registerService(serviceType, myServiceProvider);, any calendar app could register calendar services. But now I realize that the app wouldn't have any way to enforce the interface as it is done here.

Hmmmm... maybe something to be thought about separately.

@DeepDiver1975
Copy link
Member Author

Would it be better if in the future apps are able to register generic managers ?
So far we always need to add specific interfaces in core for calendar, contacts, etc.

Well - the basic idea if to nail down the 'protocol' of interapp communication within core.
Only if the interfaces are maintained in core we can ensure that the api is stable and will continue to work in the future.

As an example: have a look at the tasks app as of today - it simply reuses classes of the calendar app. This works as long as there are no changes in that specific calendar classes.
But there is a rewrite of the calendar app in progress - are the devs aware of which classes are used by any other app? And how? I'm pretty sure the calendar rewrite will break the tasks app.

And this is a very simple scenario as we know all devs and apps involved - but in a larger scope this will not work.

We need these php interface based api approach to ensure proper operations between apps. I see no other possibility.

@scrutinizer-notifier
Copy link

The inspection completed: 5 new issues, 18 updated code elements

@DeepDiver1975
Copy link
Member Author

@georgehrke @PVince81 @MorrisJobke please review

@georgehrke
Copy link
Contributor

Is the $pattern parameter for search supposed to be a regular expression?
One problem I remember with the contacts api was that I wasn't able to search for all contacts with birthday information. (searching for birthdays with pattern "*" returned an empty array)

I can imagine similar problems here, e.g. when the maps app wants to search for all events with Location or GEO in the next 30 days.

interface IManager {

/**
* @param string $pattern which should match within the $searchProperties
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgehrke the pattern would be a simple text to be searched for - no regex or something

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, needs better docs what actually should be passed in and an example maybe

@DeepDiver1975
Copy link
Member Author

One problem I remember with the contacts api was that I wasn't able to search for all contacts with birthday information. (searching for birthdays with pattern "*" returned an empty array)

Did you intend to search for all contacts who have a birthday defined or for those within a given time frame?

Regarding the general design - from my pov the contacts app should register a 'Birthday Calendar' to be consumed by any app being interested.

@MorrisJobke
Copy link
Contributor

I'm fine with that 👍

@DeepDiver1975
Copy link
Member Author

I can imagine similar problems here, e.g. when the maps app wants to search for all events with Location or GEO in the next 30 days.

nice usage scenario - this is where we have to enhance the $options - just like the already defined from and to options (which are basically just an idea for now)

@georgehrke
Copy link
Contributor

Did you intend to search for all contacts who have a birthday defined or for those within a given time frame?

My intention was to search for all contacts with a birthday defined.

@DeepDiver1975
Copy link
Member Author

My intention was to search for all contacts with a birthday defined.

try the empty string 🙊 - nevertheless: contacts should register the birthday calendar as described above

@georgehrke
Copy link
Contributor

try the empty string 🙊 - nevertheless: contacts should register the birthday calendar as described above

Didn't work either iirc (I actually didn't try %)

@DeepDiver1975
Copy link
Member Author

Didn't work either iirc (I actually didn't try %)

% is added within the implementation - see https://github.com/owncloud/contacts/blob/master/lib/addressbookprovider.php#L124

maybe worth filing an issue against the contacts repo - not really an issue of the api itself

@DeepDiver1975 DeepDiver1975 added this to the 8.0-current milestone Dec 23, 2014
@DeepDiver1975
Copy link
Member Author

please review - thx

@karlitschek @MorrisJobke @georgehrke @Raydiation @PVince81 @schiesbn @butonic

public function delete($id, $calendarKey) {
$cal = $this->getCalendar($calendarKey);
if (!$cal) {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@return says bool if successful

@BernhardPosselt
Copy link
Contributor

Can we have some examples how it should be used :)? You can spot usability issues pretty quickly if you see a few lines of code.

* This function is used to create a new task/event if 'id' is not given or not present.
* Otherwise the task/event will be updated by replacing the entire data set.
*
* @param array $properties this array if key-value-pairs defines a task/event
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a listing of available keys in the phpdoc?


namespace OCP {

interface ICalendar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a findAll method to get all objects? Or are you just supposed to use search with an empty pattern?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go for an empty pattern on search - I don't want to clutter the interface with a dozen of methods.

@DeepDiver1975 DeepDiver1975 modified the milestones: 8.1-next, 8.0-current Jan 7, 2015
@DeepDiver1975
Copy link
Member Author

moving to OC8.1 as we are beyond feature freeze

@LukasReschke LukasReschke changed the title Introduce public calendar api [WIP] [WIP] Introduce public calendar api Feb 24, 2015
@DeepDiver1975 DeepDiver1975 modified the milestones: 8.1-current, 8.2-next Apr 2, 2015
@MorrisJobke
Copy link
Contributor

@DeepDiver1975 I guess this is still valid. Do we want to address this during conf?

@DeepDiver1975 DeepDiver1975 modified the milestones: 9.0-next, 8.2-current Sep 18, 2015
@DeepDiver1975 DeepDiver1975 modified the milestones: backlog, 9.0-current Nov 12, 2015
@DeepDiver1975
Copy link
Member Author

moving since I don't know where this will go

@DeepDiver1975 DeepDiver1975 deleted the public-calendar-api branch February 3, 2016 16:31
@DeepDiver1975
Copy link
Member Author

Any app can use caldav to interact with the new caldav backend starting oc9

@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants