private WithingsClient(IAuthentication authenticator, WithingsCredentials credentials) { if (authenticator == null) { throw new ArgumentNullException(nameof(authenticator)); } _authenticator = authenticator; _credentials = credentials; this.BaseUrl = new Uri(ApiConstants.BaseApiUrl); this.AddDefaultHeader("Content-Type", "application/x-www-form-urlencoded"); this.AddDefaultHeader("Accept", "application/json"); }
public static async Task <WithingsClient> CreateAsync(IAuthentication authenticator, WithingsCredentials credentials) { var client = new WithingsClient(authenticator, credentials); await client.InitializeAsync(); return(client); }