IRoute.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Route;
  8. /**
  9. * Interface IRoute
  10. *
  11. * @since 7.0.0
  12. */
  13. interface IRoute {
  14. /**
  15. * Specify PATCH as the method to use with this route
  16. * @return \OCP\Route\IRoute
  17. * @since 7.0.0
  18. */
  19. public function patch();
  20. /**
  21. * Specify the method when this route is to be used
  22. *
  23. * @param string $method HTTP method (uppercase)
  24. * @return \OCP\Route\IRoute
  25. * @since 7.0.0
  26. */
  27. public function method($method);
  28. /**
  29. * The action to execute when this route matches, includes a file like
  30. * it is called directly
  31. *
  32. * @param string $file
  33. * @return void
  34. * @since 7.0.0
  35. */
  36. public function actionInclude($file);
  37. /**
  38. * Specify GET as the method to use with this route
  39. * @return \OCP\Route\IRoute
  40. * @since 7.0.0
  41. */
  42. public function get();
  43. /**
  44. * Specify POST as the method to use with this route
  45. * @return \OCP\Route\IRoute
  46. * @since 7.0.0
  47. */
  48. public function post();
  49. /**
  50. * Specify DELETE as the method to use with this route
  51. * @return \OCP\Route\IRoute
  52. * @since 7.0.0
  53. */
  54. public function delete();
  55. /**
  56. * The action to execute when this route matches
  57. *
  58. * @param string|callable $class the class or a callable
  59. * @param string $function the function to use with the class
  60. * @return \OCP\Route\IRoute
  61. *
  62. * This function is called with $class set to a callable or
  63. * to the class with $function
  64. * @since 7.0.0
  65. */
  66. public function action($class, $function = null);
  67. /**
  68. * Defaults to use for this route
  69. *
  70. * @param array $defaults The defaults
  71. * @return \OCP\Route\IRoute
  72. * @since 7.0.0
  73. */
  74. public function defaults($defaults);
  75. /**
  76. * Requirements for this route
  77. *
  78. * @param array $requirements The requirements
  79. * @return \OCP\Route\IRoute
  80. * @since 7.0.0
  81. */
  82. public function requirements($requirements);
  83. /**
  84. * Specify PUT as the method to use with this route
  85. * @return \OCP\Route\IRoute
  86. * @since 7.0.0
  87. */
  88. public function put();
  89. }