improve calendar features
This commit is contained in:
@@ -395,6 +395,68 @@ class CalDavClient
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Public wrapper for findObjectByUid.
|
||||
*
|
||||
* @param string $caldavUrl
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $uid
|
||||
* @return array{href: string, etag: string, data: string}|null
|
||||
*/
|
||||
public static function findObjectByUidPublic(
|
||||
string $caldavUrl,
|
||||
string $username,
|
||||
string $password,
|
||||
string $uid
|
||||
): ?array {
|
||||
return self::findObjectByUid($caldavUrl, $username, $password, $uid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Public wrapper for putCalendarObject.
|
||||
*
|
||||
* @param string $href
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $data
|
||||
* @param string $etag
|
||||
* @return string Empty string on success, error on failure
|
||||
*/
|
||||
public static function putCalendarObjectPublic(
|
||||
string $href,
|
||||
string $username,
|
||||
string $password,
|
||||
string $data,
|
||||
string $etag
|
||||
): string {
|
||||
return self::putCalendarObject($href, $username, $password, $data, $etag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a calendar object from the server.
|
||||
*
|
||||
* @param string $href Full URL of the calendar object
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $etag ETag for If-Match header (empty to skip)
|
||||
* @return bool True on success
|
||||
*/
|
||||
public static function deleteCalendarObject(
|
||||
string $href,
|
||||
string $username,
|
||||
string $password,
|
||||
string $etag
|
||||
): bool {
|
||||
$headers = [];
|
||||
if ($etag !== '') {
|
||||
$headers[] = 'If-Match: ' . $etag;
|
||||
}
|
||||
|
||||
$response = self::request('DELETE', $href, $username, $password, '', $headers);
|
||||
return $response !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an HTTP request to a CalDAV server.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user