Media.parse constructor

Media.parse(
  1. XmlElement element
)

Implementation

factory Media.parse(XmlElement element) {
  return Media(
    group: element
        .findElements('media:group')
        .map((e) => Group.parse(e))
        .firstOrNull,
    contents: element
        .findElements('media:content')
        .map((e) => Content.parse(e))
        .toList(),
    credits: element
        .findElements('media:credit')
        .map((e) => Credit.parse(e))
        .toList(),
    category: element
        .findElements('media:category')
        .map((e) => Category.parse(e))
        .firstOrNull,
    rating: element
        .findElements('media:rating')
        .map((e) => Rating.parse(e))
        .firstOrNull,
    title: findElements(element, 'media:title')
        ?.map((e) => Title.parse(e))
        .firstOrNull,
    description: element
        .findElements('media:description')
        .map((e) => Description.parse(e))
        .firstOrNull,
    keywords: element.findElements('media:keywords').firstOrNull?.text,
    thumbnails: element
        .findElements('media:thumbnail')
        .map((e) => Thumbnail.parse(e))
        .toList(),
    hash: element
        .findElements('media:hash')
        .map((e) => Hash.parse(e))
        .firstOrNull,
    player: element
        .findElements('media:player')
        .map((e) => Player.parse(e))
        .firstOrNull,
    copyright: element
        .findElements('media:copyright')
        .map((e) => Copyright.parse(e))
        .firstOrNull,
    text: element
        .findElements('media:text')
        .map((e) => Text.parse(e))
        .firstOrNull,
    restriction: element
        .findElements('media:restriction')
        .map((e) => Restriction.parse(e))
        .firstOrNull,
    community: element
        .findElements('media:community')
        .map((e) => Community.parse(e))
        .firstOrNull,
    comments: element
            .findElements('media:comments')
            .firstOrNull
            ?.findElements('media:comment')
            .map((e) => e.text)
            .toList() ??
        [],
    embed: element
        .findElements('media:embed')
        .map((e) => Embed.parse(e))
        .firstOrNull,
    responses: element
            .findElements('media:responses')
            .firstOrNull
            ?.findElements('media:response')
            .map((e) => e.text)
            .toList() ??
        [],
    backLinks: element
            .findElements('media:backLinks')
            .firstOrNull
            ?.findElements('media:backLink')
            .map((e) => e.text)
            .toList() ??
        [],
    status: element
        .findElements('media:status')
        .map((e) => Status.parse(e))
        .firstOrNull,
    prices: element
        .findElements('media:price')
        .map((e) => Price.parse(e))
        .toList(),
    license: element
        .findElements('media:license')
        .map((e) => License.parse(e))
        .firstOrNull,
    peerLink: element
        .findElements('media:peerLink')
        .map((e) => PeerLink.parse(e))
        .firstOrNull,
    rights: element
        .findElements('media:rights')
        .map((e) => Rights.parse(e))
        .firstOrNull,
    scenes: element
            .findElements('media:scenes')
            .firstOrNull
            ?.findElements('media:scene')
            .map((e) => Scene.parse(e))
            .toList() ??
        [],
  );
}