UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

75 lines 2.13 kB
import { z } from 'zod'; import { HealthCheckResponseSchema } from '../schemas'; import { BaseResponseSchema } from '../../../core/schemas'; const UnknownResponseSchema = BaseResponseSchema(z.unknown()); /** * Creates the healthCheck resource methods * OpenAPI Path: /health-check → healthCheck.* * @description Health check endpoint for P21-Core service */ export function createHealthCheckResource(executeRequest) { return { /** * Service health check * @fullPath api.p21Core.healthCheck.get * @service p21-core * @domain system-health * @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 methods * OpenAPI Path: /ping → ping.* * @description Ping endpoint for connectivity test */ export function createPingResource(executeRequest) { return { /** * Simple connectivity test * @fullPath api.p21Core.ping.get * @service p21-core * @domain system-health * @dataMethod pingData.get * @discoverable true */ get: async () => { return executeRequest({ method: 'GET', path: '/ping', responseSchema: UnknownResponseSchema, }); }, }; } /** * Creates the pingData resource methods (data-only versions) */ export function createPingDataResource(ping) { return { get: async () => { const response = await ping.get(); return response.data; }, }; } //# sourceMappingURL=health-check.js.map