getCollection method

Future<Collection> getCollection({
  1. required String userName,
  2. bool own = false,
  3. bool wishlist = false,
})

Implementation

Future<Collection> getCollection({
  required String userName,
  bool own = false,
  bool wishlist = false,
}) async {
  try {
    final xmlString = await _api.fetchCollection(
      userName: userName,
      own: own,
      wishlist: wishlist,
    );

    final document = XmlDocument.parse(xmlString);
    return Collection.fromXml(document.rootElement);
  } on BggException {
    rethrow;
  } catch (e) {
    throw BggParsingException();
  }
}