react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
67 lines (64 loc) • 1.98 kB
text/typescript
import { DeepPartial, PartiallyConstructible } from '../utils';
import { PageData } from '../document/PageData';
/**
Document Data
*/
export class DocumentData extends PartiallyConstructible {
/**
The unique identifier of the document
*/
public readonly uuid: string;
/**
The creation timestamp of the document
*/
public readonly creationTimestamp: number;
/**
The list of pages
*/
public readonly pages: PageData[];
/**
The maximum size of the document image
Default is 0
*/
public readonly documentImageSizeLimit: number = 0;
/**
The URI of the default destination location for PDF rendering.
*/
public readonly pdfURI: string;
/**
The URI of the default destination location for TIFF rendering.
*/
public readonly tiffURI: string;
/** @param source {@displayType `DeepPartial<DocumentData>`} */
public constructor(source: DeepPartial<DocumentData> = {}) {
super();
if (source.uuid !== undefined) {
this.uuid = source.uuid;
} else {
throw new Error('uuid must be present in constructor argument');
}
if (source.creationTimestamp !== undefined) {
this.creationTimestamp = source.creationTimestamp;
} else {
throw new Error('creationTimestamp must be present in constructor argument');
}
if (source.pages !== undefined) {
this.pages = source.pages.map((it) => new PageData(it));
} else {
throw new Error('pages must be present in constructor argument');
}
if (source.documentImageSizeLimit !== undefined) {
this.documentImageSizeLimit = source.documentImageSizeLimit;
}
if (source.pdfURI !== undefined) {
this.pdfURI = source.pdfURI;
} else {
throw new Error('pdfURI must be present in constructor argument');
}
if (source.tiffURI !== undefined) {
this.tiffURI = source.tiffURI;
} else {
throw new Error('tiffURI must be present in constructor argument');
}
}
}