UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

73 lines 3.81 kB
import { DocumentData, DocumentQualityAnalyzerResult, DocumentScanningResult, handleImageInput, mapRTUUIResult, withSBErrorHandling, } from '../types'; import { ScanbotSDKPlugin } from './Definitions'; /** * @internal * @hidden */ export const ScanbotDocumentImpl = { async createDocumentFromImages(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.createDocumentFromImages(Object.assign(Object.assign({}, params), { images: Array.isArray(params.images) ? handleImageInput(params.images) : undefined })))); }, async createDocumentFromLegacyPages(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.createDocumentFromLegacyPages(params))); }, async createDocumentFromPdf(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.createDocumentFromPdf(params))); }, async documentExists(documentUuid) { return withSBErrorHandling(async () => { return (await ScanbotSDKPlugin.documentExists({ documentUuid: documentUuid })).result; }); }, async loadDocument(documentUuid) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.loadDocument({ documentUuid: documentUuid }))); }, async getStoredDocumentUuids() { return withSBErrorHandling(async () => { return (await ScanbotSDKPlugin.getStoredDocumentUuids()).result; }); }, async cloneDocument(documentUuid) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.cloneDocument({ documentUuid: documentUuid }))); }, async deleteDocument(documentUuid) { return withSBErrorHandling(() => ScanbotSDKPlugin.deleteDocument({ documentUuid: documentUuid })); }, async deleteAllDocuments() { return withSBErrorHandling(() => ScanbotSDKPlugin.deleteAllDocuments()); }, async addPages(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.addPages(Object.assign(Object.assign({}, params), { images: handleImageInput(params.images) })))); }, async movePage(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.movePage(params))); }, async modifyPage(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.modifyPage(params))); }, async removePages(params) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.removePagesFromDocument(params))); }, async removeAllPages(documentUuid) { return withSBErrorHandling(async () => new DocumentData(await ScanbotSDKPlugin.removeAllPages({ documentUuid: documentUuid }))); }, async scanFromImage(params) { return withSBErrorHandling(async () => new DocumentScanningResult(await ScanbotSDKPlugin.scanDocumentFromImage({ configuration: params.configuration, image: handleImageInput(params.image), }))); }, async analyzeQualityOnImage(params) { return withSBErrorHandling(async () => new DocumentQualityAnalyzerResult(await ScanbotSDKPlugin.analyzeDocumentQualityOnImage({ configuration: params.configuration, image: handleImageInput(params.image), }))); }, async startScanner(configuration) { return withSBErrorHandling(async () => mapRTUUIResult(await ScanbotSDKPlugin.startDocumentScanner(configuration), DocumentData)); }, async startCroppingScreen(configuration) { return withSBErrorHandling(async () => mapRTUUIResult(await ScanbotSDKPlugin.startCroppingScreen(configuration), DocumentData)); }, }; //# sourceMappingURL=DocumentScannerImpl.js.map