On this page:
1.1 Atom Documents
atom
atom<%>
is-feed?
get-sxml
get-id
get-title
get-updated
get-link
get-raw-link
get-entries
get-raw-entries
get-tag-value
1.2 Atom Resources
atom-resource<%>
get-atom
get-feed-atom
get-atom-sxml
get-id
get-title
atom-feed-resource<%>
list-children
find-children-by-title
find-child-by-title
find-child-by-id

1 Atom Documents and Resources

Many web services use the Atom Syndication Format. This library provides utilities for manipulating Atom documents and resources represented with Atom documents.

1.1 Atom Documents

 (require (planet ryanc/webapi:1:=0/atom))

An Atom document is represented by an atom<%> object. Specifically, an atom<%> object is a thin, immutable wrapper around the SXML representation of an Atom document. The wrapper object provides methods for accessing some common Atom elements and attributes, but most nontrivial operations must be done on the underlying SXML.

(atom sxml)  (is-a?/c atom<%>)
  sxml : SXML
Returns an atom<%> object encapsulating the given Atom document.

Represents an Atom document. Obtain an instance via atom.

(send an-atom is-feed?)  boolean?
Returns #t if the Atom document is a feed element, #f if it is an entry element. Note that the same resource can be represented in one context as a feed and in another as an entry.
(send an-atom get-sxml)  SXML
Returns the encapsulated SXML document.
(send an-atom get-id)  string?
Returns the contents of the document’s id element.
(send an-atom get-title)  string?
Returns the contents of the document’s title element.
(send an-atom get-updated)  string?
Returns the contents of the document’s updated element (a timestamp in string form).
(send an-atom get-link rel [default])  string?
  rel : string?
  default : any/c = (lambda () (error ....))
Returns the value of the link having relation (rel attribute) rel. If no such link is found, default is applied if it is a procedure or returned otherwise.
(send an-atom get-raw-link rel [default])  SXML
  rel : string?
  default : any/c = (lambda () (error ....))
Returns the link element having relation (rel attribute) rel. If no such link is found, default is applied if it is a procedure or returned otherwise.
(send an-atom get-entries)  (listof (is-a?/c atom<%>))
If the document is a feed, returns the list of its entries as atom<%> objects. If the document is an entry, returns '().
(send an-atom get-raw-entries)  (listof SXML)
If the document is a feed, returns the list of its entry elements. If the document is an entry, returns '().
(send an-atom get-tag-value tag default)  string?
  tag : symbol?
  default : any/c
Returns the text content of the (first) element named tag among the immediate children of the Atom document’s root element. If no such element exists, default is applied if it is a procedure or returned otherwise.

1.2 Atom Resources

 (require (planet ryanc/webapi:1:=0/atom-resource))

An atom-resource<%> object represents a resource (such as a blog or photo album) that is represented and manipulated via Atom documents.

Represents an Atom-backed resource. Consult the documentation for specific web services for information on obtaining instances.

(send an-atom-resource get-atom [#:reload? reload?])
  (is-a?/c atom<%>)
  reload? : any/c = #f
Gets the Atom document describing the resource. If reload? is false, a cached version may be used (but the cached version may be out-of-date); otherwise, the document is refetched from the server.

Many resources have descriptions both as Atom feeds and Atom entries. The get-atom method may return either one, depending on which is cached. See also get-feed-atom.
(send an-atom-resource get-feed-atom [#:reload? reload?])
  (is-a?/c atom<%>)
  reload? : any/c = #f
Like get-atom, but always gets the Atom feed describing the resource, if one exists.
(send an-atom-resource get-atom-sxml [#:reload? reload?])  SXML
  reload? : any/c = #f
Gets the SXML of the resource’s Atom description.
(send an-atom-resource get-id)  string?
Gets the id of the resource’s Atom description.
(send an-atom-resource get-title)  string?
Gets the title of the resource’s Atom description.

Represents a resource backed by an Atom feed. Consult the documentation for specific web services for information on obtaining instances.

(send an-atom-feed-resource list-children [#:reload reload?])
  (listof (is-a?/c atom-resource<%>))
  reload? : any/c = #f
Returns a list of the resource’s entries.
(send an-atom-feed-resource find-children-by-title 
  title 
  [#:reload? reload?]) 
  (listof (is-a?/c atom-resource<%>))
  title : string?
  reload? : any/c = #f
Returns a list of the resource’s entries having the title title. (Titles are not required to be unique.)
(send an-atom-feed-resource find-child-by-title 
  title 
  [#:reload? reload?]) 
  (or/c (is-a?/c atom-resource<%>) #f)
  title : string?
  reload? : any/c = #f
Returns the resource’s first entry having the title title. If no such entry exists, #f is returned.
(send an-atom-feed-resource find-child-by-id 
  id 
  [#:reload? reload?]) 
  (or/c (is-a?/c atom-resource<%>) #f)
  id : string?
  reload? : any/c = #f
Returns the resource’s entry having the identifier id. If no such entry exists, #f is returned.