routes.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 Robin McCorkell <rmccorkell@karoshi.org.uk>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Tom Needham <tom@owncloud.com>
  10. *
  11. * @copyright Copyright (c) 2015, ownCloud, Inc.
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  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, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. use OCP\API;
  28. // Config
  29. API::register(
  30. 'get',
  31. '/config',
  32. array('OC_OCS_Config', 'apiConfig'),
  33. 'core',
  34. API::GUEST_AUTH
  35. );
  36. // Person
  37. API::register(
  38. 'post',
  39. '/person/check',
  40. array('OC_OCS_Person', 'check'),
  41. 'core',
  42. API::GUEST_AUTH
  43. );
  44. // Privatedata
  45. API::register(
  46. 'get',
  47. '/privatedata/getattribute',
  48. array('OC_OCS_Privatedata', 'get'),
  49. 'core',
  50. API::USER_AUTH,
  51. array('app' => '', 'key' => '')
  52. );
  53. API::register(
  54. 'get',
  55. '/privatedata/getattribute/{app}',
  56. array('OC_OCS_Privatedata', 'get'),
  57. 'core',
  58. API::USER_AUTH,
  59. array('key' => '')
  60. );
  61. API::register(
  62. 'get',
  63. '/privatedata/getattribute/{app}/{key}',
  64. array('OC_OCS_Privatedata', 'get'),
  65. 'core',
  66. API::USER_AUTH
  67. );
  68. API::register(
  69. 'post',
  70. '/privatedata/setattribute/{app}/{key}',
  71. array('OC_OCS_Privatedata', 'set'),
  72. 'core',
  73. API::USER_AUTH
  74. );
  75. API::register(
  76. 'post',
  77. '/privatedata/deleteattribute/{app}/{key}',
  78. array('OC_OCS_Privatedata', 'delete'),
  79. 'core',
  80. API::USER_AUTH
  81. );
  82. // cloud
  83. API::register(
  84. 'get',
  85. '/cloud/capabilities',
  86. array('OC_OCS_Cloud', 'getCapabilities'),
  87. 'core',
  88. API::USER_AUTH
  89. );
  90. API::register(
  91. 'get',
  92. '/cloud/user',
  93. array('OC_OCS_Cloud', 'getCurrentUser'),
  94. 'core',
  95. API::USER_AUTH
  96. );
  97. // Server-to-Server Sharing
  98. if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
  99. $s2s = new \OCA\Files_Sharing\API\Server2Server();
  100. API::register('post',
  101. '/cloud/shares',
  102. array($s2s, 'createShare'),
  103. 'files_sharing',
  104. API::GUEST_AUTH
  105. );
  106. API::register('post',
  107. '/cloud/shares/{id}/accept',
  108. array($s2s, 'acceptShare'),
  109. 'files_sharing',
  110. API::GUEST_AUTH
  111. );
  112. API::register('post',
  113. '/cloud/shares/{id}/decline',
  114. array($s2s, 'declineShare'),
  115. 'files_sharing',
  116. API::GUEST_AUTH
  117. );
  118. API::register('post',
  119. '/cloud/shares/{id}/unshare',
  120. array($s2s, 'unshare'),
  121. 'files_sharing',
  122. API::GUEST_AUTH
  123. );
  124. }