ClientRegistrationProvider
public protocol ClientRegistrationProvider : AnyObject
Interface for providers that support client registration.
-
Checks locally whether a previous
registerClientcall successfuly created a client registration for the remote OData service.Declaration
Swift
func isClientRegistered() throws -> BoolReturn Value
trueif a registration was already established. -
If
isClientRegisteredwould returnfalse, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json. Otherwise just load the previously locally-saved registration ID into theServiceOptions.clientInstanceID. The server’s metadata is expected to include aClientRegistrationSetentity set with entity typeClientRegistration, a key property namedClientIDof typelong(Edm.Int64), and a property namedClientGUIDof typeguid(Edm.Guid). If a new registration is successfully created,ServiceOptions.clientInstanceIDis set, and will subsequently be used to populate theClient-Instance-IDHTTP header for all OData calls. The purpose of creating such a client registration is to enable the server to associate various resources with the current instance of the current client application. A “current instance” can survive multiple restarts of the client application so long as the same Client-Instance-ID header value is provided for each OData call to the remote service. This is particularly useful for offline applications which rely on server-side OData change tracking implementations that store per-client server-side state to facilitate change tracking.Declaration
Swift
func registerClient(_ client: EntityValue?) throwsParameters
clientInstance of
ClientRegistrationentity type. If omitted, a default instance will be created. -
Forget any client registration previously established by
registerClient. Also attempts to make a call to the server to delete the associated entity, if thedeleteFromServerparameter istrue.Declaration
Swift
func unregisterClient(deleteFromServer: Bool) throwsParameters
deleteFromServerSpecify a value of
trueto request the server to also delete the corresponding entity.