registerClient

open suspend fun registerClient()

See registerClient_(EntityValue?).


open suspend fun registerClient(client: EntityValue?)

If {@link com.sap.cloud.mobile.kotlin.odata.DataServiceAsync#isClientRegistered() DataServiceAsync.isClientRegistered} would return 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 {@link com.sap.cloud.mobile.kotlin.odata.ServiceOptions#clientInstanceID ServiceOptions.clientInstanceID}. The server's metadata is expected to include a ClientRegistrationSet entity set with entity type ClientRegistration, a key property named ClientID of type long (Edm.Int64), and a property named ClientGUID of type guid (Edm.Guid). If a new registration is successfully created, {@link com.sap.cloud.mobile.kotlin.odata.ServiceOptions#clientInstanceID ServiceOptions.clientInstanceID} is set, and will subsequently be used to populate the Client-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.

Parameters

client

(nullable) Instance of ClientRegistration entity type. If omitted, a default instance will be created.