universal-geocoder
Version:
Universal geocoding abstraction server-side and client-side with multiple built-in providers
81 lines • 3.85 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var query_1 = require("../../query");
var GoogleMapsGeocodeQuery = /** @class */ (function (_super) {
__extends(GoogleMapsGeocodeQuery, _super);
function GoogleMapsGeocodeQuery(_a) {
var countryCodes = _a.countryCodes, components = _a.components, channel = _a.channel, geocodeQueryObject = __rest(_a, ["countryCodes", "components", "channel"]);
var _this = _super.call(this, geocodeQueryObject) || this;
if (countryCodes && countryCodes.length !== 1) {
throw new Error('The "countryCodes" parameter must have only one country code top-level domain.');
}
_this.countryCodes = countryCodes;
_this.components = components;
_this.channel = channel;
return _this;
}
GoogleMapsGeocodeQuery.create = function (object) {
return new this(object);
};
GoogleMapsGeocodeQuery.prototype.toObject = function () {
return __assign(__assign({}, _super.prototype.toObject.call(this)), { countryCodes: this.countryCodes, components: this.components, channel: this.channel });
};
GoogleMapsGeocodeQuery.prototype.withCountryCodes = function (countryCodes) {
return new GoogleMapsGeocodeQuery(__assign(__assign({}, this.toObject()), { countryCodes: countryCodes }));
};
GoogleMapsGeocodeQuery.prototype.getCountryCodes = function () {
return this.countryCodes;
};
GoogleMapsGeocodeQuery.prototype.withComponents = function (components) {
return new GoogleMapsGeocodeQuery(__assign(__assign({}, this.toObject()), { components: components }));
};
GoogleMapsGeocodeQuery.prototype.getComponents = function () {
return this.components;
};
GoogleMapsGeocodeQuery.prototype.withChannel = function (channel) {
return new GoogleMapsGeocodeQuery(__assign(__assign({}, this.toObject()), { channel: channel }));
};
GoogleMapsGeocodeQuery.prototype.getChannel = function () {
return this.channel;
};
return GoogleMapsGeocodeQuery;
}(query_1.GeocodeQuery));
exports.default = GoogleMapsGeocodeQuery;
//# sourceMappingURL=GoogleMapsGeocodeQuery.js.map