@telstra/messaging
Version:
Telstra SDK Messaging
37 lines (32 loc) • 1.05 kB
text/typescript
import { HttpClient, IAuthConfigProps } from '@telstra/core';
import { THealthCheck } from '../types/index.js';
export class HealthCheck extends HttpClient {
public constructor(public authConfig?: IAuthConfigProps) {
super(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);
});
```
*/
public async get(): Promise<THealthCheck> {
try {
const result = await this.instance.get<THealthCheck>(`/messaging/v3/health-check`);
return result;
} catch (error) {
this.logger.error('Error fetching Health Check', error);
throw error;
}
}
}