All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.algolia.search.client.internal.ClientAnalyticsImpl.kt Maven / Gradle / Ivy

Go to download

"Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search REST API from your JVM project, such as Android or backend implementations."

There is a newer version: 3.12.2
Show newest version
package com.algolia.search.client.internal

import com.algolia.search.client.ClientAnalytics
import com.algolia.search.configuration.Configuration
import com.algolia.search.configuration.Credentials
import com.algolia.search.endpoint.EndpointAnalytics
import com.algolia.search.endpoint.internal.EndpointAnalytics
import com.algolia.search.model.response.ResponseABTests
import com.algolia.search.transport.CustomRequester
import com.algolia.search.transport.RequestOptions
import com.algolia.search.transport.internal.Transport

internal class ClientAnalyticsImpl internal constructor(
    internal val transport: Transport,
) : ClientAnalytics,
    EndpointAnalytics by EndpointAnalytics(transport),
    Configuration by transport,
    Credentials by transport.credentials,
    CustomRequester by transport {

    override suspend fun browseAllABTests(
        hitsPerPage: Int?,
        requestOptions: RequestOptions?,
    ): List {
        val responses = mutableListOf()
        var page = 0

        while (true) {
            val response = listABTests(page, hitsPerPage, requestOptions)

            if (response.count == response.total || response.count == 0) break
            page += response.count
            responses += response
        }
        return responses
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy