33 AvailableLanguagesClient ,
44 ConvertTo3waClient ,
55 ConvertToCoordinatesClient ,
6+ FeatureCollectionResponse ,
67 GridSectionClient ,
78} from './client' ;
89import type {
@@ -21,29 +22,43 @@ import type {
2122import { ApiClientConfiguration } from './lib' ;
2223import type { Transport } from './lib' ;
2324
24- export type What3wordsService = {
25+ export interface What3wordsService {
2526 clients : {
2627 autosuggest : AutosuggestClient ;
2728 availableLanguages : AvailableLanguagesClient ;
2829 convertTo3wa : ConvertTo3waClient ;
2930 convertToCoordinates : ConvertToCoordinatesClient ;
3031 gridSection : GridSectionClient ;
3132 } ;
32- setApiKey : ( key : string ) => void ;
33- setConfig : ( config : ApiClientConfiguration ) => void ;
34- autosuggest : ( options : AutosuggestOptions ) => Promise < AutosuggestResponse > ;
35- autosuggestSelection : ( options : AutosuggestSuggestion ) => Promise < void > ;
36- availableLanguages : ( ) => Promise < AvailableLanguagesResponse > ;
37- convertTo3wa : (
38- options : ConvertTo3waOptions
39- ) => Promise < LocationGeoJsonResponse | LocationJsonResponse > ;
40- convertToCoordinates : (
33+ setApiKey ( key : string ) : void ;
34+ setConfig ( config : ApiClientConfiguration ) : void ;
35+ autosuggest ( options : AutosuggestOptions ) : Promise < AutosuggestResponse > ;
36+ autosuggestSelection ( options : AutosuggestSuggestion ) : Promise < void > ;
37+ availableLanguages ( ) : Promise < AvailableLanguagesResponse > ;
38+ convertTo3wa ( options : ConvertTo3waOptions ) : Promise < LocationJsonResponse > ;
39+ convertTo3wa (
40+ options : ConvertTo3waOptions & { format ?: 'json' }
41+ ) : Promise < LocationJsonResponse > ;
42+ convertTo3wa (
43+ options : ConvertTo3waOptions & { format : 'geojson' }
44+ ) : Promise < FeatureCollectionResponse < LocationGeoJsonResponse > > ;
45+ convertToCoordinates (
4146 options : ConvertToCoordinatesOptions
42- ) => Promise < LocationJsonResponse | LocationGeoJsonResponse > ;
43- gridSection : (
44- options : GridSectionOptions
45- ) => Promise < GridSectionJsonResponse | GridSectionGeoJsonResponse > ;
46- } ;
47+ ) : Promise < LocationJsonResponse > ;
48+ convertToCoordinates (
49+ options : ConvertToCoordinatesOptions & { format ?: 'json' }
50+ ) : Promise < LocationJsonResponse > ;
51+ convertToCoordinates (
52+ options : ConvertToCoordinatesOptions & { format : 'geojson' }
53+ ) : Promise < FeatureCollectionResponse < LocationGeoJsonResponse > > ;
54+ gridSection ( options : GridSectionOptions ) : Promise < GridSectionJsonResponse > ;
55+ gridSection (
56+ options : GridSectionOptions & { format ?: 'json' }
57+ ) : Promise < GridSectionJsonResponse > ;
58+ gridSection (
59+ options : GridSectionOptions & { format : 'geojson' }
60+ ) : Promise < FeatureCollectionResponse < GridSectionGeoJsonResponse > > ;
61+ }
4762
4863export function what3words (
4964 apiKey ?: string ,
0 commit comments