You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IRegistrationContext.php 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Julius Härtl <jus@bitgrid.net>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license GNU AGPL version 3 or any later version
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as
  15. * published by the Free Software Foundation, either version 3 of the
  16. * License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. */
  27. namespace OCP\AppFramework\Bootstrap;
  28. use OCP\AppFramework\IAppContainer;
  29. use OCP\Authentication\TwoFactorAuth\IProvider;
  30. use OCP\Calendar\ICalendarProvider;
  31. use OCP\Capabilities\ICapability;
  32. use OCP\Collaboration\Reference\IReferenceProvider;
  33. use OCP\EventDispatcher\IEventDispatcher;
  34. use OCP\Files\Template\ICustomTemplateProvider;
  35. use OCP\IContainer;
  36. use OCP\Notification\INotifier;
  37. use OCP\Preview\IProviderV2;
  38. use OCP\SpeechToText\ISpeechToTextProvider;
  39. use OCP\TextProcessing\IProvider as ITextProcessingProvider;
  40. use OCP\TextToImage\IProvider as ITextToImageProvider;
  41. use OCP\Translation\ITranslationProvider;
  42. /**
  43. * The context object passed to IBootstrap::register
  44. *
  45. * @since 20.0.0
  46. * @see IBootstrap::register()
  47. */
  48. interface IRegistrationContext {
  49. /**
  50. * @param string $capability
  51. * @psalm-param class-string<ICapability> $capability
  52. * @see IAppContainer::registerCapability
  53. *
  54. * @since 20.0.0
  55. */
  56. public function registerCapability(string $capability): void;
  57. /**
  58. * Register an implementation of \OCP\Support\CrashReport\IReporter that
  59. * will receive unhandled exceptions and throwables
  60. *
  61. * @param string $reporterClass
  62. * @psalm-param class-string<\OCP\Support\CrashReport\IReporter> $reporterClass
  63. * @return void
  64. * @since 20.0.0
  65. */
  66. public function registerCrashReporter(string $reporterClass): void;
  67. /**
  68. * Register an implementation of \OCP\Dashboard\IWidget that
  69. * will handle the implementation of a dashboard widget
  70. *
  71. * @param string $widgetClass
  72. * @psalm-param class-string<\OCP\Dashboard\IWidget> $widgetClass
  73. * @return void
  74. * @since 20.0.0
  75. */
  76. public function registerDashboardWidget(string $widgetClass): void;
  77. /**
  78. * Register a service
  79. *
  80. * @param string $name
  81. * @param callable $factory
  82. * @psalm-param callable(\Psr\Container\ContainerInterface): mixed $factory
  83. * @param bool $shared
  84. *
  85. * @return void
  86. * @see IContainer::registerService()
  87. *
  88. * @since 20.0.0
  89. */
  90. public function registerService(string $name, callable $factory, bool $shared = true): void;
  91. /**
  92. * @param string $alias
  93. * @psalm-param string|class-string $alias
  94. * @param string $target
  95. * @psalm-param string|class-string $target
  96. *
  97. * @return void
  98. * @see IContainer::registerAlias()
  99. *
  100. * @since 20.0.0
  101. */
  102. public function registerServiceAlias(string $alias, string $target): void;
  103. /**
  104. * @param string $name
  105. * @param mixed $value
  106. *
  107. * @return void
  108. * @see IContainer::registerParameter()
  109. *
  110. * @since 20.0.0
  111. */
  112. public function registerParameter(string $name, $value): void;
  113. /**
  114. * Register a service listener
  115. *
  116. * This is equivalent to calling IEventDispatcher::addServiceListener
  117. *
  118. * @psalm-template T of \OCP\EventDispatcher\Event
  119. * @param string $event preferably the fully-qualified class name of the Event sub class to listen for
  120. * @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for
  121. * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container
  122. * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $listener fully qualified class name that can be built by the DI container
  123. * @param int $priority The higher this value, the earlier an event
  124. * listener will be triggered in the chain (defaults to 0)
  125. *
  126. * @see IEventDispatcher::addServiceListener()
  127. *
  128. * @since 20.0.0
  129. */
  130. public function registerEventListener(string $event, string $listener, int $priority = 0): void;
  131. /**
  132. * @param string $class
  133. * @param bool $global load this middleware also for requests of other apps? Added in Nextcloud 26
  134. * @psalm-param class-string<\OCP\AppFramework\Middleware> $class
  135. *
  136. * @return void
  137. * @see IAppContainer::registerMiddleWare()
  138. *
  139. * @since 20.0.0
  140. * @since 26.0.0 Added optional argument $global
  141. */
  142. public function registerMiddleware(string $class, bool $global = false): void;
  143. /**
  144. * Register a search provider for the unified search
  145. *
  146. * It is allowed to register more than one provider per app as the search
  147. * results can go into distinct sections, e.g. "Files" and "Files shared
  148. * with you" in the Files app.
  149. *
  150. * @param string $class
  151. * @psalm-param class-string<\OCP\Search\IProvider> $class
  152. *
  153. * @return void
  154. *
  155. * @since 20.0.0
  156. */
  157. public function registerSearchProvider(string $class): void;
  158. /**
  159. * Register an alternative login option
  160. *
  161. * It is allowed to register more than one option per app.
  162. *
  163. * @param string $class
  164. * @psalm-param class-string<\OCP\Authentication\IAlternativeLogin> $class
  165. *
  166. * @return void
  167. *
  168. * @since 20.0.0
  169. */
  170. public function registerAlternativeLogin(string $class): void;
  171. /**
  172. * Register an initialstate provider
  173. *
  174. * It is allowed to register more than one provider per app.
  175. *
  176. * @param string $class
  177. * @psalm-param class-string<\OCP\AppFramework\Services\InitialStateProvider> $class
  178. *
  179. * @return void
  180. *
  181. * @since 21.0.0
  182. */
  183. public function registerInitialStateProvider(string $class): void;
  184. /**
  185. * Register a well known protocol handler
  186. *
  187. * It is allowed to register more than one handler per app.
  188. *
  189. * @param string $class
  190. * @psalm-param class-string<\OCP\Http\WellKnown\IHandler> $class
  191. *
  192. * @return void
  193. *
  194. * @since 21.0.0
  195. */
  196. public function registerWellKnownHandler(string $class): void;
  197. /**
  198. * Register a custom SpeechToText provider class that can provide transcription
  199. * of audio through the OCP\SpeechToText APIs
  200. *
  201. * @param string $providerClass
  202. * @psalm-param class-string<ISpeechToTextProvider> $providerClass
  203. * @since 27.0.0
  204. */
  205. public function registerSpeechToTextProvider(string $providerClass): void;
  206. /**
  207. * Register a custom text processing provider class that provides a promptable language model
  208. * through the OCP\TextProcessing APIs
  209. *
  210. * @param string $providerClass
  211. * @psalm-param class-string<ITextProcessingProvider> $providerClass
  212. * @since 27.1.0
  213. */
  214. public function registerTextProcessingProvider(string $providerClass): void;
  215. /**
  216. * Register a custom text2image provider class that provides the possibility to generate images
  217. * through the OCP\TextToImage APIs
  218. *
  219. * @param string $providerClass
  220. * @psalm-param class-string<ITextToImageProvider> $providerClass
  221. * @since 28.0.0
  222. */
  223. public function registerTextToImageProvider(string $providerClass): void;
  224. /**
  225. * Register a custom template provider class that is able to inject custom templates
  226. * in addition to the user defined ones
  227. *
  228. * @param string $providerClass
  229. * @psalm-param class-string<ICustomTemplateProvider> $providerClass
  230. * @since 21.0.0
  231. */
  232. public function registerTemplateProvider(string $providerClass): void;
  233. /**
  234. * Register a custom translation provider class that can provide translation
  235. * between languages through the OCP\Translation APIs
  236. *
  237. * @param string $providerClass
  238. * @psalm-param class-string<ITranslationProvider> $providerClass
  239. * @since 21.0.0
  240. */
  241. public function registerTranslationProvider(string $providerClass): void;
  242. /**
  243. * Register an INotifier class
  244. *
  245. * @param string $notifierClass
  246. * @psalm-param class-string<INotifier> $notifierClass
  247. * @since 22.0.0
  248. */
  249. public function registerNotifierService(string $notifierClass): void;
  250. /**
  251. * Register a two-factor provider
  252. *
  253. * @param string $twoFactorProviderClass
  254. * @psalm-param class-string<IProvider> $twoFactorProviderClass
  255. * @since 22.0.0
  256. */
  257. public function registerTwoFactorProvider(string $twoFactorProviderClass): void;
  258. /**
  259. * Register a preview provider
  260. *
  261. * It is allowed to register more than one provider per app.
  262. *
  263. * @param string $previewProviderClass
  264. * @param string $mimeTypeRegex
  265. * @psalm-param class-string<IProviderV2> $previewProviderClass
  266. * @since 23.0.0
  267. */
  268. public function registerPreviewProvider(string $previewProviderClass, string $mimeTypeRegex): void;
  269. /**
  270. * Register a calendar provider
  271. *
  272. * @param string $class
  273. * @psalm-param class-string<ICalendarProvider> $class
  274. * @since 23.0.0
  275. */
  276. public function registerCalendarProvider(string $class): void;
  277. /**
  278. * Register a reference provider
  279. *
  280. * @param string $class
  281. * @psalm-param class-string<IReferenceProvider> $class
  282. * @since 25.0.0
  283. */
  284. public function registerReferenceProvider(string $class): void;
  285. /**
  286. * Register an implementation of \OCP\Profile\ILinkAction that
  287. * will handle the implementation of a profile link action
  288. *
  289. * @param string $actionClass
  290. * @psalm-param class-string<\OCP\Profile\ILinkAction> $actionClass
  291. * @return void
  292. * @since 23.0.0
  293. */
  294. public function registerProfileLinkAction(string $actionClass): void;
  295. /**
  296. * Register the backend of the Talk app
  297. *
  298. * This service must only be used by the Talk app
  299. *
  300. * @param string $backend
  301. * @return void
  302. * @since 24.0.0
  303. */
  304. public function registerTalkBackend(string $backend): void;
  305. /**
  306. * Register a resource backend for the DAV server
  307. *
  308. * @param string $actionClass
  309. * @psalm-param class-string<\OCP\Calendar\Resource\IBackend> $actionClass
  310. * @return void
  311. * @since 24.0.0
  312. */
  313. public function registerCalendarResourceBackend(string $class): void;
  314. /**
  315. * Register a room backend for the DAV server
  316. *
  317. * @param string $actionClass
  318. * @psalm-param class-string<\OCP\Calendar\Room\IBackend> $actionClass
  319. * @return void
  320. * @since 24.0.0
  321. */
  322. public function registerCalendarRoomBackend(string $class): void;
  323. /**
  324. * @param string $class
  325. * @psalm-param class-string<\OCP\Calendar\Room\IBackend> $actionClass
  326. * @return void
  327. * @since 29.0.0
  328. */
  329. public function registerTeamResourceProvider(string $class): void;
  330. /**
  331. * Register an implementation of \OCP\UserMigration\IMigrator that
  332. * will handle the implementation of a migrator
  333. *
  334. * @param string $migratorClass
  335. * @psalm-param class-string<\OCP\UserMigration\IMigrator> $migratorClass
  336. * @return void
  337. * @since 24.0.0
  338. */
  339. public function registerUserMigrator(string $migratorClass): void;
  340. /**
  341. * Announce methods of classes that may contain sensitive values, which
  342. * should be obfuscated before being logged.
  343. *
  344. * @param string $class
  345. * @param string[] $methods
  346. * @return void
  347. * @since 25.0.0
  348. */
  349. public function registerSensitiveMethods(string $class, array $methods): void;
  350. /**
  351. * Register an implementation of IPublicShareTemplateProvider.
  352. *
  353. * @param string $class
  354. * @psalm-param class-string<\OCP\Share\IPublicShareTemplateProvider> $class
  355. * @return void
  356. * @since 26.0.0
  357. */
  358. public function registerPublicShareTemplateProvider(string $class): void;
  359. /**
  360. * Register an implementation of \OCP\SetupCheck\ISetupCheck that
  361. * will handle the implementation of a setup check
  362. *
  363. * @param class-string<\OCP\SetupCheck\ISetupCheck> $setupCheckClass
  364. * @since 28.0.0
  365. */
  366. public function registerSetupCheck(string $setupCheckClass): void;
  367. /**
  368. * Register an implementation of \OCP\Settings\IDeclarativeSettings that
  369. * will handle the implementation of declarative settings
  370. *
  371. * @param string $declarativeSettingsClass
  372. * @psalm-param class-string<\OCP\Settings\IDeclarativeSettingsForm> $declarativeSettingsClass
  373. * @return void
  374. * @since 29.0.0
  375. */
  376. public function registerDeclarativeSettings(string $declarativeSettingsClass): void;
  377. }