private List <AnalysisMethod> GetAnalysisMethods() { using (var client = SamplesClient.CreateConnectedClient(Context.ServerUrl, Context.ApiToken)) { return(client.Get(new GetAnalysisMethods()).DomainObjects); } }
private void Connect() { try { _client = SamplesClient.CreateConnectedClient( serverTextBox.Text.Trim(), apiTokenTextBox.Text.Trim()); GetConnectionInfo(); SaveConfig(); ClearTripList(); connectButton.Enabled = false; disconnectButton.Enabled = true; loadButton.Enabled = true; serverTextBox.Enabled = false; apiTokenTextBox.Enabled = false; apiTokenLinkLabel.Enabled = false; } catch (Exception exception) { Disconnect(); Error(exception); } }
public ImportClient(Context context) { _context = context; _httpClient = GetInitializedHttpClient(); _samplesClient = SamplesClient.CreateConnectedClient(_context.ServerUrl, _context.ApiToken); _authHeaderValue = new AuthenticationHeaderValue("Token", _context.ApiToken); }
public void ForEachTest() { _fixture = new Fixture(); _mockServiceClient = Substitute.For <IServiceClient>(); SetupMockClient(); _client = SamplesClient.CreateTestClient(_mockServiceClient); }
private static void Validate(Context context, ValidationResult result) { var rules = RuleReader.ReadFromDefaultFile(); if (!rules.Any()) { throw new ArgumentException("No rules are found."); } Log.Info($"Got {rules.Count} rules from the file."); var validator = new Validator(rules); Log.Debug($"Connecting to server with URL {context.SamplesApiBaseUrl}."); using (var client = SamplesClient.CreateConnectedClient(context.SamplesApiBaseUrl, context.SamplesAuthToken)) { var largeEnoughToGetAllObservationsInNamedSpecimens = 10000; var queryFromTime = GetLastRunStartTimeAtMinuteLevel(context.LastRunStartTimeUtc); Log.Info($"Examining observations modified from {queryFromTime}."); foreach (var specimen in client.LazyGet <Specimen, GetSpecimens, SearchResultSpecimen>(new GetSpecimens()).DomainObjects) { if (result.ProcessedSpecimenNames.Contains(specimen.Name)) { continue; } Log.Debug($"Examining specimen '{specimen.Name}'."); result.ProcessedSpecimenCount++; var observationResponse = client.Get(new GetObservations { SpecimenName = specimen.Name, QualityControlTypes = new List <string> { "NORMAL" }, DataClassifications = new List <string> { "LAB" }, StartModificationTime = queryFromTime, Limit = largeEnoughToGetAllObservationsInNamedSpecimens }); var observations = observationResponse.DomainObjects; result.ExaminedObservationsCount += observations.Count; var invalidObservations = validator.GetInvalidObservations(observations); var flaggedCount = PutBackFlaggedObservations(client, context, invalidObservations); result.InvalidObservationsTotal += flaggedCount; result.ProcessedSpecimenNames.Add(specimen.Name); } } }
private IEnumerable <ObservationV2> LoadAll() { using (var client = SamplesClient.CreateConnectedClient(Context.ServerUrl, Context.ApiToken)) { AnalysisMethods = client.Get(new GetAnalysisMethods()).DomainObjects; Locations = client.LazyGet <SamplingLocation, GetSamplingLocations, SearchResultSamplingLocation>( new GetSamplingLocations()).DomainObjects.ToList(); ObservedProperties = client.Get(new GetObservedProperties()).DomainObjects; Units = client.Get(new GetUnits()).DomainObjects; } return(Context .Files .SelectMany(LoadAllObservations)); }
private ISamplesClient Connect() { Log.Info($"{ExeHelper.ExeNameAndVersion} connecting to {Context.ServerUrl} ..."); return(SamplesClient.CreateConnectedClient(Context.ServerUrl, Context.ApiToken)); }