Kotlin API client V1.0 is released

#1

We’re happy to announce that the V1.0 of the Kotlin API client is now out :rocket:

But what is Kotlin ? :thinking:

Kotlin is a statically typed language developed by Jetbrains. The first stable version was released in early 2016. Initially designed as an alternative to Java on the JVM, it rapidly gained traction for Android development, and is now Google’s preferred language of development on the platform. Which means having a Kotlin client is required to provide a modern experience on Android InstantSearch !

Documentation efforts also includes gazillons of snippets, playgrounds and guides.

It’s all thanks to the API Client squad and the Doc team for their incredible support! :clap:

:construction_worker_man: Build your Algolia applications for the JVM and Android

This Kotlin client is a JVM library that can be used for Android and JVM applications.

Developers starting with the Kotlin client will notice its familiar look: It implements the common specs for modern API clients: Search, Indexing, Analytics, Insights, Query Rules and Multi-Cluster management.

:sparkling_heart: Smooth integration with Kotlinx libraries

On Android and elsewhere, integrating Algolia with the Kotlin client makes for a catered developer experience: It integrates seamlessly in your projects by relying exclusively on Kotlinx libraries such as Serialization, Ktor and exposes suspending functions for natural Coroutines usage.

:muscle: Strong typing everywhere

For optimal developer experience and type safety, the Kotlin client introduces methodical strong typing.

What does it mean ?

  • Typed request: Never pass an invalid value ever again.
  • Typed response: easily get each property with the proper type from the response.
  • Search parameter and other objects are strongly typed, using sealed classes for handling proteiform parameters, such as aroundRadius.
  • IDE autocomplete everytime, everywhere. Let it do all the hard work for you!

:parasol_on_ground: DSL for Query, Settings and Query Rules

Strong typing sometimes means a lot of extra things to write … Unless you have a Domain Specific Language for that.

Example of the DSL for creating a Settings object:

You can also easily write filters for your queries using the DSL:

The Filter DSL does a ton of work for you:

  • Supports filters, numericFilters, facetFilters, tagFilters, optionalFilters query parameters.

  • Guarantees at compile-time that all your filter are syntactically valid and respect all engine rules :scream:If you can write it, the engine can parse it!

  • Handles escaping automatically

  • Supports the SQL-like syntax, but also the original nested list syntax.

  • Pretty print your filters for easier debugging.

:syringe: Injectable HttpClient

The Kotlin client can use a wide variety of HttpClient, directly out of the box. Just choose the dependency you need from the list: OkHttp, HttpUrlConnection, CIO, Netty, Apache and more. Whatever your choice, it will run with the retry strategy!

:gear: Thread Safe clients

The client is thread-safe. Every Client class in the library, such as SearchClient, AnalyticsClient, and InsightsClient can be used in a multithreaded environment.

:stopwatch: Waitable operations

For each operation that returns a taskID, waiting for the operation can be done in just one line.

Waiting in parallel for several operations to complete is just as easy: use waitAll() !

:checkered_flag: Where should I start?

Our documentation was updated, check out the API Reference.

:raised_hands: How to help?

If you spot a bug or if you’re stuck when using the library: open an issue on the github repository.

3 Likes