FHIRServerJSONResponse
open class FHIRServerJSONResponse: FHIRServerDataResponse
Encapsulates a server response with JSON response body, if any.
-
The response body, decoded into a FHIRJSON
Declaration
Swift
open var json: FHIRJSON? -
If the status is >= 400, the response body is checked for an OperationOutcome and its first issue item is turned into an error message.
Declaration
Swift
public required init(handler: FHIRRequestHandler, response: URLResponse, data inData: Data?, error: Error?) -
Undocumented
Declaration
Swift
open class FHIRServerJSONResponse: FHIRServerDataResponse -
Uses FHIRElement’s factory method to instantiate the resource of the given type from the response.
Throws
Errors if there was no response, if it was of a different type or if there were errors in the dataDeclaration
Swift
override open func responseResource<T: Resource>(ofType: T.Type) throws -> TParameters
ofTypeThe type of resource to extract
Return Value
The resource that was found in the response if it is of the desired type
-
The response’s body data is used to update the resource by calling
resource.populateFrom(json: ). Will throwFHIRError.responseNoResourceReceivedif body is nil.This method must not be called if the response has a non-nil error.
Declaration
Swift
override open func applyBody(to resource: Resource) throwsParameters
resourceThe resource to apply the response data to
View on GitHub
Install in Dash
FHIRServerJSONResponse Class Reference