Beispiel #1
0
        /// <inheritdoc />
        public async Task <byte[]> ExportAnnotationReport(ExportReportParameters parameters)
        {
            var response = await ApiClient.GetAsync($"Approvals/ExportAnnotationReport/?{parameters.ToQueryStringValues()}");

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsByteArrayAsync());
            }

            throw new ApiException("Approvals.ExportAnnotationReport", response.StatusCode, await response.Content.ReadAsStringAsync());
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <byte[]> ExportAnnotationReport(ExportReportParameters parameters)
        {
            var response = await ApiClient.GetAsync($"/approvals/{parameters.Id}/report?groupId={parameters.ApprovalGroupId}&version={parameters.Version}");

            if (response.IsSuccessStatusCode)
            {
                return(await response.Content.ReadAsByteArrayAsync());
            }

            throw new ApiException("Approvals.ExportAnnotationReport", response.StatusCode, await response.Content.ReadAsStringAsync());
        }
Beispiel #3
0
        internal async Task ExportApprovalReport()
        {
            Printer.PrintStepTitle("Export Report Of An Existing Approval");
            Console.Write("Enter Approval ID:");
            string id = Console.ReadLine();

            if (id == "-1")
            {
                return;
            }

            Console.WriteLine($"Reading approval {id}..");
            var approval = await _apiClient.Approvals.Get(id);

            Printer.PrintApproval(approval);

            Console.Write("Enter Approval Group ID:");
            string approvalGroupId = Console.ReadLine();

            Console.Write("Enter Approval Version:");
            string versionInput = Console.ReadLine();

            int.TryParse(versionInput, out int version);


            var parameters = new ExportReportParameters
            {
                ApprovalGroupId = approvalGroupId,
                Id      = id,
                Version = version
            };

            Console.WriteLine("Exporting report...");
            var result = await _apiClient.Approvals.ExportAnnotationReport(parameters);

            Console.WriteLine($"Saving export file ({result.Length})...");

            var path       = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var directory  = System.IO.Path.GetDirectoryName(path);
            var reportPath = Path.Combine(directory, $"{Guid.NewGuid().ToString().Substring(0, 5)}.pdf");

            File.WriteAllBytes(reportPath, result);
            Console.WriteLine($"Saved to ${reportPath}");
        }
Beispiel #4
0
        public static async Task ExportApprovalReport()
        {
            Printer.PrintStepTitle("Export Report Of An Existing Approval");

            var parameters = new ExportReportParameters
            {
                ApprovalGroupId = TestContainer.Approval.Versions.FirstOrDefault().ApprovalGroups.FirstOrDefault().Id,
                Id      = TestContainer.Approval.Id,
                Version = TestContainer.Approval.Versions.FirstOrDefault().Version
            };

            Printer.Print("Exporting report...");
            var result = await ApiClient.Approvals.ExportAnnotationReport(parameters);

            Printer.Print($"Saving export file ({result.Length})...");

            var path       = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var directory  = System.IO.Path.GetDirectoryName(path);
            var reportPath = Path.Combine(directory, $"{Guid.NewGuid().ToString().Substring(0, 5)}.pdf");

            File.WriteAllBytes(reportPath, result);
            Printer.Print($"Saved to ${reportPath}");
        }