routes.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Christopher Schäpers <kondou@ts.unde.re>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. * @author Tom Needham <tom@owncloud.com>
  9. *
  10. * @copyright Copyright (c) 2015, ownCloud, Inc.
  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. use OCP\API;
  27. // Config
  28. API::register(
  29. 'get',
  30. '/config',
  31. array('OC_OCS_Config', 'apiConfig'),
  32. 'core',
  33. API::GUEST_AUTH
  34. );
  35. // Person
  36. API::register(
  37. 'post',
  38. '/person/check',
  39. array('OC_OCS_Person', 'check'),
  40. 'core',
  41. API::GUEST_AUTH
  42. );
  43. // Privatedata
  44. API::register(
  45. 'get',
  46. '/privatedata/getattribute',
  47. array('OC_OCS_Privatedata', 'get'),
  48. 'core',
  49. API::USER_AUTH,
  50. array('app' => '', 'key' => '')
  51. );
  52. API::register(
  53. 'get',
  54. '/privatedata/getattribute/{app}',
  55. array('OC_OCS_Privatedata', 'get'),
  56. 'core',
  57. API::USER_AUTH,
  58. array('key' => '')
  59. );
  60. API::register(
  61. 'get',
  62. '/privatedata/getattribute/{app}/{key}',
  63. array('OC_OCS_Privatedata', 'get'),
  64. 'core',
  65. API::USER_AUTH
  66. );
  67. API::register(
  68. 'post',
  69. '/privatedata/setattribute/{app}/{key}',
  70. array('OC_OCS_Privatedata', 'set'),
  71. 'core',
  72. API::USER_AUTH
  73. );
  74. API::register(
  75. 'post',
  76. '/privatedata/deleteattribute/{app}/{key}',
  77. array('OC_OCS_Privatedata', 'delete'),
  78. 'core',
  79. API::USER_AUTH
  80. );
  81. // cloud
  82. API::register(
  83. 'get',
  84. '/cloud/capabilities',
  85. array('OC_OCS_Cloud', 'getCapabilities'),
  86. 'core',
  87. API::USER_AUTH
  88. );
  89. API::register(
  90. 'get',
  91. '/cloud/users/{userid}',
  92. array('OC_OCS_Cloud', 'getUser'),
  93. 'core',
  94. API::USER_AUTH
  95. );
  96. API::register(
  97. 'get',
  98. '/cloud/user',
  99. array('OC_OCS_Cloud', 'getCurrentUser'),
  100. 'core',
  101. API::USER_AUTH
  102. );
  103. // Server-to-Server Sharing
  104. if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
  105. $s2s = new \OCA\Files_Sharing\API\Server2Server();
  106. API::register('post',
  107. '/cloud/shares',
  108. array($s2s, 'createShare'),
  109. 'files_sharing',
  110. API::GUEST_AUTH
  111. );
  112. API::register('post',
  113. '/cloud/shares/{id}/accept',
  114. array($s2s, 'acceptShare'),
  115. 'files_sharing',
  116. API::GUEST_AUTH
  117. );
  118. API::register('post',
  119. '/cloud/shares/{id}/decline',
  120. array($s2s, 'declineShare'),
  121. 'files_sharing',
  122. API::GUEST_AUTH
  123. );
  124. API::register('post',
  125. '/cloud/shares/{id}/unshare',
  126. array($s2s, 'unshare'),
  127. 'files_sharing',
  128. API::GUEST_AUTH
  129. );
  130. }