Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/dav/lib/CardDAV/AddressBookImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
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.
Expand Down Expand Up @@ -336,4 +337,8 @@ public function isEnabled(): bool {
}
return true;
}

public function createFromString(string $name, string $vcfData): void {
$this->backend->createCard($this->getKey(), $name, $vcfData);
}
}
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@
'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',
Expand Down
1 change: 1 addition & 0 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
30 changes: 30 additions & 0 deletions lib/public/ICreateContactFromString.php
Original file line number Diff line number Diff line change
@@ -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