FHIRServerDataResponse

open class FHIRServerDataResponse: FHIRServerResponse

Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the error property carries the only useful information.

  • The handler handling the request provoking this response.

    Declaration

    Swift

    public internal(set) var handler: FHIRRequestHandler?
  • The HTTP status code.

    Declaration

    Swift

    open let status: Int
  • Response headers.

    Declaration

    Swift

    open let headers: [String: String]
  • The response body data.

    Declaration

    Swift

    open var body: Data?
  • The request’s operation outcome, if any.

    Declaration

    Swift

    public internal(set) var outcome: OperationOutcome?
  • The error encountered, if any.

    Declaration

    Swift

    open var error: FHIRError?
  • Instantiate a FHIRServerResponse from a (HTTP)URLResponse, Data and an optional Error.

    Declaration

    Swift

    public required init(handler: FHIRRequestHandler, response: URLResponse, data: Data?, error: Error?)
  • Undocumented

    Declaration

    Swift

    open class FHIRServerDataResponse: FHIRServerResponse
  • The base method does not know how to extract a response resource, so this will throw FHIRError.responseNoResourceReceived.

    Declaration

    Swift

    open func responseResource<T: Resource>(ofType: T.Type) throws -> T

    Parameters

    type

    The response resource’s type

    Return Value

    An instance of the expected type

  • The base method does not actually know how to handle the data to update a resource, but it will still throw FHIRError.ResponseNoResourceReceived if body is nil.

    Declaration

    Swift

    open func applyBody(to: Resource) throws

    Parameters

    to

    The resource to apply the response data to