SubscriptionSupport.php 3.1 KB

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