listObject method

Future<ListBucketResult> listObject({
  1. String prefix = "",
})

Implementation

Future<ListBucketResult> listObject({String prefix = ""}) async {
  cosLog("listObject");
  var response = await getResponse("GET", "/", params: {"prefix": prefix});
  cosLog("request-id:" + (response.headers["x-cos-request-id"]?.first ?? ""));
  String xmlContent = await response.transform(utf8.decoder).join("");
  if (response.statusCode != 200) {
    throw COSException(response.statusCode, xmlContent);
  }
  var content = XmlDocument.parse(xmlContent);
  return ListBucketResult(content.rootElement);
}