public void Connect(VersionOneSettings settings) { var path = settings.Path; var username = settings.Username; var password = settings.Password; var integrated = settings.Integrated; var proxy = GetProxy(settings.ProxySettings); VersionOneSettings = settings; if (VersionOneSettings.OAuth2) { var storage = OAuth2Client.Storage.JsonFileStorage.Default; var metaConnector = new V1OAuth2APIConnector(path + MetaUrlSuffix, storage, proxy); MetaModel = new MetaModel(metaConnector); var localizerConnector = new V1OAuth2APIConnector(path + LocalizerUrlSuffix, storage, proxy); Localizer = new Localizer(localizerConnector); var dataConnector = new V1OAuth2APIConnector(path + DataUrlSuffix, storage, proxy); Services = new Services(MetaModel, dataConnector); } else { var metaConnector = new V1APIConnector(path + MetaUrlSuffix, username, password, integrated, proxy); MetaModel = new MetaModel(metaConnector); var localizerConnector = new V1APIConnector(path + LocalizerUrlSuffix, username, password, integrated, proxy); Localizer = new Localizer(localizerConnector); var dataConnector = new V1APIConnector(path + DataUrlSuffix, username, password, integrated, proxy); Services = new Services(MetaModel, dataConnector); } V1Configuration = LoadV1Configuration(); }
public IServices CreateServices(string baseUrl, OAuth2Client.IStorage storage) { var dataConnector = new V1OAuth2APIConnector(baseUrl + "/rest-1.oauth.v1/", storage); var metaConnector = new V1OAuth2APIConnector(baseUrl + "/meta.v1/", storage); _metaModel = new MetaModel(metaConnector); var services = new Services(_metaModel, dataConnector); return(services); }
private IAPIConnector CreateConnector(string url) { // TODO check integratedAuth here if (_oauthStorage == null) { var cc = new V1APIConnector(url, _username, _password, _integratedAuth, proxyProvider); cc.SetCallerUserAgent(MyUserAgent); return(cc); } else { var cc = new V1OAuth2APIConnector(url, _oauthStorage, proxyProvider); cc.SetCallerUserAgent(MyUserAgent); return(cc); } }