iroute.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Route;
  26. /**
  27. * Interface IRoute
  28. *
  29. * @package OCP\Route
  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. }