SubscriptionSupport.php 3.1 KB

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