-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
238 lines (207 loc) · 7.21 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
declare module 'react-native-algolia-places' {
import * as React from 'react';
type PlacesProperties = {
appId: string,
appKey: string
} & Partial<DefaultProperties>
type DefaultProperties = {
itemList: (item: Hit, i: number, text: string) => React.ReactNode
options: Partial<PlacesOptions>,
onSearchError: (err: any) => void;
}
type SearchType = "city" | "country" | "address" | "busStop" | "trainStation" | "townhall" | "airport";
interface HighlightResult {
administrative: Array<Highlight>;
country: Array<Highlight> | HighlightTraduction;
county: Array<Highlight> | HighlightTraduction;
locale_names: Array<Highlight> | HighlightTraduction;
postcode: Array<Highlight> | HighlightTraduction;
}
interface Highlight {
fullyHighlighted: boolean;
matchedWords: Array<string>;
matchLevel: string;
value: string;
}
interface GeoLoc {
lat: number;
lng: number;
}
interface HighlightTraduction extends Traduction<Array<Highlight>> {}
interface LocalNamesTraduction extends Traduction<Array<string>> {}
interface CountryTraduction extends Traduction<string>{}
interface Traduction<T> {
ar: T;
de: T;
default: T;
en: T;
es: T;
fr: T;
hu: T;
it: T;
ja: T;
nl: T;
pl: T;
pt: T;
ro: T;
ru: T;
zh: T;
}
interface Hit {
/**
* List of names of the place. If no language parameter is specified, retrieves all of them.
*
* Examples:
* - Paris
* - 589 Howard Street
*/
locale_names: Array<string> | LocalNamesTraduction;
/**
* List of the associated city names. If no language parameter is specified, retrieves all of them.
*/
city: Array<string>;
/**
* List of the associated county names. If no language parameter is specified, retrieves all of them.
*/
county: Array<string>;
/**
* List of associated administrative region names.
*
* Examples:
* - Pays de la Loire
* - Texas
* - Catalunya
*/
administrative: Array<string>;
/**
* Associated country name.
*/
country: string | CountryTraduction;
/**
* Two letters country code (ISO 639-1).
*/
country_code: string;
/**
* List of associated postcodes.
*/
postcode: Array<string>;
/**
* Associated population.
*/
population: number;
/**
* Associated list of latitude and longitude.
*
* Examples:
*
* [{lat: 48.797885, lng: 2.337034}]
*/
_geoloc: GeoLoc;
/**
* The associated highlighting information.
*/
_highlightResult: HighlightResult;
_tags: Array<string>;
admin_level: number;
importance: number;
is_city: boolean;
is_country: boolean;
is_highway: boolean;
is_popular: boolean;
is_suburb: boolean;
objectID: string;
}
/**
* The available query parameters you can use to filter your search results.
*/
type PlacesOptions = {
/**
* If specified, restrict the search results to a single language. You can pass two letters country codes (ISO 639-1).
*
* Warning: language parameter is case sensitive and should be lowercase otherwise it will fallback to default language.
*/
language: string,
/**
* If specified, restrict the search results to a specific list of comma-separated countries. You can pass two letters country codes (ISO 3166-1).
*
* Default: Search on the whole planet.
*
* Warning: country codes must be lower-cased.
*/
countries: string,
/**
* Specifies how many results you want to retrieve per search.
*
* Default: 20.
*/
hitsPerPage: number,
/**
* Restrict the search results to a specific type.
*
* Available types:
* - city
* - country
* - address
* - busStop
* - trainStation
* - townhall
* - airport
*
* Default: Search in all types.
*
* Note: If you restrict the search to city or airport, you probably want to disable the aroundLatLngViaIP option as well.
* This will make sure you don't get only nearby results.
*/
type: SearchType,
/**
* Force to first search around a specific latitude longitude.
* The option value must be provided as a string: latitude,longitude like 12.232,23.1.
*
* The default is to search around the location of the user determined via his IP address (geoip).
*/
aroundLatLng: string,
/**
* Whether or not to first search around the geolocation of the user found via his IP address.
* This is true by default.
*/
aroundLatLngViaIP: boolean,
/**
* Radius in meters to search around the latitude longitude.
* Otherwise a default radius is automatically computed given the area density.
*/
aroundRadius: number,
/**
* Filters the results inside the area defined by the two extreme points of a rectangle.
* See guide: https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-inside-rectanglepolygonal-area
* or API reference: https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/
*
* Format: topRightLat, topRightLng, bottomLeftLat, bottomLeftLng
*
* Example: "60, 16, 40, -4"
*/
insideBoundingBox: string,
/**
* Filters the results inside the area defined by a shape.
* See guide: https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-inside-rectanglepolygonal-area
* or API reference: https://www.algolia.com/doc/api-reference/api-parameters/insidePolygon/
*
* Format: p1Lat, p1Lng, p2Lat, p2Lng, p3Lat, p3Lng...
*/
insidePolygon: string,
/**
* Controls whether the _rankingInfo (https://www.algolia.com/doc/api-reference/api-methods/search/#method-response-_rankinginfo) object should be included in the hits. This defaults to false.
* The _rankingInfo object for a Places query is slightly different from a regular Algolia query
* and you can read up more about the difference and how to leverage them in our guide.
* https://community.algolia.com/places/examples.html#using-_rankinginfo
*/
getRankingInfo: boolean
}
export interface Result {
degradedQuery: boolean;
hits: Array<Hit>;
nbHits: number;
query: string;
processingTimeMS: number;
}
export default class ReactNativeAlgoliaPlaces extends React.Component<PlacesProperties> {}
}