add notes about exceptions being thrown to doc-comments

This commit is contained in:
Gered 2014-07-14 13:34:14 -04:00
parent c2bd54c15c
commit 35e5e4ad1a

View file

@ -186,6 +186,7 @@
(defn get-resource (defn get-resource
"gets a single resource from a FHIR server. the raw resource itself is returned (that is, "gets a single resource from a FHIR server. the raw resource itself is returned (that is,
it is not contained in a bundle). if the resource could not be found, nil is returned. it is not contained in a bundle). if the resource could not be found, nil is returned.
for any other type of response (errors), an exception is thrown.
a relative url can be used to identify the resource to be retrieved, or a resource type, a relative url can be used to identify the resource to be retrieved, or a resource type,
id and optional version number can be used. id and optional version number can be used.
@ -216,7 +217,8 @@
(defn get-relative-resource (defn get-relative-resource
"gets a single resource from a FHIR server. the server to be queried will be taken from the "gets a single resource from a FHIR server. the server to be queried will be taken from the
'fhir-base' link in the provided bundle." 'fhir-base' link in the provided bundle. an exception is thrown if an error response is
received."
[bundle relative-url] [bundle relative-url]
(if bundle (if bundle
(let [base-url (->> (:link bundle) (let [base-url (->> (:link bundle)
@ -228,6 +230,7 @@
(defn get-resource-bundle (defn get-resource-bundle
"gets a single resource from a FHIR server. the returned resource will be contained in a "gets a single resource from a FHIR server. the returned resource will be contained in a
bundle. if the resource could not be found, a bundle containing zero resources is returned. bundle. if the resource could not be found, a bundle containing zero resources is returned.
an exception is thrown if an error response is received.
reference: reference:
bundles: http://hl7.org/implement/standards/fhir/extras.html#bundle" bundles: http://hl7.org/implement/standards/fhir/extras.html#bundle"
@ -243,7 +246,7 @@
"searches for resources on a FHIR server. multiple parameters are ANDed together. use of the search "searches for resources on a FHIR server. multiple parameters are ANDed together. use of the search
operator helper functions is encouraged to ensure proper escaping/encoding of search parameters. operator helper functions is encouraged to ensure proper escaping/encoding of search parameters.
the results of this function can be passed to fetch-next-page or fetch-all to collect resources the results of this function can be passed to fetch-next-page or fetch-all to collect resources
returned in paged search results easier returned in paged search results easier. an exception is thrown if an error response is received.
reference: reference:
search: http://hl7.org/implement/standards/fhir/http.html#search" search: http://hl7.org/implement/standards/fhir/http.html#search"
@ -262,14 +265,17 @@
(defn search-and-fetch (defn search-and-fetch
"same as search, but automatically fetches all pages of resources returning a single bundle "same as search, but automatically fetches all pages of resources returning a single bundle
that contains all search results." that contains all search results. an exception is thrown if an error response is received."
[base-url type where & params] [base-url type where & params]
(fetch-all (fetch-all
(search base-url type where params))) (search base-url type where params)))
(defn create (defn create
"creates a new resource. returns the created resource if successful, throws an exception "creates a new resource. returns the created resource if successful, throws an exception
otherwise." otherwise.
reference:
create: http://hl7.org/implement/standards/fhir/http.html#create"
[base-url type resource] [base-url type resource]
(let [resource-name (->fhir-resource-name type) (let [resource-name (->fhir-resource-name type)
uri-components ["/" resource-name]] uri-components ["/" resource-name]]