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.

119 lines
2.8 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Robin McCorkell <robin@mccorkell.me.uk>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP\Route;
  27. /**
  28. * Interface IRoute
  29. *
  30. * @since 7.0.0
  31. */
  32. interface IRoute {
  33. /**
  34. * Specify PATCH as the method to use with this route
  35. * @return \OCP\Route\IRoute
  36. * @since 7.0.0
  37. */
  38. public function patch();
  39. /**
  40. * Specify the method when this route is to be used
  41. *
  42. * @param string $method HTTP method (uppercase)
  43. * @return \OCP\Route\IRoute
  44. * @since 7.0.0
  45. */
  46. public function method($method);
  47. /**
  48. * The action to execute when this route matches, includes a file like
  49. * it is called directly
  50. *
  51. * @param string $file
  52. * @return void
  53. * @since 7.0.0
  54. */
  55. public function actionInclude($file);
  56. /**
  57. * Specify GET as the method to use with this route
  58. * @return \OCP\Route\IRoute
  59. * @since 7.0.0
  60. */
  61. public function get();
  62. /**
  63. * Specify POST as the method to use with this route
  64. * @return \OCP\Route\IRoute
  65. * @since 7.0.0
  66. */
  67. public function post();
  68. /**
  69. * Specify DELETE as the method to use with this route
  70. * @return \OCP\Route\IRoute
  71. * @since 7.0.0
  72. */
  73. public function delete();
  74. /**
  75. * The action to execute when this route matches
  76. *
  77. * @param string|callable $class the class or a callable
  78. * @param string $function the function to use with the class
  79. * @return \OCP\Route\IRoute
  80. *
  81. * This function is called with $class set to a callable or
  82. * to the class with $function
  83. * @since 7.0.0
  84. */
  85. public function action($class, $function = null);
  86. /**
  87. * Defaults to use for this route
  88. *
  89. * @param array $defaults The defaults
  90. * @return \OCP\Route\IRoute
  91. * @since 7.0.0
  92. */
  93. public function defaults($defaults);
  94. /**
  95. * Requirements for this route
  96. *
  97. * @param array $requirements The requirements
  98. * @return \OCP\Route\IRoute
  99. * @since 7.0.0
  100. */
  101. public function requirements($requirements);
  102. /**
  103. * Specify PUT as the method to use with this route
  104. * @return \OCP\Route\IRoute
  105. * @since 7.0.0
  106. */
  107. public function put();
  108. }