From 043b455fa64b07d15601a4e39c40f22914014fa1 Mon Sep 17 00:00:00 2001 From: Trevor Gerhardt Date: Tue, 31 Jan 2017 18:16:58 +0100 Subject: [PATCH] docs(readme): Update readme to reflect new api --- README.md | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 996807c..7a51600 100644 --- a/README.md +++ b/README.md @@ -3,41 +3,49 @@ Isomorphic Mapzen search for reuse across our JavaScript libraries. Get an API k ## API -### `search(apiKey, searchText, options = {})` +### `search({apiKey, text, ...options})` ```js import {search} from 'isomorphic-mapzen-search' -search(MAPZEN_API_KEY, '1301 U Street NW, Washington, DC', { +search({ + apiKey: MAPZEN_API_KEY, + text: '1301 U Street NW, Washington, DC', + focusPoint: {lat: 39.7691, lon: -86.1570}, boundary: { country: 'US', - maxLonLat: maxLonLat, - minLonLat: minLonLat + rect: { + minLon: minLon, + minLat: minLat, + maxLon: maxLon, + maxLat: maxLat + }, + circle: { + centerPoint: centerLonLat, + radius: 35 // kilometers + } }, - circle: { - center: centerLonLat, - radius: 35 // kilometers - }, - focusLonLat: {lat: 39.7691, lon: -86.1570}, format: false // keep as returned GeoJSON -}).then(geojson => { +}).then((geojson) => { console.log(geojson) -}).catch(err => { +}).catch((err) => { console.error(err) }) ``` -### `reverse(apiKey, latlng, options = {})` +### `reverse({apiKey, point, format})` ```js import {reverse} from 'isomorphic-mapzen-search' -reverse(MAPZEN_API_KEY, { - lat: 39.7691, - lng: -86.1570 -}, { +reverse({ + apiKey: MAPZEN_API_KEY, + point: { + lat: 39.7691, + lng: -86.1570 + }, format: true -}).then(json => { +}).then((json) => { console.log(json[0].address) -}).catch(err => { +}).catch((err) => { console.error(err) }) ```