digital-payments-sdk
Version:
The APIs detailed within this SDK will enable Shell's Fleet Solutions Customers to digitalize Shell Card/s and use them to pay to refuel their vehicles at Shell Stations.
91 lines • 6.15 kB
JavaScript
;
/**
* Shell SmartPay APILib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
exports.__esModule = true;
exports.StationLocatorController = void 0;
var tslib_1 = require("tslib");
var aroundLocationArray_1 = require("../models/aroundLocationArray");
var typeEnum_1 = require("../models/typeEnum");
var schema_1 = require("../schema");
var baseController_1 = require("./baseController");
var stationLocatorBadRequestError_1 = require("../errors/stationLocatorBadRequestError");
var stationLocatorForbiddenError_1 = require("../errors/stationLocatorForbiddenError");
var stationLocatorInternalServerError_1 = require("../errors/stationLocatorInternalServerError");
var stationLocatorNotFoundError_1 = require("../errors/stationLocatorNotFoundError");
var stationLocatorUnauthorizedError_1 = require("../errors/stationLocatorUnauthorizedError");
var StationLocatorController = /** @class */ (function (_super) {
tslib_1.__extends(StationLocatorController, _super);
function StationLocatorController() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Returns all sites within specified radius of specified GPS location. Sites of all Types are returned.
* This call must be used when attempting to establish the station the user is located at as part of
* fuelling journey (i.e. user has to be within 300m of station to be considered located at the
* station). This API could also be used as a general query to find nearby Shell locations
*
* @param m API Method to be executed
* @param lon The user’s current longitude
* @param lat The user’s current latitude
* @param radius The search radius in kilometers
* @param offerCode This enables requestor to specify locations that will honour the specified
* (advanced) offer code
* @param n This enables requestor to limit the number of locations that are returned and
* defaulted to a maximum of 250 locations. Locations returned based on distance to
* User’s location as-the-crow-flies.
* @param amenities This enables requestor to filter locations based on one or more amenities (e.g.
* Filter locations so that only those with a Toilet are returned).
* @param countries This enables requestor to filter locations based on one or more Countries (i.e. by
* country codes).
* @param type All fuel stations are of at least one Type, indicating whether it is Shell-branded
* or not, and if the station can be used by trucks. Note that a station can have more
* than one Type (e.g. Shell retail sites (Type=0) can also be truck friendly (Type=2)).
* Type values are as follows: * 0 = Shell owned/branded stations that are not
* also Type=2 or Type=3 * 1 = Partner stations accepting Shell Card * 2 = Shell
* owned/branded stations that are truck friendly but not Type=3 * 3 = Shell
* owned/branded stations that are truck only <br/>**When type is not provided, API
* will return type 0 and 2 only.**
* @return Response from the API call
*/
StationLocatorController.prototype.stationlocatorV1StationsGetAroundLocation = function (m, lon, lat, radius, offerCode, n, amenities, countries, type, requestOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var req, mapped;
return tslib_1.__generator(this, function (_a) {
req = this.createRequest('GET', '/SiteData/v1/stations');
mapped = req.prepareArgs({
m: [m, (0, schema_1.string)()],
lon: [lon, (0, schema_1.number)()],
lat: [lat, (0, schema_1.number)()],
radius: [radius, (0, schema_1.number)()],
offerCode: [offerCode, (0, schema_1.optional)((0, schema_1.string)())],
n: [n, (0, schema_1.optional)((0, schema_1.number)())],
amenities: [amenities, (0, schema_1.optional)((0, schema_1.array)((0, schema_1.string)()))],
countries: [countries, (0, schema_1.optional)((0, schema_1.array)((0, schema_1.string)()))],
type: [type, (0, schema_1.optional)(typeEnum_1.typeEnumSchema)]
});
req.query('m', mapped.m);
req.query('lon', mapped.lon);
req.query('lat', mapped.lat);
req.query('radius', mapped.radius);
req.query('offer_code', mapped.offerCode);
req.query('n', mapped.n);
req.query('amenities', mapped.amenities);
req.query('countries', mapped.countries);
req.query('type', mapped.type);
req.throwOn(400, stationLocatorBadRequestError_1.StationLocatorBadRequestError, 'Bad request');
req.throwOn(401, stationLocatorUnauthorizedError_1.StationLocatorUnauthorizedError, 'Unauthorized');
req.throwOn(403, stationLocatorForbiddenError_1.StationLocatorForbiddenError, 'Forbbiden');
req.throwOn(404, stationLocatorNotFoundError_1.StationLocatorNotFoundError, 'Not Found');
req.throwOn(500, stationLocatorInternalServerError_1.StationLocatorInternalServerError, 'Internal Server Error');
req.authenticate([{ oAuthTokenPost: true }]);
return [2 /*return*/, req.callAsJson(aroundLocationArray_1.aroundLocationArraySchema, requestOptions)];
});
});
};
return StationLocatorController;
}(baseController_1.BaseController));
exports.StationLocatorController = StationLocatorController;
//# sourceMappingURL=stationLocatorController.js.map