Example: Browsing the contents of a folder¶
Frequency of use | Common |
---|---|
Trigger | User initiated |
Pre-conditions |
|
Actors |
|
Communication Flow: Kotlin
Files.browse.call(
ResourceBrowseRequest(
consistency = null,
flags = UFileIncludeFlags(
allowUnsupportedInclude = null,
filterByFileExtension = null,
filterCreatedAfter = null,
filterCreatedBefore = null,
filterCreatedBy = null,
filterHiddenFiles = false,
filterIds = null,
filterProductCategory = null,
filterProductId = null,
filterProvider = null,
filterProviderIds = null,
hideProductCategory = null,
hideProductId = null,
hideProvider = null,
includeMetadata = null,
includeOthers = false,
includePermissions = null,
includeProduct = false,
includeSizes = null,
includeSupport = false,
includeTimestamps = true,
includeUnixInfo = null,
includeUpdates = false,
path = null,
),
itemsPerPage = null,
itemsToSkip = null,
next = null,
sortBy = null,
sortDirection = null,
),
user
).orThrow()
/*
PageV2(
items = listOf(UFile(
createdAt = 1632903417165,
id = "/123/folder/file.txt",
owner = ResourceOwner(
createdBy = "user",
project = "f63919cd-60d3-45d3-926b-0246dcc697fd",
),
permissions = null,
specification = UFileSpecification(
collection = "123",
product = ProductReference(
category = "u1-cephfs",
id = "u1-cephfs",
provider = "ucloud",
),
),
status = UFileStatus(
accessedAt = null,
icon = null,
metadata = null,
modifiedAt = 1632903417165,
resolvedProduct = null,
resolvedSupport = null,
sizeInBytes = null,
sizeIncludingChildrenInBytes = null,
type = FileType.FILE,
unixGroup = null,
unixMode = null,
unixOwner = null,
),
updates = emptyList(),
providerGeneratedId = "/123/folder/file.txt",
)),
itemsPerPage = 50,
next = null,
)
*/
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 -XGET -H "Authorization: Bearer $accessToken" "$host/api/files/browse?includeOthers=false&includeUpdates=false&includeSupport=false&includeProduct=false&includeTimestamps=true&filterHiddenFiles=false"
# {
# "itemsPerPage": 50,
# "items": [
# {
# "id": "/123/folder/file.txt",
# "specification": {
# "collection": "123",
# "product": {
# "id": "u1-cephfs",
# "category": "u1-cephfs",
# "provider": "ucloud"
# }
# },
# "createdAt": 1632903417165,
# "status": {
# "type": "FILE",
# "icon": null,
# "sizeInBytes": null,
# "sizeIncludingChildrenInBytes": null,
# "modifiedAt": 1632903417165,
# "accessedAt": null,
# "unixMode": null,
# "unixOwner": null,
# "unixGroup": null,
# "metadata": null,
# "resolvedSupport": null,
# "resolvedProduct": null
# },
# "owner": {
# "createdBy": "user",
# "project": "f63919cd-60d3-45d3-926b-0246dcc697fd"
# },
# "permissions": null,
# "updates": [
# ]
# }
# ],
# "next": null
# }