Server Interaction
-
Representing the FHIR resource server a client connects to.
This implementation holds on to an
Auth
instance to handle authentication. It is automatically instantiated with properties from the settings dictionary provided uponClient
initalization or from the server’s cabability statement.The server’s cabability statement is automatically downloaded the first time it’s needed for various tasks, such as instantiating the
Auth
instance or validating/executing operations.A server manages its own NSURLSession, either with an optional delegate provided via
See moresessionDelegate
or simply the system shared session. Subclasses can change this behavior by overridingcreateDefaultSession
or any of the other request-related methods.Declaration
Swift
open class Server: FHIROpenServer, OAuth2RequestPerformer
-
Protocol for server objects to be used by
See moreFHIRResource
and subclasses.Declaration
Swift
public protocol FHIRServer
-
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. ReturnsFHIRJSONRequestHandler
.configurableRequest(for:)
: the SMART framework returns a request that already has an Authorization headers set, if needed.
Declaration
Swift
open class FHIROpenServer: FHIRMinimalServer
-
A minimal FHIRServer implementation that deals with Open FHIR servers in JSON.
These methods are of interest to you when you create a subclass:
handlerForRequest(withMethod:resource:)
: what kind of handler your server wants to use. ReturnsFHIRJSONRequestHandler
.configurableRequest(for:)
: the SMART framework returns a request that already has an Authorization headers set, if needed.
Declaration
Swift
open class FHIRMinimalServer: FHIRServer
-
Instances of this class can perform searches on a server.
TODO: needs a refresh!!
Searches are instantiated from MongoDB-like query constructs, like:
let srch = Patient.search(["address": "Boston", "gender": "male", "given": ["$exact": "Willis"]])
Then srch.perform() will run the following URL query against the server:
See more"Patient?address=Boston&gender=male&given:exact=Willis"
Declaration
Swift
open class FHIRSearch
-
Protocol for different request/response handlers.
TODO: should add
See moreResponseType
associated type as soon as those can be constrained (SE-0142 – Swift 4?).Declaration
Swift
public protocol FHIRRequestHandler
-
Base implementation of
See moreFHIRRequestHandler
.Declaration
Swift
open class FHIRBaseRequestHandler: FHIRRequestHandler
-
PRELIMINARY! Prepare and handle a request returning some type of data.
If you use this as PUT/POST, you are responsible for setting the
See moredata
property to an appropriate NSData representation. TheAccept
andContent-Type
headers will be set to thecontentType
propertyDeclaration
Swift
open class FHIRDataRequestHandler: FHIRBaseRequestHandler
-
Prepare and handle a request returning JSON data.
JSON body data can be greated from the resource, if the receiver holds on to one. The header’s content type for PUT and POST will be set to
See moreapplication/fhir+json; charset=utf-8
no matter what.Declaration
Swift
open class FHIRJSONRequestHandler: FHIRBaseRequestHandler
-
Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the
See moreerror
property carries the only useful information.Declaration
Swift
public protocol FHIRServerResponse
-
Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the
See moreerror
property carries the only useful information.Declaration
Swift
open class FHIRServerDataResponse: FHIRServerResponse
-
Encapsulates a server response with JSON response body, if any.
See moreDeclaration
Swift
open class FHIRServerJSONResponse: FHIRServerDataResponse