UNPKG

mindee

Version:

Mindee Client Library for Node.js

85 lines (84 loc) 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DriverLicenseV1Document = void 0; const common_1 = require("../../parsing/common"); const standard_1 = require("../../parsing/standard"); /** * Driver License API version 1.0 document data. */ class DriverLicenseV1Document { constructor(rawPrediction, pageId) { this.category = new standard_1.StringField({ prediction: rawPrediction["category"], pageId: pageId, }); this.countryCode = new standard_1.StringField({ prediction: rawPrediction["country_code"], pageId: pageId, }); this.dateOfBirth = new standard_1.DateField({ prediction: rawPrediction["date_of_birth"], pageId: pageId, }); this.ddNumber = new standard_1.StringField({ prediction: rawPrediction["dd_number"], pageId: pageId, }); this.expiryDate = new standard_1.DateField({ prediction: rawPrediction["expiry_date"], pageId: pageId, }); this.firstName = new standard_1.StringField({ prediction: rawPrediction["first_name"], pageId: pageId, }); this.id = new standard_1.StringField({ prediction: rawPrediction["id"], pageId: pageId, }); this.issuedDate = new standard_1.DateField({ prediction: rawPrediction["issued_date"], pageId: pageId, }); this.issuingAuthority = new standard_1.StringField({ prediction: rawPrediction["issuing_authority"], pageId: pageId, }); this.lastName = new standard_1.StringField({ prediction: rawPrediction["last_name"], pageId: pageId, }); this.mrz = new standard_1.StringField({ prediction: rawPrediction["mrz"], pageId: pageId, }); this.placeOfBirth = new standard_1.StringField({ prediction: rawPrediction["place_of_birth"], pageId: pageId, }); this.state = new standard_1.StringField({ prediction: rawPrediction["state"], pageId: pageId, }); } /** * Default string representation. */ toString() { const outStr = `:Country Code: ${this.countryCode} :State: ${this.state} :ID: ${this.id} :Category: ${this.category} :Last Name: ${this.lastName} :First Name: ${this.firstName} :Date of Birth: ${this.dateOfBirth} :Place of Birth: ${this.placeOfBirth} :Expiry Date: ${this.expiryDate} :Issued Date: ${this.issuedDate} :Issuing Authority: ${this.issuingAuthority} :MRZ: ${this.mrz} :DD Number: ${this.ddNumber}`.trimEnd(); return (0, common_1.cleanOutString)(outStr); } } exports.DriverLicenseV1Document = DriverLicenseV1Document;