wft-geodb-js-client
v2.0.3
Published
Provides Javascript client bindings to the GeoDB service
Downloads
153
Readme
wft-geodb-js-client
GeoDb - JavaScript client for wft-geodb-js-client The GeoDB API focuses on getting global places and regions. Easily obtain country, region, and place data for use in your apps!
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 2.0.3
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
For Node.js
npm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install wft-geodb-js-client --save
Finally, you need to build the module:
npm run build
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your wft-geodb-js-client from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
git
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var GeoDb = require('wft-geodb-js-client');
var defaultClient = GeoDb.ApiClient.instance;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//UserSecurity.apiKeyPrefix['X-RapidAPI-Key'] = "Token"
var api = new GeoDb.GeoApi()
var opts = {
'location': "location_example", // {String} Only places near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD
'radius': 56, // {Number} The location radius within which to find places
'distanceUnit': "'MI'", // {String} The unit of distance: MI | KM
'countryIds': "countryIds_example", // {String} Only places in these countries (comma-delimited country codes or WikiData ids)
'excludedCountryIds': "excludedCountryIds_example", // {String} Only places NOT in these countries (comma-delimited country codes or WikiData ids)
'minPopulation': 56, // {Number} Only places having at least this population
'maxPopulation': 56, // {Number} Only places having no more than this population
'namePrefix': "namePrefix_example", // {String} Only entities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language.
'namePrefixDefaultLangResults': true, // {Boolean} When name-prefix matching, whether or not to match on names in the default language if a non-default languageCode is set.
'timeZoneIds': "timeZoneIds_example", // {String} Only places in these time-zones (comma-delimited)
'asciiMode': false, // {Boolean} Display results using ASCII characters
'hateoasMode': true, // {Boolean} Include HATEOAS-style links in results
'languageCode': "languageCode_example", // {String} Display results in this language
'limit': 10, // {Number} The maximum number of results to retrieve
'offset': 0, // {Number} The zero-ary offset index into the results
'sort': "sort_example", // {String} How to sort places. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population
'includeDeleted': "'NONE'" // {String} Whether to include any divisions marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE
};
api.findAdminDivisionsUsingGET(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Documentation for API Endpoints
All URIs are relative to https://wft-geo-db.p.rapidapi.com/v1
Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- GeoDb.GeoApi | findAdminDivisionsUsingGET | GET /geo/adminDivisions | Find admin divisions GeoDb.GeoApi | findCitiesNearAdminDivisionUsingGET | GET /geo/adminDivisions/{divisionId}/nearbyCities | Find cities near division GeoDb.GeoApi | findCitiesNearCityUsingGET | GET /geo/cities/{cityId}/nearbyCities | Find cities near city GeoDb.GeoApi | findCitiesNearLocationUsingGET | GET /geo/locations/{locationId}/nearbyCities | Find cities near location GeoDb.GeoApi | findCitiesUsingGET | GET /geo/cities | Find cities GeoDb.GeoApi | findCountryPlacesUsingGET | GET /geo/countries/{countryId}/places | Find country places GeoDb.GeoApi | findDivisionsNearAdminDivisionUsingGET | GET /geo/adminDivisions/{divisionId}/nearbyDivisions | Find admin divisions near division GeoDb.GeoApi | findDivisionsNearCityUsingGET | GET /geo/cities/{cityId}/nearbyDivisions | Find admin divisions near city GeoDb.GeoApi | findDivisionsNearLocationUsingGET | GET /geo/locations/{locationId}/nearbyDivisions | Find admin divisions near location GeoDb.GeoApi | findPlacesNearAdminDivisionUsingGET | GET /geo/adminDivisions/{divisionId}/nearbyPlaces | Find places near division GeoDb.GeoApi | findPlacesNearCityUsingGET | GET /geo/cities/{cityId}/nearbyPlaces | Find places near city GeoDb.GeoApi | findPlacesNearLocationUsingGET | GET /geo/locations/{locationId}/nearbyPlaces | Find places near location GeoDb.GeoApi | findPlacesNearPlaceUsingGET | GET /geo/places/{placeId}/nearbyPlaces | Find places near place GeoDb.GeoApi | findPlacesUsingGET | GET /geo/places | Find places GeoDb.GeoApi | findRegionCitiesUsingGET | GET /geo/countries/{countryId}/regions/{regionCode}/cities | Find country region cities GeoDb.GeoApi | findRegionDivisionsUsingGET | GET /geo/countries/{countryId}/regions/{regionCode}/adminDivisions | Find country region administrative divisions GeoDb.GeoApi | findRegionPlacesUsingGET | GET /geo/countries/{countryId}/regions/{regionCode}/places | Find country region places GeoDb.GeoApi | getAdminDivisionUsingGET | GET /geo/adminDivisions/{divisionId} | Get admin division details GeoDb.GeoApi | getCityDateTimeUsingGET | GET /geo/cities/{cityId}/dateTime | Get city date-time GeoDb.GeoApi | getCityDistanceUsingGET | GET /geo/cities/{cityId}/distance | Get city distance GeoDb.GeoApi | getCityLocatedInUsingGET | GET /geo/cities/{cityId}/locatedIn | Get city containing region GeoDb.GeoApi | getCityTimeUsingGET | GET /geo/cities/{cityId}/time | Get city time GeoDb.GeoApi | getCityUsingGET | GET /geo/cities/{cityId} | Get city details GeoDb.GeoApi | getCountriesUsingGET | GET /geo/countries | Find countries GeoDb.GeoApi | getCountryUsingGET | GET /geo/countries/{countryId} | Get country details GeoDb.GeoApi | getPlaceDateTimeUsingGET | GET /geo/places/{placeId}/dateTime | Get place date-time GeoDb.GeoApi | getPlaceDistanceUsingGET | GET /geo/places/{placeId}/distance | Get place distance GeoDb.GeoApi | getPlaceLocatedInUsingGET | GET /geo/places/{placeId}/locatedIn | Get place containing region GeoDb.GeoApi | getPlaceTimeUsingGET | GET /geo/places/{placeId}/time | Get place time GeoDb.GeoApi | getPlaceUsingGET | GET /geo/places/{placeId} | Get place details GeoDb.GeoApi | getRegionUsingGET | GET /geo/countries/{countryId}/regions/{regionCode} | Get region details GeoDb.GeoApi | getRegionsUsingGET | GET /geo/countries/{countryId}/regions | Find country regions GeoDb.LocaleApi | getCurrenciesUsingGET | GET /locale/currencies | Find currencies GeoDb.LocaleApi | getLanguagesUsingGET | GET /locale/languages | Get languages GeoDb.LocaleApi | getLocalesUsingGET | GET /locale/locales | Get locales GeoDb.LocaleApi | getTimeZoneDateTimeUsingGET | GET /locale/timezones/{zoneId}/dateTime | Get time-zone date-time GeoDb.LocaleApi | getTimeZoneTimeUsingGET | GET /locale/timezones/{zoneId}/time | Get time-zone time GeoDb.LocaleApi | getTimeZoneUsingGET | GET /locale/timezones/{zoneId} | Get time-zone GeoDb.LocaleApi | getTimezonesUsingGET | GET /locale/timezones | Get time-zones
Documentation for Models
- GeoDb.BadRequestResponse
- GeoDb.BaseCollectionResponse
- GeoDb.BaseCollectionResponseAllOf
- GeoDb.BaseResponse
- GeoDb.CountriesResponse
- GeoDb.CountriesResponseAllOf
- GeoDb.CountryDetails
- GeoDb.CountryResponse
- GeoDb.CountryResponseAllOf
- GeoDb.CountrySummary
- GeoDb.CurrenciesResponse
- GeoDb.CurrenciesResponseAllOf
- GeoDb.Currency
- GeoDb.DateTimeResponse
- GeoDb.DateTimeResponseAllOf
- GeoDb.DistanceResponse
- GeoDb.DistanceResponseAllOf
- GeoDb.Error
- GeoDb.ErrorCode
- GeoDb.ForbiddenResponse
- GeoDb.LanguageDescriptor
- GeoDb.LanguagesResponse
- GeoDb.LanguagesResponseAllOf
- GeoDb.Link
- GeoDb.Locale
- GeoDb.LocalesResponse
- GeoDb.LocalesResponseAllOf
- GeoDb.Metadata
- GeoDb.NotFoundResponse
- GeoDb.PopulatedPlaceDetails
- GeoDb.PopulatedPlaceResponse
- GeoDb.PopulatedPlaceResponseAllOf
- GeoDb.PopulatedPlaceSummary
- GeoDb.PopulatedPlaceType
- GeoDb.PopulatedPlacesResponse
- GeoDb.PopulatedPlacesResponseAllOf
- GeoDb.RegionDetails
- GeoDb.RegionResponse
- GeoDb.RegionResponseAllOf
- GeoDb.RegionSummary
- GeoDb.RegionsResponse
- GeoDb.RegionsResponseAllOf
- GeoDb.TimeResponse
- GeoDb.TimeResponseAllOf
- GeoDb.TimeZoneDescriptor
- GeoDb.TimeZoneResponse
- GeoDb.TimeZoneResponseAllOf
- GeoDb.TimeZonesResponse
- GeoDb.TimeZonesResponseAllOf
Documentation for Authorization
UserSecurity
- Type: API key
- API key parameter name: X-RapidAPI-Key
- Location: HTTP header