xref: /plugin/davcal/vendor/sabre/dav/lib/CalDAV/Backend/SubscriptionSupport.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\CalDAV\Backend;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehleruse Sabre\DAV;
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehler/**
8*a1a3b679SAndreas Boehler * Every CalDAV backend must at least implement this interface.
9*a1a3b679SAndreas Boehler *
10*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
11*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/)
12*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License
13*a1a3b679SAndreas Boehler */
14*a1a3b679SAndreas Boehlerinterface SubscriptionSupport extends BackendInterface {
15*a1a3b679SAndreas Boehler
16*a1a3b679SAndreas Boehler    /**
17*a1a3b679SAndreas Boehler     * Returns a list of subscriptions for a principal.
18*a1a3b679SAndreas Boehler     *
19*a1a3b679SAndreas Boehler     * Every subscription is an array with the following keys:
20*a1a3b679SAndreas Boehler     *  * id, a unique id that will be used by other functions to modify the
21*a1a3b679SAndreas Boehler     *    subscription. This can be the same as the uri or a database key.
22*a1a3b679SAndreas Boehler     *  * uri. This is just the 'base uri' or 'filename' of the subscription.
23*a1a3b679SAndreas Boehler     *  * principaluri. The owner of the subscription. Almost always the same as
24*a1a3b679SAndreas Boehler     *    principalUri passed to this method.
25*a1a3b679SAndreas Boehler     *
26*a1a3b679SAndreas Boehler     * Furthermore, all the subscription info must be returned too:
27*a1a3b679SAndreas Boehler     *
28*a1a3b679SAndreas Boehler     * 1. {DAV:}displayname
29*a1a3b679SAndreas Boehler     * 2. {http://apple.com/ns/ical/}refreshrate
30*a1a3b679SAndreas Boehler     * 3. {http://calendarserver.org/ns/}subscribed-strip-todos (omit if todos
31*a1a3b679SAndreas Boehler     *    should not be stripped).
32*a1a3b679SAndreas Boehler     * 4. {http://calendarserver.org/ns/}subscribed-strip-alarms (omit if alarms
33*a1a3b679SAndreas Boehler     *    should not be stripped).
34*a1a3b679SAndreas Boehler     * 5. {http://calendarserver.org/ns/}subscribed-strip-attachments (omit if
35*a1a3b679SAndreas Boehler     *    attachments should not be stripped).
36*a1a3b679SAndreas Boehler     * 6. {http://calendarserver.org/ns/}source (Must be a
37*a1a3b679SAndreas Boehler     *     Sabre\DAV\Property\Href).
38*a1a3b679SAndreas Boehler     * 7. {http://apple.com/ns/ical/}calendar-color
39*a1a3b679SAndreas Boehler     * 8. {http://apple.com/ns/ical/}calendar-order
40*a1a3b679SAndreas Boehler     * 9. {urn:ietf:params:xml:ns:caldav}supported-calendar-component-set
41*a1a3b679SAndreas Boehler     *    (should just be an instance of
42*a1a3b679SAndreas Boehler     *    Sabre\CalDAV\Property\SupportedCalendarComponentSet, with a bunch of
43*a1a3b679SAndreas Boehler     *    default components).
44*a1a3b679SAndreas Boehler     *
45*a1a3b679SAndreas Boehler     * @param string $principalUri
46*a1a3b679SAndreas Boehler     * @return array
47*a1a3b679SAndreas Boehler     */
48*a1a3b679SAndreas Boehler    function getSubscriptionsForUser($principalUri);
49*a1a3b679SAndreas Boehler
50*a1a3b679SAndreas Boehler    /**
51*a1a3b679SAndreas Boehler     * Creates a new subscription for a principal.
52*a1a3b679SAndreas Boehler     *
53*a1a3b679SAndreas Boehler     * If the creation was a success, an id must be returned that can be used to reference
54*a1a3b679SAndreas Boehler     * this subscription in other methods, such as updateSubscription.
55*a1a3b679SAndreas Boehler     *
56*a1a3b679SAndreas Boehler     * @param string $principalUri
57*a1a3b679SAndreas Boehler     * @param string $uri
58*a1a3b679SAndreas Boehler     * @param array $properties
59*a1a3b679SAndreas Boehler     * @return mixed
60*a1a3b679SAndreas Boehler     */
61*a1a3b679SAndreas Boehler    function createSubscription($principalUri, $uri, array $properties);
62*a1a3b679SAndreas Boehler
63*a1a3b679SAndreas Boehler    /**
64*a1a3b679SAndreas Boehler     * Updates a subscription
65*a1a3b679SAndreas Boehler     *
66*a1a3b679SAndreas Boehler     * The list of mutations is stored in a Sabre\DAV\PropPatch object.
67*a1a3b679SAndreas Boehler     * To do the actual updates, you must tell this object which properties
68*a1a3b679SAndreas Boehler     * you're going to process with the handle() method.
69*a1a3b679SAndreas Boehler     *
70*a1a3b679SAndreas Boehler     * Calling the handle method is like telling the PropPatch object "I
71*a1a3b679SAndreas Boehler     * promise I can handle updating this property".
72*a1a3b679SAndreas Boehler     *
73*a1a3b679SAndreas Boehler     * Read the PropPatch documenation for more info and examples.
74*a1a3b679SAndreas Boehler     *
75*a1a3b679SAndreas Boehler     * @param mixed $subscriptionId
76*a1a3b679SAndreas Boehler     * @param \Sabre\DAV\PropPatch $propPatch
77*a1a3b679SAndreas Boehler     * @return void
78*a1a3b679SAndreas Boehler     */
79*a1a3b679SAndreas Boehler    function updateSubscription($subscriptionId, DAV\PropPatch $propPatch);
80*a1a3b679SAndreas Boehler
81*a1a3b679SAndreas Boehler    /**
82*a1a3b679SAndreas Boehler     * Deletes a subscription.
83*a1a3b679SAndreas Boehler     *
84*a1a3b679SAndreas Boehler     * @param mixed $subscriptionId
85*a1a3b679SAndreas Boehler     * @return void
86*a1a3b679SAndreas Boehler     */
87*a1a3b679SAndreas Boehler    function deleteSubscription($subscriptionId);
88*a1a3b679SAndreas Boehler
89*a1a3b679SAndreas Boehler}
90