api2dat5
v1.5.3
Published
This npm package provides a DAT client with auto TypeScript source code generation based on a WSDL (Web Services Description Language) definition. It utilizes the **axios** library for making requests and the **fast-xml-parser** package for XML parsing.
Downloads
65
Readme
api2dat5 package
This npm package provides a DAT client with auto TypeScript source code generation based on a WSDL (Web Services Description Language) definition. It utilizes the axios library for making requests and the fast-xml-parser package for XML parsing.
One notable feature of this package is its ability to parse XML files based on an Example object This approach facilitates accurate and neat type conversion, array detection, and included value.
With the automated script implementations, this package enables automatic updates based on the API provided by the WSDL from the backend, ensuring that your application remains up-to-date. This capability not only accelerates the development process but also reduces the occurrence of bugs in your project.
How to use
Example:
import * as DAT5 from 'api2dat5';
async function getTestList() {
const input: DAT5.MyClaimExternalService_schema1.listContracts = { pageLimit: 1, pageOffset: 0 };
const options: DAT5.Options = {
credentials: {
customerNumber: 'xxx',
customerLogin: 'xxx',
customerPassword: 'xxx'
}
};
return (await DAT5.MyClaimExternalService.listContracts(input, options)).responseObj;
}
It is possible to use default options or redefine them with the function setDefaultOption. In this case, you don't always need to provide options for every call.
import * as DAT5 from 'api2dat5';
// options for default usage in entire application
const option: DAT5.Options = {
credentials: {
customerNumber: 'xxx',
customerLogin: 'xxx',
customerPassword: 'xxx'
}
environmentId: 'prod' // can be 'gold'
}
DAT5.setDefaultOption(option);
async function getTestList() {
const input: DAT5.MyClaimExternalService_schema1.listContracts = { pageLimit: 1, pageOffset: 0 };
return (await DAT5.MyClaimExternalService.listContracts(input)).responseObj;
}
There is a possibility to redefine the environment, such as the URL, for different services. You can create multiple environments and switch between them.
Full Description of Options:
export type Options = {
credentials?: Credentials;
headers?: {
[key: string]: string
}
environmentId?: string;
environmentServiceUrlConfig?: EnvironmentServiceUrlConfig;
environmentInterfacePartnerData?: EnvironmentInterfacePartnerData;
};
export type EnvironmentServiceUrlConfig = {
[environmentId: string]: {
[serviceName: string]: string;
};
};
export type EnvironmentInterfacePartnerData = {
[environmentId: string]: {
interfacePartnerNumber: string;
interfacePartnerSignature: string;
};
};
export type Credentials = CredentialsWithSignatures | CredentialsWithToken | CredentialsWithCustomerSignature;
export interface CredentialsWithSignatures {
interfacePartnerNumber?: string;
interfacePartnerSignature?: string;
customerNumber: string;
customerLogin: string;
customerPassword: string;
}
export interface CredentialsWithToken {
'dat-authorizationtoken': string;
}
The default configuration looks like this (actual values are better to check in the library):
export const defaultEnvironmentServiceUrlConfig: EnvironmentServiceUrlConfig = {
prod: {
ConversionFunctionsService: 'https://www.dat.de/myClaim/soap/v2/ConversionFunctionsService',
FastTrackService: 'https://www.datgroup.com/myClaim/soap/FastTrackService',
FastTrackServiceRest: 'https://www.dat.de/myClaim/rest/FastTrackService',
MyClaimExternalAuthenticationService: 'https://www.dat.de/myClaim/soap/v2/MyClaimExternalAuthenticationService',
MyClaimExternalService: 'https://www.dat.de/myClaim/soap/v2/MyClaimExternalService',
SpareParts: 'https://www.dat.de/PartsInfo/services/SpareParts',
VehicleIdentificationService: 'https://www.dat.de/myClaim/soap/v2/VehicleIdentificationService',
VehicleRepairService: 'https://www.dat.de/myClaim/soap/v2/VehicleRepairService',
VehicleRepairOnlineService: 'https://www.dat.de/VehicleRepairOnline/services/VehicleRepairService',
VehicleSelectionService: 'https://www.dat.de/myClaim/soap/v2/VehicleSelectionService',
Evaluation: 'https://www.dat.de/FinanceLine/soap/Evaluation',
DossierN: 'https://www.dat.de/FinanceLine/soap/DossierN',
Dossier1N: 'https://www.dat.de/valuateNG/soap/Dossier1N',
Authentication: 'https://www.dat.de/rentalPrices/soap/Authentication',
RentalPricesService: 'https://www.dat.de/rentalPrices/soap/RentalPricesService',
VehicleRepairItalyService: 'https://www.dat.de/myClaim/soap/v2/VehicleRepairItalyService',
VehicleImagery: 'https://www.dat.de/myClaim/soap/v2/VehicleImagery'
},
gold: {
ConversionFunctionsService: 'https://gold.dat.de/myClaim/soap/v2/ConversionFunctionsService',
FastTrackService: 'https://gold.datgroup.com/myClaim/soap/FastTrackService',
FastTrackServiceRest: 'https://gold.dat.de/myClaim/rest/FastTrackService',
MyClaimExternalAuthenticationService:
'https://gold.dat.de/myClaim/soap/v2/MyClaimExternalAuthenticationService',
MyClaimExternalService: 'https://gold.dat.de/myClaim/soap/v2/MyClaimExternalService',
SpareParts: 'https://gold.dat.de/PartsInfo/services/SpareParts',
VehicleIdentificationService: 'https://gold.dat.de/myClaim/soap/v2/VehicleIdentificationService',
VehicleRepairService: 'https://gold.dat.de/myClaim/soap/v2/VehicleRepairService',
VehicleRepairOnlineService: 'https://gold.dat.de/VehicleRepairOnline/services/VehicleRepairService',
VehicleSelectionService: 'https://gold.dat.de/myClaim/soap/v2/VehicleSelectionService',
Evaluation: 'https://gold.dat.de/FinanceLine/soap/Evaluation',
DossierN: 'https://gold.dat.de/FinanceLine/soap/DossierN',
Dossier1N: 'https://gold.dat.de/valuateNG/soap/Dossier1N',
Authentication: 'https://gold.dat.de/rentalPrices/soap/Authentication',
RentalPricesService: 'https://gold.dat.de/rentalPrices/soap/RentalPricesService',
VehicleRepairItalyService: 'https://gold.dat.de/myClaim/soap/v2/VehicleRepairItalyService',
VehicleImagery: 'https://gold.dat.de/myClaim/soap/v2/VehicleImagery'
}
};
Update
release 1.5.3 24.05.2024 update SilverDat interface Version
release 1.5.1 25.01.2024 added 'VehicleRepairItalyService' wsdlUrl: 'https://www.dat.de/myClaim/soap/v2/VehicleRepairItalyService?wsdl' added 'VehicleImageryService' wsdlUrl: 'https://www.dat.de/myClaim/soap/v2/VehicleImagery?wsdl'
release 1.4.1 23.01.2024 added 'RentalPricesAuthentication' wsdlUrl: 'https://www.dat.de/rentalPrices/soap/Authentication?wsdl' added 'RentalPricesService' wsdlUrl: 'https://www.datgroup.com/rentalPrices/soap/RentalPricesService?wsdl'
release 1.3.1 17.01.2024 added 'FinanceLineEvaluationService' wsdlUrl: 'https://www.dat.de/FinanceLine/soap/Evaluation?wsdl' added 'FinanceLineDossierNService' wsdlUrl: 'https://www.datgroup.com/FinanceLine/soap/DossierN?wsdl' added 'ValuateNGDossier1NService' wsdlUrl: 'https://www.datgroup.com/valuateNG/soap/Dossier1N?wsdl'
22.11.2023 update SilverDat interface Version 2023-06 Nr. 82 Published 31/10/2023 added 'PartsService' wsdlUrl: 'https://www.dat.de/myClaim/soap/v2/PartsService?wsdl'