Skip to content

Commit c26f173

Browse files
[SP-10204] get raw request response (#101)
* update-clients_GetRawRequestResponse * add methods to get request and response --------- Co-authored-by: GitHub Action <action@github.com>
1 parent 0a39bbd commit c26f173

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

example/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const {DOCUMENT_NUMBER} = TextFieldType;
3333
const ir_page_0 = fs.readFileSync('IR.jpg').buffer;
3434
const uv_page_0 = fs.readFileSync('UV.jpg').buffer;
3535

36-
const response = await api.process({
36+
const request = {
3737
images: [
3838
{
3939
ImageData: white_page_0, light: Light.WHITE, page_idx: 0
@@ -57,7 +57,12 @@ const {DOCUMENT_NUMBER} = TextFieldType;
5757
Result.LEXICAL_ANALYSIS
5858
]
5959
}
60-
});
60+
}
61+
62+
const response = await api.process(request);
63+
64+
const requestJson = JSON.stringify(request);
65+
const responseJson = response.json();
6166

6267
const docOverallStatus = response.status.overallStatus;
6368
const docOpticalTextStatus = response.status.detailsOptical.text;

src/api/process-api.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,4 @@ export class ProcessApi extends BaseAPI {
150150
public apiProcess(processRequest: ProcessRequest, xRequestID?: string, options?: any) {
151151
return ProcessApiFp(this.configuration).apiProcess(processRequest, xRequestID, options).then((request) => request(this.axios, this.basePath));
152152
}
153-
154-
public setConfiguration(configuration: Configuration): void {
155-
this.configuration = configuration;
156-
}
157153
}

src/ext/document-reader.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export class DocumentReaderApi {
3535
.then((axiosResult) => axiosResult.data);
3636
}
3737

38-
setConfiguration(configuration: Configuration): void {
39-
this.processApi.setConfiguration(configuration);
40-
}
41-
4238
/**
4339
*
4440
* @summary Process list of documents images and return extracted data
@@ -67,6 +63,7 @@ export class DocumentReaderApi {
6763
baseRequest = requestToBaseRequest(request)
6864
} else {
6965
baseRequest = request
66+
console.log();
7067
}
7168

7269
return this.processApi.apiProcess(baseRequest, xRequestID, options)

src/ext/process-response.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export class Response {
5858
}
5959
}
6060

61+
public json(): string {
62+
return JSON.stringify(this.lowLvlResponse);
63+
}
64+
6165
public authenticityPerPage(): Array<Authenticity> {
6266
const filteredByTypeArray = <Array<AuthenticityResult>>this.lowLvlResponse.resultsByType(Result.AUTHENTICITY)
6367

src/models/scenario.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export enum Scenario {
2828
MRZ_OR_BARCODE = 'MrzOrBarcode',
2929
MRZ_OR_LOCATE = 'MrzOrLocate',
3030
MRZ_AND_LOCATE = 'MrzAndLocate',
31+
BARCODE_AND_LOCATE = 'BarcodeAndLocate',
3132
MRZ_OR_OCR = 'MrzOrOcr',
3233
MRZ_OR_BARCODE_OR_OCR = 'MrzOrBarcodeOrOcr',
3334
LOCATE_VISUAL_AND_MRZ_OR_OCR = 'LocateVisual_And_MrzOrOcr',

0 commit comments

Comments
 (0)