Skip to content

Commit

Permalink
refactor(kotlin): prepare beta release (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
aallam authored Oct 12, 2023
1 parent a586263 commit a8eeb30
Show file tree
Hide file tree
Showing 44 changed files with 1,344 additions and 222 deletions.
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.96
0.0.97
69 changes: 1 addition & 68 deletions clients/algoliasearch-client-kotlin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,48 @@
## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)
## [3.0.0-beta.1](https://github.com/algolia/algoliasearch-client-kotlin/tree/3.0.0-beta.1)

- [b5ec54151](https://github.com/algolia/api-clients-automation/commit/b5ec54151) feat(specs): revenue and filterEffects typing updates ([#2105](https://github.com/algolia/api-clients-automation/pull/2105)) by [@cdhawke](https://github.com/cdhawke/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [e3b7e2ab6](https://github.com/algolia/api-clients-automation/commit/e3b7e2ab6) feat(specs): synchronize specs for all client ([#2103](https://github.com/algolia/api-clients-automation/pull/2103)) by [@Fluf22](https://github.com/Fluf22/)
- [f8e79a1e2](https://github.com/algolia/api-clients-automation/commit/f8e79a1e2) fix(specs): search `insideBoundingBox` type ([#2098](https://github.com/algolia/api-clients-automation/pull/2098)) by [@aallam](https://github.com/aallam/)
- [d38619103](https://github.com/algolia/api-clients-automation/commit/d38619103) feat(specs): add new events type for insights ([#2080](https://github.com/algolia/api-clients-automation/pull/2080)) by [@millotp](https://github.com/millotp/)
- [756f19ab7](https://github.com/algolia/api-clients-automation/commit/756f19ab7) feat(specs): Remove attributeForDistinct from the indexSettingsAsSearc… ([#2078](https://github.com/algolia/api-clients-automation/pull/2078)) by [@clemfromspace](https://github.com/clemfromspace/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [2260e903f](https://github.com/algolia/api-clients-automation/commit/2260e903f) feat(specs): add `attributesToExclude` for Ingestion ([#2053](https://github.com/algolia/api-clients-automation/pull/2053)) by [@shortcuts](https://github.com/shortcuts/)
- [b7b6565ab](https://github.com/algolia/api-clients-automation/commit/b7b6565ab) fix(specs): `userData` type as 'any' ([#2033](https://github.com/algolia/api-clients-automation/pull/2033)) by [@aallam](https://github.com/aallam/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [265518125](https://github.com/algolia/api-clients-automation/commit/265518125) fix(specs): `exhaustiveNbHits` as optional ([#2007](https://github.com/algolia/api-clients-automation/pull/2007)) by [@aallam](https://github.com/aallam/)
- [e73b9cf52](https://github.com/algolia/api-clients-automation/commit/e73b9cf52) fix(specs): introduced SourceUpdateDocker ([#2005](https://github.com/algolia/api-clients-automation/pull/2005)) by [@Fluf22](https://github.com/Fluf22/)
- [02ca9f694](https://github.com/algolia/api-clients-automation/commit/02ca9f694) fix(specs): add 'critical' event status to enum ([#2006](https://github.com/algolia/api-clients-automation/pull/2006)) by [@Fluf22](https://github.com/Fluf22/)
- [48b23af07](https://github.com/algolia/api-clients-automation/commit/48b23af07) fix(clients): userToken max length ([#2004](https://github.com/algolia/api-clients-automation/pull/2004)) by [@kai687](https://github.com/kai687/)
- [964962605](https://github.com/algolia/api-clients-automation/commit/964962605) fix(clients): user token character limit ([#2003](https://github.com/algolia/api-clients-automation/pull/2003)) by [@kai687](https://github.com/kai687/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [24affb264](https://github.com/algolia/api-clients-automation/commit/24affb264) feat(specs): add `recordType` and `fallbackIsInStockValue` in inputs ([#1988](https://github.com/algolia/api-clients-automation/pull/1988)) by [@damcou](https://github.com/damcou/)
- [1381b70ff](https://github.com/algolia/api-clients-automation/commit/1381b70ff) feat(specs): add inference ACL to API key object ([#1985](https://github.com/algolia/api-clients-automation/pull/1985)) by [@helenamariano](https://github.com/helenamariano/)
- [028bf073b](https://github.com/algolia/api-clients-automation/commit/028bf073b) feat(specs): add `failureThreshold` to Ingestion API ([#1962](https://github.com/algolia/api-clients-automation/pull/1962)) by [@shortcuts](https://github.com/shortcuts/)
- [b19273392](https://github.com/algolia/api-clients-automation/commit/b19273392) feat(specs): update ingestion specs for BigCommerce ([#1961](https://github.com/algolia/api-clients-automation/pull/1961)) by [@shortcuts](https://github.com/shortcuts/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [693631cc7](https://github.com/algolia/api-clients-automation/commit/693631cc7) fix(specs): remove some parameters from trending requests ([#1915](https://github.com/algolia/api-clients-automation/pull/1915)) by [@shortcuts](https://github.com/shortcuts/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [5a9d949db](https://github.com/algolia/api-clients-automation/commit/5a9d949db) fix(specs): mixed `SearchParams` and `IndexSettings` ([#1889](https://github.com/algolia/api-clients-automation/pull/1889)) by [@shortcuts](https://github.com/shortcuts/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [82d7dcf5a](https://github.com/algolia/api-clients-automation/commit/82d7dcf5a) fix(specs): allow JSON array for `aroundPrecision` ([#1855](https://github.com/algolia/api-clients-automation/pull/1855)) by [@shortcuts](https://github.com/shortcuts/)
- [c6a7ab404](https://github.com/algolia/api-clients-automation/commit/c6a7ab404) fix(specs): optional/required `query` and `params` ([#1864](https://github.com/algolia/api-clients-automation/pull/1864)) by [@aallam](https://github.com/aallam/)
- [a5bf6232c](https://github.com/algolia/api-clients-automation/commit/a5bf6232c) feat(specs): delete Predict ([#1860](https://github.com/algolia/api-clients-automation/pull/1860)) by [@shortcuts](https://github.com/shortcuts/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [58ea5dbf](https://github.com/algolia/api-clients-automation/commit/58ea5dbf) fix(specs): allow partial input update for authentications ([#1856](https://github.com/algolia/api-clients-automation/pull/1856)) by [@Fluf22](https://github.com/Fluf22/)
- [2ac508ff](https://github.com/algolia/api-clients-automation/commit/2ac508ff) fix(specs): search w/ hits & facets responses ([#1774](https://github.com/algolia/api-clients-automation/pull/1774)) by [@aallam](https://github.com/aallam/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [333368a3b](https://github.com/algolia/api-clients-automation/commit/333368a3b) feat(specs): query suggestions ([#1740](https://github.com/algolia/api-clients-automation/pull/1740)) by [@kai687](https://github.com/kai687/)
- [f15457fd1](https://github.com/algolia/api-clients-automation/commit/f15457fd1) feat(specs): Review OpenAPI common specs ([#1692](https://github.com/algolia/api-clients-automation/pull/1692)) by [@gazconroy](https://github.com/gazconroy/)
- [8765f6d47](https://github.com/algolia/api-clients-automation/commit/8765f6d47) feat(specs): add OpenAPI spec for Monitoring API ([#1683](https://github.com/algolia/api-clients-automation/pull/1683)) by [@kai687](https://github.com/kai687/)
- [dc0ff048a](https://github.com/algolia/api-clients-automation/commit/dc0ff048a) fix(specs): facet stats properties as double ([#1694](https://github.com/algolia/api-clients-automation/pull/1694)) by [@aallam](https://github.com/aallam/)
- [7250930c7](https://github.com/algolia/api-clients-automation/commit/7250930c7) fix(specs): add input to authentication list ([#1688](https://github.com/algolia/api-clients-automation/pull/1688)) by [@millotp](https://github.com/millotp/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [15bc7618](https://github.com/algolia/api-clients-automation/commit/15bc7618) feat(specs): updated_at removed from Run response ([#1651](https://github.com/algolia/api-clients-automation/pull/1651)) by [@mehmetaligok](https://github.com/mehmetaligok/)
- [b7c71def](https://github.com/algolia/api-clients-automation/commit/b7c71def) feat(specs): add new outlier count properties to variant payload ([#1656](https://github.com/algolia/api-clients-automation/pull/1656)) by [@febeck](https://github.com/febeck/)
- [b703dea4](https://github.com/algolia/api-clients-automation/commit/b703dea4) docs(specs): review Insights API spec ([#1647](https://github.com/algolia/api-clients-automation/pull/1647)) by [@kai687](https://github.com/kai687/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [19e99bb9](https://github.com/algolia/api-clients-automation/commit/19e99bb9) fix(specs): change github container registry name ([#1641](https://github.com/algolia/api-clients-automation/pull/1641)) by [@morganleroi](https://github.com/morganleroi/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [19e99bb9](https://github.com/algolia/api-clients-automation/commit/19e99bb9) fix(specs): change github container registry name ([#1641](https://github.com/algolia/api-clients-automation/pull/1641)) by [@morganleroi](https://github.com/morganleroi/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [308c7ccb](https://github.com/algolia/api-clients-automation/commit/308c7ccb) fix(specs): add blocking to reasonCode instead of outcome ([#1622](https://github.com/algolia/api-clients-automation/pull/1622)) by [@damcou](https://github.com/damcou/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [3cdb7495](https://github.com/algolia/api-clients-automation/commit/3cdb7495) fix(specs): add blocking run outcome ([#1619](https://github.com/algolia/api-clients-automation/pull/1619)) by [@damcou](https://github.com/damcou/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [81401eed](https://github.com/algolia/api-clients-automation/commit/81401eed) feat(specs): add `startDate` and `endDate` parameters to Ingestion API ([#1614](https://github.com/algolia/api-clients-automation/pull/1614)) by [@shortcuts](https://github.com/shortcuts/)
- [138a35b5](https://github.com/algolia/api-clients-automation/commit/138a35b5) fix(specs): add processing run outcome ([#1613](https://github.com/algolia/api-clients-automation/pull/1613)) by [@millotp](https://github.com/millotp/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [e1cb1c89](https://github.com/algolia/api-clients-automation/commit/e1cb1c89) fix(specs): add docker source input ([#1594](https://github.com/algolia/api-clients-automation/pull/1594)) by [@millotp](https://github.com/millotp/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [2a55abf5](https://github.com/algolia/api-clients-automation/commit/2a55abf5) feat(specs): add objectID to BQ source input ([#1575](https://github.com/algolia/api-clients-automation/pull/1575)) by [@damcou](https://github.com/damcou/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [635806cb](https://github.com/algolia/api-clients-automation/commit/635806cb) feat(specs): ingestion partial update method changed to patch ([#1564](https://github.com/algolia/api-clients-automation/pull/1564)) by [@mehmetaligok](https://github.com/mehmetaligok/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [6284a8bc](https://github.com/algolia/api-clients-automation/commit/6284a8bc) feat(specs): add task input for bigquery ([#1549](https://github.com/algolia/api-clients-automation/pull/1549)) by [@Fluf22](https://github.com/Fluf22/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [49b4c00c](https://github.com/algolia/api-clients-automation/commit/49b4c00c) feat(specs): add property to BigQuery source input ([#1547](https://github.com/algolia/api-clients-automation/pull/1547)) by [@Fluf22](https://github.com/Fluf22/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [49b4c00c](https://github.com/algolia/api-clients-automation/commit/49b4c00c) feat(specs): add property to BigQuery source input ([#1547](https://github.com/algolia/api-clients-automation/pull/1547)) by [@Fluf22](https://github.com/Fluf22/)

## [3.0.0-SNAPSHOT](https://github.com/algolia/algoliasearch-client-kotlin/compare/3.0.0-SNAPSHOT...3.0.0-SNAPSHOT)

- [7c9cfb9b](https://github.com/algolia/api-clients-automation/commit/7c9cfb9b) feat(specs): add reason code to run outcome ([#1531](https://github.com/algolia/api-clients-automation/pull/1531)) by [@Fluf22](https://github.com/Fluf22/)
- [558b8fbb](https://github.com/algolia/api-clients-automation/commit/558b8fbb) feat(clients): add Kotlin API client ([#1400](https://github.com/algolia/api-clients-automation/pull/1400)) by [@aallam](https://github.com/aallam/)
- [102f3d4d](https://github.com/algolia/api-clients-automation/commit/102f3d4d) fix(specs): remove unsupported delete option for task action type ([#1511](https://github.com/algolia/api-clients-automation/pull/1511)) by [@Fluf22](https://github.com/Fluf22/)

3 changes: 2 additions & 1 deletion clients/algoliasearch-client-kotlin/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ kotlin {
iosX64()
iosArm64()
iosSimulatorArm64()
macosArm64()
macosX64()
}

sourceSets {
all {
languageSettings {
optIn("kotlinx.coroutines.ExperimentalCoroutinesApi")
optIn("kotlinx.serialization.ExperimentalSerializationApi")
optIn("com.algolia.client.InternalAlgoliaClient")
}
}
val commonMain by getting {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,58 @@ import com.algolia.client.transport.Requester
import io.ktor.client.*
import io.ktor.client.engine.*
import io.ktor.client.plugins.logging.*
import kotlinx.serialization.json.JsonBuilder
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

/** Custom client configuration. */
public class ClientOptions(
public expect class ClientOptions(
connectTimeout: Duration = 2.seconds,
writeTimeout: Duration = 30.seconds,
readTimeout: Duration = 5.seconds,
logLevel: LogLevel = LogLevel.NONE,
logger: Logger = Logger.DEFAULT,
hosts: List<Host>? = null,
defaultHeaders: Map<String, String>? = null,
engine: HttpClientEngine? = null,
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
jsonConfig: ((JsonBuilder) -> Unit)? = null,
requester: Requester? = null,
algoliaAgentSegments: List<AgentSegment> = emptyList()
) {

/** Connect timeout for each request */
public val connectTimeout: Duration = 2.seconds,
public val connectTimeout: Duration

/** The timeout for each request when performing write operations. */
public val writeTimeout: Duration = 30.seconds,
public val writeTimeout: Duration

/** The timeout for each request when performing read operations. */
public val readTimeout: Duration = 5.seconds,
public val readTimeout: Duration

/** [LogLevel] to display in the console. */
public val logLevel: LogLevel = LogLevel.NONE,
public val logLevel: LogLevel

/** [Logger] to use for logs. */
public val logger: Logger = Logger.DEFAULT,
public val logger: Logger

/** Custom list of hosts and back-up host used to perform a custom retry logic. */
public val hosts: List<Host>? = null,
public val hosts: List<Host>?

/** Optional default headers that should be applied to every request. */
public val defaultHeaders: Map<String, String>? = null,
public val defaultHeaders: Map<String, String>?

/** An optional [HttpClientEngine] to specify which HttpEngine should be used by Ktor. */
public val engine: HttpClientEngine? = null,
public val engine: HttpClientEngine?

/** An optional [HttpClientConfig] used by Ktor for advanced HttpClient configuration. */
public val httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
public val httpClientConfig: ((HttpClientConfig<*>) -> Unit)?

/** An optional [JsonBuilder] configuration. */
public val jsonConfig: ((JsonBuilder) -> Unit)?

/** Custom Http Requester. */
public val requester: Requester? = null,
public val requester: Requester?

/** List of Algolia agent segments */
public val algoliaAgentSegments: List<AgentSegment> = emptyList(),
)
public val algoliaAgentSegments: List<AgentSegment>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.algolia.client.configuration.internal

import com.algolia.client.configuration.AgentSegment
import io.ktor.client.plugins.api.*

/** Handles to handle algolia agent segments. */
internal class AlgoliaAgent(clientVersion: String) {
Expand All @@ -27,7 +26,7 @@ internal class AlgoliaAgent(clientVersion: String) {
return segments.joinToString("; ") { it.formatted() }
}

fun AgentSegment.formatted(): String = buildString {
private fun AgentSegment.formatted(): String = buildString {
append(value)
version?.let { version ->
append(" (")
Expand All @@ -36,21 +35,3 @@ internal class AlgoliaAgent(clientVersion: String) {
}
}
}

/**
* A plugin that adds Algolia agent to all requests.
*
* @property agent `X-Algolia-Agent` header value.
*/
internal fun algoliaAgent(agent: AlgoliaAgent) =
createClientPlugin("AlgoliaAgent") {
onRequest { request, _ ->
request.url.parameters.apply {
val parameter = "X-Algolia-Agent"
val current = getAll(parameter) ?: listOf()
val updated = listOf(agent.toString()) + current
remove(parameter)
append(parameter, updated.joinToString("; "))
}
}
}
Loading

0 comments on commit a8eeb30

Please sign in to comment.