public Client CreateClient() { var config = ConfigurationManager.OpenExeConfiguration(GetType().Assembly.Location); Assertion.AssertNotNull(config, "There is no config"); var apiKey = config.AppSettings.Settings["Dropbox.ApiKey"].Value; var appSecret = config.AppSettings.Settings["Dropbox.AppSecret"].Value; var useSandBox = Convert.ToBoolean(config.AppSettings.Settings["Dropbox.UseSandBox"].Value); return(new Client(myLogger, apiKey, appSecret, myProxySettingsReader.GetProxySettings()) { UseSandbox = useSandBox }); }
public GitHubClient GetClient([NotNull] IDataContext context) { var boundSettings = mySettingsStore.BindToContextTransient(ContextRange.Smart((lt, _) => context)); var proxy = myProxySettingsReader.GetProxySettings(boundSettings); var settings = boundSettings.GetKey <GitHubSettings>(SettingsOptimization.DoMeSlowly); var client = new GitHubClient { Proxy = proxy }; if (!settings.IsAnonymous) { client.Authenticator = new HttpBasicAuthenticator(settings.Username, settings.Password); } return(client); }