tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

List Content

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-07 11:03:09

Introduction

This document provides an API overview for listing directory or album content and SDK sample code.
API
Operation Description
List directory or album content

Listing Directory or Album

Feature Overview

List directory or album content.

Example Code

File List
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.list(
//target directory
dir = targetDir,
page number
page = 1,
items per page
pageSize = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List file list via marker + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listWithMarker(
//target directory
dir = targetDir,
//Used to list paginated identification sequentially
marker = 100,
//Used to limit the local project count for sequential paginated listing
limit = 100,
//ETag of current directory
eTag = "eTag",
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List file list via offset + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listWithOffset(
//target directory
dir = targetDir,
//file offset
offset = 100,
//the number of list
limit = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List all files
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listAll(
//target directory
dir = targetDir,
items per page
pageSize = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List all files via marker + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listAllWithMarker(
//target directory
dir = targetDir,
items per pull
limit = 100
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}


Ajuda e Suporte

Esta página foi útil?

comentários