@adobe/pdftools-extract-node-sdk
Version:
The Document Services PDF Tools Extract Node.js SDK provides APIs for extracting elements and renditions from PDF
54 lines (43 loc) • 1.55 kB
JavaScript
/*
* Copyright 2019 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
const DefaultConfig = require('./config/dc-services-default-config');
class InternalClientConfig{
constructor(connectTimeout, readTimeout, v2ServicesPredictUri, opsCreateUri){
this.connectTimeout = connectTimeout ? connectTimeout : parseInt(DefaultConfig.http.connectTimeout, 10);
this.readTimeout = readTimeout ? readTimeout : parseInt(DefaultConfig.http.readTimeout, 10);
this.v2PredictUri = v2ServicesPredictUri ? v2ServicesPredictUri : DefaultConfig.v2PredictUri;
this.opsCreateUri = opsCreateUri ? opsCreateUri : DefaultConfig.opsCreateUri;
this.validate();
}
getConnectTimeout() {
return this.connectTimeout;
}
getReadTimeout() {
return this.readTimeout;
}
getV2PredictUri() {
return this.v2PredictUri;
}
getOpsCreateUri(){
return this.opsCreateUri;
}
validate() {
if (this.readTimeout <= 0) {
throw new Error(`Invalid value for read timeout ${
this.readTimeout} Must be valid integer greater than 0`);
}
if (this.connectTimeout <= 0) {
throw new Error(`Invalid value for connect timeout ${
this.connectTimeout} Must be valid integer greater than 0`);
}
}
}
module.exports = InternalClientConfig;