chore: standardize protocol
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -621,7 +621,7 @@ class Manager {
|
||||
* @return CollectionBaseInterface
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function collectionModify(string $tenantId, string $userId, string $providerId, string|int $serviceId, string|int $collectionId, CollectionMutableInterface|array $object): CollectionBaseInterface {
|
||||
public function collectionUpdate(string $tenantId, string $userId, string $providerId, string|int $serviceId, string|int $collectionId, CollectionMutableInterface|array $object): CollectionBaseInterface {
|
||||
// retrieve service
|
||||
$service = $this->serviceFetch($tenantId, $userId, $providerId, $serviceId);
|
||||
|
||||
@@ -629,8 +629,8 @@ class Manager {
|
||||
if (!($service instanceof ServiceCollectionMutableInterface)) {
|
||||
throw new InvalidArgumentException("Service does not support collection mutations");
|
||||
}
|
||||
if (!$service->capable(ServiceCollectionMutableInterface::CAPABILITY_COLLECTION_MODIFY)) {
|
||||
throw new InvalidArgumentException("Service is not capable of modifying collections");
|
||||
if (!$service->capable(ServiceCollectionMutableInterface::CAPABILITY_COLLECTION_UPDATE)) {
|
||||
throw new InvalidArgumentException("Service is not capable of updating collections");
|
||||
}
|
||||
|
||||
if (is_array($object)) {
|
||||
@@ -640,12 +640,12 @@ class Manager {
|
||||
$collection = $object;
|
||||
}
|
||||
|
||||
// Modify collection
|
||||
return $service->collectionModify($collectionId, $collection);
|
||||
// Update collection
|
||||
return $service->collectionUpdate($collectionId, $collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a specific collection
|
||||
* Delete a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
@@ -657,23 +657,23 @@ class Manager {
|
||||
*
|
||||
* @return CollectionBaseInterface|null
|
||||
*/
|
||||
public function collectionDestroy(string $tenantId, ?string $userId, string $providerId, string|int $serviceId, string|int $collectionId, array $options = []): bool {
|
||||
public function collectionDelete(string $tenantId, ?string $userId, string $providerId, string|int $serviceId, string|int $collectionId, array $options = []): bool {
|
||||
// retrieve service
|
||||
$service = $this->serviceFetch($tenantId, $userId, $providerId, $serviceId);
|
||||
|
||||
// Check if service supports collection destruction
|
||||
// Check if service supports collection deletion
|
||||
if (!($service instanceof ServiceCollectionMutableInterface)) {
|
||||
throw new InvalidArgumentException("Service does not support collection mutations");
|
||||
}
|
||||
if (!$service->capable(ServiceCollectionMutableInterface::CAPABILITY_COLLECTION_DESTROY)) {
|
||||
throw new InvalidArgumentException("Service is not capable of destroying collections");
|
||||
if (!$service->capable(ServiceCollectionMutableInterface::CAPABILITY_COLLECTION_DELETE)) {
|
||||
throw new InvalidArgumentException("Service is not capable of deleting collections");
|
||||
}
|
||||
|
||||
$force = $options['force'] ?? false;
|
||||
$recursive = $options['recursive'] ?? false;
|
||||
|
||||
// destroy collection
|
||||
return $service->collectionDestroy($collectionId, $force, $recursive);
|
||||
// delete collection
|
||||
return $service->collectionDelete($collectionId, $force, $recursive);
|
||||
}
|
||||
|
||||
// ==================== Message Operations ====================
|
||||
|
||||
Reference in New Issue
Block a user