private void SetupApiEndpoints() { Console.WriteLine("Start - Setup API Endpoints."); UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials(TestConstants.InstanceDetails.RELATIVITY_ADMIN_USERNAME, TestConstants.InstanceDetails.RELATIVITY_ADMIN_PASSWORD); ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings(TestConstants.InstanceDetails.RelativityServicesUri, TestConstants.InstanceDetails.RelativityRestUri, usernamePasswordCredentials); _serviceFactory = new ServiceFactory(serviceFactorySettings); _agentUtility = new AgentUtility(_eddsDbContext, _serviceFactory); _rsapiClient = _serviceFactory.CreateProxy <IRSAPIClient>(); Console.WriteLine("End - Setup API Endpoints."); }
/// <summary> /// Generates a Service Factory based on credentials passed into the Constructor /// </summary> /// <returns></returns> public ServiceFactory GetServiceFactory() { if (_serviceFactory != null) { return(_serviceFactory); } Uri relativityServicesUri = new Uri($"{_protocol}://{_serverAddress}/Relativity.Services"); Uri relativityRestUri = new Uri($"{_protocol}://{_serverAddress.ToLower().Replace("-services", "")}/Relativity.Rest/Api"); Relativity.Services.ServiceProxy.UsernamePasswordCredentials usernamePasswordCredentials = new Relativity.Services.ServiceProxy.UsernamePasswordCredentials( username: _userName, password: _password); ServiceFactorySettings serviceFactorySettings = new ServiceFactorySettings( relativityServicesUri: relativityServicesUri, relativityRestUri: relativityRestUri, credentials: usernamePasswordCredentials); _serviceFactory = new ServiceFactory( settings: serviceFactorySettings); return(_serviceFactory); }
/// <summary> /// Gets the service factory with username/password /// </summary> /// <returns></returns> public ServiceFactory GetServiceFactory() { Credentials credentials; switch (_authType) { case Constants.Enums.AuthType.UsernamePassword: credentials = new Relativity.Services.ServiceProxy.UsernamePasswordCredentials(_user, _password); break; case Constants.Enums.AuthType.Integrated: credentials = new Relativity.Services.ServiceProxy.IntegratedAuthCredentials(); break; default: credentials = new Relativity.Services.ServiceProxy.IntegratedAuthCredentials(); break; } ServiceFactory factory = new ServiceFactory(new ServiceFactorySettings(ServicesUri, RestUri, credentials)); return(factory); }