/// <summary>
 /// Creates a new <see cref="DatasyncClient"/> that connects to the specified endpoint for information transfer.
 /// </summary>
 /// <param name="endpoint">The endpoint of the datasync service.</param>
 /// <param name="clientOptions">The client options used to modify any request/response that is sent.</param>
 /// <exception cref="ArgumentNullException">if the endpoint is null</exception>
 /// <exception cref="UriFormatException">if the endpoint is malformed</exception>
 public DatasyncClient(Uri endpoint, DatasyncClientOptions clientOptions)
     : this(endpoint, null, clientOptions)
 {
 }
 /// <summary>
 /// Creates a new <see cref="DatasyncClient"/> that connects to the specified endpoint for information transfer.
 /// </summary>
 /// <param name="endpoint">The endpoint of the datasync service.</param>
 /// <param name="clientOptions">The client options used to modify any request/response that is sent.</param>
 /// <exception cref="UriFormatException">if the endpoint is not a valid Uri.</exception>
 public DatasyncClient(string endpoint, DatasyncClientOptions clientOptions)
     : this(new Uri(endpoint, UriKind.Absolute), null, clientOptions)
 {
 }
 /// <summary>
 /// Creates a new <see cref="DatasyncClient"/> that connects to the specified endpoint for information transfer.
 /// </summary>
 /// <param name="endpoint">The endpoint of the datasync service.</param>
 /// <param name="authenticationProvider">The authentication provider to use for authenticating the request</param>
 /// <param name="clientOptions">The client options used to modify any request/response that is sent.</param>
 /// <exception cref="UriFormatException">if the endpoint is malformed</exception>
 public DatasyncClient(string endpoint, AuthenticationProvider authenticationProvider, DatasyncClientOptions clientOptions)
     : this(new Uri(endpoint, UriKind.Absolute), authenticationProvider, clientOptions)
 {
 }
        /// <summary>
        /// Creates a new <see cref="DatasyncClient"/> that connects to the specified endpoint for information transfer.
        /// </summary>
        /// <param name="endpoint">The endpoint of the datasync service.</param>
        /// <param name="authenticationProvider">The authentication provider to use for authenticating the request</param>
        /// <param name="clientOptions">The client options used to modify any request/response that is sent.</param>
        /// <exception cref="ArgumentNullException">if the endpoint is null</exception>
        /// <exception cref="UriFormatException">if the endpoint is malformed</exception>
        public DatasyncClient(Uri endpoint, AuthenticationProvider authenticationProvider, DatasyncClientOptions clientOptions)
        {
            Arguments.IsValidEndpoint(endpoint, nameof(endpoint));

            Endpoint      = endpoint.NormalizeEndpoint();
            ClientOptions = clientOptions ?? new DatasyncClientOptions();
            HttpClient    = new ServiceHttpClient(Endpoint, authenticationProvider, ClientOptions);
            if (ClientOptions.SerializerSettings != null)
            {
                Serializer.SerializerSettings = ClientOptions.SerializerSettings;
            }
            if (ClientOptions.OfflineStore != null)
            {
                SyncContext = new SyncContext(this, ClientOptions.OfflineStore);
            }
        }