private static async Task <int> OutputRow(string baseUrl, string dataViewName, string username, string password, string systemName, string referenceVariableName, string urnValue, List <string> variableNames) { using (LoggingHandler loggingHandler = new LoggingHandler()) { ILogger <Program> logger = loggingHandler.CreateLogger <Program>(); ApiConnectorFactory connectorFactory = new ApiConnectorFactory(baseUrl); LoginService loginService = new LoginService(connectorFactory, dataViewName); SessionDetails sessionDetails = await loginService.Login(username, password); if (sessionDetails == null) { logger.LogError($"Couldn't log in to data view {dataViewName} as user {username}"); return(-1); } try { DataExplorer dataExplorer = new DataExplorer(connectorFactory, dataViewName, loggingHandler.CreateLogger <DataExplorer>()); bool success = await dataExplorer.TryShowRowForUrn(sessionDetails, systemName, referenceVariableName, urnValue, variableNames, System.Console.Out); return(success ? 0 : -1); } finally { await loginService.Logout(sessionDetails); } } }