We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2135cd4 commit a5da61eCopy full SHA for a5da61e
client/src/commonMain/kotlin/com/algolia/client/extensions/SearchClient.kt
@@ -521,3 +521,16 @@ public fun securedApiKeyRemainingValidity(apiKey: String): Duration {
521
val validUntil = Instant.fromEpochMilliseconds(match.groupValues[1].toLong())
522
return validUntil - Clock.System.now()
523
}
524
+
525
+public suspend fun SearchClient.indexExists(indexName: String): Boolean {
526
+ try {
527
+ getSettings(indexName)
528
+ } catch (e: AlgoliaApiException) {
529
+ if (e.httpErrorCode == 404) {
530
+ return false
531
+ }
532
+ throw e
533
534
535
+ return true
536
+}
0 commit comments