Skip to content

Commit 7402f8c

Browse files
committed
feat(kotlin): setHeaderUserIDThenSaveObjects
1 parent 7bc2b90 commit 7402f8c

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{> snippets/import}}
2+
import com.algolia.client.model.search.*
3+
4+
suspend fun setHeaderUserIDThenSaveObjects() {
5+
{{> snippets/init}}
6+
7+
playlists.foreach { playlist ->
8+
val playlistUserID = playlist["userID"].toString()
9+
client.{{#dynamicSnippet}}saveObjectsPlaylistsWithRequestOptions{{/dynamicSnippet}}
10+
}
11+
}

templates/scala/guides/search/setHeaderUserIDThenSaveObjects.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def setHeaderUserIDThenSaveObjects(): Future[Unit] = {
99
{{> snippets/init}}
1010

1111
playlists.foreach { playlist =>
12+
val playlistUserID = playlist("userID").toString()
1213
Await.result(
1314
{{#dynamicSnippet}}saveObjectsPlaylistsWithRequestOptions{{/dynamicSnippet}},
1415
Duration(5, "sec")

templates/swift/guides/search/setHeaderUserIDThenSaveObjects.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func setHeaderUserIDThenSaveObjects() async throws {
1111
{{> snippets/init}}
1212

1313
for playlist in playlists {
14+
let playlistUserID = playlist.userID
1415
{{#dynamicSnippet}}saveObjectsPlaylistsWithRequestOptions{{/dynamicSnippet}}
1516
}
1617
} catch {

tests/CTS/guides/search.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"requestOptions": {
7171
"headers": {
72-
"X-Algolia-User-ID": "$var: playlist.userID"
72+
"X-Algolia-User-ID": "$var: playlistUserID"
7373
}
7474
}
7575
},

0 commit comments

Comments
 (0)