mindee
Version:
Mindee Client Library for Node.js
25 lines (24 loc) • 970 B
JavaScript
import { Inference, Page } from "../../../../v1/parsing/common/index.js";
import { IdCardV2Document } from "./idCardV2Document.js";
import { IdCardV2Page } from "./idCardV2Page.js";
/**
* Carte Nationale d'Identité API version 2 inference prediction.
*/
export class IdCardV2 extends Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "idcard_fr";
/** The endpoint's version. */
this.endpointVersion = "2";
/** The document's pages. */
this.pages = [];
this.prediction = new IdCardV2Document(rawPrediction["prediction"]);
rawPrediction["pages"].forEach((page) => {
if (page.prediction !== undefined && page.prediction !== null &&
Object.keys(page.prediction).length > 0) {
this.pages.push(new Page(IdCardV2Page, page, page["id"], page["orientation"]));
}
});
}
}