mobility-toolbox-js
Version:
Toolbox for JavaScript applications in the domains of mobility and logistics.
45 lines (44 loc) • 1.58 kB
TypeScript
import HttpAPI from './HttpAPI';
import type { StopsParameters, StopsResponse } from '../types';
export interface StopsAPIOptions {
apiKey?: string;
url?: string;
}
/**
* This class provides convenience methods to use to the [geOps Stops API](https://developer.geops.io/apis/stops/).
*
* @example
* import { StopsAPI } from 'mobility-toolbox-js/api';
*
* const api = new StopsAPI({
* apiKey: [yourApiKey],
* // url: 'https://api.geops.io/stops/v1/',
* });
*
* const stops = await api.search({ q:"Bern" });
*
* console.log('Log stops:', JSON.stringify(stops));
*
* @public
*/
declare class StopsAPI extends HttpAPI {
/**
* Constructor
*
* @param {Object} options Options.
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
* @param {string} [options.url='https://api.geops.io/stops/v1/'] Url of the [geOps stops API](https://developer.geops.io/apis/stops/).
* @public
*/
constructor(options?: StopsAPIOptions);
/**
* Search for stops.
*
* @param {StopsParameters} params Request parameters. See [Stops API documentation](https://developer.geops.io/apis/stops).
* @param {FetchOptions} config Options for the fetch request.
* @returns {Promise<StopsResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326). See [Stops API documentation](https://developer.geops.io/apis/stops).
* @public
*/
search(params: StopsParameters, config: RequestInit): Promise<StopsResponse>;
}
export default StopsAPI;