@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
66 lines • 1.84 kB
JavaScript
import { HealthCheckResponseSchema, PingResponseSchema } from '../schemas';
/**
* Creates the healthCheck resource methods
* OpenAPI Path: /health-check → healthCheck.*
* @description Health check endpoint for Joomla service
*/
export function createHealthCheckResource(executeRequest) {
return {
/**
* Service health check
* @fullPath api.joomla.healthCheck.get
* @service joomla
* @domain system
* @dataMethod healthCheckData.get
* @discoverable true
*/
get: async () => {
return executeRequest({
method: 'GET',
path: '/health-check',
responseSchema: HealthCheckResponseSchema,
});
},
};
}
/**
* Creates the healthCheckData resource methods (data-only versions)
*/
export function createHealthCheckDataResource(healthCheck) {
return {
get: async () => {
const response = await healthCheck.get();
return response.data;
},
};
}
/**
* Creates the ping resource method
* OpenAPI Path: /ping → ping
* @description Ping endpoint (no bearer token required)
*/
export function createPingResource(executeRequest) {
return async () => {
return executeRequest({
method: 'GET',
path: '/ping',
responseSchema: PingResponseSchema,
});
};
}
/**
* Creates the healthData resource methods
*/
export function createHealthDataResource(healthCheck, ping) {
return {
check: async () => {
const response = await healthCheck.get();
return response.data;
},
ping: async () => {
const response = await ping();
return response.data;
},
};
}
//# sourceMappingURL=health-check.js.map