Browse Source
feat(invitations): Allow importing CSV email lists
feat(invitations): Allow importing CSV email lists
Signed-off-by: Joas Schilling <coding@schilljs.com>pull/13871/head
No known key found for this signature in database
GPG Key ID: F72FA5B49FFA96B0
11 changed files with 893 additions and 2 deletions
-
2appinfo/routes/routesRoomController.php
-
1docs/capabilities.md
-
1lib/Capabilities.php
-
47lib/Controller/RoomController.php
-
91lib/Exceptions/GuestImportException.php
-
125lib/GuestManager.php
-
6lib/Service/ParticipantService.php
-
212openapi-full.json
-
212openapi.json
-
99src/types/openapi/openapi-full.ts
-
99src/types/openapi/openapi.ts
@ -0,0 +1,91 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
/** |
|||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
|
|||
namespace OCA\Talk\Exceptions; |
|||
|
|||
class GuestImportException extends \Exception { |
|||
public const REASON_ROOM = 'room'; |
|||
public const REASON_ROWS = 'rows'; |
|||
public const REASON_HEADER_EMAIL = 'header-email'; |
|||
public const REASON_HEADER_NAME = 'header-name'; |
|||
|
|||
/** |
|||
* @param self::REASON_* $reason |
|||
* @param list<non-negative-int>|null $invalidLines |
|||
* @param non-negative-int|null $invites |
|||
* @param non-negative-int|null $duplicates |
|||
*/ |
|||
public function __construct( |
|||
protected readonly string $reason, |
|||
protected readonly ?string $errorMessage = null, |
|||
protected readonly ?array $invalidLines = null, |
|||
protected readonly ?int $invites = null, |
|||
protected readonly ?int $duplicates = null, |
|||
) { |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* @return self::REASON_* |
|||
*/ |
|||
public function getReason(): string { |
|||
return $this->reason; |
|||
} |
|||
|
|||
public function getErrorMessage(): ?string { |
|||
return $this->errorMessage; |
|||
} |
|||
|
|||
/** |
|||
* @return non-negative-int|null |
|||
*/ |
|||
public function getInvites(): ?int { |
|||
return $this->invites; |
|||
} |
|||
|
|||
/** |
|||
* @return non-negative-int|null |
|||
*/ |
|||
public function getDuplicates(): ?int { |
|||
return $this->duplicates; |
|||
} |
|||
|
|||
/** |
|||
* @return non-negative-int|null |
|||
*/ |
|||
public function getInvalid(): ?int { |
|||
return $this->invalidLines === null ? null : count($this->invalidLines); |
|||
} |
|||
|
|||
/** |
|||
* @return list<non-negative-int>|null |
|||
*/ |
|||
public function getInvalidLines(): ?array { |
|||
return $this->invalidLines; |
|||
} |
|||
|
|||
public function getData(): array { |
|||
$data = ['error' => $this->errorMessage]; |
|||
if ($this->errorMessage !== null) { |
|||
$data['message'] = $this->errorMessage; |
|||
} |
|||
if ($this->invites !== null) { |
|||
$data['invites'] = $this->invites; |
|||
} |
|||
if ($this->duplicates !== null) { |
|||
$data['duplicates'] = $this->duplicates; |
|||
} |
|||
if ($this->invalidLines !== null) { |
|||
$data['invalid'] = count($this->invalidLines); |
|||
$data['invalidLines'] = $this->invalidLines; |
|||
} |
|||
|
|||
return $data; |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue