lml-main
Version:
This is now a mono repository published into many standalone packages.
59 lines • 2.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var moment = require("moment");
var redux_rx_http_1 = require("redux-rx-http");
exports.FETCH_LOCATION_BY_OBJECT_ID = redux_rx_http_1.createRxHttpActionTypes('FETCH_LOCATION_BY_OBJECT_ID');
exports.FETCH_LOCATION_BY_OBJECT_ID_BATCH = redux_rx_http_1.createRxHttpActionTypes('FETCH_LOCATION_BY_OBJECT_ID_BATCH');
exports.POST_LOCATION = redux_rx_http_1.createRxHttpActionTypes('POST_LOCATION');
exports.POST_COURIER_LOCATION = redux_rx_http_1.createRxHttpActionTypes('POST_COURIER_LOCATION');
exports.SET_LOCATION_BY_OBJECT_ID = 'SET_LOCATION_BY_OBJECT_ID';
exports.SET_LOCATION_BY_OBJECT_ID_BATCH = 'SET_LOCATION_BY_OBJECT_ID_BATCH';
exports.fetchLocationById = function (object, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpGet('/v3/location', exports.FETCH_LOCATION_BY_OBJECT_ID, { object: object }, tslib_1.__assign({}, args, { object: object }));
};
exports.fetchLocationByIdBatch = function (objects, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpPost('/v3/location/batch', exports.FETCH_LOCATION_BY_OBJECT_ID_BATCH, { objects: objects }, tslib_1.__assign({}, args, { objects: objects }));
};
exports.postLocation = function (data, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpPost('/v3/location/pings', exports.POST_LOCATION, data, {
args: tslib_1.__assign({}, args, { data: data }),
});
};
exports.postCourierLocation = function (refId, latitude, longitude, args) {
if (args === void 0) { args = {}; }
var data = {
objectId: refId,
position: {
coordinates: {
latitude: latitude,
longitude: longitude,
},
type: 'point',
},
timestamp: moment().toISOString(),
// fake fields (do these even matter anyway??)
headingDegrees: 0,
velocityKph: 0,
gpsSatellites: 0,
network: {
carrier: 'API',
isConnected: false,
sStrength: 0,
networkType: 'API',
},
};
return redux_rx_http_1.rxHttpPost('/v3/location/pings', exports.POST_LOCATION, data, {
args: tslib_1.__assign({}, args, { data: data }),
});
};
exports.setLocationByObjectId = function (location) {
return ({ type: exports.SET_LOCATION_BY_OBJECT_ID, location: location });
};
exports.setLocationByObjectIdBatch = function (locations) {
return ({ type: exports.SET_LOCATION_BY_OBJECT_ID_BATCH, locations: locations });
};
//# sourceMappingURL=data.js.map