Skip to content

Commit

Permalink
chore(deps): dependencies 2025-01-13 [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4325

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Algolia Bot <30854082+algolia-bot@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
4 people committed Jan 13, 2025
1 parent b763a4b commit 01f3992
Show file tree
Hide file tree
Showing 76 changed files with 818 additions and 1,203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ internal class AlgoliaAgent(clientVersion: String) {
AgentSegment("Algolia for Kotlin", clientVersion),
)

fun add(segment: AgentSegment): Boolean {
return segments.add(segment)
}
fun add(segment: AgentSegment): Boolean = segments.add(segment)

fun add(segments: List<AgentSegment>): Boolean {
return this.segments.addAll(segments)
}
fun add(segments: List<AgentSegment>): Boolean = this.segments.addAll(segments)

fun remove(segment: AgentSegment): Boolean {
return segments.remove(segment)
}
fun remove(segment: AgentSegment): Boolean = segments.remove(segment)

override fun toString(): String {
return segments.joinToString("; ") { it.formatted() }
}
override fun toString(): String = segments.joinToString("; ") { it.formatted() }

private fun AgentSegment.formatted(): String = buildString {
append(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ internal fun algoliaHttpClient(
agent: AlgoliaAgent,
) = httpClientOf(options) { configure(appId, apiKey, options, agent) }

private fun httpClientOf(options: ClientOptions, block: HttpClientConfig<*>.() -> Unit) =
options.engine?.let { HttpClient(it, block) } ?: HttpClient(block)
private fun httpClientOf(options: ClientOptions, block: HttpClientConfig<*>.() -> Unit) = options.engine?.let { HttpClient(it, block) } ?: HttpClient(block)

internal fun HttpClientConfig<*>.configure(
appId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ import com.algolia.client.exception.AlgoliaRuntimeException
import io.ktor.client.plugins.*

/** Coerce a Throwable to a [AlgoliaClientException]. */
internal fun Throwable.asClientException(): AlgoliaClientException {
return AlgoliaClientException(message = message, cause = this)
}
internal fun Throwable.asClientException(): AlgoliaClientException = AlgoliaClientException(message = message, cause = this)

/** Coerce a [ResponseException] to a [AlgoliaRuntimeException]. */
internal fun ResponseException.asApiException(): AlgoliaApiException {
return AlgoliaApiException(
message = message,
cause = this,
httpErrorCode = response.status.value,
)
}
internal fun ResponseException.asApiException(): AlgoliaApiException = AlgoliaApiException(
message = message,
cause = this,
httpErrorCode = response.status.value,
)
Loading

0 comments on commit 01f3992

Please sign in to comment.