Skip to content

chore(deps): update plugin spotless to v7 #4344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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