Skip to content

Commit 8eedda0

Browse files
committed
feat(dart): saveObjectsPublicUser (+ local vars)
1 parent 1110b5e commit 8eedda0

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{> snippets/import}}
2+
3+
var playlists = [/* Your records */];
4+
5+
void saveObjectsPublicUser() async {
6+
{{> snippets/init}}
7+
8+
var batchParams = BatchWriteParams(
9+
requests: playlists
10+
.map((record) => BatchRequest(
11+
action: Action.addObject,
12+
body: record,
13+
))
14+
.toList());
15+
await {{#dynamicSnippet}}batchChunksWithUserIDPublic{{/dynamicSnippet}};
16+
}

templates/kotlin/guides/search/saveObjectsPublicUser.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import com.algolia.client.model.search.*
33
import com.algolia.client.transport.RequestOptions
44

5+
val playlists: List<JsonObject> = listOf() // Your records
6+
57
suspend fun saveObjectsPublicUser() {
68
{{> snippets/init}}
79

templates/scala/guides/search/saveObjectsMCM.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ val getAllAppIDConfigurations: () => Map[String, String] = () => {
88
Map(/* A map of your MCM AppID/ApiKey pairs */)
99
}
1010

11-
val playlists: List[Any] = List(/* Your records */)
11+
val playlists: Seq[Any] = Seq(/* Your records */)
1212

1313
def saveObjectsMCM(): Future[Unit] = {
1414
val configurations = getAllAppIDConfigurations()

templates/scala/guides/search/saveObjectsPublicUser.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import scala.concurrent.duration.Duration
66
{{> snippets/import}}
77
import algoliasearch.config.RequestOptions
88

9+
val playlists: Seq[Any] = Seq() // Your records
10+
911
def saveObjectsPublicUser(): Future[Unit] = {
1012
{{> snippets/init}}
1113

templates/swift/guides/search/saveObjectsPublicUser.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Foundation
66
import Core
77
{{> snippets/import}}
88

9+
let playlists: [[String: AnyCodable]] = [] // Your records
10+
911
func saveObjectsPublicUser() async throws {
1012
do {
1113
{{> snippets/init}}

tests/CTS/guides/search.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@
6868
}
6969
}
7070
},
71+
"batchChunksWithUserIDPublic": {
72+
"method": "batch",
73+
"parameters": {
74+
"indexName": "indexName",
75+
"batchWriteParams": "$var: batchParams"
76+
},
77+
"requestOptions": {
78+
"headers": {
79+
"X-Algolia-User-ID": "*"
80+
}
81+
}
82+
},
7183
"saveObjectsPlaylistsWithRequestOptions": {
7284
"method": "saveObjects",
7385
"parameters": {

0 commit comments

Comments
 (0)