Skip to content

Commit 4da3d1d

Browse files
docs: Add method docs
Signed-off-by: Andy Scherzinger <[email protected]>
1 parent 22eb114 commit 4da3d1d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

app/src/main/java/it/niedermann/owncloud/notes/share/repository/ShareRepository.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ class ShareRepository(private val applicationContext: Context, private val accou
231231
)
232232
}
233233

234+
/**
235+
* Fetches all shares for the given file or folder identified by its remote ID.
236+
*
237+
* @param remoteId The remote file ID on the server for which to retrieve shares.
238+
* @return A list of [OCShare] objects if the request is successful, or `null` if the request fails or an exception
239+
* occurs.
240+
*/
234241
fun getShares(remoteId: Long): List<OCShare>? {
235242
val shareAPI = apiProvider.getShareAPI(applicationContext, account)
236243
val call = shareAPI.getShares(remoteId)
@@ -314,6 +321,13 @@ class ShareRepository(private val applicationContext: Context, private val accou
314321
}
315322
}
316323

324+
/**
325+
* Updates an existing share.
326+
*
327+
* @param shareId The id of the share to update.
328+
* @param requestBody The [UpdateShareRequest] containing the new share attributes.
329+
* @return An [ApiResult] with the server response [OcsResponse] on success, or an error result on failure.
330+
*/
317331
fun updateShare(shareId: Long, requestBody: UpdateShareRequest): ApiResult<OcsResponse<CreateShareResponse>?> {
318332
val shareAPI = apiProvider.getShareAPI(applicationContext, account)
319333
val call = shareAPI.updateShare(shareId, requestBody)
@@ -391,6 +405,14 @@ class ShareRepository(private val applicationContext: Context, private val accou
391405
}
392406
}
393407

408+
/**
409+
* Updates the permissions for an existing share.
410+
*
411+
* @param shareId The id of the share to update.
412+
* @param permissions The new permission level to set
413+
* @return An [ApiResult] containing the server response [OcsResponse] with the updated share details on success,
414+
* or an error message on failure.
415+
*/
394416
fun updateSharePermission(shareId: Long, permissions: Int? = null): ApiResult<OcsResponse<CreateShareResponse>?> {
395417
val shareAPI = apiProvider.getShareAPI(applicationContext, account)
396418
val requestBody = UpdateSharePermissionRequest(permissions = permissions)

0 commit comments

Comments
 (0)