Skip to content

Commit 3751838

Browse files
authored
Merge pull request #456 from Magnus-Kuhn/healthcheck-sdk
feat: add healthcheck to sdk
2 parents b4420f9 + 26874a3 commit 3751838

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

packages/eudiplo-sdk-core/src/client.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ import { client } from './api/client.gen';
22
import {
33
authControllerGetOAuth2Token,
44
credentialOfferControllerGetOffer,
5-
verifierOfferControllerGetOffer,
5+
healthControllerCheck,
66
sessionControllerGetSession,
7+
verifierOfferControllerGetOffer,
78
} from './api/sdk.gen';
89
import type {
9-
Session,
10+
HealthControllerCheckError,
11+
HealthControllerCheckResponse,
1012
OfferRequestDto,
1113
PresentationRequest,
14+
Session,
1215
} from './api/types.gen';
1316

1417
// ============================================================================
@@ -394,6 +397,22 @@ export class EudiploClient {
394397
};
395398
}
396399

400+
/**
401+
* Get the current health of the EUDIPLO connector.
402+
* The status in the response is `ok`/`error`.
403+
* The health of the components is listed in the response under `info`/`error`/`details`.
404+
* If the EUDIPLO connector itself is unreachable, no components are listed.
405+
*/
406+
async getHealth(): Promise<HealthControllerCheckResponse | HealthControllerCheckError> {
407+
const response = await healthControllerCheck({ throwOnError: false });
408+
409+
if (!response.data) {
410+
return { status: "error" };
411+
}
412+
413+
return response.data;
414+
}
415+
397416
/**
398417
* Get the current status of a session.
399418
*/

0 commit comments

Comments
 (0)