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.
func isClientRegistered() throws -> Bool
trueif a registration was already established.
false, 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 the
ServiceOptions.clientInstanceID. The server’s metadata is expected to include a
ClientRegistrationSetentity set with entity type
ClientRegistration, a key property named
long(Edm.Int64), and a property named ‘ClientGUID
(Edm.Guid). If a new registration is successfully created,ServiceOptions.clientInstanceID
is set, and will subsequently be used to populate theClient-Instance-ID` HTTP 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.
func registerClient(_ client: EntityValue?) throws
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 the
func unregisterClient(deleteFromServer: Bool) throws
Specify a value of
trueto request the server to also delete the corresponding entity.