Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Modules\Dav\Domain\Repository;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use App\Modules\Dav\Domain\Model\DavAccount;
12use App\Modules\Dav\Domain\Model\DavResource;
13
14/**
15 * DAV Client Contract Interface.
16 *
17 * Defines standard transport operations for CalDAV and CardDAV collections.
18 *
19 * @package App\Modules\Dav\Domain\Repository
20 */
21interface DavClientInterface
22{
23    /**
24     * Fetches all resources within a collection URL using PROPFIND / REPORT.
25     *
26     * @param DavAccount $account Authenticated user profile.
27     * @param string $collectionUrl Target collection endpoint URL.
28     * @param string $resourceType Content type filter (calendar or addressbook).
29     * @return array<string, DavResource> Map of resource URL / UID to DavResource.
30     */
31    public function listResources(
32        DavAccount $account,
33        string $collectionUrl,
34        string $resourceType
35    ): array;
36
37    /**
38     * Retrieves the raw content of a specific resource.
39     *
40     * @param DavAccount $account Authenticated user profile.
41     * @param string $resourceUrl Full URL to the remote resource.
42     * @return DavResource Fetched resource object.
43     */
44    public function getResource(DavAccount $account, string $resourceUrl): DavResource;
45
46    /**
47     * Publishes or updates a resource via HTTP PUT.
48     *
49     * @param DavAccount $account Authenticated user profile.
50     * @param string $resourceUrl Target resource URL.
51     * @param DavResource $resource Resource payload containing body and content type.
52     * @return string Updated ETag returned from server.
53     */
54    public function putResource(
55        DavAccount $account,
56        string $resourceUrl,
57        DavResource $resource
58    ): string;
59
60    /**
61     * Deletes a remote resource via HTTP DELETE.
62     *
63     * @param DavAccount $account Authenticated user profile.
64     * @param string $resourceUrl Target resource URL.
65     * @param string $etag Optional ETag for concurrency check.
66     * @return bool True if successfully deleted or already absent.
67     */
68    public function deleteResource(
69        DavAccount $account,
70        string $resourceUrl,
71        string $etag = ''
72    ): bool;
73}