webls/atom

Types

An Atom 1.0 spec compliant entry

pub type AtomEntry {
  AtomEntry(
    id: String,
    title: Text,
    updated: timestamp.Timestamp,
    authors: List(Person),
    content: option.Option(Text),
    link: option.Option(Link),
    summary: option.Option(Text),
    categories: List(Category),
    contributors: List(Person),
    published: option.Option(timestamp.Timestamp),
    rights: option.Option(Text),
    source: option.Option(Source),
  )
}

Constructors

  • AtomEntry(
      id: String,
      title: Text,
      updated: timestamp.Timestamp,
      authors: List(Person),
      content: option.Option(Text),
      link: option.Option(Link),
      summary: option.Option(Text),
      categories: List(Category),
      contributors: List(Person),
      published: option.Option(timestamp.Timestamp),
      rights: option.Option(Text),
      source: option.Option(Source),
    )

    Arguments

    id

    The unique identifier of the entry

    title

    The title of the entry

    updated

    The last time the entry was updated

    authors

    A list of authors of the entry

    content

    The content of the entry

    link

    An optional link associated with the entry

    summary

    A summary of the entry

    categories

    A list of categories for the entry

    contributors

    A list of contributors to the entry

    published

    The original publication date of the entry

    rights

    Rights information for the entry

    source

    The source feed if the entry was copied from another feed

An Atom 1.0 spec compliant feed

pub type AtomFeed {
  AtomFeed(
    id: String,
    title: Text,
    updated: timestamp.Timestamp,
    authors: List(Person),
    link: option.Option(Link),
    categories: List(Category),
    contributors: List(Person),
    generator: option.Option(Generator),
    icon: option.Option(String),
    logo: option.Option(String),
    rights: option.Option(Text),
    subtitle: option.Option(String),
    entries: List(AtomEntry),
  )
}

Constructors

  • AtomFeed(
      id: String,
      title: Text,
      updated: timestamp.Timestamp,
      authors: List(Person),
      link: option.Option(Link),
      categories: List(Category),
      contributors: List(Person),
      generator: option.Option(Generator),
      icon: option.Option(String),
      logo: option.Option(String),
      rights: option.Option(Text),
      subtitle: option.Option(String),
      entries: List(AtomEntry),
    )

    Arguments

    id

    The unique identifier of the feed

    title

    The title of the feed

    updated

    The last time the feed was updated

    authors

    A list of authors of the feed

    link

    An optional link associated with the feed

    categories

    A list of categories for the feed

    contributors

    A list of contributors to the feed

    generator

    The generator program of the feed

    icon

    A small icon URL representing the feed

    logo

    A larger logo URL representing the feed

    rights

    Rights information for the feed

    subtitle

    A subtitle or tagline for the feed

    entries

    A list of entries in the feed

A category for classifying feeds or entries

pub type Category {
  Category(
    term: String,
    scheme: option.Option(String),
    label: option.Option(String),
  )
}

Constructors

  • Category(
      term: String,
      scheme: option.Option(String),
      label: option.Option(String),
    )

    Arguments

    term

    The category identifier

    scheme

    An optional URI for the categorization scheme

    label

    An optional human-readable label for the category

Generator information for the feed

pub type Generator {
  Generator(
    uri: option.Option(String),
    version: option.Option(String),
  )
}

Constructors

  • Generator(
      uri: option.Option(String),
      version: option.Option(String),
    )

    Arguments

    uri

    An optional URI for the generator

    version

    An optional version of the generator

A link element in the feed or entry

pub type Link {
  Link(
    href: String,
    rel: option.Option(String),
    content_type: option.Option(String),
    hreflang: option.Option(String),
    title: option.Option(String),
    length: option.Option(Int),
  )
}

Constructors

  • Link(
      href: String,
      rel: option.Option(String),
      content_type: option.Option(String),
      hreflang: option.Option(String),
      title: option.Option(String),
      length: option.Option(Int),
    )

    Arguments

    href

    The URI of the link

    rel

    The relationship type (e.g., “alternate”, “self”, “enclosure”)

    content_type

    The MIME type of the linked resource

    hreflang

    The language of the linked resource

    title

    A human-readable title for the link

    length

    The length in bytes of the linked resource

A person associated with a feed or entry (author or contributor)

pub type Person {
  Person(
    name: String,
    email: option.Option(String),
    uri: option.Option(String),
  )
}

Constructors

  • Person(
      name: String,
      email: option.Option(String),
      uri: option.Option(String),
    )

    Arguments

    name

    The name of the person

    email

    An optional email address of the person

    uri

    An optional URI associated with the person

Source information for an entry copied from another feed

pub type Source {
  Source(id: String, title: String, updated: timestamp.Timestamp)
}

Constructors

  • Source(id: String, title: String, updated: timestamp.Timestamp)

    Arguments

    id

    The unique identifier of the source feed

    title

    The title of the source feed

    updated

    The last time the source feed was updated

Text content that can be plain text, HTML, or XHTML

pub type Text {
  PlainText(value: String)
  Html(value: String)
  XHtml(value: String)
}

Constructors

  • PlainText(value: String)

    Plain text content

  • Html(value: String)

    HTML content

  • XHtml(value: String)

    XHTML content

Values

pub fn category(term: String) -> Category

