mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
feat(ocp): create contacts from string
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
parent
5a73733ec1
commit
16ad73cd15
4 changed files with 38 additions and 1 deletions
|
|
@ -10,13 +10,14 @@ namespace OCA\DAV\CardDAV;
|
|||
use OCA\DAV\Db\PropertyMapper;
|
||||
use OCP\Constants;
|
||||
use OCP\IAddressBookEnabled;
|
||||
use OCP\ICreateContactFromString;
|
||||
use OCP\IURLGenerator;
|
||||
use Sabre\VObject\Component\VCard;
|
||||
use Sabre\VObject\Property;
|
||||
use Sabre\VObject\Reader;
|
||||
use Sabre\VObject\UUIDUtil;
|
||||
|
||||
class AddressBookImpl implements IAddressBookEnabled {
|
||||
class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString {
|
||||
|
||||
/**
|
||||
* AddressBookImpl constructor.
|
||||
|
|
@ -336,4 +337,8 @@ class AddressBookImpl implements IAddressBookEnabled {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createFromString(string $name, string $vcfData): void {
|
||||
$this->backend->createCard($this->getKey(), $name, $vcfData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -606,6 +606,7 @@ return array(
|
|||
'OCP\\ICertificateManager' => $baseDir . '/lib/public/ICertificateManager.php',
|
||||
'OCP\\IConfig' => $baseDir . '/lib/public/IConfig.php',
|
||||
'OCP\\IContainer' => $baseDir . '/lib/public/IContainer.php',
|
||||
'OCP\\ICreateContactFromString' => $baseDir . '/lib/public/ICreateContactFromString.php',
|
||||
'OCP\\IDBConnection' => $baseDir . '/lib/public/IDBConnection.php',
|
||||
'OCP\\IDateTimeFormatter' => $baseDir . '/lib/public/IDateTimeFormatter.php',
|
||||
'OCP\\IDateTimeZone' => $baseDir . '/lib/public/IDateTimeZone.php',
|
||||
|
|
|
|||
|
|
@ -647,6 +647,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OCP\\ICertificateManager' => __DIR__ . '/../../..' . '/lib/public/ICertificateManager.php',
|
||||
'OCP\\IConfig' => __DIR__ . '/../../..' . '/lib/public/IConfig.php',
|
||||
'OCP\\IContainer' => __DIR__ . '/../../..' . '/lib/public/IContainer.php',
|
||||
'OCP\\ICreateContactFromString' => __DIR__ . '/../../..' . '/lib/public/ICreateContactFromString.php',
|
||||
'OCP\\IDBConnection' => __DIR__ . '/../../..' . '/lib/public/IDBConnection.php',
|
||||
'OCP\\IDateTimeFormatter' => __DIR__ . '/../../..' . '/lib/public/IDateTimeFormatter.php',
|
||||
'OCP\\IDateTimeZone' => __DIR__ . '/../../..' . '/lib/public/IDateTimeZone.php',
|
||||
|
|
|
|||
30
lib/public/ICreateContactFromString.php
Normal file
30
lib/public/ICreateContactFromString.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCP;
|
||||
|
||||
use OCP\AppFramework\Attribute\Consumable;
|
||||
|
||||
/**
|
||||
* Create a new contact in an address book from a serialized vCard.
|
||||
*
|
||||
* @since 32.0.0
|
||||
*/
|
||||
#[Consumable(since: '32.0.0')]
|
||||
interface ICreateContactFromString extends IAddressBook {
|
||||
/**
|
||||
* Create a new contact in this address book.
|
||||
*
|
||||
* @param string $name The name or uri of the vCard to be created. Should have a vcf file extension.
|
||||
* @param string $vcfData The raw, serialized vCard data.
|
||||
*
|
||||
* @since 32.0.0
|
||||
*/
|
||||
public function createFromString(string $name, string $vcfData): void;
|
||||
}
|
||||
Loading…
Reference in a new issue