Blame view

sources/3rdparty/sabre/dav/lib/Sabre/CardDAV/Backend/BackendInterface.php 5.49 KB
03e52840d   Kload   Init
1
  <?php
6d9380f96   Cédric Dupont   Update sources OC...
2
  namespace Sabre\CardDAV\Backend;
03e52840d   Kload   Init
3
  /**
6d9380f96   Cédric Dupont   Update sources OC...
4
   * CardDAV Backend Interface
03e52840d   Kload   Init
5
   *
6d9380f96   Cédric Dupont   Update sources OC...
6
   * Any CardDAV backend must implement this interface.
03e52840d   Kload   Init
7
8
9
10
11
   *
   * Note that there are references to 'addressBookId' scattered throughout the
   * class. The value of the addressBookId is completely up to you, it can be any
   * arbitrary value you can use as an unique identifier.
   *
6d9380f96   Cédric Dupont   Update sources OC...
12
13
14
   * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
   * @author Evert Pot (http://evertpot.com/)
   * @license http://sabre.io/license/ Modified BSD License
03e52840d   Kload   Init
15
   */
6d9380f96   Cédric Dupont   Update sources OC...
16
  interface BackendInterface {
03e52840d   Kload   Init
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  
      /**
       * Returns the list of addressbooks for a specific user.
       *
       * Every addressbook should have the following properties:
       *   id - an arbitrary unique id
       *   uri - the 'basename' part of the url
       *   principaluri - Same as the passed parameter
       *
       * Any additional clark-notation property may be passed besides this. Some
       * common ones are :
       *   {DAV:}displayname
       *   {urn:ietf:params:xml:ns:carddav}addressbook-description
       *   {http://calendarserver.org/ns/}getctag
       *
       * @param string $principalUri
       * @return array
       */
6d9380f96   Cédric Dupont   Update sources OC...
35
      public function getAddressBooksForUser($principalUri);
03e52840d   Kload   Init
36
37
38
39
  
      /**
       * Updates an addressbook's properties
       *
6d9380f96   Cédric Dupont   Update sources OC...
40
       * See Sabre\DAV\IProperties for a description of the mutations array, as
03e52840d   Kload   Init
41
42
43
44
       * well as the return value.
       *
       * @param mixed $addressBookId
       * @param array $mutations
6d9380f96   Cédric Dupont   Update sources OC...
45
       * @see Sabre\DAV\IProperties::updateProperties
03e52840d   Kload   Init
46
47
       * @return bool|array
       */
6d9380f96   Cédric Dupont   Update sources OC...
48
      public function updateAddressBook($addressBookId, array $mutations);
03e52840d   Kload   Init
49
50
51
52
53
54
55
56
57
  
      /**
       * Creates a new address book
       *
       * @param string $principalUri
       * @param string $url Just the 'basename' of the url.
       * @param array $properties
       * @return void
       */
6d9380f96   Cédric Dupont   Update sources OC...
58
      public function createAddressBook($principalUri, $url, array $properties);
03e52840d   Kload   Init
59
60
61
62
63
64
65
  
      /**
       * Deletes an entire addressbook and all its contents
       *
       * @param mixed $addressBookId
       * @return void
       */
6d9380f96   Cédric Dupont   Update sources OC...
66
      public function deleteAddressBook($addressBookId);
03e52840d   Kload   Init
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  
      /**
       * Returns all cards for a specific addressbook id.
       *
       * This method should return the following properties for each card:
       *   * carddata - raw vcard data
       *   * uri - Some unique url
       *   * lastmodified - A unix timestamp
       *
       * It's recommended to also return the following properties:
       *   * etag - A unique etag. This must change every time the card changes.
       *   * size - The size of the card in bytes.
       *
       * If these last two properties are provided, less time will be spent
       * calculating them. If they are specified, you can also ommit carddata.
       * This may speed up certain requests, especially with large cards.
       *
       * @param mixed $addressbookId
       * @return array
       */
6d9380f96   Cédric Dupont   Update sources OC...
87
      public function getCards($addressbookId);
03e52840d   Kload   Init
88
89
90
91
92
93
94
95
96
97
98
  
      /**
       * Returns a specfic card.
       *
       * The same set of properties must be returned as with getCards. The only
       * exception is that 'carddata' is absolutely required.
       *
       * @param mixed $addressBookId
       * @param string $cardUri
       * @return array
       */
6d9380f96   Cédric Dupont   Update sources OC...
99
      public function getCard($addressBookId, $cardUri);
03e52840d   Kload   Init
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  
      /**
       * Creates a new card.
       *
       * The addressbook id will be passed as the first argument. This is the
       * same id as it is returned from the getAddressbooksForUser method.
       *
       * The cardUri is a base uri, and doesn't include the full path. The
       * cardData argument is the vcard body, and is passed as a string.
       *
       * It is possible to return an ETag from this method. This ETag is for the
       * newly created resource, and must be enclosed with double quotes (that
       * is, the string itself must contain the double quotes).
       *
       * You should only return the ETag if you store the carddata as-is. If a
       * subsequent GET request on the same card does not have the same body,
       * byte-by-byte and you did return an ETag here, clients tend to get
       * confused.
       *
       * If you don't return an ETag, you can just return null.
       *
       * @param mixed $addressBookId
       * @param string $cardUri
       * @param string $cardData
       * @return string|null
       */
6d9380f96   Cédric Dupont   Update sources OC...
126
      public function createCard($addressBookId, $cardUri, $cardData);
03e52840d   Kload   Init
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  
      /**
       * Updates a card.
       *
       * The addressbook id will be passed as the first argument. This is the
       * same id as it is returned from the getAddressbooksForUser method.
       *
       * The cardUri is a base uri, and doesn't include the full path. The
       * cardData argument is the vcard body, and is passed as a string.
       *
       * It is possible to return an ETag from this method. This ETag should
       * match that of the updated resource, and must be enclosed with double
       * quotes (that is: the string itself must contain the actual quotes).
       *
       * You should only return the ETag if you store the carddata as-is. If a
       * subsequent GET request on the same card does not have the same body,
       * byte-by-byte and you did return an ETag here, clients tend to get
       * confused.
       *
       * If you don't return an ETag, you can just return null.
       *
       * @param mixed $addressBookId
       * @param string $cardUri
       * @param string $cardData
       * @return string|null
       */
6d9380f96   Cédric Dupont   Update sources OC...
153
      public function updateCard($addressBookId, $cardUri, $cardData);
03e52840d   Kload   Init
154
155
156
157
158
159
160
161
  
      /**
       * Deletes a card
       *
       * @param mixed $addressBookId
       * @param string $cardUri
       * @return bool
       */
6d9380f96   Cédric Dupont   Update sources OC...
162
      public function deleteCard($addressBookId, $cardUri);
03e52840d   Kload   Init
163
164
  
  }