public static void Run() { const string fileName = "DownloadedReport.csv"; const string downloadFilePath = @".\Resource\" + fileName; string organizationId = "testrest"; var reportDate = DateTime.ParseExact("2020-05-03", "yyyy-MM-dd", CultureInfo.InvariantCulture); string reportName = "testrest_subcription_v2989"; try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ReportDownloadsApi(clientConfig); var content = apiInstance.DownloadReportWithHttpInfo(reportDate, reportName, organizationId); // START : FILE DOWNLOAD FUNCTIONALITY File.WriteAllText(downloadFilePath, CreateXml(content.Data)); Console.WriteLine("\nFile Downloaded at the following location : "); Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n"); // END : FILE DOWNLOAD FUNCTIONALITY } catch (FileNotFoundException) { Console.WriteLine("File Not Found : Kindly verify the path."); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); } }
public static void Run() { // File will be created with the Data received in the Response Body // Provide the File Name const string fileName = "DownloadReport.csv"; // Provide the path where the file needs to be downloaded // This can be either a relative path or an absolute path const string downloadFilePath = @".\Resource\" + fileName; const string organizationId = "testrest"; const string reportName = "testrest_v2"; var reportDate = DateTime.ParseExact("2018-09-02", "yyyy-MM-dd", CultureInfo.InvariantCulture); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ReportDownloadsApi(clientConfig); apiInstance.DownloadReport(reportDate, reportName, organizationId); Console.WriteLine("\nFile downloaded at the below location:"); Console.WriteLine($"{Path.GetFullPath(downloadFilePath)}\n"); } catch (FileNotFoundException) { Console.WriteLine("File Not Found: Kindly verify the path"); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }
public void Init() { instance = new ReportDownloadsApi(); }