private static void FetchUpdates(QueryFilter queryToRun, CompressedMetadataStore destinationResult) { var server = new UpstreamServerClient(destinationResult.UpstreamSource); server.MetadataQueryProgress += Server_MetadataQueryProgress; Console.WriteLine("Fetching categories ..."); server.GetCategories(destinationResult).GetAwaiter().GetResult(); if (queryToRun != null) { Console.WriteLine("Running query with filters:"); MetadataQuery.PrintFilter(queryToRun, destinationResult); server.GetUpdates(queryToRun, destinationResult).GetAwaiter().GetResult(); } Console.WriteLine(); destinationResult.CommitProgress += Program.MetadataSourceOperationProgressHandler; destinationResult.Commit(); Console.WriteLine(); ConsoleOutput.WriteGreen($"Query result saved to file {destinationResult.FilePath}"); }
/// <summary> /// Fetches categories from an upstream server /// </summary> /// <param name="options">Pre-Fetch command options</param> public static void FetchConfiguration(FetchConfigurationOptions options) { Endpoint upstreamEndpoint; if (!string.IsNullOrEmpty(options.UpstreamEndpoint)) { upstreamEndpoint = new Endpoint(options.UpstreamEndpoint); } else { upstreamEndpoint = Endpoint.Default; } var server = new UpstreamServerClient(upstreamEndpoint); server.MetadataQueryProgress += Server_MetadataQueryProgress; var configData = server.GetServerConfigData().GetAwaiter().GetResult(); File.WriteAllText(options.OutFile, JsonConvert.SerializeObject(configData)); }