Example: Emptying trash folder

Frequency of useCommon
TriggerUser initiated
Pre-conditions
  • A trash folder located at /home/trash
  • The trash folder contains two files and a folder
Post-conditions
  • The folder and all children are removed from the trash folder
  • The files is removed from the trash folder
Actors
  • An authenticated user (user)
Communication Flow: Kotlin
Files.trash.call(
    bulkRequestOf(FindByPath(
        id = "/home/trash", 
    )),
    user
).orThrow()

/*
BulkResponse(
    responses = listOf(LongRunningTask.Complete()), 
)
*/
Communication Flow: TypeScript
// Authenticated as user
await callAPI(FilesApi.trash(
    {
        "items": [
            {
                "id": "/home/trash"
            }
        ]
    }
);

/*
{
    "responses": [
        {
            "type": "complete"
        }
    ]
}
*/
Communication Flow: Curl
# ------------------------------------------------------------------------------------------------------
# $host is the UCloud instance to contact. Example: 'http://localhost:8080' or 'https://cloud.sdu.dk'
# $accessToken is a valid access-token issued by UCloud
# ------------------------------------------------------------------------------------------------------

# Authenticated as user
curl -XPOST -H "Authorization: Bearer $accessToken" -H "Content-Type: content-type: application/json; charset=utf-8" "$host/api/files/trash" -d '{
    "items": [
        {
            "id": "/home/trash"
        }
    ]
}'


# {
#     "responses": [
#         {
#             "type": "complete"
#         }
#     ]
# }
Communication Flow: Visual