add optional argument to create/update to specify whether to return the complete new/updated resource or not
This commit is contained in:
parent
ad44c28666
commit
00350cfccc
|
@ -304,15 +304,17 @@
|
||||||
|
|
||||||
reference:
|
reference:
|
||||||
create: http://hl7.org/implement/standards/fhir/http.html#create"
|
create: http://hl7.org/implement/standards/fhir/http.html#create"
|
||||||
[base-url type resource]
|
[base-url type resource & {:keys [return-resource?]}]
|
||||||
(if-not (resource? resource)
|
(if-not (resource? resource)
|
||||||
(throw (Exception. "Not a valid FHIR resource")))
|
(throw (Exception. "Not a valid FHIR resource")))
|
||||||
(let [resource-name (->fhir-resource-name type)
|
(let [resource-name (->fhir-resource-name type)
|
||||||
uri-components ["/" resource-name]]
|
uri-components ["/" resource-name]
|
||||||
|
return-resource? (if (nil? return-resource?) true return-resource?)]
|
||||||
(fhir-request :post
|
(fhir-request :post
|
||||||
base-url
|
base-url
|
||||||
(apply join-paths uri-components)
|
(apply join-paths uri-components)
|
||||||
:body resource)))
|
:body resource
|
||||||
|
:follow-location? return-resource?)))
|
||||||
|
|
||||||
(defn update
|
(defn update
|
||||||
"updates an existing resource. returns the updated resource if successful and the server
|
"updates an existing resource. returns the updated resource if successful and the server
|
||||||
|
@ -321,17 +323,19 @@
|
||||||
|
|
||||||
reference:
|
reference:
|
||||||
update: http://hl7.org/implement/standards/fhir/http.html#update"
|
update: http://hl7.org/implement/standards/fhir/http.html#update"
|
||||||
[base-url type id resource & {:keys [version]}]
|
[base-url type id resource & {:keys [version return-resource?]}]
|
||||||
(if-not (resource? resource)
|
(if-not (resource? resource)
|
||||||
(throw (Exception. "Not a valid FHIR resource")))
|
(throw (Exception. "Not a valid FHIR resource")))
|
||||||
(let [resource-name (->fhir-resource-name type)
|
(let [resource-name (->fhir-resource-name type)
|
||||||
uri-components (if version
|
uri-components (if version
|
||||||
["/" resource-name id "_history" version]
|
["/" resource-name id "_history" version]
|
||||||
["/" resource-name id])]
|
["/" resource-name id])
|
||||||
|
return-resource? (if (nil? return-resource?) true return-resource?)]
|
||||||
(fhir-request :put
|
(fhir-request :put
|
||||||
base-url
|
base-url
|
||||||
(apply join-paths uri-components)
|
(apply join-paths uri-components)
|
||||||
:body resource)))
|
:body resource
|
||||||
|
:follow-location? return-resource?)))
|
||||||
|
|
||||||
(defn delete
|
(defn delete
|
||||||
"deletes an existing resource. returns nil on success, throws an exception if an error
|
"deletes an existing resource. returns nil on success, throws an exception if an error
|
||||||
|
|
Reference in a new issue