|
1
|
|
|
<?php namespace CalDAVClient\Facade\Requests; |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright 2017 OpenStack Foundation |
|
4
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5
|
|
|
* you may not use this file except in compliance with the License. |
|
6
|
|
|
* You may obtain a copy of the License at |
|
7
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
8
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
9
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
10
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
11
|
|
|
* See the License for the specific language governing permissions and |
|
12
|
|
|
* limitations under the License. |
|
13
|
|
|
**/ |
|
14
|
|
|
use Sabre\Xml\Service; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class CalendarSyncRequest |
|
18
|
|
|
* @see https://tools.ietf.org/html/rfc6578 |
|
19
|
|
|
* @package CalDAVClient\Facade\Requests |
|
20
|
|
|
*/ |
|
21
|
|
|
final class CalendarSyncRequest implements IAbstractWebDAVRequest |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
private $sync_token; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* CalendarSyncRequest constructor. |
|
30
|
|
|
* @param string $sync_token |
|
31
|
|
|
*/ |
|
32
|
|
|
public function __construct($sync_token) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->sync_token = $sync_token; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @return string |
|
39
|
|
|
*/ |
|
40
|
|
|
public function getContent() |
|
41
|
|
|
{ |
|
42
|
|
|
$service = new Service(); |
|
43
|
|
|
|
|
44
|
|
|
$service->namespaceMap = [ |
|
45
|
|
|
'DAV:' => 'D', |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
return $service->write('{DAV:}sync-collection', |
|
49
|
|
|
[ |
|
50
|
|
|
'{DAV:}sync-token' => $this->sync_token, |
|
51
|
|
|
'{DAV:}sync-level' => 1, |
|
52
|
|
|
'{DAV:}prop' => [ |
|
53
|
|
|
'{DAV:}getetag' => '' |
|
54
|
|
|
] |
|
55
|
|
|
]); |
|
56
|
|
|
} |
|
57
|
|
|
} |