Skip to content

Commit

Permalink
fix: kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluf22 committed Jan 24, 2025
1 parent 25f4f13 commit 11da452
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions templates/kotlin/guides/search/saveObjectsMCM.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ val getAllAppIDConfigurations: () -> Map<String, String> = {
mapOf() // A map of your MCM AppID/ApiKey pairs
}

val playlists: List<JsonObject> = listOf() // Your records

suspend fun saveObjectsMCM() {
val playlists: List<JsonObject> = listOf() // Your records
val configurations = getAllAppIDConfigurations()
configurations.map { (appID, apiKey) ->
Expand Down
4 changes: 2 additions & 2 deletions templates/kotlin/guides/search/saveObjectsPublicUser.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import kotlinx.serialization.json.JsonObject
import com.algolia.client.model.search.*
import com.algolia.client.transport.RequestOptions

val playlists: List<JsonObject> = listOf() // Your records
suspend fun saveObjectsPublicUser() {
val playlists: List<JsonObject> = listOf() // Your records
suspend fun saveObjectsPublicUser() {
{{> snippets/init}}

client.{{#dynamicSnippet}}saveObjectsPlaylistsWithUserIDPublic{{/dynamicSnippet}}
Expand Down
3 changes: 2 additions & 1 deletion templates/kotlin/guides/search/savePopularRecords.mustache
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive

{{> snippets/import}}
import com.algolia.client.model.search.*
Expand All @@ -9,7 +10,7 @@ suspend fun savePopularRecords() {

var records: List<JsonObject> = listOf()

client.browseObjects(indexName, BrowseParamsObject(), aggregator = { response ->
client.browseObjects("YOUR_INDEX_NAME", BrowseParamsObject(), aggregator = { response ->
records = records + response.hits.map { hit ->
val props = hit.additionalProperties ?: mapOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import kotlinx.serialization.json.JsonObject

{{> snippets/import}}
import com.algolia.client.model.search.*

val playlists: List<Map<String, Any>> = listOf() // Your records

suspend fun setHeaderUserIDThenSaveObjects() {
val playlists: List<JsonObject> = listOf() // Your records
{{> snippets/init}}

playlists.foreach { playlist ->
Expand Down

0 comments on commit 11da452

Please sign in to comment.