javascript library that provides a client api the for the central electronic document managment system (KSHDE) provided by mindigital.
Full documentation of the REST api can be found here.
npm install kshde-client
import axiosRetry, { IAxiosRetryConfig } from 'axios-retry';
import { KSHDEClient } from 'kshde-client/v1';
//Optional. Change to your needs
const retryConfig: IAxiosRetryConfig = {
retries: 4,
retryDelay: (...arg) => axiosRetry.exponentialDelay(...arg, 300),
retryCondition(error: AxiosError) {
if (error.response)
switch (error.response.status) {
//retry only if status is 500 or 501
case 500:
case 501:
return true;
default:
return false;
}
return false;
},
onRetry: (retryCount, error) => {
console.log(`retry count: ${retryCount} ${error.response?.config.url}`);
},
};
const clientConfig = {
sectorCode: ' a sector code ',
clientId: ' client id ',
clientSecret: ' client secret ',
// Whether to run against the testing or the real endpoints
// Optional. Defaults to 'development'
mode: 'production' | 'development'
// Optional. No default is supplied
retryConfig?: retryConfig;
}
const client = new KSHDEClient(clientConfig)
client.documents(protocolNo).attachments(attachmentId).content.get(...)
client.documents(protocolNo).attachments.post(...)
client.documents(protocolNo).put(...)
Copyright © 2023 grnet
KSHDE-client is licensed under the EUPL-1.2-or-later