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 webapi/atom) | package: webapi |
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.
|
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.Returns the encapsulated SXML document.Returns the contents of the document’s id element.Returns the contents of the document’s title element.
method
(send an-atom get-updated) → string?
Returns the contents of the document’s updated element (a timestamp in string form).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.
method
(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.
method
(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 '().
method
(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 '().
method
(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 webapi/atom-resource) | package: webapi |
An atom-resource<%> object represents a resource (such as a blog or photo album) that is represented and manipulated via Atom documents.
|
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.
method
(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.
method
(send an-atom-resource get-atom-sxml [#:reload? reload?]) → SXML
reload? : any/c = #f Gets the SXML of the resource’s Atom description.Gets the id of the resource’s Atom description.Gets the title of the resource’s Atom description.
| ||
|
method
(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.
method
(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.)
method
(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.
method
(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.