FHIROpenServer

open class FHIROpenServer: FHIRMinimalServer

A very basic FHIRServer implementation that deals with Open FHIR servers in JSON.

It knows its base URL, can fetch and hold on to the cabability statement and perform requests and operations.

These methods are of interest to you when you create a subclass:

  • handlerForRequest(withMethod:resource:): what kind of handler your server wants to use. Returns FHIRJSONRequestHandler.
  • configurableRequest(for:): the SMART framework returns a request that already has an Authorization headers set, if needed.
  • Retrieve the operation definition with the given name, either from cache or load the OperationDefinition resource.

    Once an OperationDefinition has been retrieved, it is cached into the instance’s operations dictionary. Must be used after the cabability statement has been fetched, i.e. after using ready or getCapabilityStatement.

    Declaration

    Swift

    open func operation(_ name: String, callback: @escaping ((OperationDefinition?) -> Void))
  • Performs the given Operation.

    The server first validates the operation and only proceeds with execution if validation succeeds.

    Resource has extensions to facilitate working with operations, be sure to take a look.

    Declaration

    Swift

    open func perform(_ operation: FHIROperation, callback: @escaping ((FHIRServerResponse) -> Void))

    Parameters

    operation

    The operation instance to perform

    callback

    The callback to call when the request ends (success or failure)