From e4689d03eb6bdb727c6547abb635b18fc77255d6 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 2 Sep 2014 15:20:52 -0400 Subject: [PATCH] add get-base-url-from-bundle. make get-bundle-next-page-url public. --- src/clj_hl7_fhir/core.clj | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/clj_hl7_fhir/core.clj b/src/clj_hl7_fhir/core.clj index 5569164..23e2b0c 100644 --- a/src/clj_hl7_fhir/core.clj +++ b/src/clj_hl7_fhir/core.clj @@ -271,13 +271,27 @@ (map :content) (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) (->> (:link bundle) (filter #(= "next" (:rel %))) (first) :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 "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