@tomtom-org/maps-sdk 0.58.1 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +147 -0
- package/README.md +2 -1
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +38 -76
- package/map/dist/index.d.ts +9621 -9346
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/map/package.json +1 -1
- package/package.json +2 -2
- package/services/dist/index.d.ts +348 -527
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
- package/services/package.json +1 -1
package/services/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressProperties, AreaAnalyticsMetricKey, Avoidable, ChargingPark, ChargingParkWithAvailability, ChargingStation, ChargingStationsAccessType, ChargingStationsAvailability, ChargingStopProps, CommonPlaceProps, Connector, ConnectorType, CurrentType, EVChargingStationWithAvailabilityPlaceProps, EntryPoint, Fuel, GeographyType, GetPositionEntryPointOption, GlobalConfig, HasBBox, HasLngLat, MapcodeType, OpeningHours, OpeningHoursMode, POICategory, Place, PlaceType, Places, PlugType, PolygonFeature, PolygonFeatures, RevGeoAddressProps, RoadShieldReference, Route, RoutePlanningLocation, Routes, SearchPlaceProps, TimeZone, TomTomAPIHeaders, TomTomHeaders, TrafficAreaAnalytics, TrafficIncidentDetails, TrafficIncidentRequestCategory, TrafficIncidentTEC, TrafficIncidentTimeValidity, TravelMode, View, inputSectionTypes } from "@tomtom-org/maps-sdk/core";
|
|
1
|
+
import { AddressProperties, AreaAnalyticsMetricKey, Avoidable, ChargingPark, ChargingParkWithAvailability, ChargingPoint, ChargingStation, ChargingStationsAccessType, ChargingStationsAvailability, ChargingStopProps, CommonPlaceProps, Connector, ConnectorType, CurrentType, EVChargingStationWithAvailabilityPlaceProps, EntryPoint, Fuel, GeographyType, GetPositionEntryPointOption, GlobalConfig, HasBBox, HasLngLat, MapcodeType, OpeningHours, OpeningHoursMode, POICategory, Place, PlaceType, Places, PlugType, PolygonFeature, PolygonFeatures, RevGeoAddressProps, RoadShieldReference, Route, RoutePlanningLocation, Routes, SearchPlaceProps, StaticChargingPoint, TimeZone, TomTomAPIHeaders, TomTomHeaders, TrafficAreaAnalytics, TrafficIncidentDetails, TrafficIncidentRequestCategory, TrafficIncidentTEC, TrafficIncidentTimeValidity, TravelMode, View, inputSectionTypes } from "@tomtom-org/maps-sdk/core";
|
|
2
2
|
import { ZodError, ZodIssue, ZodObject } from "zod";
|
|
3
3
|
//#region ../node_modules/.pnpm/@types+geojson@7946.0.16/node_modules/@types/geojson/index.d.ts
|
|
4
4
|
/**
|
|
@@ -285,7 +285,7 @@ type RequestValidationConfig<Params = any> = {
|
|
|
285
285
|
*
|
|
286
286
|
* @remarks
|
|
287
287
|
* This type extends the global configuration and provides additional service-specific options
|
|
288
|
-
* such as
|
|
288
|
+
* such as request validation, cancellation, and lifecycle event listeners.
|
|
289
289
|
*
|
|
290
290
|
* @typeParam ApiRequest - The type of the API request object
|
|
291
291
|
* @typeParam ApiResponse - The type of the API response object
|
|
@@ -293,20 +293,6 @@ type RequestValidationConfig<Params = any> = {
|
|
|
293
293
|
* @group Shared
|
|
294
294
|
*/
|
|
295
295
|
export type CommonServiceParams<ApiRequest = any, ApiResponse = any> = Partial<GlobalConfig> & {
|
|
296
|
-
/**
|
|
297
|
-
* Custom base URL for the service endpoint.
|
|
298
|
-
*
|
|
299
|
-
* @remarks
|
|
300
|
-
* Should contain the URL up to the part that changes per service call.
|
|
301
|
-
*
|
|
302
|
-
* @example
|
|
303
|
-
* ```ts
|
|
304
|
-
* customServiceBaseURL: 'https://api.tomtom.com/search/10/reverseGeocode/'
|
|
305
|
-
* ```
|
|
306
|
-
*
|
|
307
|
-
* @defaultValue `undefined` (uses default service URL)
|
|
308
|
-
*/
|
|
309
|
-
customServiceBaseURL?: string;
|
|
310
296
|
/**
|
|
311
297
|
* Controls whether input request schema validation is performed.
|
|
312
298
|
*
|
|
@@ -349,20 +335,11 @@ export type CommonServiceParams<ApiRequest = any, ApiResponse = any> = Partial<G
|
|
|
349
335
|
* Compose signals to add a deadline: `AbortSignal.any([mine, AbortSignal.timeout(5000)])`.
|
|
350
336
|
*
|
|
351
337
|
* @example
|
|
352
|
-
*
|
|
338
|
+
* Keep only the latest search with {@link createLatestRequest}:
|
|
353
339
|
* ```ts
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* controller?.abort();
|
|
358
|
-
* controller = new AbortController();
|
|
359
|
-
* try {
|
|
360
|
-
* return await discoverPlaces({ query, signal: controller.signal });
|
|
361
|
-
* } catch (error) {
|
|
362
|
-
* if (error instanceof SDKAbortError) return;
|
|
363
|
-
* throw error;
|
|
364
|
-
* }
|
|
365
|
-
* };
|
|
340
|
+
* const latestSearch = createLatestRequest();
|
|
341
|
+
* const search = await latestSearch.run((signal) => discoverPlaces({ query, signal }));
|
|
342
|
+
* if (search.current) showResults(search.value);
|
|
366
343
|
* ```
|
|
367
344
|
*
|
|
368
345
|
* @defaultValue `undefined` (the request cannot be cancelled)
|
|
@@ -412,16 +389,11 @@ export type ServiceTemplate<Params extends CommonServiceParams<ApiRequest, ApiRe
|
|
|
412
389
|
*/
|
|
413
390
|
buildRequest: (params: Params) => ApiRequest;
|
|
414
391
|
/**
|
|
415
|
-
*
|
|
392
|
+
* The API version the service calls. Callers cannot override it.
|
|
416
393
|
*
|
|
417
|
-
* @
|
|
418
|
-
* Useful for services that require a specific API version different from the global configuration.
|
|
419
|
-
* If not provided, the API version from the global or provided configuration will be used.
|
|
420
|
-
*
|
|
421
|
-
* @param params - Input parameters that may influence the API version selection
|
|
422
|
-
* @returns The API version number
|
|
394
|
+
* @defaultValue 1
|
|
423
395
|
*/
|
|
424
|
-
|
|
396
|
+
apiVersion?: number;
|
|
425
397
|
/**
|
|
426
398
|
* Sends the constructed request to the API server.
|
|
427
399
|
*
|
|
@@ -558,12 +530,15 @@ export declare class SDKServiceError extends SDKError {
|
|
|
558
530
|
* the convention used by `fetch`, and the original abort reason — including a custom
|
|
559
531
|
* value passed to `AbortController.abort(reason)` — is available on `cause`.
|
|
560
532
|
*
|
|
533
|
+
* To drop a call a newer one supersedes without catching this error, run it through
|
|
534
|
+
* {@link createLatestRequest}.
|
|
535
|
+
*
|
|
561
536
|
* @example
|
|
562
537
|
* ```typescript
|
|
563
538
|
* try {
|
|
564
|
-
* await discoverPlaces({ query: 'cafe', signal:
|
|
539
|
+
* await discoverPlaces({ query: 'cafe', signal: AbortSignal.timeout(5000) });
|
|
565
540
|
* } catch (error) {
|
|
566
|
-
* if (error instanceof SDKAbortError) return
|
|
541
|
+
* if (error instanceof SDKAbortError) return showMessage('Search timed out');
|
|
567
542
|
* throw error;
|
|
568
543
|
* }
|
|
569
544
|
* ```
|
|
@@ -601,6 +576,78 @@ export declare const buildResponseError: (error: unknown, serviceName: ServiceNa
|
|
|
601
576
|
*/
|
|
602
577
|
export declare const buildValidationError: (error: ValidationError, serviceName: ServiceName) => SDKError;
|
|
603
578
|
//#endregion
|
|
579
|
+
//#region src/shared/types/latestRequest.d.ts
|
|
580
|
+
/**
|
|
581
|
+
* What {@link LatestRequest.run} resolves to.
|
|
582
|
+
*
|
|
583
|
+
* `current: false` means a newer `run` or a `cancel` retired the request, so its value — or its
|
|
584
|
+
* error — is stale and must not be shown.
|
|
585
|
+
*
|
|
586
|
+
* @group Shared
|
|
587
|
+
*/
|
|
588
|
+
export type LatestRequestResult<T> = {
|
|
589
|
+
current: true;
|
|
590
|
+
value: T;
|
|
591
|
+
} | {
|
|
592
|
+
current: false;
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* One in-flight request slot, where each new request retires the one before it.
|
|
596
|
+
*
|
|
597
|
+
* @see {@link createLatestRequest}
|
|
598
|
+
*
|
|
599
|
+
* @group Shared
|
|
600
|
+
*/
|
|
601
|
+
export type LatestRequest = {
|
|
602
|
+
/**
|
|
603
|
+
* Aborts the request in flight, if any, then starts this one.
|
|
604
|
+
*
|
|
605
|
+
* @remarks
|
|
606
|
+
* `request` is called synchronously with a fresh signal, which it passes to every service
|
|
607
|
+
* call it makes. A rejection is rethrown only while the request is still current, so a
|
|
608
|
+
* deadline of your own composed onto the signal still surfaces as an {@link SDKAbortError}.
|
|
609
|
+
*
|
|
610
|
+
* @param request - The work to run, typically one or more service calls sharing the signal
|
|
611
|
+
*/
|
|
612
|
+
run: <T>(request: (signal: AbortSignal) => Promise<T>) => Promise<LatestRequestResult<T>>;
|
|
613
|
+
/**
|
|
614
|
+
* Aborts the request in flight without starting another, so it resolves `{ current: false }`.
|
|
615
|
+
*/
|
|
616
|
+
cancel: () => void;
|
|
617
|
+
/**
|
|
618
|
+
* Whether a request is in flight and not yet retired.
|
|
619
|
+
*/
|
|
620
|
+
isRunning: () => boolean;
|
|
621
|
+
};
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/shared/latestRequest.d.ts
|
|
624
|
+
/**
|
|
625
|
+
* Creates a slot that keeps only the latest request: starting one aborts its predecessor, and an
|
|
626
|
+
* answer that arrives after a newer request or a `cancel` is dropped rather than returned.
|
|
627
|
+
*
|
|
628
|
+
* @remarks
|
|
629
|
+
* Use one per thing that can be superseded — a click lookup, a search box, a refetch on map move.
|
|
630
|
+
* Aborting stops the network work; checking again once the answer is in also catches a `cancel`
|
|
631
|
+
* that arrives after the response but before the caller paints it.
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```ts
|
|
635
|
+
* const lookup = createLatestRequest();
|
|
636
|
+
*
|
|
637
|
+
* map.mapLibreMap.on('click', async (event) => {
|
|
638
|
+
* const result = await lookup.run((signal) => reverseGeocode({ position: event.lngLat.toArray(), signal }));
|
|
639
|
+
* if (!result.current) return;
|
|
640
|
+
* showAddress(result.value);
|
|
641
|
+
* });
|
|
642
|
+
* clearButton.addEventListener('click', lookup.cancel);
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @see [Keeping only the latest request](https://docs.tomtom.com/maps-sdk-js/guides/services/request-options-and-errors#keeping-only-the-latest-request)
|
|
646
|
+
*
|
|
647
|
+
* @group Shared
|
|
648
|
+
*/
|
|
649
|
+
export declare const createLatestRequest: () => LatestRequest;
|
|
650
|
+
//#endregion
|
|
604
651
|
//#region src/shared/types/geoBias.d.ts
|
|
605
652
|
/**
|
|
606
653
|
* A point to search around, optionally bounded by a radius.
|
|
@@ -661,135 +708,6 @@ export type GeoBias = (PointGeoBias & {
|
|
|
661
708
|
radiusMeters?: never;
|
|
662
709
|
});
|
|
663
710
|
//#endregion
|
|
664
|
-
//#region src/shared/types/commonGeocodeAndFuzzySearchParams.d.ts
|
|
665
|
-
/**
|
|
666
|
-
* Common parameters shared between fuzzy search and geocoding services.
|
|
667
|
-
*
|
|
668
|
-
* These parameters control search behavior that applies to both fuzzy search
|
|
669
|
-
* and geocoding operations, including autocomplete mode, pagination, and geographic filtering.
|
|
670
|
-
*
|
|
671
|
-
* @remarks
|
|
672
|
-
* Used by:
|
|
673
|
-
* - {@link fuzzySearch}
|
|
674
|
-
* - {@link geocode}
|
|
675
|
-
*
|
|
676
|
-
* @group Places Search
|
|
677
|
-
*/
|
|
678
|
-
export type CommonGeocodeAndFuzzySearchParams = {
|
|
679
|
-
/**
|
|
680
|
-
* Enable predictive/autocomplete mode for partial input queries.
|
|
681
|
-
*
|
|
682
|
-
* When true, the query is treated as incomplete text being typed by a user,
|
|
683
|
-
* and the search returns suggestions that match the partial input.
|
|
684
|
-
*
|
|
685
|
-
* @remarks
|
|
686
|
-
* **Autocomplete Behavior:**
|
|
687
|
-
* - Optimized for real-time search-as-you-type
|
|
688
|
-
* - Returns results that start with or contain the query
|
|
689
|
-
* - Better for interactive search boxes
|
|
690
|
-
* - Lower result quality thresholds to show more options
|
|
691
|
-
*
|
|
692
|
-
* **Regular Search (false):**
|
|
693
|
-
* - Treats query as complete input
|
|
694
|
-
* - Higher quality thresholds
|
|
695
|
-
* - Better for final search submission
|
|
696
|
-
*
|
|
697
|
-
* @default false
|
|
698
|
-
*
|
|
699
|
-
* @example
|
|
700
|
-
* ```typescript
|
|
701
|
-
* // Autocomplete mode for "Amst" input
|
|
702
|
-
* typeahead: true // Returns: Amsterdam, Amstelveen, etc.
|
|
703
|
-
*
|
|
704
|
-
* // Regular search mode
|
|
705
|
-
* typeahead: false // Expects complete query
|
|
706
|
-
* ```
|
|
707
|
-
*/
|
|
708
|
-
typeahead?: boolean;
|
|
709
|
-
/**
|
|
710
|
-
* Starting position within the complete result set for pagination.
|
|
711
|
-
*
|
|
712
|
-
* Use with `limit` to implement pagination through large result sets.
|
|
713
|
-
* Zero-based index indicating which result to start from.
|
|
714
|
-
*
|
|
715
|
-
* @remarks
|
|
716
|
-
* **Pagination Pattern:**
|
|
717
|
-
* - Page 1: `offset: 0, limit: 10` (results 0-9)
|
|
718
|
-
* - Page 2: `offset: 10, limit: 10` (results 10-19)
|
|
719
|
-
* - Page 3: `offset: 20, limit: 10` (results 20-29)
|
|
720
|
-
*
|
|
721
|
-
* **Performance Note:**
|
|
722
|
-
* Very high offset values may have slower performance.
|
|
723
|
-
*
|
|
724
|
-
* @default 0
|
|
725
|
-
*
|
|
726
|
-
* @example
|
|
727
|
-
* ```typescript
|
|
728
|
-
* // First page
|
|
729
|
-
* offset: 0
|
|
730
|
-
*
|
|
731
|
-
* // Second page (assuming limit: 10)
|
|
732
|
-
* offset: 10
|
|
733
|
-
*
|
|
734
|
-
* // Third page
|
|
735
|
-
* offset: 20
|
|
736
|
-
* ```
|
|
737
|
-
*/
|
|
738
|
-
offset?: number;
|
|
739
|
-
/**
|
|
740
|
-
* Where to look: a point with an optional radius, or a bounding box.
|
|
741
|
-
*
|
|
742
|
-
* @remarks
|
|
743
|
-
* A point without `radiusMeters` biases the ranking; with one, or with a `boundingBox`, results
|
|
744
|
-
* are confined to that area. Leave it out to search without a geographic bias.
|
|
745
|
-
*
|
|
746
|
-
* @example
|
|
747
|
-
* ```typescript
|
|
748
|
-
* geoBias: { position: [4.9, 52.3], radiusMeters: 2000 }
|
|
749
|
-
* geoBias: { boundingBox: [4.8, 52.3, 5.0, 52.4] }
|
|
750
|
-
* ```
|
|
751
|
-
*/
|
|
752
|
-
geoBias?: GeoBias;
|
|
753
|
-
/**
|
|
754
|
-
* Restrict search to specific countries.
|
|
755
|
-
*
|
|
756
|
-
* Limits results to locations within the specified countries only.
|
|
757
|
-
* Useful for country-specific searches or compliance requirements.
|
|
758
|
-
*
|
|
759
|
-
* @remarks
|
|
760
|
-
* **Country Code Formats:**
|
|
761
|
-
* - ISO 3166-1 alpha-2: Two-letter codes (e.g., "US", "FR", "DE")
|
|
762
|
-
* - ISO 3166-1 alpha-3: Three-letter codes (e.g., "USA", "FRA", "DEU")
|
|
763
|
-
* - Can mix formats: `["US", "FRA", "DE"]`
|
|
764
|
-
*
|
|
765
|
-
* **Behavior:**
|
|
766
|
-
* - Multiple countries create OR condition (results from any listed country)
|
|
767
|
-
* - Case-insensitive
|
|
768
|
-
* - The `view` parameter may affect available countries
|
|
769
|
-
*
|
|
770
|
-
* **Use Cases:**
|
|
771
|
-
* - Regional applications (EU-only, North America-only)
|
|
772
|
-
* - Compliance with data sovereignty rules
|
|
773
|
-
* - Simplifying results for specific markets
|
|
774
|
-
*
|
|
775
|
-
* @example
|
|
776
|
-
* ```typescript
|
|
777
|
-
* // Single country (United States)
|
|
778
|
-
* countries: ['US']
|
|
779
|
-
*
|
|
780
|
-
* // Multiple countries (Europe)
|
|
781
|
-
* countries: ['FR', 'DE', 'NL', 'BE']
|
|
782
|
-
*
|
|
783
|
-
* // Mixed formats
|
|
784
|
-
* countries: ['US', 'GBR', 'CA']
|
|
785
|
-
*
|
|
786
|
-
* // North America
|
|
787
|
-
* countries: ['USA', 'CAN', 'MEX']
|
|
788
|
-
* ```
|
|
789
|
-
*/
|
|
790
|
-
countries?: string[];
|
|
791
|
-
};
|
|
792
|
-
//#endregion
|
|
793
711
|
//#region src/shared/types/commonPlacesParams.d.ts
|
|
794
712
|
/**
|
|
795
713
|
* Index representing the type of place data to search.
|
|
@@ -838,18 +756,11 @@ export type SearchIndexType = 'Geo' | 'PAD' | 'Addr' | 'Str' | 'XStr' | 'POI';
|
|
|
838
756
|
* **Key Features:**
|
|
839
757
|
* - Result limits and pagination
|
|
840
758
|
* - Geographic biasing for location-aware results
|
|
841
|
-
* - Result type filtering (addresses, POIs, geographies)
|
|
842
759
|
* - Additional data inclusion (mapcodes, extended postal codes)
|
|
843
760
|
* - Geopolitical view context for disputed territories
|
|
844
761
|
*
|
|
845
762
|
* @example
|
|
846
763
|
* ```typescript
|
|
847
|
-
* // Search with geography type filter
|
|
848
|
-
* const citySearch: CommonPlacesParams<URL, Response> = {
|
|
849
|
-
* geographyTypes: ['Municipality'], // Only cities
|
|
850
|
-
* limit: 10
|
|
851
|
-
* };
|
|
852
|
-
*
|
|
853
764
|
* // Search with mapcodes and specific geopolitical view
|
|
854
765
|
* const detailedSearch: CommonPlacesParams<URL, Response> = {
|
|
855
766
|
* view: 'IN', // India's perspective
|
|
@@ -860,7 +771,6 @@ export type SearchIndexType = 'Geo' | 'PAD' | 'Addr' | 'Str' | 'XStr' | 'POI';
|
|
|
860
771
|
*
|
|
861
772
|
* // Address search with extended postal codes
|
|
862
773
|
* const addressSearch: CommonPlacesParams<URL, Response> = {
|
|
863
|
-
* geographyTypes: ['Country', 'Municipality'],
|
|
864
774
|
* extendedPostalCodesFor: ['Geo', 'PAD', 'Addr'],
|
|
865
775
|
* limit: 15
|
|
866
776
|
* };
|
|
@@ -873,7 +783,7 @@ export type CommonPlacesParams<ApiRequest, ApiResponse> = CommonServiceParams<Ap
|
|
|
873
783
|
* Maximum number of results to return.
|
|
874
784
|
*
|
|
875
785
|
* Controls pagination by limiting the number of results in a single response.
|
|
876
|
-
*
|
|
786
|
+
* Fuzzy search and geocoding page with `cursor`; see {@link CommonGeocodeAndFuzzySearchParams.cursor}.
|
|
877
787
|
*
|
|
878
788
|
* @remarks
|
|
879
789
|
* **Range:** 1 to 100
|
|
@@ -996,54 +906,154 @@ export type CommonPlacesParams<ApiRequest, ApiResponse> = CommonServiceParams<Ap
|
|
|
996
906
|
* ```
|
|
997
907
|
*/
|
|
998
908
|
view?: View;
|
|
909
|
+
};
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/shared/types/searchFilters.d.ts
|
|
912
|
+
/**
|
|
913
|
+
* Which countries results may come from. Everything here **excludes** results.
|
|
914
|
+
*
|
|
915
|
+
* @remarks
|
|
916
|
+
* Separate from {@link PlaceFilters} because geometry and along-route search take no country
|
|
917
|
+
* restriction. Where to look is {@link GeoBias}, not a filter.
|
|
918
|
+
*
|
|
919
|
+
* @group Places Search
|
|
920
|
+
*/
|
|
921
|
+
export type GeographicFilters = {
|
|
922
|
+
/** Countries to restrict to, as ISO 3166-1 alpha-2 or alpha-3 codes. */
|
|
923
|
+
countries?: string[];
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* What kind of places may come back. Everything here **excludes** results: a place that does not
|
|
927
|
+
* match is dropped, not ranked lower.
|
|
928
|
+
*
|
|
929
|
+
* @remarks
|
|
930
|
+
* Values within one member are OR'd: `poiBrands: ['Shell', 'BP']` keeps a place of either brand.
|
|
931
|
+
* Members are AND'd with each other.
|
|
932
|
+
*
|
|
933
|
+
* Fuzzy search intersects it with {@link GeographicFilters} as {@link SearchFilters}, so one
|
|
934
|
+
* `filters` object carries the country and the attribute restrictions together.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* filters: { poiCategories: ['RESTAURANT', 'CAFE'] }
|
|
939
|
+
* filters: { poiBrands: ['Shell', 'BP'], fuelTypes: ['Diesel'] }
|
|
940
|
+
* filters: { connectors: ['IEC62196Type2CCS'], minPowerKW: 50, maxPowerKW: 150 }
|
|
941
|
+
* ```
|
|
942
|
+
*
|
|
943
|
+
* @group Places Search
|
|
944
|
+
*/
|
|
945
|
+
export type PlaceFilters = {
|
|
946
|
+
/** POI categories to restrict to. */
|
|
947
|
+
poiCategories?: POICategory[];
|
|
948
|
+
/** POI brands to restrict to, by name. Case-sensitive; quote a name containing a comma: `'"A,B"'`. */
|
|
949
|
+
poiBrands?: string[];
|
|
950
|
+
/** Which kinds of place data to search. Defaults to all. */
|
|
951
|
+
indexes?: SearchIndexType[];
|
|
952
|
+
/** Geography types to restrict `Geography` results to. */
|
|
953
|
+
geographyTypes?: GeographyType[];
|
|
954
|
+
/** EV connector types to restrict charging results to. */
|
|
955
|
+
connectors?: ConnectorType[];
|
|
956
|
+
/** Fuel types to restrict fuel station results to. */
|
|
957
|
+
fuelTypes?: Fuel[];
|
|
958
|
+
/** Minimum EV charging power, in kilowatts. */
|
|
959
|
+
minPowerKW?: number;
|
|
960
|
+
/** Maximum EV charging power, in kilowatts. */
|
|
961
|
+
maxPowerKW?: number;
|
|
962
|
+
};
|
|
963
|
+
/**
|
|
964
|
+
* Both halves of `filters` in one object: what fuzzy search takes.
|
|
965
|
+
*
|
|
966
|
+
* @group Places Search
|
|
967
|
+
*/
|
|
968
|
+
export type SearchFilters = PlaceFilters & GeographicFilters;
|
|
969
|
+
//#endregion
|
|
970
|
+
//#region src/shared/types/commonGeocodeAndFuzzySearchParams.d.ts
|
|
971
|
+
/**
|
|
972
|
+
* Common parameters shared between fuzzy search and geocoding services.
|
|
973
|
+
*
|
|
974
|
+
* These parameters control search behavior that applies to both fuzzy search
|
|
975
|
+
* and geocoding operations, including autocomplete mode, pagination, and geographic filtering.
|
|
976
|
+
*
|
|
977
|
+
* @remarks
|
|
978
|
+
* Used by:
|
|
979
|
+
* - {@link fuzzySearch}
|
|
980
|
+
* - {@link geocode}
|
|
981
|
+
*
|
|
982
|
+
* @group Places Search
|
|
983
|
+
*/
|
|
984
|
+
export type CommonGeocodeAndFuzzySearchParams = {
|
|
999
985
|
/**
|
|
1000
|
-
*
|
|
986
|
+
* Enable predictive/autocomplete mode for partial input queries.
|
|
1001
987
|
*
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
988
|
+
* When true, the query is treated as incomplete text being typed by a user,
|
|
989
|
+
* and the search returns suggestions that match the partial input.
|
|
1004
990
|
*
|
|
1005
991
|
* @remarks
|
|
1006
|
-
* **
|
|
1007
|
-
* -
|
|
1008
|
-
* -
|
|
1009
|
-
* -
|
|
1010
|
-
* -
|
|
1011
|
-
* - `Municipality`: Cities, towns
|
|
1012
|
-
* - `MunicipalitySubdivision`: City districts
|
|
1013
|
-
* - `Neighbourhood`: Neighborhoods, quarters
|
|
1014
|
-
* - `PostalCodeArea`: Areas defined by postal codes
|
|
1015
|
-
*
|
|
1016
|
-
* **Filtering Behavior:**
|
|
1017
|
-
* When specified, only Geography results with matching entity types
|
|
1018
|
-
* are returned. POIs, addresses, and other result types are excluded.
|
|
992
|
+
* **Autocomplete Behavior:**
|
|
993
|
+
* - Optimized for real-time search-as-you-type
|
|
994
|
+
* - Returns results that start with or contain the query
|
|
995
|
+
* - Better for interactive search boxes
|
|
996
|
+
* - Lower result quality thresholds to show more options
|
|
1019
997
|
*
|
|
1020
|
-
* **
|
|
1021
|
-
* -
|
|
1022
|
-
* -
|
|
1023
|
-
* -
|
|
1024
|
-
*
|
|
998
|
+
* **Regular Search (false):**
|
|
999
|
+
* - Treats query as complete input
|
|
1000
|
+
* - Higher quality thresholds
|
|
1001
|
+
* - Better for final search submission
|
|
1002
|
+
*
|
|
1003
|
+
* @default false
|
|
1025
1004
|
*
|
|
1026
1005
|
* @example
|
|
1027
1006
|
* ```typescript
|
|
1028
|
-
* //
|
|
1029
|
-
*
|
|
1030
|
-
*
|
|
1031
|
-
* // Search for countries and cities
|
|
1032
|
-
* geographyTypes: ['Country', 'Municipality']
|
|
1033
|
-
*
|
|
1034
|
-
* // Search for all administrative levels
|
|
1035
|
-
* geographyTypes: [
|
|
1036
|
-
* 'Country',
|
|
1037
|
-
* 'CountrySubdivision',
|
|
1038
|
-
* 'CountrySecondarySubdivision',
|
|
1039
|
-
* 'Municipality'
|
|
1040
|
-
* ]
|
|
1007
|
+
* // Autocomplete mode for "Amst" input
|
|
1008
|
+
* typeahead: true // Returns: Amsterdam, Amstelveen, etc.
|
|
1041
1009
|
*
|
|
1042
|
-
* //
|
|
1043
|
-
*
|
|
1010
|
+
* // Regular search mode
|
|
1011
|
+
* typeahead: false // Expects complete query
|
|
1044
1012
|
* ```
|
|
1045
1013
|
*/
|
|
1046
|
-
|
|
1014
|
+
typeahead?: boolean;
|
|
1015
|
+
/**
|
|
1016
|
+
* Continues a previous search: its response's `nextCursor`, passed back unchanged alongside the
|
|
1017
|
+
* same parameters. Leave it out for the first page.
|
|
1018
|
+
*
|
|
1019
|
+
* @remarks
|
|
1020
|
+
* The value is **opaque**: the SDK mints it and only the SDK reads it, which lets the pagination
|
|
1021
|
+
* mechanism change without breaking callers. Passing a value this SDK did not produce throws.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```typescript
|
|
1025
|
+
* let response = await discoverPlaces({ query: 'cafe', limit: 20 });
|
|
1026
|
+
*
|
|
1027
|
+
* while (response.properties?.nextCursor) {
|
|
1028
|
+
* response = await discoverPlaces({ query: 'cafe', limit: 20, cursor: response.properties?.nextCursor });
|
|
1029
|
+
* }
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
cursor?: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* Where to look: a point with an optional radius, or a bounding box.
|
|
1035
|
+
*
|
|
1036
|
+
* @remarks
|
|
1037
|
+
* A point without `radiusMeters` biases the ranking; with one, or with a `boundingBox`, results
|
|
1038
|
+
* are confined to that area. Leave it out to search without a geographic bias.
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```typescript
|
|
1042
|
+
* geoBias: { position: [4.9, 52.3], radiusMeters: 2000 }
|
|
1043
|
+
* geoBias: { boundingBox: [4.8, 52.3, 5.0, 52.4] }
|
|
1044
|
+
* ```
|
|
1045
|
+
*/
|
|
1046
|
+
geoBias?: GeoBias;
|
|
1047
|
+
/**
|
|
1048
|
+
* Which countries results may come from: see {@link GeographicFilters}. Fuzzy search's `filters`
|
|
1049
|
+
* also carries {@link PlaceFilters}; geocoding's also carries `geographyTypes`.
|
|
1050
|
+
*
|
|
1051
|
+
* @example
|
|
1052
|
+
* ```typescript
|
|
1053
|
+
* filters: { countries: ['NL', 'BE'] }
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
filters?: GeographicFilters;
|
|
1047
1057
|
};
|
|
1048
1058
|
//#endregion
|
|
1049
1059
|
//#region src/shared/types/vehicleEngineParams.d.ts
|
|
@@ -1238,6 +1248,8 @@ type ChargingModel = {
|
|
|
1238
1248
|
* Must contain from zero to up to 20 (inclusive) json objects describing a battery point,
|
|
1239
1249
|
* each containing stateOfChargeInkWh and maxPowerInkW.
|
|
1240
1250
|
*
|
|
1251
|
+
* Required for a route with charging stops (`preferences.chargingPreferences`): the service rejects one without it.
|
|
1252
|
+
*
|
|
1241
1253
|
* None of the stateOfChargeInkWh values from such an object may equal any other stateOfChargeInkWh of an object.
|
|
1242
1254
|
* maxPowerInkW must be larger than zero.
|
|
1243
1255
|
*/
|
|
@@ -1374,6 +1386,9 @@ type PredefinedVehicleModel = {
|
|
|
1374
1386
|
* Physical properties of the vehicle.
|
|
1375
1387
|
*
|
|
1376
1388
|
* @remarks
|
|
1389
|
+
* Weight is the only dimension routing takes: there are no height, width, length or axle-weight
|
|
1390
|
+
* restrictions. `TravelMode` lists the modes routing offers.
|
|
1391
|
+
*
|
|
1377
1392
|
* The vehicle weight is used to:
|
|
1378
1393
|
* - Check road weight restrictions
|
|
1379
1394
|
* - Calculate toll costs (weight-based pricing)
|
|
@@ -2628,7 +2643,7 @@ export type DepartArriveParams<Option extends DepartArriveOption = DepartArriveO
|
|
|
2628
2643
|
* },
|
|
2629
2644
|
* engine: {
|
|
2630
2645
|
* consumption: {
|
|
2631
|
-
*
|
|
2646
|
+
* speedsToConsumptionsKWH: [
|
|
2632
2647
|
* { speedKMH: 50, consumptionUnitsPer100KM: 15 },
|
|
2633
2648
|
* { speedKMH: 90, consumptionUnitsPer100KM: 18 },
|
|
2634
2649
|
* { speedKMH: 120, consumptionUnitsPer100KM: 22 }
|
|
@@ -2642,13 +2657,12 @@ export type DepartArriveParams<Option extends DepartArriveOption = DepartArriveO
|
|
|
2642
2657
|
* }
|
|
2643
2658
|
* };
|
|
2644
2659
|
*
|
|
2645
|
-
* //
|
|
2646
|
-
* const
|
|
2660
|
+
* // Heavy, speed-limited vehicle, described by weight alone (see `VehicleDimensions`)
|
|
2661
|
+
* const heavyVehicleParams: CommonRoutingParams = {
|
|
2647
2662
|
* costModel: {
|
|
2648
2663
|
* routeType: 'short',
|
|
2649
2664
|
* avoid: ['tollRoads', 'ferries']
|
|
2650
2665
|
* },
|
|
2651
|
-
* travelMode: 'truck',
|
|
2652
2666
|
* vehicle: {
|
|
2653
2667
|
* model: {
|
|
2654
2668
|
* dimensions: {
|
|
@@ -2751,8 +2765,8 @@ export type TimeZoneRequest = 'iana';
|
|
|
2751
2765
|
/**
|
|
2752
2766
|
* Common parameters for search services with POI filtering capabilities.
|
|
2753
2767
|
*
|
|
2754
|
-
* Extends basic places parameters with
|
|
2755
|
-
*
|
|
2768
|
+
* Extends basic places parameters with the POI attribute filters — categories, brands, EV
|
|
2769
|
+
* charging specifics — grouped under `filters`.
|
|
2756
2770
|
*
|
|
2757
2771
|
* @typeParam ApiRequest - The API request type
|
|
2758
2772
|
* @typeParam ApiResponse - The API response type
|
|
@@ -2763,10 +2777,8 @@ export type TimeZoneRequest = 'iana';
|
|
|
2763
2777
|
* - {@link fuzzySearch}
|
|
2764
2778
|
* - {@link geometrySearch}
|
|
2765
2779
|
*
|
|
2766
|
-
* Provides
|
|
2767
|
-
* - POI
|
|
2768
|
-
* - EV charging station specifications
|
|
2769
|
-
* - Fuel type availability
|
|
2780
|
+
* Provides:
|
|
2781
|
+
* - POI category, brand, EV charging and fuel type filters (`filters`)
|
|
2770
2782
|
* - Opening hours and timezone data
|
|
2771
2783
|
* - Related POI relationships
|
|
2772
2784
|
*
|
|
@@ -2779,8 +2791,8 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
2779
2791
|
* Search query string.
|
|
2780
2792
|
*
|
|
2781
2793
|
* The text to search for — can be a place name, POI, address, or any free-form location query.
|
|
2782
|
-
* When omitted, results are driven entirely by
|
|
2783
|
-
*
|
|
2794
|
+
* When omitted, results are driven entirely by `filters` — a category, a brand, a fuel type —
|
|
2795
|
+
* or by `geometries` on geometry search.
|
|
2784
2796
|
*
|
|
2785
2797
|
* @remarks
|
|
2786
2798
|
* **Query Examples:**
|
|
@@ -2796,173 +2808,12 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
2796
2808
|
* query: 'coffee shop'
|
|
2797
2809
|
*
|
|
2798
2810
|
* // Omit query to search purely by category
|
|
2799
|
-
* poiCategories: ['CHARGING_LOCATION']
|
|
2811
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] }
|
|
2800
2812
|
* ```
|
|
2801
2813
|
*/
|
|
2802
2814
|
query?: string;
|
|
2803
|
-
/**
|
|
2804
|
-
|
|
2805
|
-
*
|
|
2806
|
-
* Fine-tunes search by selecting specific data categories to include.
|
|
2807
|
-
* By default, all indexes are searched.
|
|
2808
|
-
*
|
|
2809
|
-
* @remarks
|
|
2810
|
-
* **Available Indexes:**
|
|
2811
|
-
* - `Geo`: Geographic entities (countries, cities, etc.)
|
|
2812
|
-
* - `PAD`: Point addresses with building numbers
|
|
2813
|
-
* - `Addr`: Address ranges on streets
|
|
2814
|
-
* - `Str`: Street names
|
|
2815
|
-
* - `XStr`: Cross streets (intersections)
|
|
2816
|
-
* - `POI`: Points of interest
|
|
2817
|
-
*
|
|
2818
|
-
* **Use Cases:**
|
|
2819
|
-
* - POI-only search: `['POI']`
|
|
2820
|
-
* - Address-only search: `['PAD', 'Addr']`
|
|
2821
|
-
* - Exclude geographies: `['PAD', 'Addr', 'Str', 'POI']`
|
|
2822
|
-
*
|
|
2823
|
-
* @example
|
|
2824
|
-
* ```typescript
|
|
2825
|
-
* // Search only POIs
|
|
2826
|
-
* indexes: ['POI']
|
|
2827
|
-
*
|
|
2828
|
-
* // Search addresses and streets only
|
|
2829
|
-
* indexes: ['PAD', 'Addr', 'Str']
|
|
2830
|
-
* ```
|
|
2831
|
-
*/
|
|
2832
|
-
indexes?: SearchIndexType[];
|
|
2833
|
-
/**
|
|
2834
|
-
* Filter results to specific POI categories.
|
|
2835
|
-
*
|
|
2836
|
-
* Restricts results to Points of Interest belonging to the specified
|
|
2837
|
-
* categories. Use values from the {@link POICategory} type.
|
|
2838
|
-
*
|
|
2839
|
-
* @remarks
|
|
2840
|
-
* **Multiple Categories:**
|
|
2841
|
-
* Results include POIs matching ANY of the specified categories (OR logic).
|
|
2842
|
-
*
|
|
2843
|
-
* **Discovering Categories:**
|
|
2844
|
-
* Use the {@link getPOICategories} service to search and browse available
|
|
2845
|
-
* categories by name or synonym, then pass the resulting `code` values here.
|
|
2846
|
-
*
|
|
2847
|
-
* @example
|
|
2848
|
-
* ```typescript
|
|
2849
|
-
* // Filter to specific categories
|
|
2850
|
-
* poiCategories: ['RESTAURANT', 'CAFE']
|
|
2851
|
-
*
|
|
2852
|
-
* // Category-only search (no query)
|
|
2853
|
-
* poiCategories: ['CHARGING_LOCATION']
|
|
2854
|
-
*
|
|
2855
|
-
* // Discovered via getPOICategories() service
|
|
2856
|
-
* import { getPOICategoryCodes } from '@tomtom-org/maps-sdk/services';
|
|
2857
|
-
* const codes = await getPOICategoryCodes({ filters: ['italian'] });
|
|
2858
|
-
* const results = await discoverPlaces({ poiCategories: codes, position });
|
|
2859
|
-
* ```
|
|
2860
|
-
*/
|
|
2861
|
-
poiCategories?: POICategory[];
|
|
2862
|
-
/**
|
|
2863
|
-
* Filter results to specific POI brands.
|
|
2864
|
-
*
|
|
2865
|
-
* Restricts results to Points of Interest belonging to the specified
|
|
2866
|
-
* brand names. Useful for finding specific chain locations.
|
|
2867
|
-
*
|
|
2868
|
-
* @remarks
|
|
2869
|
-
* **Brand Names:**
|
|
2870
|
-
* - Case-sensitive
|
|
2871
|
-
* - Exact match required
|
|
2872
|
-
* - Brands with commas must be quoted: `"A,B,C"`
|
|
2873
|
-
*
|
|
2874
|
-
* **Multiple Brands:**
|
|
2875
|
-
* Results include POIs matching ANY of the specified brands (OR logic).
|
|
2876
|
-
*
|
|
2877
|
-
* **Use Cases:**
|
|
2878
|
-
* - Find specific chain stores: "Starbucks", "McDonald's"
|
|
2879
|
-
* - Compare competing brands
|
|
2880
|
-
* - Brand-specific navigation
|
|
2881
|
-
*
|
|
2882
|
-
* @example
|
|
2883
|
-
* ```typescript
|
|
2884
|
-
* // Single brand
|
|
2885
|
-
* poiBrands: ['Starbucks']
|
|
2886
|
-
*
|
|
2887
|
-
* // Multiple brands
|
|
2888
|
-
* poiBrands: ['Shell', 'BP', 'Chevron']
|
|
2889
|
-
*
|
|
2890
|
-
* // Brand with comma in name
|
|
2891
|
-
* poiBrands: ['"A,B,C"']
|
|
2892
|
-
* ```
|
|
2893
|
-
*/
|
|
2894
|
-
poiBrands?: string[];
|
|
2895
|
-
/**
|
|
2896
|
-
* Filter EV charging stations by connector types.
|
|
2897
|
-
*
|
|
2898
|
-
* Restricts results to EV charging stations that support at least one
|
|
2899
|
-
* of the specified connector types. Essential for EV drivers to find
|
|
2900
|
-
* compatible charging infrastructure.
|
|
2901
|
-
*
|
|
2902
|
-
* @remarks
|
|
2903
|
-
* **Common Connector Types:**
|
|
2904
|
-
* - `IEC62196Type2CableAttached`: Type 2 / Mennekes (Europe)
|
|
2905
|
-
* - `IEC62196Type2CCS`: CCS Combo 2 (Europe)
|
|
2906
|
-
* - `IEC62196Type1CCS`: CCS Combo 1 (North America)
|
|
2907
|
-
* - `Chademo`: CHAdeMO (Japan)
|
|
2908
|
-
* - `Tesla`: Tesla proprietary
|
|
2909
|
-
*
|
|
2910
|
-
* **Multiple Connectors:**
|
|
2911
|
-
* Results include stations with ANY of the specified connectors (OR logic).
|
|
2912
|
-
*
|
|
2913
|
-
* **Use Cases:**
|
|
2914
|
-
* - Find compatible chargers for specific EV model
|
|
2915
|
-
* - Route planning for long-distance EV travel
|
|
2916
|
-
* - Filter by fast charging capability
|
|
2917
|
-
*
|
|
2918
|
-
* @example
|
|
2919
|
-
* ```typescript
|
|
2920
|
-
* // CCS Combo 2 (common in Europe)
|
|
2921
|
-
* connectors: ['IEC62196Type2CCS']
|
|
2922
|
-
*
|
|
2923
|
-
* // Multiple connector types
|
|
2924
|
-
* connectors: ['IEC62196Type2CCS', 'Chademo']
|
|
2925
|
-
*
|
|
2926
|
-
* // Tesla or CCS
|
|
2927
|
-
* connectors: ['Tesla', 'IEC62196Type2CCS']
|
|
2928
|
-
* ```
|
|
2929
|
-
*/
|
|
2930
|
-
connectors?: ConnectorType[];
|
|
2931
|
-
/**
|
|
2932
|
-
* Filter fuel stations by available fuel types.
|
|
2933
|
-
*
|
|
2934
|
-
* Restricts results to fuel stations that offer the specified fuel types.
|
|
2935
|
-
* Can be used with empty query to find any station with specific fuel.
|
|
2936
|
-
*
|
|
2937
|
-
* @remarks
|
|
2938
|
-
* **Common Fuel Types:**
|
|
2939
|
-
* - Petrol/Gasoline
|
|
2940
|
-
* - Diesel
|
|
2941
|
-
* - LPG (Liquefied Petroleum Gas)
|
|
2942
|
-
* - CNG (Compressed Natural Gas)
|
|
2943
|
-
* - E85 (Ethanol blend)
|
|
2944
|
-
* - AdBlue (Diesel exhaust fluid)
|
|
2945
|
-
*
|
|
2946
|
-
* **Multiple Fuel Types:**
|
|
2947
|
-
* Results include stations offering ANY of the specified fuels (OR logic).
|
|
2948
|
-
*
|
|
2949
|
-
* **Empty Query:**
|
|
2950
|
-
* When `fuelTypes` is specified, the query parameter can be empty,
|
|
2951
|
-
* and all POIs with matching fuel types will be returned.
|
|
2952
|
-
*
|
|
2953
|
-
* @example
|
|
2954
|
-
* ```typescript
|
|
2955
|
-
* // Diesel stations only
|
|
2956
|
-
* fuelTypes: ['Diesel']
|
|
2957
|
-
*
|
|
2958
|
-
* // Alternative fuels
|
|
2959
|
-
* fuelTypes: ['CNG', 'LPG', 'E85']
|
|
2960
|
-
*
|
|
2961
|
-
* // Standard fuels
|
|
2962
|
-
* fuelTypes: ['Petrol', 'Diesel']
|
|
2963
|
-
* ```
|
|
2964
|
-
*/
|
|
2965
|
-
fuelTypes?: Fuel[];
|
|
2815
|
+
/** What kind of places may come back: see {@link PlaceFilters}. */
|
|
2816
|
+
filters?: PlaceFilters;
|
|
2966
2817
|
/**
|
|
2967
2818
|
* Request opening hours information for POIs.
|
|
2968
2819
|
*
|
|
@@ -3044,67 +2895,6 @@ export type CommonSearchParams<ApiRequest, ApiResponse> = CommonPlacesParams<Api
|
|
|
3044
2895
|
* ```
|
|
3045
2896
|
*/
|
|
3046
2897
|
relatedPois?: RelatedPoisRequest;
|
|
3047
|
-
/**
|
|
3048
|
-
* Minimum charging power for EV stations (in kilowatts).
|
|
3049
|
-
*
|
|
3050
|
-
* Filters EV charging stations to those supporting at least one
|
|
3051
|
-
* connector with the specified minimum power output. Useful for
|
|
3052
|
-
* finding fast charging capabilities.
|
|
3053
|
-
*
|
|
3054
|
-
* @remarks
|
|
3055
|
-
* **Power Levels:**
|
|
3056
|
-
* - 3-7 kW: Level 2 AC (slow charging)
|
|
3057
|
-
* - 7-22 kW: Level 2 AC (moderate charging)
|
|
3058
|
-
* - 50+ kW: DC fast charging
|
|
3059
|
-
* - 150+ kW: Ultra-fast charging
|
|
3060
|
-
* - 350 kW: Maximum current technology
|
|
3061
|
-
*
|
|
3062
|
-
* **Closed Interval:**
|
|
3063
|
-
* Includes stations with exactly this power value.
|
|
3064
|
-
*
|
|
3065
|
-
* @example
|
|
3066
|
-
* ```typescript
|
|
3067
|
-
* // Fast charging (50kW+)
|
|
3068
|
-
* minPowerKW: 50
|
|
3069
|
-
*
|
|
3070
|
-
* // Ultra-fast charging (150kW+)
|
|
3071
|
-
* minPowerKW: 150
|
|
3072
|
-
*
|
|
3073
|
-
* // Combined with max power
|
|
3074
|
-
* minPowerKW: 50,
|
|
3075
|
-
* maxPowerKW: 150 // 50-150 kW range
|
|
3076
|
-
* ```
|
|
3077
|
-
*/
|
|
3078
|
-
minPowerKW?: number;
|
|
3079
|
-
/**
|
|
3080
|
-
* Maximum charging power for EV stations (in kilowatts).
|
|
3081
|
-
*
|
|
3082
|
-
* Filters EV charging stations to those with at least one connector
|
|
3083
|
-
* not exceeding the specified maximum power output.
|
|
3084
|
-
*
|
|
3085
|
-
* @remarks
|
|
3086
|
-
* **Use Cases:**
|
|
3087
|
-
* - Find charging compatible with vehicle's maximum charge rate
|
|
3088
|
-
* - Exclude ultra-fast chargers when not needed
|
|
3089
|
-
* - Filter by infrastructure capability
|
|
3090
|
-
*
|
|
3091
|
-
* **Closed Interval:**
|
|
3092
|
-
* Includes stations with exactly this power value.
|
|
3093
|
-
*
|
|
3094
|
-
* @example
|
|
3095
|
-
* ```typescript
|
|
3096
|
-
* // Level 2 charging only (up to 22kW)
|
|
3097
|
-
* maxPowerKW: 22
|
|
3098
|
-
*
|
|
3099
|
-
* // Moderate fast charging (up to 50kW)
|
|
3100
|
-
* maxPowerKW: 50
|
|
3101
|
-
*
|
|
3102
|
-
* // Power range 50-150 kW
|
|
3103
|
-
* minPowerKW: 50,
|
|
3104
|
-
* maxPowerKW: 150
|
|
3105
|
-
* ```
|
|
3106
|
-
*/
|
|
3107
|
-
maxPowerKW?: number;
|
|
3108
2898
|
};
|
|
3109
2899
|
//#endregion
|
|
3110
2900
|
//#region src/shared/types/searchSummary.d.ts
|
|
@@ -3123,29 +2913,29 @@ type SummaryQueryType = 'NEARBY' | 'NON_NEAR';
|
|
|
3123
2913
|
/**
|
|
3124
2914
|
* Metadata summary for search API responses.
|
|
3125
2915
|
*
|
|
3126
|
-
* Provides information about the search query execution, result counts,
|
|
3127
|
-
*
|
|
3128
|
-
*
|
|
2916
|
+
* Provides information about the search query execution, result counts, and the cursor that
|
|
2917
|
+
* continues the search. This metadata helps understand how the search was processed and page
|
|
2918
|
+
* through results.
|
|
3129
2919
|
*
|
|
3130
2920
|
* @remarks
|
|
3131
2921
|
* This summary is included in responses from:
|
|
3132
2922
|
* - {@link discoverPlaces}
|
|
3133
2923
|
* - {@link fuzzySearch}
|
|
3134
2924
|
* - {@link geometrySearch}
|
|
2925
|
+
* - {@link geocode}
|
|
3135
2926
|
*
|
|
3136
2927
|
* @example
|
|
3137
2928
|
* ```typescript
|
|
3138
2929
|
* const results = await discoverPlaces({
|
|
3139
|
-
* key: 'your-api-key',
|
|
3140
2930
|
* query: 'pizza',
|
|
3141
|
-
*
|
|
2931
|
+
* geoBias: { position: [4.9, 52.3] }
|
|
3142
2932
|
* });
|
|
3143
2933
|
*
|
|
3144
|
-
* const summary = results.
|
|
3145
|
-
* console.log(`Found ${summary
|
|
3146
|
-
* console.log(`Showing ${summary
|
|
3147
|
-
* console.log(`Query type: ${summary
|
|
3148
|
-
* console.log(`Search took ${summary
|
|
2934
|
+
* const summary = results.properties;
|
|
2935
|
+
* console.log(`Found ${summary?.totalResults ?? 'an unknown number of'} total results`);
|
|
2936
|
+
* console.log(`Showing ${summary?.numResults} results`);
|
|
2937
|
+
* console.log(`Query type: ${summary?.queryType}`); // 'NEARBY'
|
|
2938
|
+
* console.log(`Search took ${summary?.queryTime}ms`);
|
|
3149
2939
|
* ```
|
|
3150
2940
|
*
|
|
3151
2941
|
* @group Places Search
|
|
@@ -3204,27 +2994,14 @@ export type SearchSummary = {
|
|
|
3204
2994
|
*/
|
|
3205
2995
|
numResults: number;
|
|
3206
2996
|
/**
|
|
3207
|
-
*
|
|
3208
|
-
*
|
|
3209
|
-
* Zero-based index indicating where this page of results begins.
|
|
3210
|
-
* Used for pagination to retrieve subsequent pages.
|
|
2997
|
+
* The opaque cursor that continues this search: pass it back as the request's `cursor`, see
|
|
2998
|
+
* {@link CommonGeocodeAndFuzzySearchParams.cursor}. Only fuzzy search and geocoding page this way.
|
|
3211
2999
|
*
|
|
3212
3000
|
* @remarks
|
|
3213
|
-
*
|
|
3214
|
-
*
|
|
3215
|
-
* @example
|
|
3216
|
-
* ```typescript
|
|
3217
|
-
* // First page (results 0-9)
|
|
3218
|
-
* offset: 0, numResults: 10
|
|
3219
|
-
*
|
|
3220
|
-
* // Second page (results 10-19)
|
|
3221
|
-
* offset: 10, numResults: 10
|
|
3222
|
-
*
|
|
3223
|
-
* // Third page (results 20-29)
|
|
3224
|
-
* offset: 20, numResults: 10
|
|
3225
|
-
* ```
|
|
3001
|
+
* Absent means pagination has ended: the result set is exhausted, this page came back empty, or
|
|
3002
|
+
* the next page would start past result 1900, the furthest the backend serves.
|
|
3226
3003
|
*/
|
|
3227
|
-
|
|
3004
|
+
nextCursor?: string;
|
|
3228
3005
|
/**
|
|
3229
3006
|
* Total number of matching results found by the search.
|
|
3230
3007
|
*
|
|
@@ -3232,19 +3009,16 @@ export type SearchSummary = {
|
|
|
3232
3009
|
* regardless of pagination limits.
|
|
3233
3010
|
*
|
|
3234
3011
|
* @remarks
|
|
3235
|
-
* Optional — a total is not guaranteed, so guard it rather than assuming a number.
|
|
3236
|
-
*
|
|
3237
|
-
*
|
|
3238
|
-
* - Total pages: `totalResults === undefined ? undefined : Math.ceil(totalResults / limit)`
|
|
3239
|
-
* - Has more results: `totalResults !== undefined && offset + numResults < totalResults`
|
|
3012
|
+
* Optional — a total is not guaranteed, so guard it rather than assuming a number. Use it to
|
|
3013
|
+
* size a progress indicator, such as a page count of `Math.ceil(totalResults / limit)`, not to
|
|
3014
|
+
* drive pagination: `nextCursor` decides whether a further page exists.
|
|
3240
3015
|
*
|
|
3241
3016
|
* @example
|
|
3242
3017
|
* ```typescript
|
|
3243
3018
|
* totalResults: 50 // 50 total matches found
|
|
3244
3019
|
* numResults: 10 // Showing first 10
|
|
3245
|
-
* offset: 0 // Starting from beginning
|
|
3246
3020
|
*
|
|
3247
|
-
* //
|
|
3021
|
+
* // Fetch the rest by passing `nextCursor` back as `cursor`
|
|
3248
3022
|
* ```
|
|
3249
3023
|
*/
|
|
3250
3024
|
totalResults?: number;
|
|
@@ -3405,10 +3179,14 @@ type AddressRangesAPI = {
|
|
|
3405
3179
|
* we call always send them, and this type is what asserts that. Relaxing it would let a parser
|
|
3406
3180
|
* silently stop populating them.
|
|
3407
3181
|
*
|
|
3182
|
+
* The wire pages by `offset`; `nextCursor` is the SDK's own, minted from it by the parser.
|
|
3183
|
+
*
|
|
3408
3184
|
* @ignore
|
|
3409
3185
|
*/
|
|
3410
|
-
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias'> & Required<Pick<SearchSummary, 'totalResults' | 'fuzzyLevel'>> & {
|
|
3186
|
+
type SummaryAPI$1 = Omit<SearchSummary, 'geoBias' | 'nextCursor'> & Required<Pick<SearchSummary, 'totalResults' | 'fuzzyLevel'>> & {
|
|
3411
3187
|
geoBias?: LatLonAPI;
|
|
3188
|
+
/** Where this page starts in the full result set, zero-based. */
|
|
3189
|
+
offset: number;
|
|
3412
3190
|
};
|
|
3413
3191
|
/**
|
|
3414
3192
|
* @ignore
|
|
@@ -3463,17 +3241,22 @@ type POIAPI = {
|
|
|
3463
3241
|
timeZone?: TimeZone;
|
|
3464
3242
|
};
|
|
3465
3243
|
/**
|
|
3244
|
+
* A connector as the places APIs return it: `chargingSpeed` is derived by the SDK.
|
|
3466
3245
|
* @ignore
|
|
3467
3246
|
*/
|
|
3468
|
-
type ConnectorAPI = Omit<Connector, '
|
|
3469
|
-
connectorType: ConnectorType;
|
|
3470
|
-
};
|
|
3247
|
+
type ConnectorAPI = Omit<Connector, 'chargingSpeed'>;
|
|
3471
3248
|
/**
|
|
3249
|
+
* A charging point as the places APIs return it: `ev/id` omits empty `capabilities` and `restrictions`.
|
|
3472
3250
|
* @ignore
|
|
3473
3251
|
*/
|
|
3474
|
-
type
|
|
3475
|
-
connectors
|
|
3252
|
+
type ChargingPointAPI = Omit<StaticChargingPoint, 'capabilities' | 'restrictions' | 'connectors'> & Partial<Pick<StaticChargingPoint, 'capabilities' | 'restrictions'>> & {
|
|
3253
|
+
connectors?: ConnectorAPI[];
|
|
3476
3254
|
};
|
|
3255
|
+
/**
|
|
3256
|
+
* @typeParam Status - `Pick<ChargingPoint, 'status'>` from `ev/id`; nothing from the search services.
|
|
3257
|
+
* @ignore
|
|
3258
|
+
*/
|
|
3259
|
+
type ChargingStationAPI<Status extends object = object> = ChargingStation<ChargingPointAPI & Status>;
|
|
3477
3260
|
/**
|
|
3478
3261
|
* @ignore
|
|
3479
3262
|
*/
|
|
@@ -3486,7 +3269,7 @@ type CommonSearchPlaceResultAPI = Omit<SearchPlaceProps, 'distance' | 'position'
|
|
|
3486
3269
|
entryPoints?: EntryPointAPI[];
|
|
3487
3270
|
address?: AddressProperties;
|
|
3488
3271
|
poi?: POIAPI;
|
|
3489
|
-
|
|
3272
|
+
chargingStations?: ChargingStationAPI[];
|
|
3490
3273
|
};
|
|
3491
3274
|
//#endregion
|
|
3492
3275
|
//#region src/along-route-search/types/alongRouteSearchResponseAPI.d.ts
|
|
@@ -3556,7 +3339,7 @@ type AlongRouteSortBy = 'detourTime' | 'detourOffset';
|
|
|
3556
3339
|
* const chargers = await discoverPlaces({
|
|
3557
3340
|
* route: [[4.9, 52.37], [4.95, 52.28], [5.1, 52.09]],
|
|
3558
3341
|
* maxDetourTimeSeconds: 600,
|
|
3559
|
-
* poiCategories: ['CHARGING_LOCATION'],
|
|
3342
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] },
|
|
3560
3343
|
* sortBy: 'detourOffset',
|
|
3561
3344
|
* });
|
|
3562
3345
|
* ```
|
|
@@ -3656,7 +3439,7 @@ type AlongRouteSearchResponse = Places<SearchPlaceProps, SearchSummary>;
|
|
|
3656
3439
|
* const chargers = await alongRouteSearch({
|
|
3657
3440
|
* route: routeResult.features[0].geometry,
|
|
3658
3441
|
* maxDetourTimeSeconds: 600,
|
|
3659
|
-
* poiCategories: ['CHARGING_LOCATION'],
|
|
3442
|
+
* filters: { poiCategories: ['CHARGING_LOCATION'] },
|
|
3660
3443
|
* sortBy: 'detourOffset',
|
|
3661
3444
|
* });
|
|
3662
3445
|
* ```
|
|
@@ -3678,7 +3461,7 @@ type EVChargingStationResultAPI = {
|
|
|
3678
3461
|
openingHours: OpeningHoursAPI;
|
|
3679
3462
|
timeZone: TimeZone;
|
|
3680
3463
|
accessType: ChargingStationsAccessType;
|
|
3681
|
-
chargingStations:
|
|
3464
|
+
chargingStations: ChargingStationAPI<Pick<ChargingPoint, 'status'>>[];
|
|
3682
3465
|
};
|
|
3683
3466
|
/**
|
|
3684
3467
|
* @ignore
|
|
@@ -3770,6 +3553,9 @@ type ChargingStationsAvailabilityParams = CommonServiceParams<URL, ChargingStati
|
|
|
3770
3553
|
* - **Access information**: Public, private, or restricted access
|
|
3771
3554
|
* - **Opening hours**: When the charging facility is accessible
|
|
3772
3555
|
*
|
|
3556
|
+
* Returns availability records, not places. To show stations with their availability, pass the
|
|
3557
|
+
* places to {@link getPlacesWithEVAvailability} instead, and its result to `PlacesModule.show()`.
|
|
3558
|
+
*
|
|
3773
3559
|
* @param params - Charging availability parameters with station ID
|
|
3774
3560
|
*
|
|
3775
3561
|
* @returns Promise resolving to charging station availability information
|
|
@@ -3778,17 +3564,17 @@ type ChargingStationsAvailabilityParams = CommonServiceParams<URL, ChargingStati
|
|
|
3778
3564
|
* ```typescript
|
|
3779
3565
|
* // Get availability for a specific charging park
|
|
3780
3566
|
* const availability = await evChargingStationsAvailability({
|
|
3781
|
-
*
|
|
3567
|
+
* apiKey: 'YOUR_API_KEY',
|
|
3782
3568
|
* id: 'charging-park-id-123'
|
|
3783
3569
|
* });
|
|
3784
3570
|
*
|
|
3785
3571
|
* // Check how many chargers are available
|
|
3786
|
-
* const availableCount = availability
|
|
3572
|
+
* const availableCount = availability?.chargingPointAvailability.statusCounts.Available ?? 0;
|
|
3787
3573
|
* console.log(`${availableCount} chargers available`);
|
|
3788
3574
|
*
|
|
3789
|
-
* //
|
|
3790
|
-
* const ccsConnectors = availability
|
|
3791
|
-
*
|
|
3575
|
+
* // CCS connectors, one entry per power level
|
|
3576
|
+
* const ccsConnectors = availability?.connectorAvailabilities.filter(
|
|
3577
|
+
* ({ connector }) => connector.type === 'IEC62196Type2CCS'
|
|
3792
3578
|
* );
|
|
3793
3579
|
* ```
|
|
3794
3580
|
*
|
|
@@ -3807,13 +3593,15 @@ export declare const evChargingStationsAvailability: (params: ChargingStationsAv
|
|
|
3807
3593
|
*
|
|
3808
3594
|
* @remarks
|
|
3809
3595
|
* Needs the same API key access as {@link evChargingStationsAvailability}. A failed request,
|
|
3810
|
-
* including one from a key without that access, is logged and resolves to `undefined`.
|
|
3596
|
+
* including one from a key without that access, is logged and resolves to `undefined`. A
|
|
3597
|
+
* cancellation is the caller's own decision rather than a data gap, so it rejects the call instead.
|
|
3811
3598
|
*
|
|
3812
3599
|
* @param place - The place to enhance with availability data
|
|
3813
|
-
* @param commonParams - Common service parameters (e.g. `
|
|
3600
|
+
* @param commonParams - Common service parameters (e.g. `apiKey`, `onAPIRequest`, `signal`) forwarded to the availability request
|
|
3814
3601
|
*
|
|
3815
3602
|
* @returns Promise resolving to the place with merged availability information
|
|
3816
3603
|
* @returns undefined if no availability data is present for the `place` input parameter.
|
|
3604
|
+
* @throws {@link SDKAbortError} when `commonParams.signal` is aborted
|
|
3817
3605
|
*
|
|
3818
3606
|
* @example
|
|
3819
3607
|
* ```typescript
|
|
@@ -3822,10 +3610,9 @@ export declare const evChargingStationsAvailability: (params: ChargingStationsAv
|
|
|
3822
3610
|
* const place = searchResult.features[0];
|
|
3823
3611
|
*
|
|
3824
3612
|
* const enhancedPlace = await getPlaceWithEVAvailability(place);
|
|
3825
|
-
*
|
|
3826
|
-
*
|
|
3827
|
-
*
|
|
3828
|
-
* console.log('Available chargers:', availability.chargingPointAvailability.count);
|
|
3613
|
+
* if (enhancedPlace) {
|
|
3614
|
+
* const { count, statusCounts } = enhancedPlace.properties.chargingPark.availability.chargingPointAvailability;
|
|
3615
|
+
* console.log(`${statusCounts.Available ?? 0} of ${count} chargers available`);
|
|
3829
3616
|
* }
|
|
3830
3617
|
* ```
|
|
3831
3618
|
*
|
|
@@ -3841,13 +3628,14 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3841
3628
|
* @remarks
|
|
3842
3629
|
* **Important**: Availability requests are made sequentially to avoid exceeding
|
|
3843
3630
|
* API rate limits (QPS - Queries Per Second). For large result sets, this may
|
|
3844
|
-
* take some time.
|
|
3631
|
+
* take some time. Pass a `signal` to stop early: aborting it cancels the in-flight
|
|
3632
|
+
* request, skips the remaining ones and rejects with {@link SDKAbortError}.
|
|
3845
3633
|
*
|
|
3846
3634
|
* Needs the same API key access as {@link evChargingStationsAvailability}. A place whose request
|
|
3847
3635
|
* fails, including for a key without that access, counts as having unknown availability.
|
|
3848
3636
|
*
|
|
3849
3637
|
* @param places - Collection of places to enhance
|
|
3850
|
-
* @param options - Configuration options, including common service parameters (e.g. `
|
|
3638
|
+
* @param options - Configuration options, including common service parameters (e.g. `apiKey`, `onAPIRequest`, `signal`) forwarded to each availability request
|
|
3851
3639
|
*
|
|
3852
3640
|
* @returns Promise resolving to places collection with merged availability
|
|
3853
3641
|
*
|
|
@@ -3856,8 +3644,7 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3856
3644
|
* // Search for charging stations and add availability
|
|
3857
3645
|
* const results = await discoverPlaces({
|
|
3858
3646
|
* query: 'EV charging',
|
|
3859
|
-
*
|
|
3860
|
-
* radius: 5000
|
|
3647
|
+
* geoBias: { position: [4.9, 52.3], radiusMeters: 5000 }
|
|
3861
3648
|
* });
|
|
3862
3649
|
*
|
|
3863
3650
|
* const withAvailability = await getPlacesWithEVAvailability(results, {
|
|
@@ -3866,8 +3653,8 @@ export declare const getPlaceWithEVAvailability: <P extends CommonPlaceProps = C
|
|
|
3866
3653
|
*
|
|
3867
3654
|
* // Display only stations with known availability
|
|
3868
3655
|
* withAvailability.features.forEach(place => {
|
|
3869
|
-
* const
|
|
3870
|
-
* console.log(`${place.properties.poi?.name}: ${
|
|
3656
|
+
* const { count, statusCounts } = place.properties.chargingPark.availability.chargingPointAvailability;
|
|
3657
|
+
* console.log(`${place.properties.poi?.name}: ${statusCounts.Available ?? 0} of ${count} chargers available`);
|
|
3871
3658
|
* });
|
|
3872
3659
|
* ```
|
|
3873
3660
|
*
|
|
@@ -3933,11 +3720,11 @@ type GeocodingProps = Omit<SearchPlaceProps, 'info'> & {
|
|
|
3933
3720
|
* Response from the geocoding service.
|
|
3934
3721
|
*
|
|
3935
3722
|
* Collection of places matching the geocoding query, each with address information
|
|
3936
|
-
* and match confidence scoring.
|
|
3723
|
+
* and match confidence scoring. Its {@link SearchSummary} carries the `nextCursor` for the next page.
|
|
3937
3724
|
*
|
|
3938
3725
|
* @group Geocoding
|
|
3939
3726
|
*/
|
|
3940
|
-
type GeocodingResponse = Places<GeocodingProps>;
|
|
3727
|
+
type GeocodingResponse = Places<GeocodingProps, SearchSummary>;
|
|
3941
3728
|
//#endregion
|
|
3942
3729
|
//#region src/geocode/types/apiTypes.d.ts
|
|
3943
3730
|
/**
|
|
@@ -4006,6 +3793,19 @@ type GeocodingIndexTypesAbbreviation = Exclude<SearchIndexType, 'POI'>;
|
|
|
4006
3793
|
* @group Geocoding
|
|
4007
3794
|
*/
|
|
4008
3795
|
type GeocodingParams = Omit<CommonPlacesParams<GetObject, GeocodingResponseAPI> & CommonGeocodeAndFuzzySearchParams, 'extendedPostalCodesFor'> & {
|
|
3796
|
+
/**
|
|
3797
|
+
* Where results may come from. Everything here **excludes** results.
|
|
3798
|
+
*
|
|
3799
|
+
* @remarks
|
|
3800
|
+
* {@link GeographicFilters} plus `geographyTypes`, which restricts the kinds of geography that
|
|
3801
|
+
* come back. Geocoding has no POI notion, so the rest of {@link PlaceFilters} does not apply.
|
|
3802
|
+
*
|
|
3803
|
+
* @example
|
|
3804
|
+
* ```typescript
|
|
3805
|
+
* filters: { countries: ['NL'], geographyTypes: ['Municipality'] }
|
|
3806
|
+
* ```
|
|
3807
|
+
*/
|
|
3808
|
+
filters?: GeographicFilters & Pick<PlaceFilters, 'geographyTypes'>;
|
|
4009
3809
|
/**
|
|
4010
3810
|
* Address or location query to geocode.
|
|
4011
3811
|
*
|
|
@@ -4019,7 +3819,7 @@ type GeocodingParams = Omit<CommonPlacesParams<GetObject, GeocodingResponseAPI>
|
|
|
4019
3819
|
* - City name: "Amsterdam"
|
|
4020
3820
|
* - Intersection: "Broadway & 42nd St, New York"
|
|
4021
3821
|
* - Landmark: "Eiffel Tower, Paris"
|
|
4022
|
-
* - Partial address: "Dam Square" (city context resolved via `
|
|
3822
|
+
* - Partial address: "Dam Square" (city context resolved via `geoBias` or `filters.countries`)
|
|
4023
3823
|
*
|
|
4024
3824
|
* @example
|
|
4025
3825
|
* ```typescript
|
|
@@ -4355,6 +4155,9 @@ type GeometryParams = GeometryDataParams | GeometryPlaceParams;
|
|
|
4355
4155
|
* - Visualize administrative divisions
|
|
4356
4156
|
* - Calculate areas and spatial relationships
|
|
4357
4157
|
*
|
|
4158
|
+
* Returns polygons, not places. Pass the result to `GeometriesModule.show()`,
|
|
4159
|
+
* not `PlacesModule.show()`. The `geometryId` comes from a prior search result.
|
|
4160
|
+
*
|
|
4358
4161
|
* @param params - Geometry parameters with IDs or places to fetch boundaries for
|
|
4359
4162
|
*
|
|
4360
4163
|
* @returns Promise resolving to polygon features representing area boundaries
|
|
@@ -5013,7 +4816,7 @@ type POICategoryResult = {
|
|
|
5013
4816
|
/**
|
|
5014
4817
|
* The standardized enum value identifying this category.
|
|
5015
4818
|
*
|
|
5016
|
-
* Use this value in search `poiCategories`
|
|
4819
|
+
* Use this value in a search's `filters.poiCategories` to filter results by category,
|
|
5017
4820
|
* or to cross-reference with `Place.properties.poi.categories` on search results.
|
|
5018
4821
|
*/
|
|
5019
4822
|
code: POICategory;
|
|
@@ -5024,7 +4827,7 @@ type POICategoryResult = {
|
|
|
5024
4827
|
* possible sub-categories — so you can understand the category hierarchy without
|
|
5025
4828
|
* additional lookups.
|
|
5026
4829
|
*
|
|
5027
|
-
* Use these values directly in search `poiCategories
|
|
4830
|
+
* Use these values directly in a search's `filters.poiCategories`.
|
|
5028
4831
|
*/
|
|
5029
4832
|
childCategoryCodes: POICategory[];
|
|
5030
4833
|
/**
|
|
@@ -5050,7 +4853,7 @@ type POICategoriesResponse = {
|
|
|
5050
4853
|
* Retrieve the list of POI category types supported by the TomTom Search API.
|
|
5051
4854
|
*
|
|
5052
4855
|
* The returned `code` values (`POICategory`) serve two purposes:
|
|
5053
|
-
* - Pass to `discoverPlaces({ poiCategories })` to filter search results by category.
|
|
4856
|
+
* - Pass to `discoverPlaces({ filters: { poiCategories } })` to filter search results by category.
|
|
5054
4857
|
* - Pass to `POIsModule.filterCategories()` to filter the map's built-in POI icons.
|
|
5055
4858
|
* Generic parent codes (e.g. `'RESTAURANT'`) are supported there; overly specific child
|
|
5056
4859
|
* codes (e.g. `'ITALIAN_RESTAURANT'`) are not — use a parent or a `POICategoryGroup` instead.
|
|
@@ -5077,7 +4880,7 @@ export declare const getPOICategories: (params?: POICategoriesParams) => Promise
|
|
|
5077
4880
|
* Convenience wrapper around {@link getPOICategories} that returns a flat array of `POICategory` codes.
|
|
5078
4881
|
*
|
|
5079
4882
|
* The returned codes serve two purposes:
|
|
5080
|
-
* - Pass to `discoverPlaces({ poiCategories })` to filter search results by category.
|
|
4883
|
+
* - Pass to `discoverPlaces({ filters: { poiCategories } })` to filter search results by category.
|
|
5081
4884
|
* - Pass to `POIsModule.filterCategories()` to filter the map's built-in POI icons.
|
|
5082
4885
|
* Generic parent codes (e.g. `'RESTAURANT'`) are supported there; overly specific child
|
|
5083
4886
|
* codes (e.g. `'ITALIAN_RESTAURANT'`) are not — use a parent or a `POICategoryGroup` instead.
|
|
@@ -7108,7 +6911,7 @@ type NearbyIntentDetailsAPI = Omit<NearbyIntentDetails, 'position'> & {
|
|
|
7108
6911
|
* const params: FuzzySearchParams = {
|
|
7109
6912
|
* key: 'your-api-key',
|
|
7110
6913
|
* query: 'pizz', // Will find "pizza" restaurants
|
|
7111
|
-
* position: [4.9041, 52.3676]
|
|
6914
|
+
* geoBias: { position: [4.9041, 52.3676] }
|
|
7112
6915
|
* };
|
|
7113
6916
|
*
|
|
7114
6917
|
* // Fuzzy search with custom fuzziness
|
|
@@ -7124,6 +6927,8 @@ type NearbyIntentDetailsAPI = Omit<NearbyIntentDetails, 'position'> & {
|
|
|
7124
6927
|
* @group Places Search
|
|
7125
6928
|
*/
|
|
7126
6929
|
type FuzzySearchParams = CommonSearchParams<GetObject, FuzzySearchResponseAPI> & CommonGeocodeAndFuzzySearchParams & {
|
|
6930
|
+
/** What may come back: the country and the POI-attribute restrictions together. */
|
|
6931
|
+
filters?: SearchFilters;
|
|
7127
6932
|
/**
|
|
7128
6933
|
* Minimum fuzziness level to be used.
|
|
7129
6934
|
*
|
|
@@ -7180,6 +6985,24 @@ type FuzzySearchParams = CommonSearchParams<GetObject, FuzzySearchResponseAPI> &
|
|
|
7180
6985
|
type SearchFeatureCollectionProps = SearchSummary & {
|
|
7181
6986
|
queryIntent?: QueryIntent[];
|
|
7182
6987
|
};
|
|
6988
|
+
/** The keys of `Params` that `Base` lacks, each forbidden. */
|
|
6989
|
+
type Without<Params, Base> = { [Key in Exclude<keyof Params, keyof Base>]?: never; };
|
|
6990
|
+
/**
|
|
6991
|
+
* What {@link discoverPlaces} takes: one search variant's params, with the other variants' own
|
|
6992
|
+
* options forbidden. So `{ geometries, cursor }` is a compile error rather than a cursor silently
|
|
6993
|
+
* dropped, as it would be with a plain union.
|
|
6994
|
+
*
|
|
6995
|
+
* @group Places Search
|
|
6996
|
+
*/
|
|
6997
|
+
export type DiscoverPlacesParams = (FuzzySearchParams & Without<GeometrySearchParams, FuzzySearchParams> & Without<AlongRouteSearchParams, FuzzySearchParams>) | (GeometrySearchParams & Without<FuzzySearchParams, GeometrySearchParams> & Without<AlongRouteSearchParams, GeometrySearchParams> & {
|
|
6998
|
+
filters?: {
|
|
6999
|
+
countries?: never;
|
|
7000
|
+
};
|
|
7001
|
+
}) | (AlongRouteSearchParams & Without<FuzzySearchParams, AlongRouteSearchParams> & Without<GeometrySearchParams, AlongRouteSearchParams> & {
|
|
7002
|
+
filters?: {
|
|
7003
|
+
countries?: never;
|
|
7004
|
+
};
|
|
7005
|
+
});
|
|
7183
7006
|
/**
|
|
7184
7007
|
* Search service response containing places that match the query.
|
|
7185
7008
|
*
|
|
@@ -7205,7 +7028,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7205
7028
|
*
|
|
7206
7029
|
* Results are ranked by relevance with scores and optional distances.
|
|
7207
7030
|
*
|
|
7208
|
-
* @param params - Search parameters
|
|
7031
|
+
* @param params - Search parameters: {@link FuzzySearchParams}, {@link GeometrySearchParams} or {@link AlongRouteSearchParams}
|
|
7209
7032
|
*
|
|
7210
7033
|
* @returns Promise resolving to a collection of matching places
|
|
7211
7034
|
*
|
|
@@ -7227,7 +7050,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7227
7050
|
*
|
|
7228
7051
|
* // Category search
|
|
7229
7052
|
* const restaurants = await discoverPlaces({
|
|
7230
|
-
* poiCategories: ['ITALIAN_RESTAURANT'],
|
|
7053
|
+
* filters: { poiCategories: ['ITALIAN_RESTAURANT'] },
|
|
7231
7054
|
* geoBias: { position: [4.9041, 52.3676], radiusMeters: 5000 } // Within 5km
|
|
7232
7055
|
* });
|
|
7233
7056
|
* ```
|
|
@@ -7238,7 +7061,7 @@ export type DiscoverPlacesResponse = Places<SearchPlaceProps, SearchFeatureColle
|
|
|
7238
7061
|
*
|
|
7239
7062
|
* @group Places Search
|
|
7240
7063
|
*/
|
|
7241
|
-
export declare const discoverPlaces: (params:
|
|
7064
|
+
export declare const discoverPlaces: (params: DiscoverPlacesParams) => Promise<DiscoverPlacesResponse>;
|
|
7242
7065
|
/**
|
|
7243
7066
|
* Search for a single place by text query.
|
|
7244
7067
|
*
|
|
@@ -7369,11 +7192,9 @@ type SearchSuggestion = PlaceSuggestion | RefinementSuggestion;
|
|
|
7369
7192
|
* Shaped after Places Search v3's `suggest` body: `filters` for what narrows the result set, and
|
|
7370
7193
|
* `origin` for the point to search around.
|
|
7371
7194
|
*
|
|
7372
|
-
* No `customServiceBaseURL`: the call spans two endpoints, and one URL cannot stand for both.
|
|
7373
|
-
*
|
|
7374
7195
|
* @group Places Search
|
|
7375
7196
|
*/
|
|
7376
|
-
type SearchSuggestionsParams =
|
|
7197
|
+
type SearchSuggestionsParams = CommonServiceParams & {
|
|
7377
7198
|
/** What the user typed. A partial query is fine; so is a complete one. */
|
|
7378
7199
|
query: string;
|
|
7379
7200
|
/**
|