aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Support
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Support')
-rw-r--r--lib/public/Support/CrashReport/ICollectBreadcrumbs.php25
-rw-r--r--lib/public/Support/CrashReport/IMessageReporter.php24
-rw-r--r--lib/public/Support/CrashReport/IRegistry.php75
-rw-r--r--lib/public/Support/CrashReport/IReporter.php26
-rw-r--r--lib/public/Support/Subscription/Exception/AlreadyRegisteredException.php15
-rw-r--r--lib/public/Support/Subscription/IAssertion.php25
-rw-r--r--lib/public/Support/Subscription/IRegistry.php69
-rw-r--r--lib/public/Support/Subscription/ISubscription.php35
-rw-r--r--lib/public/Support/Subscription/ISupportedApps.php21
9 files changed, 315 insertions, 0 deletions
diff --git a/lib/public/Support/CrashReport/ICollectBreadcrumbs.php b/lib/public/Support/CrashReport/ICollectBreadcrumbs.php
new file mode 100644
index 00000000000..54a88041b52
--- /dev/null
+++ b/lib/public/Support/CrashReport/ICollectBreadcrumbs.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\CrashReport;
+
+/**
+ * @since 15.0.0
+ */
+interface ICollectBreadcrumbs extends IReporter {
+ /**
+ * Collect breadcrumbs for crash reports
+ *
+ * @param string $message
+ * @param string $category
+ * @param array $context
+ *
+ * @since 15.0.0
+ */
+ public function collect(string $message, string $category, array $context = []);
+}
diff --git a/lib/public/Support/CrashReport/IMessageReporter.php b/lib/public/Support/CrashReport/IMessageReporter.php
new file mode 100644
index 00000000000..dee6ee61121
--- /dev/null
+++ b/lib/public/Support/CrashReport/IMessageReporter.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\CrashReport;
+
+/**
+ * @since 17.0.0
+ */
+interface IMessageReporter extends IReporter {
+ /**
+ * Report a (error) message
+ *
+ * @param string $message
+ * @param array $context
+ *
+ * @since 17.0.0
+ */
+ public function reportMessage(string $message, array $context = []): void;
+}
diff --git a/lib/public/Support/CrashReport/IRegistry.php b/lib/public/Support/CrashReport/IRegistry.php
new file mode 100644
index 00000000000..503a21038ca
--- /dev/null
+++ b/lib/public/Support/CrashReport/IRegistry.php
@@ -0,0 +1,75 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\CrashReport;
+
+use Exception;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
+use Throwable;
+
+/**
+ * @since 13.0.0
+ * @deprecated 20.0.0 used internally only
+ */
+interface IRegistry {
+ /**
+ * Register a reporter instance
+ *
+ * @param IReporter $reporter
+ *
+ * @since 13.0.0
+ * @deprecated 20.0.0 use IRegistrationContext::registerCrashReporter
+ * @see IRegistrationContext::registerCrashReporter()
+ */
+ public function register(IReporter $reporter): void;
+
+ /**
+ * Delegate breadcrumb collection to all registered reporters
+ *
+ * @param string $message
+ * @param string $category
+ * @param array $context
+ *
+ * @deprecated 20.0.0 used internally only
+ * @since 15.0.0
+ */
+ public function delegateBreadcrumb(string $message, string $category, array $context = []): void;
+
+ /**
+ * Delegate crash reporting to all registered reporters
+ *
+ * @param Exception|Throwable $exception
+ * @param array $context
+ *
+ * @deprecated 20.0.0 used internally only
+ * @since 13.0.0
+ */
+ public function delegateReport($exception, array $context = []);
+
+ /**
+ * Delegate a message to all reporters that implement IMessageReporter
+ *
+ * @param string $message
+ * @param array $context
+ *
+ * @return void
+ *
+ * @deprecated 20.0.0 used internally only
+ * @since 17.0.0
+ */
+ public function delegateMessage(string $message, array $context = []): void;
+
+ /**
+ * Check if any reporter has been registered to delegate to
+ *
+ * @return bool
+ * @deprecated 20.0.0 use internally only
+ * @since 26.0.0
+ */
+ public function hasReporters(): bool;
+}
diff --git a/lib/public/Support/CrashReport/IReporter.php b/lib/public/Support/CrashReport/IReporter.php
new file mode 100644
index 00000000000..1be8ba58c30
--- /dev/null
+++ b/lib/public/Support/CrashReport/IReporter.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\CrashReport;
+
+use Exception;
+use Throwable;
+
+/**
+ * @since 13.0.0
+ */
+interface IReporter {
+ /**
+ * Report an (unhandled) exception
+ *
+ * @since 13.0.0
+ * @param Exception|Throwable $exception
+ * @param array $context
+ */
+ public function report($exception, array $context = []);
+}
diff --git a/lib/public/Support/Subscription/Exception/AlreadyRegisteredException.php b/lib/public/Support/Subscription/Exception/AlreadyRegisteredException.php
new file mode 100644
index 00000000000..95179f0501a
--- /dev/null
+++ b/lib/public/Support/Subscription/Exception/AlreadyRegisteredException.php
@@ -0,0 +1,15 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\Subscription\Exception;
+
+/**
+ * @since 17.0.0
+ */
+class AlreadyRegisteredException extends \Exception {
+}
diff --git a/lib/public/Support/Subscription/IAssertion.php b/lib/public/Support/Subscription/IAssertion.php
new file mode 100644
index 00000000000..973800ba854
--- /dev/null
+++ b/lib/public/Support/Subscription/IAssertion.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\Subscription;
+
+use OCP\HintException;
+
+/**
+ * @since 26.0.0
+ */
+interface IAssertion {
+ /**
+ * This method throws a localized exception when user limits are exceeded,
+ * if applicable. Notifications are also created in that case. It is a
+ * shorthand for a check against IRegistry::delegateIsHardUserLimitReached().
+ *
+ * @throws HintException
+ * @since 26.0.0
+ */
+ public function createUserIsLegit(): void;
+}
diff --git a/lib/public/Support/Subscription/IRegistry.php b/lib/public/Support/Subscription/IRegistry.php
new file mode 100644
index 00000000000..5452430ceed
--- /dev/null
+++ b/lib/public/Support/Subscription/IRegistry.php
@@ -0,0 +1,69 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\Subscription;
+
+use OCP\Notification\IManager;
+use OCP\Support\Subscription\Exception\AlreadyRegisteredException;
+
+/**
+ * @since 17.0.0
+ */
+interface IRegistry {
+ /**
+ * Register a subscription instance. In case it is called multiple times an
+ * exception is thrown
+ *
+ * @param ISubscription $subscription
+ * @throws AlreadyRegisteredException
+ *
+ * @since 17.0.0
+ * @deprecated 20.0.0 use registerService
+ */
+ public function register(ISubscription $subscription): void;
+
+ /**
+ * Register a subscription handler. The service has to implement the ISubscription interface.
+ * In case this is called multiple times an exception is thrown.
+ *
+ * @param string $subscriptionService
+ * @throws AlreadyRegisteredException
+ *
+ * @since 20.0.0
+ */
+ public function registerService(string $subscriptionService): void;
+
+ /**
+ * Fetches the list of app IDs that are supported by the subscription
+ *
+ * @since 17.0.0
+ */
+ public function delegateGetSupportedApps(): array;
+
+ /**
+ * Indicates if a valid subscription is available
+ *
+ * @since 17.0.0
+ */
+ public function delegateHasValidSubscription(): bool;
+
+ /**
+ * Indicates if the subscription has extended support
+ *
+ * @since 17.0.0
+ */
+ public function delegateHasExtendedSupport(): bool;
+
+ /**
+ * Indicates if a hard user limit is reached and no new users should be created
+ *
+ * @param IManager|null $notificationManager
+ * @since 21.0.0
+ */
+ public function delegateIsHardUserLimitReached(?IManager $notificationManager = null): bool;
+}
diff --git a/lib/public/Support/Subscription/ISubscription.php b/lib/public/Support/Subscription/ISubscription.php
new file mode 100644
index 00000000000..a785875d241
--- /dev/null
+++ b/lib/public/Support/Subscription/ISubscription.php
@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\Subscription;
+
+/**
+ * @since 17.0.0
+ */
+interface ISubscription {
+ /**
+ * Indicates if a valid subscription is available
+ *
+ * @since 17.0.0
+ */
+ public function hasValidSubscription(): bool;
+
+ /**
+ * Indicates if the subscription has extended support
+ *
+ * @since 17.0.0
+ */
+ public function hasExtendedSupport(): bool;
+
+ /**
+ * Indicates if a hard user limit is reached and no new users should be created
+ *
+ * @since 21.0.0
+ */
+ public function isHardUserLimitReached(): bool;
+}
diff --git a/lib/public/Support/Subscription/ISupportedApps.php b/lib/public/Support/Subscription/ISupportedApps.php
new file mode 100644
index 00000000000..d18870e827b
--- /dev/null
+++ b/lib/public/Support/Subscription/ISupportedApps.php
@@ -0,0 +1,21 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Support\Subscription;
+
+/**
+ * @since 17.0.0
+ */
+interface ISupportedApps extends ISubscription {
+ /**
+ * Fetches the list of app IDs that are supported by the subscription
+ *
+ * @since 17.0.0
+ */
+ public function getSupportedApps(): array;
+}