diff --git a/src/InboundGarminWrapper.ts b/src/InboundGarminWrapper.ts index 8778901..a250c64 100644 --- a/src/InboundGarminWrapper.ts +++ b/src/InboundGarminWrapper.ts @@ -4,6 +4,7 @@ import { request } from './request'; import type { BaseGetOpts, DevicesKey, + EmergencyState, History, HistoryItems, Interval, @@ -11,6 +12,7 @@ import type { LastKnownLocation, LocationRequest, LocationsKey, + Respondent, Tracking, Version, } from './types'; @@ -127,4 +129,37 @@ export class InboundGarminWrapper { const opts = Object.assign(this.baseGetOpts, options); return await request(`https://${this.IPCUrl}/IPCInbound/V1/Location.svc/Version`, opts); } + + /** + * @see https://explore.garmin.com/IPCInbound/docs/#!/Emergency.svc/GetEmergencyRespondentGET + * + * @param options + */ + public async getEmergencyRespondent(options: RequestInit = {}) { + const opts = Object.assign(this.baseGetOpts, options); + return await request(`https://${this.IPCUrl}/IPCInbound/V1/Emergency.svc/Respondent`, opts); + } + + /** + * @see https://explore.garmin.com/IPCInbound/docs/#!/Emergency.svc/StateGET + * + * @params options + */ + public async getEmergencyState(options: RequestInit = {}) { + const opts = Object.assign(this.baseGetOpts, options); + return await request>( + `https://${this.IPCUrl}/IPCInbound/V1/Emergency.svc/State?IMEI=${this.imei}`, + opts + ); + } + + /** + * @see https://explore.garmin.com/IPCInbound/docs/#!/Emergency.svc/VersionGET + * + * @params options + */ + public async getEmergencyVersion(options: RequestInit = {}) { + const opts = Object.assign(this.baseGetOpts, options); + return await request(`https://${this.IPCUrl}/IPCInbound/V1/Emergency.svc/Version`, opts); + } } diff --git a/src/types.ts b/src/types.ts index 3533b71..4e43208 100644 --- a/src/types.ts +++ b/src/types.ts @@ -69,3 +69,12 @@ export type LocationRequest = { StartDate: string; ExpirationDate: string; }; + +export type Respondent = { + Respondent: string; +}; + +export type EmergencyState = { + IMEI: number; + State: string; +};