Creates a base category with just the term

pub fn entry(
  id: String,
  title: Text,
  updated: timestamp.Timestamp,
) -> AtomEntry

Creates a base Atom entry with required fields

pub fn feed(
  id: String,
  title: Text,
  updated: timestamp.Timestamp,
) -> AtomFeed

Creates a base Atom feed with required fields

pub fn html(input: String) -> Text

Creates HTML text content

pub fn link(href: String) -> Link

Creates a base link with just the href

pub fn person(name: String) -> Person

Creates a base person with just the name

pub fn plain_text(input: String) -> Text

Creates plain text content

pub fn to_string(feed: AtomFeed) -> String

Converts an Atom feed to a string of a valid Atom 1.0 feed

pub fn with_category_label(
  category: Category,
  label: String,
) -> Category

Sets the human-readable label for the category

pub fn with_category_scheme(
  category: Category,
  scheme: String,
) -> Category

Sets the categorization scheme URI for the category

pub fn with_entry_authors(
  entry: AtomEntry,
  authors: List(Person),
) -> AtomEntry

Adds a list of authors to the entry

pub fn with_entry_categories(
  entry: AtomEntry,
  categories: List(Category),
) -> AtomEntry

Adds a list of categories to the entry

pub fn with_entry_content(
  entry: AtomEntry,
  content: Text,
) -> AtomEntry

Sets the content of the entry

pub fn with_entry_contributors(
  entry: AtomEntry,
  contributors: List(Person),
) -> AtomEntry

Adds a list of contributors to the entry

pub fn with_entry_id(entry: AtomEntry, id: String) -> AtomEntry

Sets the unique identifier of the entry

pub fn with_entry_link(entry: AtomEntry, link: Link) -> AtomEntry

Sets the link of the entry

pub fn with_entry_published(
  entry: AtomEntry,
  published: timestamp.Timestamp,
) -> AtomEntry

Sets the publication date of the entry

pub fn with_entry_rights(
  entry: AtomEntry,
  rights: Text,
) -> AtomEntry

Sets the rights information of the entry

pub fn with_entry_source(
  entry: AtomEntry,
  source: Source,
) -> AtomEntry

Sets the source feed of the entry

pub fn with_entry_summary(
  entry: AtomEntry,
  summary: Text,
) -> AtomEntry

Sets the summary of the entry

pub fn with_entry_title(
  entry: AtomEntry,
  title: Text,
) -> AtomEntry

Sets the title of the entry

pub fn with_entry_updated(
  entry: AtomEntry,
  updated: timestamp.Timestamp,
) -> AtomEntry

Sets the last updated timestamp of the entry

pub fn with_feed_author(
  feed: AtomFeed,
  author: Person,
) -> AtomFeed

Adds an author to the feed

pub fn with_feed_authors(
  feed: AtomFeed,
  authors: List(Person),
) -> AtomFeed

Adds a list of authors to the feed

pub fn with_feed_categories(
  feed: AtomFeed,
  categories: List(Category),
) -> AtomFeed

Adds a list of categories to the feed

pub fn with_feed_category(
  feed: AtomFeed,
  category: Category,
) -> AtomFeed

Adds a category to the feed

pub fn with_feed_contributor(
  feed: AtomFeed,
  contributor: Person,
) -> AtomFeed

Adds a contributor to the feed

pub fn with_feed_contributors(
  feed: AtomFeed,
  contributors: List(Person),
) -> AtomFeed

Adds a list of contributors to the feed

pub fn with_feed_entries(
  feed: AtomFeed,
  entries: List(AtomEntry),
) -> AtomFeed

Adds a list of entries to the feed

pub fn with_feed_entry(
  feed: AtomFeed,
  entry: AtomEntry,
) -> AtomFeed

Adds an entry to the feed

pub fn with_feed_generator(
  feed: AtomFeed,
  generator: Generator,
) -> AtomFeed

Sets the generator of the feed

pub fn with_feed_icon(feed: AtomFeed, icon: String) -> AtomFeed

Sets the icon URL of the feed

pub fn with_feed_link(feed: AtomFeed, link: Link) -> AtomFeed

Sets the link of the feed

pub fn with_feed_logo(feed: AtomFeed, logo: String) -> AtomFeed

Sets the logo URL of the feed

pub fn with_feed_rights(feed: AtomFeed, rights: Text) -> AtomFeed

Sets the rights information of the feed

pub fn with_feed_subtitle(
  feed: AtomFeed,
  subtitle: String,
) -> AtomFeed

Sets the subtitle of the feed

pub fn with_link_content_type(
  link: Link,
  content_type: String,
) -> Link

Sets the content type of the link

pub fn with_link_hreflang(link: Link, hreflang: String) -> Link

Sets the language of the linked resource

pub fn with_link_length(link: Link, length: Int) -> Link

Sets the length in bytes of the linked resource

pub fn with_link_rel(link: Link, rel: String) -> Link

Sets the relationship type of the link

pub fn with_link_title(link: Link, title: String) -> Link

Sets the title of the link

pub fn with_person_email(person: Person, email: String) -> Person

Sets the email address of the person

pub fn with_person_uri(person: Person, uri: String) -> Person

Sets the URI associated with the person

pub fn xhtml(input: String) -> Text

Creates XHTML text content

Search Document