add get-base-url-from-bundle. make get-bundle-next-page-url public.

This commit is contained in:
Gered 2014-09-02 15:20:52 -04:00
parent 442162d7e5
commit e4689d03eb

View file

@ -271,13 +271,27 @@
(map :content) (map :content)
(remove nil?))) (remove nil?)))
(defn- get-bundle-next-page-url [bundle] (defn get-bundle-next-page-url
"returns the 'next' bundle URL from the given FHIR bundle. useful for paged
search results. throws an exception if the value passed is not a valid FHIR
bundle."
[bundle]
(validate-bundle! bundle) (validate-bundle! bundle)
(->> (:link bundle) (->> (:link bundle)
(filter #(= "next" (:rel %))) (filter #(= "next" (:rel %)))
(first) (first)
:href)) :href))
(defn get-base-url-from-bundle
"returns the base-url from the given FHIR bundle. throws an exception if the
value passed is not a valid FHIR bundle."
[bundle]
(validate-bundle!)
(->> (:link bundle)
(filter #(= "fhir-base" (:rel %)))
(first)
:href))
(defn fetch-next-page (defn fetch-next-page
"for resources that are returned over more then one page, this will fetch the "for resources that are returned over more then one page, this will fetch the
next page of resources as indicated by the link information contained in the next page of resources as indicated by the link information contained in the