55 * @author Bjoern Schiessle <[email protected] > 66 * @author Joas Schilling <[email protected] > 77 * @author Roeland Jago Douma <[email protected] > 8+ * @author Kate Döen <[email protected] > 89 *
910 * @license AGPL-3.0
1011 *
2425namespace OCA \Files_Sharing \Controller ;
2526
2627use OCA \Files_Sharing \External \Manager ;
28+ use OCA \Files_Sharing \ResponseDefinitions ;
29+ use OCP \AppFramework \Http ;
2730use OCP \AppFramework \Http \DataResponse ;
2831use OCP \AppFramework \OCS \OCSForbiddenException ;
2932use OCP \AppFramework \OCS \OCSNotFoundException ;
3033use OCP \AppFramework \OCSController ;
3134use OCP \IRequest ;
3235use Psr \Log \LoggerInterface ;
3336
37+ /**
38+ * @psalm-import-type FilesSharingRemoteShare from ResponseDefinitions
39+ */
3440class RemoteController extends OCSController {
3541 /**
3642 * @NoAdminRequired
@@ -55,7 +61,7 @@ public function __construct(
5561 *
5662 * Get list of pending remote shares
5763 *
58- * @return DataResponse
64+ * @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare[], array{}>
5965 */
6066 public function getOpenShares () {
6167 return new DataResponse ($ this ->externalManager ->getOpenShares ());
@@ -66,9 +72,11 @@ public function getOpenShares() {
6672 *
6773 * Accept a remote share
6874 *
69- * @param int $id
70- * @return DataResponse
71- * @throws OCSNotFoundException
75+ * @param int $id ID of the share
76+ * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
77+ * @throws OCSNotFoundException Share not found
78+ *
79+ * 200: Share accepted successfully
7280 */
7381 public function acceptShare ($ id ) {
7482 if ($ this ->externalManager ->acceptShare ($ id )) {
@@ -86,9 +94,11 @@ public function acceptShare($id) {
8694 *
8795 * Decline a remote share
8896 *
89- * @param int $id
90- * @return DataResponse
91- * @throws OCSNotFoundException
97+ * @param int $id ID of the share
98+ * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
99+ * @throws OCSNotFoundException Share not found
100+ *
101+ * 200: Share declined successfully
92102 */
93103 public function declineShare ($ id ) {
94104 if ($ this ->externalManager ->declineShare ($ id )) {
@@ -125,9 +135,9 @@ private static function extendShareInfo($share) {
125135 /**
126136 * @NoAdminRequired
127137 *
128- * List accepted remote shares
138+ * Get a list of accepted remote shares
129139 *
130- * @return DataResponse
140+ * @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare[], array{}>
131141 */
132142 public function getShares () {
133143 $ shares = $ this ->externalManager ->getAcceptedShares ();
@@ -141,9 +151,11 @@ public function getShares() {
141151 *
142152 * Get info of a remote share
143153 *
144- * @param int $id
145- * @return DataResponse
146- * @throws OCSNotFoundException
154+ * @param int $id ID of the share
155+ * @return DataResponse<Http::STATUS_OK, FilesSharingRemoteShare, array{}>
156+ * @throws OCSNotFoundException Share not found
157+ *
158+ * 200: Share returned
147159 */
148160 public function getShare ($ id ) {
149161 $ shareInfo = $ this ->externalManager ->getShare ($ id );
@@ -161,10 +173,12 @@ public function getShare($id) {
161173 *
162174 * Unshare a remote share
163175 *
164- * @param int $id
165- * @return DataResponse
166- * @throws OCSNotFoundException
167- * @throws OCSForbiddenException
176+ * @param int $id ID of the share
177+ * @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
178+ * @throws OCSNotFoundException Share not found
179+ * @throws OCSForbiddenException Unsharing is not possible
180+ *
181+ * 200: Share unshared successfully
168182 */
169183 public function unshare ($ id ) {
170184 $ shareInfo = $ this ->externalManager ->getShare ($ id );
0 commit comments