Skip to content

GetResourcePosition

Source: src/AWS/IoTWireless/GetResourcePosition.ts

Runtime binding for iotwireless:GetResourcePosition — read the bound wireless device’s position (WGS84, returned as a GeoJSON payload stream) from a deployed Lambda or Task.

Provide the GetResourcePositionHttp implementation layer on the Function effect, bind the device in the init phase, then call the returned client at runtime. The GeoJsonPayload is a byte Stream — decode it to a string with Stream.mkString(Stream.decodeText(...)).

// init
const getPosition = yield* AWS.IoTWireless.GetResourcePosition(device);
// runtime
const { GeoJsonPayload } = yield* getPosition();
const geoJson = GeoJsonPayload === undefined
? undefined
: yield* Stream.mkString(Stream.decodeText(GeoJsonPayload));
// on the Function effect:
// .pipe(Effect.provide(AWS.IoTWireless.GetResourcePositionHttp))