FHIRServer

public protocol FHIRServer

Protocol for server objects to be used by FHIRResource and subclasses.

  • A server object must always have a base URL.

    Declaration

    Swift

    var baseURL: URL
  • Designated initializer. Should make sure that the base URL ends with a /!

    Declaration

    Swift

    init(baseURL base: URL, auth: [String: Any]?)
  • Create a request handler with the given method and the given resource (if any).

    Declaration

    Swift

    func handlerForRequest(withMethod method: FHIRRequestMethod, resource: Resource?) -> FHIRRequestHandler?

    Parameters

    method

    The HTTP method type of the request

    resource

    The resource to be involved in the request, if any

    Return Value

    A request handler that can be used with the performRequest(against:handler:callback:) method

  • Execute a request against a given relative URL with a given request/response handler.

    Declaration

    Swift

    func performRequest(against path: String, handler: FHIRRequestHandler, callback: @escaping ((FHIRServerResponse) -> Void))

    Parameters

    path

    The path, relative to the server’s base; may include URL query and URL fragment (!)

    handler

    The FHIRRequestHandler that prepares the request and processes the response

    callback

    The callback to execute; NOT guaranteed to be performed on the main thread!