getCategoryList method
获取分类文件列表
参数查看 官方文档
Implementation
Future<CategoryList> getCategoryList({
required List<BaiduCategory> categorys,
String parentPath = '/',
bool showDir = false,
bool recursion = false,
List<String> ext = const [],
int start = 0,
int limit = 1000,
BaiduOrder order = BaiduOrder.time,
bool desc = false,
}) async {
if (categorys.isEmpty) {
throw Exception('categorys is empty');
}
final path = 'rest/2.0/xpan/multimedia';
var param = <String, String>{
'method': 'categorylist',
'parent_path': parentPath,
};
if (recursion) {
param['recursion'] = '1';
}
_addCommonParams(params: param, order: order, desc: desc);
param.putIfNotNull('show_dir', showDir);
param.putIfNotNull('start', start);
param.putIfNotNull('limit', limit);
final categoryIndex = categorys.map((category) => category.value).join(',');
param['category'] = categoryIndex;
if (ext.isNotEmpty) {
param['ext'] = ext.join(',');
}
final map = await _get(path, params: param);
return CategoryList.fromJson(map);
}