diff --git a/services/__tests__/geocoding-v6.test.js b/services/__tests__/geocoding-v6.test.js index 32a3752..8ac0cff 100644 --- a/services/__tests__/geocoding-v6.test.js +++ b/services/__tests__/geocoding-v6.test.js @@ -34,6 +34,7 @@ describe('forwardGeocode', () => { language: 'de', worldview: 'us', permanent: true, + sessionId: 'abc123', // structured input parameters will be ignored in normal mode address_line1: '12 main', @@ -60,7 +61,8 @@ describe('forwardGeocode', () => { limit: 3, language: 'de', worldview: 'us', - permanent: 'true' + permanent: 'true', + sessionId: 'abc123' } }); }); @@ -76,6 +78,7 @@ describe('forwardGeocode', () => { limit: 3, language: 'de', worldview: 'us', + sessionId: 'abc123', // structured input parameters will be picked address_line1: '12 main', @@ -99,6 +102,7 @@ describe('forwardGeocode', () => { limit: 3, language: 'de', worldview: 'us', + sessionId: 'abc123', address_line1: '12 main', address_number: '12', @@ -140,7 +144,8 @@ describe('reverseGeocode', () => { limit: 3, language: 'de', worldview: 'us', - permanent: true + permanent: true, + sessionId: 'abc123' }); expect(tu.requestConfig(geocoding)).toEqual({ method: 'GET', @@ -153,7 +158,8 @@ describe('reverseGeocode', () => { limit: 3, language: 'de', worldview: 'us', - permanent: 'true' + permanent: 'true', + sessionId: 'abc123' } }); }); diff --git a/services/__tests__/geocoding.test.js b/services/__tests__/geocoding.test.js index d6d2b55..cbae233 100644 --- a/services/__tests__/geocoding.test.js +++ b/services/__tests__/geocoding.test.js @@ -37,7 +37,8 @@ describe('forwardGeocode', () => { language: ['de', 'bs'], routing: true, fuzzyMatch: true, - worldview: 'us' + worldview: 'us', + sessionId: 'abc123' }); expect(tu.requestConfig(geocoding)).toEqual({ method: 'GET', @@ -56,7 +57,8 @@ describe('forwardGeocode', () => { language: ['de', 'bs'], routing: 'true', fuzzyMatch: 'true', - worldview: 'us' + worldview: 'us', + sessionId: 'abc123' } }); }); @@ -89,7 +91,8 @@ describe('reverseGeocode', () => { language: ['de', 'bs'], reverseMode: 'distance', routing: true, - worldview: 'us' + worldview: 'us', + sessionId: 'abc123' }); expect(tu.requestConfig(geocoding)).toEqual({ method: 'GET', @@ -106,7 +109,8 @@ describe('reverseGeocode', () => { language: ['de', 'bs'], reverseMode: 'distance', routing: 'true', - worldview: 'us' + worldview: 'us', + sessionId: 'abc123' } }); }); diff --git a/services/geocoding-v6.js b/services/geocoding-v6.js index c04286b..80ea916 100644 --- a/services/geocoding-v6.js +++ b/services/geocoding-v6.js @@ -129,6 +129,7 @@ GeocodingV6.forwardGeocode = function(config) { worldview: v.string, autocomplete: v.boolean, permanent: v.boolean, + sessionId: v.string, // structured input fields address_line1: v.string, @@ -168,7 +169,8 @@ GeocodingV6.forwardGeocode = function(config) { 'limit', 'worldview', 'autocomplete', - 'permanent' + 'permanent', + 'sessionId' ]) ) ); @@ -220,7 +222,8 @@ GeocodingV6.reverseGeocode = function(config) { limit: v.number, language: v.string, worldview: v.string, - permanent: v.boolean + permanent: v.boolean, + sessionId: v.string })(config); var query = stringifyBooleans( @@ -233,7 +236,8 @@ GeocodingV6.reverseGeocode = function(config) { 'limit', 'language', 'worldview', - 'permanent' + 'permanent', + 'sessionId' ]) ) ); diff --git a/services/geocoding.js b/services/geocoding.js index 02f2814..2100e25 100644 --- a/services/geocoding.js +++ b/services/geocoding.js @@ -104,7 +104,8 @@ Geocoding.forwardGeocode = function(config) { language: v.arrayOf(v.string), routing: v.boolean, fuzzyMatch: v.boolean, - worldview: v.string + worldview: v.string, + sessionId: v.string })(config); config.mode = config.mode || 'mapbox.places'; @@ -121,7 +122,8 @@ Geocoding.forwardGeocode = function(config) { 'language', 'routing', 'fuzzyMatch', - 'worldview' + 'worldview', + 'sessionId' ]) ) ); @@ -176,7 +178,8 @@ Geocoding.reverseGeocode = function(config) { language: v.arrayOf(v.string), reverseMode: v.oneOf('distance', 'score'), routing: v.boolean, - worldview: v.string + worldview: v.string, + sessionId: v.string })(config); config.mode = config.mode || 'mapbox.places'; @@ -192,7 +195,8 @@ Geocoding.reverseGeocode = function(config) { 'language', 'reverseMode', 'routing', - 'worldview' + 'worldview', + 'sessionId' ]) ) );