-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from algolia/develop
Merge 1.1.0 in master
- Loading branch information
Showing
134 changed files
with
4,475 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 1.1.0 | ||
|
||
- Kotlin version 1.3.41 | ||
- Ktor version 1.2.3-rc | ||
- Added `enableABTest` as `Query` parameter | ||
- Added `similarQuery` as `Query` parameter | ||
- Added `advancedSyntaxFeatures` as `Query` parameter | ||
- Added `index.exists()` method | ||
- New `AlgoliaSearchClient` object exposes library version constant | ||
- Added `Compression` feature. `Gzip` compression is enabled by default. | ||
- Default `readTimeout` has been increased to 5 seconds | ||
- It is now possible to configure `HttpClientConfig` in `Configuration` | ||
- Added `ClientPlaces` to access Algolia Places endpoints. See this [file](docs/Places.md) for getting starting with Places. | ||
- `QueryLanguage` is renamed to `Language` | ||
- Fixed a bug in `browseAllABTests` methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Algolia | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
object Serialization : Dependency { | ||
|
||
override val version = "0.11.0" | ||
override val version = "0.11.1" | ||
override val group = "org.jetbrains.kotlinx" | ||
override val artifact = "kotlinx-serialization" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Places client | ||
|
||
Algolia Places provides a fast, distributed and easy way to use address search. | ||
|
||
## Pricing | ||
|
||
#### Rate limit | ||
|
||
The Algolia Places API enforces 30 queries per second. [Contact us](https://community.algolia.com/places/contact.html) if you need more. | ||
|
||
If you're calling the API from your backend, the rate-limits computation is then based on the source IP. | ||
|
||
#### Plans | ||
|
||
- Free: 1000 requests / day [Sign Up](https://www.algolia.com/users/sign_up/places) | ||
- Free, with authentication: 100 000 requests / month [Sign Up](https://www.algolia.com/users/sign_up/places) | ||
- Paying: $0.40 per 1000 requests [Sign Up](https://www.algolia.com/users/sign_up/places) | ||
- Up to unlimited: [Contact us](https://community.algolia.com/places/contact.html) | ||
|
||
|
||
Visit our [website](https://community.algolia.com/places/pricing.html). | ||
|
||
## Usage | ||
|
||
#### Unauthenticated | ||
|
||
You can use Algolia Places without authentication. Limited to 1000 requests per day. | ||
|
||
```kotlin | ||
val client = ClientPlaces() | ||
``` | ||
|
||
#### Authenticated | ||
|
||
Pass an `ApplicationID` and an `APIKey` to the `ClientPlaces` for authenticated usage. | ||
|
||
```kotlin | ||
val client = ClientPlaces( | ||
ApplicationID("YourApplicationID"), | ||
APIKey("YourPlacesAPIKey") | ||
) | ||
``` | ||
|
||
#### Search places for multiple languages | ||
|
||
By default, the response of `searchPlaces` contains translations in all languages. | ||
|
||
```kotlin | ||
val response = client.searchPlaces(PlacesQuery("Paris")) | ||
|
||
response.hits.first().city.getValue(Language.English) | ||
``` | ||
|
||
#### Search places for one language | ||
|
||
However, it is possible to restrict the search results to a single language. | ||
|
||
```kotlin | ||
val response = client.searchPlaces( | ||
query = PlacesQuery("New-York"), | ||
language = Language.English | ||
) | ||
|
||
response.hits.first().city | ||
``` | ||
|
||
#### Search places in countries | ||
|
||
Unless one or multiple countries are specified, it will search on the whole planet. | ||
|
||
```kotlin | ||
val query = placesQuery("York") { | ||
countries { | ||
+UnitedKingdom | ||
+UnitedStates | ||
} | ||
} | ||
|
||
client.searchPlaces(query) | ||
``` | ||
|
||
#### Search places around radius | ||
|
||
Use latitude and longitude coordinates to find places. | ||
|
||
```kotlin | ||
val query = placesQuery { | ||
aroundLatLng = Point(40.7128f, -74.0060f) // New-York | ||
} | ||
|
||
client.searchPlaces(query) | ||
``` | ||
|
||
#### Reverse geocoding | ||
|
||
Reverse geocoding means converting a location (latitude and longitude) to a readable address. | ||
|
||
```kotlin | ||
client.reverseGeocoding(Point(40.7128f, -74.0060f)) // New-York | ||
``` | ||
|
||
#### Get By ObjectID | ||
|
||
Use a Places `objectID` to get an Algolia Places record. | ||
|
||
```kotlin | ||
clientPlaces.getByObjectID(ObjectID("201316654_7340078")) // New-York | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/commonMain/kotlin/com/algolia/search/client/ClientPlaces.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.algolia.search.client | ||
|
||
import com.algolia.search.configuration.CredentialsImpl | ||
import com.algolia.search.configuration.Configuration | ||
import com.algolia.search.configuration.ConfigurationPlaces | ||
import com.algolia.search.endpoint.EndpointPlaces | ||
import com.algolia.search.endpoint.EndpointPlacesImpl | ||
import com.algolia.search.model.APIKey | ||
import com.algolia.search.model.ApplicationID | ||
import com.algolia.search.transport.Transport | ||
|
||
|
||
public class ClientPlaces private constructor( | ||
private val tranport: Transport | ||
) : EndpointPlaces by EndpointPlacesImpl(tranport), | ||
Configuration by tranport { | ||
|
||
public constructor( | ||
applicationID: ApplicationID, | ||
apiKey: APIKey | ||
) : this( | ||
Transport(ConfigurationPlaces(), CredentialsImpl(applicationID, apiKey)) | ||
) | ||
|
||
public constructor( | ||
configuration: ConfigurationPlaces | ||
) : this(Transport(configuration, null)) | ||
|
||
public constructor() : this(Transport(ConfigurationPlaces(), null)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/commonMain/kotlin/com/algolia/search/configuration/AlgoliaSearchClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.algolia.search.configuration | ||
|
||
|
||
/** | ||
* Singleton exposing information on the library. | ||
*/ | ||
public object AlgoliaSearchClient { | ||
|
||
/** | ||
* Current version of the library. | ||
*/ | ||
const val version = BuildConfig.version | ||
} |
10 changes: 10 additions & 0 deletions
10
src/commonMain/kotlin/com/algolia/search/configuration/Compression.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.algolia.search.configuration | ||
|
||
|
||
/** | ||
* The different methods of request payload compression. | ||
*/ | ||
public enum class Compression { | ||
None, | ||
Gzip | ||
} |
Oops, something went wrong.