UNPKG

@telstra/messaging

Version:
37 lines (34 loc) 1.05 kB
import { HttpClient } from '@telstra/core'; export class HealthCheck extends HttpClient { authConfig; constructor(authConfig) { super(authConfig); this.authConfig = authConfig; } /** * Determine whether the messaging service is up or down. * @link https://dev.telstra.com/docs/messaging-api/apiReference/apiReferenceOverviewEndpoints?version=3.x#HealthCheck * @example ```typescript import { HealthCheck } from '@telstra/messaging' const healthCheck = new HealthCheck(); healthCheck.get() .then(result => { console.log(result); }) .catch(error => { console.error(error); }); ``` */ async get() { try { const result = await this.instance.get(`/messaging/v3/health-check`); return result; } catch (error) { this.logger.error('Error fetching Health Check', error); throw error; } } }