Recombee Docs
Visit recombee.comStart Free
docs20User Documentation
adminuiAdmin UI
reql32ReQL
codeAPI Clients & Integrations
suitcaseMisc

Kotlin API Client

GitHub (contains installation info and more examples).

The library allows you to request recommendations and send interactions between users and items (views, bookmarks, purchases …).

It is intended for usage in Android applications.

Example

Kotlin
import com.recombee.apiclientkotlin.RecombeeClient
import com.recombee.apiclientkotlin.bindings.RecommendationResponse
import com.recombee.apiclientkotlin.exceptions.ApiException
import com.recombee.apiclientkotlin.requests.*
import com.recombee.apiclientkotlin.util.Region

fun main() {

    val client = RecombeeClient(
        databaseId = "your-db-id",
        publicToken = "associated-public-token",
        region = Region.UsWest
    )

    client.send(SetViewPortion(userId = "user-4289", itemId = "item-487", portion = 0.3))

    val recommRequest = RecommendItemsToUser(userId = "user-4289", count = 10)

    client.send(recommRequest,
        { response: RecommendationResponse ->
            // Show recommendations
            for (recommendedItem in response.recomms) {
                println("ID: ${recommendedItem.id}")
            }
        },
        { exception: ApiException ->
            println("Exception: $exception")
            // use fallback ...
        }
    )
}
© Copyright 2024, Recombee s.r.o
docs.recombee.com