mpgirro / stalla

A Kotlin and Java library for RSS podcast feeds
https://stalla.dev
BSD 3-Clause "New" or "Revised" License
26 stars 5 forks source link

Accessor methods for Link Relations #85

Open mpgirro opened 3 years ago

mpgirro commented 3 years ago

76 already proposes accessor methods for Atom link elements for RFC 5005 support. There are more link relations encountered in feeds (most are IANA registered), so I propose to extend the concept to other rel values relevant for podcast feeds. These are the link relations I know of right now:

Link Relation Type Specification
self RFC 4287
alternate HTML
first RFC 5005
last RFC 5005
previous RFC 5005
next RFC 5005
prev-archive RFC 5005
next-archive RFC 5005
current RFC 5005
payment RFC 8288
hub WebSub
http://podlove.org/simple-chapters Podlove External Chapter Information
http://podlove.org/deep-link Podlove Deep Linking
replies RFC 4685
search OpenSearch
related RFC 4287

Accessor methods should be exposed in the Atom Link companion object. The feed history companion can then simply delegate to the Atom methods.

I'll also add this to the scrapper to find out if there are more link relations around.

mpgirro commented 3 years ago

Updated table with RFC 4685 "replies" relation

mpgirro commented 3 years ago

We can also extend this by providing creation methods in the companion for convenience:

const val SELF_REL = "self"

fun createSelfRelation(
    val href: String,
    val hrefLang: String? = null,
    val hrefResolved: String? = null,
    val length: String? = null,
    val title: String? = null,
    val type: MediaType? = null
) = Link(href, hrefLang, hrefResolved, length, title, SELF_REL, title, type)