From 45b6d2a327880cb4f5a520276993a6f9ae2402b1 Mon Sep 17 00:00:00 2001 From: Shiranuit Date: Mon, 28 Feb 2022 12:55:11 +0100 Subject: [PATCH 1/6] Fix a special case where only requestId is sent back instead of room --- src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt index d0479455..3457367b 100644 --- a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt +++ b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt @@ -56,8 +56,10 @@ class Kuzzle { val response = Response().apply { fromMap(JsonSerializer.deserialize(message) as Map) } + + val requestId = response.room ?: response.requestId - if (queries.size == 0 || (queries.size != 0 && (response.room == null || queries[response.room!!] == null))) { + if (queries.size == 0 || (queries.size != 0 && (requestId == null || queries[requestId] == null))) { protocol.trigger("unhandledResponse", message) return } From cb6af2db281b678198174188a797f9ec2f3d2829 Mon Sep 17 00:00:00 2001 From: Shiranuit Date: Mon, 28 Feb 2022 13:01:43 +0100 Subject: [PATCH 2/6] remove trailing space --- src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt index 3457367b..ebe71181 100644 --- a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt +++ b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt @@ -56,7 +56,7 @@ class Kuzzle { val response = Response().apply { fromMap(JsonSerializer.deserialize(message) as Map) } - + val requestId = response.room ?: response.requestId if (queries.size == 0 || (queries.size != 0 && (requestId == null || queries[requestId] == null))) { From 0860d9f253a456cfbf1e729f30102f3d305ba23e Mon Sep 17 00:00:00 2001 From: Shiranuit Date: Fri, 11 Mar 2022 14:47:08 +0100 Subject: [PATCH 3/6] Improve DX for Query method (#66) # What does this PR do ? Improves the DX of the Query method - Add a RawJson object that designate a string that should represent a Json Object and should not be escaped, RawJson can be given to `sdk.query` or be put anywhere in a map or object - Add RequestPayload class, mostly used in Kotlin to instantiate new query without having to use `map.put` multiples times in row - The serializer is now capable of serializing Java Objects directly --- .ci/doc/templates/default.tpl.kt | 1 + .../snippets/check-rights-java.test.yml | 4 +- .../snippets/check-rights-kotlin.test.yml | 4 +- .../snippets/check-token-java.test.yml | 4 +- .../snippets/check-token-kotlin.test.yml | 4 +- .../create-my-credentials-java.test.yml | 4 +- .../create-my-credentials-kotlin.test.yml | 4 +- .../snippets/credentials-exist-java.test.yml | 4 +- .../credentials-exist-kotlin.test.yml | 4 +- .../delete-my-credentials-java.test.yml | 4 +- .../delete-my-credentials-kotlin.test.yml | 4 +- .../snippets/get-current-user-java.test.yml | 4 +- .../snippets/get-current-user-kotlin.test.yml | 4 +- .../snippets/get-my-credentials-java.test.yml | 4 +- .../get-my-credentials-kotlin.test.yml | 4 +- .../snippets/get-my-rights-java.test.yml | 4 +- .../snippets/get-my-rights-kotlin.test.yml | 4 +- .../snippets/get-strategies-java.test.yml | 4 +- .../snippets/get-strategies-kotlin.test.yml | 4 +- .../auth/login/snippets/login-java.test.yml | 4 +- .../auth/login/snippets/login-kotlin.test.yml | 4 +- .../auth/logout/snippets/logout-java.test.yml | 4 +- .../logout/snippets/logout-kotlin.test.yml | 4 +- .../snippets/refresh-token-java.test.yml | 4 +- .../snippets/refresh-token-kotlin.test.yml | 4 +- .../snippets/search-api-keys-es-java.java | 3 + .../snippets/search-api-keys-es-java.test.yml | 2 +- .../snippets/search-api-keys-es-kotlin.kt | 4 + .../search-api-keys-es-kotlin.test.yml | 2 +- .../search-api-keys-koncorde-java.java | 3 + .../search-api-keys-koncorde-java.test.yml | 2 +- .../search-api-keys-koncorde-kotlin.kt | 3 + .../search-api-keys-koncorde-kotlin.test.yml | 2 +- .../update-my-credentials-java.test.yml | 4 +- .../update-my-credentials-kotlin.test.yml | 4 +- .../snippets/update-self-java.test.yml | 6 +- .../snippets/update-self-kotlin.test.yml | 6 +- .../validate-my-credentials-java.test.yml | 4 +- .../validate-my-credentials-kotlin.test.yml | 4 +- doc/1/core-classes/kuzzle/query/index.md | 79 +++++++++- src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt | 14 ++ .../kuzzle/sdk/coreClasses/RequestPayload.kt | 73 ++++++++++ .../json/ConcurrentHashMapTypeAdapter.kt | 129 +++++++++-------- .../sdk/coreClasses/json/JsonSerializer.kt | 15 +- .../io/kuzzle/sdk/coreClasses/json/RawJson.kt | 3 + .../coreClasses/json/RequestTypeAdapter.kt | 137 ++++++++++++++++++ 46 files changed, 461 insertions(+), 135 deletions(-) create mode 100644 src/main/kotlin/io/kuzzle/sdk/coreClasses/RequestPayload.kt create mode 100644 src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RawJson.kt create mode 100644 src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RequestTypeAdapter.kt diff --git a/.ci/doc/templates/default.tpl.kt b/.ci/doc/templates/default.tpl.kt index 51aca01e..42f9c5cb 100644 --- a/.ci/doc/templates/default.tpl.kt +++ b/.ci/doc/templates/default.tpl.kt @@ -5,6 +5,7 @@ import java.util.concurrent.ExecutionException import io.kuzzle.sdk.coreClasses.responses.Response import io.kuzzle.sdk.coreClasses.SearchResult import io.kuzzle.sdk.coreClasses.lang.Lang +import java.util.*; fun main() { val ws = WebSocket("kuzzle") diff --git a/doc/1/controllers/auth/check-rights/snippets/check-rights-java.test.yml b/doc/1/controllers/auth/check-rights/snippets/check-rights-java.test.yml index bde01332..c08ff6c7 100644 --- a/doc/1/controllers/auth/check-rights/snippets/check-rights-java.test.yml +++ b/doc/1/controllers/auth/check-rights/snippets/check-rights-java.test.yml @@ -1,7 +1,7 @@ name: java-auth#checkRights description: Checks if an API action can be executed by the current user hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: true \ No newline at end of file diff --git a/doc/1/controllers/auth/check-rights/snippets/check-rights-kotlin.test.yml b/doc/1/controllers/auth/check-rights/snippets/check-rights-kotlin.test.yml index 5ce27aa8..e50f6f38 100644 --- a/doc/1/controllers/auth/check-rights/snippets/check-rights-kotlin.test.yml +++ b/doc/1/controllers/auth/check-rights/snippets/check-rights-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-auth#checkRights description: Checks if an API action can be executed by the current user hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: true \ No newline at end of file diff --git a/doc/1/controllers/auth/check-token/snippets/check-token-java.test.yml b/doc/1/controllers/auth/check-token/snippets/check-token-java.test.yml index fb786a69..1907b73e 100644 --- a/doc/1/controllers/auth/check-token/snippets/check-token-java.test.yml +++ b/doc/1/controllers/auth/check-token/snippets/check-token-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#CheckToken description: Checks an authentication token's validity. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success \ No newline at end of file diff --git a/doc/1/controllers/auth/check-token/snippets/check-token-kotlin.test.yml b/doc/1/controllers/auth/check-token/snippets/check-token-kotlin.test.yml index de532fb7..a2fbd79d 100644 --- a/doc/1/controllers/auth/check-token/snippets/check-token-kotlin.test.yml +++ b/doc/1/controllers/auth/check-token/snippets/check-token-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#CheckToken description: Checks an authentication token's validity. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success \ No newline at end of file diff --git a/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-java.test.yml b/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-java.test.yml index 4ca4705c..c01d681f 100644 --- a/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-java.test.yml +++ b/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#CreateMyCredentials description: Creates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: catch expected: io.kuzzle.sdk.coreClasses.exceptions.ApiErrorException:\ Unknown\ authentication\ strategy\ "other" diff --git a/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-kotlin.test.yml b/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-kotlin.test.yml index f9492459..8af67771 100644 --- a/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-kotlin.test.yml +++ b/doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#CreateMyCredentials description: Creates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: catch expected: io.kuzzle.sdk.coreClasses.exceptions.ApiErrorException:\ Unknown\ authentication\ strategy\ "other" diff --git a/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-java.test.yml b/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-java.test.yml index 70e98baf..6ad73323 100644 --- a/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-java.test.yml +++ b/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#CredentialsExist description: Checks that the current user has credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: "true" diff --git a/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-kotlin.test.yml b/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-kotlin.test.yml index da5536a3..1ba2de90 100644 --- a/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-kotlin.test.yml +++ b/doc/1/controllers/auth/credentials-exist/snippets/credentials-exist-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#CredentialsExist description: Checks that the current user has credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: "true" diff --git a/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-java.test.yml b/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-java.test.yml index b5aa6705..a92dc903 100644 --- a/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-java.test.yml +++ b/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#DeleteMyCredentials description: Deletes the current user's credentials for the specified. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success \ No newline at end of file diff --git a/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-kotlin.test.yml b/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-kotlin.test.yml index 1c378fa8..994891f8 100644 --- a/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-kotlin.test.yml +++ b/doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#DeleteMyCredentials description: Deletes the current user's credentials for the specified. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success \ No newline at end of file diff --git a/doc/1/controllers/auth/get-current-user/snippets/get-current-user-java.test.yml b/doc/1/controllers/auth/get-current-user/snippets/get-current-user-java.test.yml index 441f38a7..a62a6ab2 100644 --- a/doc/1/controllers/auth/get-current-user/snippets/get-current-user-java.test.yml +++ b/doc/1/controllers/auth/get-current-user/snippets/get-current-user-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#GetCurrentUser description: Returns the profile object for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{strategies=\[local\],\ _source={profileIds=\[default\],\ _kuzzle_info={.*}},\ _id=foo}$ diff --git a/doc/1/controllers/auth/get-current-user/snippets/get-current-user-kotlin.test.yml b/doc/1/controllers/auth/get-current-user/snippets/get-current-user-kotlin.test.yml index a1c2ad5d..6c9136f4 100644 --- a/doc/1/controllers/auth/get-current-user/snippets/get-current-user-kotlin.test.yml +++ b/doc/1/controllers/auth/get-current-user/snippets/get-current-user-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#GetCurrentUser description: Returns the profile object for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{strategies=\[local\],\ _source={profileIds=\[default\],\ _kuzzle_info={.*}},\ _id=foo}$ diff --git a/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-java.test.yml b/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-java.test.yml index 8cdf1855..6839ce0f 100644 --- a/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-java.test.yml +++ b/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-java.test.yml @@ -1,8 +1,8 @@ name: java-Auth#GetMyCredentials description: Returns the current user's credential information for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: - {kuid=foo,\ username=foo} diff --git a/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-kotlin.test.yml b/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-kotlin.test.yml index b85feef2..58137649 100644 --- a/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-kotlin.test.yml +++ b/doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials-kotlin.test.yml @@ -1,8 +1,8 @@ name: kotlin-Auth#GetMyCredentials description: Returns the current user's credential information for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: - {kuid=foo,\ username=foo} diff --git a/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-java.test.yml b/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-java.test.yml index 1feba503..00ec461e 100644 --- a/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-java.test.yml +++ b/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#GetMyRights description: Returns the rights for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [{controller=*,\ action=*,\ index=*,\ collection=*,\ value=allowed}] diff --git a/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-kotlin.test.yml b/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-kotlin.test.yml index 69c7f87e..5bc20d24 100644 --- a/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-kotlin.test.yml +++ b/doc/1/controllers/auth/get-my-rights/snippets/get-my-rights-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#GetMyRights description: Returns the rights for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [{controller=*,\ action=*,\ index=*,\ collection=*,\ value=allowed}] diff --git a/doc/1/controllers/auth/get-strategies/snippets/get-strategies-java.test.yml b/doc/1/controllers/auth/get-strategies/snippets/get-strategies-java.test.yml index 047741f8..1dade8ac 100644 --- a/doc/1/controllers/auth/get-strategies/snippets/get-strategies-java.test.yml +++ b/doc/1/controllers/auth/get-strategies/snippets/get-strategies-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#GetStrategies description: Returns the rights for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [local] diff --git a/doc/1/controllers/auth/get-strategies/snippets/get-strategies-kotlin.test.yml b/doc/1/controllers/auth/get-strategies/snippets/get-strategies-kotlin.test.yml index 5f325735..79797849 100644 --- a/doc/1/controllers/auth/get-strategies/snippets/get-strategies-kotlin.test.yml +++ b/doc/1/controllers/auth/get-strategies/snippets/get-strategies-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#GetStrategies description: Returns the rights for the user linked to the `JSON Web Token`. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [local] diff --git a/doc/1/controllers/auth/login/snippets/login-java.test.yml b/doc/1/controllers/auth/login/snippets/login-java.test.yml index 37f98ede..5c25cecb 100644 --- a/doc/1/controllers/auth/login/snippets/login-java.test.yml +++ b/doc/1/controllers/auth/login/snippets/login-java.test.yml @@ -2,7 +2,7 @@ name: java-Auth#Login description: Authenticates a user. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{jwt=.*,\ _id=foo,\ ttl=3600000,\ expiresAt=[0-9]+}$ diff --git a/doc/1/controllers/auth/login/snippets/login-kotlin.test.yml b/doc/1/controllers/auth/login/snippets/login-kotlin.test.yml index 9ac9612e..53bf3c0a 100644 --- a/doc/1/controllers/auth/login/snippets/login-kotlin.test.yml +++ b/doc/1/controllers/auth/login/snippets/login-kotlin.test.yml @@ -2,7 +2,7 @@ name: kotlin-Auth#Login description: Authenticates a user. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{jwt=.*,\ _id=foo,\ ttl=3600000,\ expiresAt=[0-9]+}$ diff --git a/doc/1/controllers/auth/logout/snippets/logout-java.test.yml b/doc/1/controllers/auth/logout/snippets/logout-java.test.yml index 1386bb2b..16c3dc4c 100644 --- a/doc/1/controllers/auth/logout/snippets/logout-java.test.yml +++ b/doc/1/controllers/auth/logout/snippets/logout-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#Logout description: Revokes the user's token & unsubscribe them from registered rooms. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success diff --git a/doc/1/controllers/auth/logout/snippets/logout-kotlin.test.yml b/doc/1/controllers/auth/logout/snippets/logout-kotlin.test.yml index cbad8c85..46a65f68 100644 --- a/doc/1/controllers/auth/logout/snippets/logout-kotlin.test.yml +++ b/doc/1/controllers/auth/logout/snippets/logout-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#Logout description: Revokes the user's token & unsubscribe them from registered rooms. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: default expected: Success diff --git a/doc/1/controllers/auth/refresh-token/snippets/refresh-token-java.test.yml b/doc/1/controllers/auth/refresh-token/snippets/refresh-token-java.test.yml index bdf4eaaa..c3831988 100644 --- a/doc/1/controllers/auth/refresh-token/snippets/refresh-token-java.test.yml +++ b/doc/1/controllers/auth/refresh-token/snippets/refresh-token-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#RefreshToken description: Refreshes an authentication token. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{jwt=.*,\ _id=foo,\ ttl=3600000,\ expiresAt=[0-9]+}$ diff --git a/doc/1/controllers/auth/refresh-token/snippets/refresh-token-kotlin.test.yml b/doc/1/controllers/auth/refresh-token/snippets/refresh-token-kotlin.test.yml index d452aef0..bff4d65f 100644 --- a/doc/1/controllers/auth/refresh-token/snippets/refresh-token-kotlin.test.yml +++ b/doc/1/controllers/auth/refresh-token/snippets/refresh-token-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#RefreshToken description: Refreshes an authentication token. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: ^{jwt=.*,\ _id=foo,\ ttl=3600000,\ expiresAt=[0-9]+}$ diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.java b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.java index 09cd5ac2..c3217f04 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.java +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.java @@ -7,15 +7,18 @@ query.put("action", "createApiKey"); query.put("userId", "jared.doe"); query.put("refresh", "wait_for"); +query.put("_id", "lora-key"); query.put("body", description); kuzzle.query(query).get(); description.put("description", "Sigfox API key"); +query.put("_id", "sigfox-key"); query.put("body", description); kuzzle.query(query).get(); description.put("description", "LoRa 6 month API key"); +query.put("_id", "lora-temp-key"); query.put("body", description); query.put("expiresIn", 36000); kuzzle.query(query).get(); diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.test.yml b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.test.yml index 89ef873c..eff85f26 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.test.yml +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-java.test.yml @@ -14,7 +14,7 @@ hooks: } }' "kuzzle:7512/users/jared.doe/_create?refresh=wait_for" after: - curl -XDELETE kuzzle:7512/users/jared.doe + curl -XDELETE kuzzle:7512/users/jared.doe?refresh=wait_for template: default expected: - Found 2 API keys matching 'LoRa' diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.kt b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.kt index 6d1b2106..958e990c 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.kt +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.kt @@ -8,16 +8,20 @@ val query: HashMap = HashMap().apply { put("action", "createApiKey") put("userId", "jared.doe") put("refresh", "wait_for") + put("_id", "lora-key") put("body", description) } kuzzle.query(query).get() + description.put("description", "Sigfox API key") +query.put("_id", "sigfox-key") query.put("body", description); kuzzle.query(query).get() description.put("description", "LoRa 6 month API key") +query.put("_id", "lora-temp-key") query.put("body", description); query.put("expiresIn", 36000); kuzzle.query(query).get() diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.test.yml b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.test.yml index ceb857f1..26019ff9 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.test.yml +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-es-kotlin.test.yml @@ -14,7 +14,7 @@ hooks: } }' "kuzzle:7512/users/jared.doe/_create?refresh=wait_for" after: - curl -XDELETE kuzzle:7512/users/jared.doe + curl -XDELETE kuzzle:7512/users/jared.doe?refresh=wait_for template: default expected: - Found 2 API keys matching 'LoRa' diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.java b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.java index def28c28..7837c701 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.java +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.java @@ -7,15 +7,18 @@ query.put("action", "createApiKey"); query.put("userId", "jared.doe"); query.put("refresh", "wait_for"); +query.put("_id", "lora-key"); query.put("body", description); kuzzle.query(query).get(); description.put("description", "Sigfox API key"); +query.put("_id", "sigfox-key"); query.put("body", description); kuzzle.query(query).get(); description.put("description", "LoRa 6 month API key"); +query.put("_id", "lora-temp-key"); query.put("body", description); query.put("expiresIn", 36000); kuzzle.query(query).get(); diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.test.yml b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.test.yml index 82be47f3..e3cc6a6d 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.test.yml +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-java.test.yml @@ -14,7 +14,7 @@ hooks: } }' "kuzzle:7512/users/jared.doe/_create?refresh=wait_for" after: - curl -XDELETE kuzzle:7512/users/jared.doe + curl -XDELETE kuzzle:7512/users/jared.doe?refresh=wait_for template: default expected: - Found 1 API key diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.kt b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.kt index 5f5814b9..243de202 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.kt +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.kt @@ -8,16 +8,19 @@ val query: HashMap = HashMap().apply { put("action", "createApiKey") put("userId", "jared.doe") put("refresh", "wait_for") + put("_id", "lora-key") put("body", description) } kuzzle.query(query).get() description.put("description", "Sigfox API key") +query.put("_id", "sigfox-key") query.put("body", description); kuzzle.query(query).get() description.put("description", "LoRa 6 month API key") +query.put("_id", "lora-temp-key") query.put("body", description); query.put("expiresIn", 36000); kuzzle.query(query).get() diff --git a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.test.yml b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.test.yml index f43a1584..b0ac5bc9 100644 --- a/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.test.yml +++ b/doc/1/controllers/auth/search-api-keys/snippets/search-api-keys-koncorde-kotlin.test.yml @@ -14,7 +14,7 @@ hooks: } }' "kuzzle:7512/users/jared.doe/_create?refresh=wait_for" after: - curl -XDELETE kuzzle:7512/users/jared.doe + curl -XDELETE kuzzle:7512/users/jared.doe?refresh=wait_for template: default expected: - Found 1 API key diff --git a/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-java.test.yml b/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-java.test.yml index e23bf94b..e9f00430 100644 --- a/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-java.test.yml +++ b/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#UpdateMyCredentials description: Updates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: {username=foo} diff --git a/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-kotlin.test.yml b/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-kotlin.test.yml index 21b5d1e8..7a046992 100644 --- a/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-kotlin.test.yml +++ b/doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#UpdateMyCredentials description: Updates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: {username=foo} diff --git a/doc/1/controllers/auth/update-self/snippets/update-self-java.test.yml b/doc/1/controllers/auth/update-self/snippets/update-self-java.test.yml index 93e49b55..51c07704 100644 --- a/doc/1/controllers/auth/update-self/snippets/update-self-java.test.yml +++ b/doc/1/controllers/auth/update-self/snippets/update-self-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#UpdateSelf description: Updates the current user object in Kuzzle. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result -expected: ^{_source={profileIds=\[default\],\ _kuzzle_info={updatedAt=[0-9]+,\ updater=foo},\ age=42},\ _id=foo}$ +expected: ^{_source={profileIds=\[default\],\ _kuzzle_info={.+},\ age=42},\ _id=foo}$ diff --git a/doc/1/controllers/auth/update-self/snippets/update-self-kotlin.test.yml b/doc/1/controllers/auth/update-self/snippets/update-self-kotlin.test.yml index da138f02..d1c2f88f 100644 --- a/doc/1/controllers/auth/update-self/snippets/update-self-kotlin.test.yml +++ b/doc/1/controllers/auth/update-self/snippets/update-self-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#UpdateSelf description: Updates the current user object in Kuzzle. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result -expected: ^{_source={profileIds=\[default\],\ _kuzzle_info={updatedAt=[0-9]+,\ updater=foo},\ age=42},\ _id=foo}$ +expected: ^{_source={profileIds=\[default\],\ _kuzzle_info={.+},\ age=42},\ _id=foo}$ diff --git a/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-java.test.yml b/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-java.test.yml index fd136e9b..48dda7de 100644 --- a/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-java.test.yml +++ b/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-java.test.yml @@ -1,7 +1,7 @@ name: java-Auth#ValidateMyCredentials description: Validates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [true] diff --git a/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-kotlin.test.yml b/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-kotlin.test.yml index 0163f238..d794f704 100644 --- a/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-kotlin.test.yml +++ b/doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials-kotlin.test.yml @@ -1,7 +1,7 @@ name: kotlin-Auth#ValidateMyCredentials description: Validates the current user's credentials for the specified strategy. hooks: - before: curl -X POST kuzzle:7512/users/foo/_create -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' - after: curl -X DELETE kuzzle:7512/users/foo + before: curl -X POST kuzzle:7512/users/foo/_create?refresh=wait_for -H "Content-Type:application/json" --data '{"content":{"profileIds":["default"]},"credentials":{"local":{"username":"foo","password":"bar"}}}' + after: curl -X DELETE kuzzle:7512/users/foo?refresh=wait_for template: print-result expected: [true] diff --git a/doc/1/core-classes/kuzzle/query/index.md b/doc/1/core-classes/kuzzle/query/index.md index bd1a3d91..9bc2a97b 100644 --- a/doc/1/core-classes/kuzzle/query/index.md +++ b/doc/1/core-classes/kuzzle/query/index.md @@ -24,11 +24,50 @@ public CompletableFuture query( throws InternalException, NotConnectedException ``` + + +```java +public CompletableFuture query( + String query) + throws InternalException, NotConnectedException + +public CompletableFuture query( + RawJson query) + throws InternalException, NotConnectedException + +public CompletableFuture query( + RequestPayload query) + throws InternalException, NotConnectedException + +public CompletableFuture query( + Object query) + throws InternalException, NotConnectedException +``` +
| Argument | Type | Description | | --------- | ----------------- | ---------------------- | -| `query` |
Map
| API request | +| `query` |
Map | API request    |
+
+
+
+| Argument  | Type              | Description            |
+| --------- | ----------------- | ---------------------- |
+| `query` | 
Map
or String
or RawJson
or RequestPayload
or Object
| API request | + +::: info +Calling query with a `String` or `RawJson` makes no differences, and will be interpreted as raw json strings. +::: + +::: warn +Calling query directly with a `String` or `RawJson` causes the SDK to deserialize the query, add some properties, then reserialize the query. + +This can decrease performances when giving big JSON payloads. + +If you have big JSON body payloads to send, consider using a Map and only use a RawJson for the body property. +This will avoid the deserialization + reserialization slowdown +::: ### query @@ -39,11 +78,11 @@ The following properties are the most common. | ------------ | ----------------- | ---------------------------------------- | | `controller` |
String
| Controller name (mandatory) | | `action` |
String
| Action name (mandatory) | -| `body` |
Map
| Query body for this action | +| `body` |
Map
or RawJson
or Object
| Query body for this action | | `index` |
String
| Index name for this action | | `collection` |
String
| Collection name for this action | | `_id` |
String
| id for this action | -| `volatile` |
Map
| Additional information to send to Kuzzle | +| `volatile` |
Map
or RawJson
or Object
| Additional information to send to Kuzzle | ## Returns @@ -62,11 +101,39 @@ Returns a [Response](/sdk/jvm/1/core-classes/response) object which represents a fun query(query: Map): CompletableFuture ``` + + +```kotlin +fun query(query: RawJson): CompletableFuture +fun query(query: String): CompletableFuture +fun query(query: RequestPayload): CompletableFuture +fun query(query: Any): CompletableFuture +``` +
| Argument | Type | Description | | --------- | ----------------- | ---------------------- | -| `query` |
Map
| API request | +| `query` |
Map | API request    |
+
+
+
+| Argument  | Type              | Description            |
+| --------- | ----------------- | ---------------------- |
+| `query` | 
Map
or RawJson
or String
or RequestPayload
or Any
| API request | + +::: info +Calling query with a `String` or `RawJson` makes no differences, and will be interpreted as raw json strings. +::: + +::: warn +Calling query directly with a `String` or `RawJson` causes the SDK to deserialize the query, add some properties, then reserialize the query. + +This can decrease performances when giving big JSON payloads. + +If you have big JSON body payloads to send, consider using a Map and only use a RawJson for the body property. +This will avoid the deserialization + reserialization slowdown +::: ### query @@ -77,11 +144,11 @@ The following properties are the most common. | ------------ | ----------------- | ---------------------------------------- | | `controller` |
String
| Controller name (mandatory) | | `action` |
String
| Action name (mandatory) | -| `body` |
Map
| Query body for this action | +| `body` |
Map
or RawJson
or Any
| Query body for this action | | `index` |
String
| Index name for this action | | `collection` |
String
| Collection name for this action | | `_id` |
String
| id for this action | -| `volatile` |
Map
| Additional information to send to Kuzzle | +| `volatile` |
Map
or RawJson
or Any
| Additional information to send to Kuzzle | ## Returns diff --git a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt index d0479455..0a7dc2cd 100644 --- a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt +++ b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt @@ -7,6 +7,7 @@ import io.kuzzle.sdk.controllers.DocumentController import io.kuzzle.sdk.controllers.IndexController import io.kuzzle.sdk.controllers.RealtimeController import io.kuzzle.sdk.controllers.ServerController +import io.kuzzle.sdk.coreClasses.RequestPayload import io.kuzzle.sdk.coreClasses.exceptions.ApiErrorException import io.kuzzle.sdk.coreClasses.exceptions.KuzzleExceptionCode import io.kuzzle.sdk.coreClasses.exceptions.NotConnectedException @@ -94,6 +95,19 @@ class Kuzzle { protocol.disconnect() } + fun query(query: RequestPayload): CompletableFuture { + return query(query.toMap()) + } + + fun query(query: Any): CompletableFuture { + return query(JsonSerializer.serialize(query)) + } + + fun query(query: String): CompletableFuture { + val queryMap = JsonSerializer.deserialize(query) as Map + return query(queryMap) + } + fun query(query: Map): CompletableFuture { if (protocol.state == ProtocolState.CLOSE) { throw NotConnectedException() diff --git a/src/main/kotlin/io/kuzzle/sdk/coreClasses/RequestPayload.kt b/src/main/kotlin/io/kuzzle/sdk/coreClasses/RequestPayload.kt new file mode 100644 index 00000000..6369af83 --- /dev/null +++ b/src/main/kotlin/io/kuzzle/sdk/coreClasses/RequestPayload.kt @@ -0,0 +1,73 @@ +package io.kuzzle.sdk.coreClasses + +/** + * Kuzzle Request Payload + * @property controller API controller name + * @property action API action name + * @property index Index name + * @property collection Collection name + * @property _id Document unique identifier + * @property jwt Authentication token + * @property volatile Volatile data + * @property body Request body + * @property requestId Request unique identifier + * @property other Other parameters not present in RequestPayload + */ +data class RequestPayload( + var controller: String? = null, + var action: String? = null, + var index: String? = null, + var collection: String? = null, + var _id: String? = null, + var jwt: String? = null, + var volatile: Any? = null, + var body: Any? = null, + var requestId: String? = null, + var other: Map? = null +) { + fun toMap(): Map { + val map = HashMap() + + if (controller != null) { + map["controller"] = controller + } + + if (action != null) { + map["action"] = action + } + + if (index != null) { + map["index"] = index + } + + if (collection != null) { + map["collection"] = collection + } + + if (_id != null) { + map["_id"] = _id + } + + if (jwt != null) { + map["jwt"] = jwt + } + + if (volatile != null) { + map["volatile"] = volatile + } + + if (body != null) { + map["body"] = body + } + + if (requestId != null) { + map["requestId"] = requestId + } + + if (other != null) { + map.putAll(other!!) + } + + return map + } +} diff --git a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/ConcurrentHashMapTypeAdapter.kt b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/ConcurrentHashMapTypeAdapter.kt index b012269b..0908ed6b 100644 --- a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/ConcurrentHashMapTypeAdapter.kt +++ b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/ConcurrentHashMapTypeAdapter.kt @@ -11,6 +11,7 @@ import java.io.IOException import java.util.* class MapTypeAdapter : TypeAdapter?>() { + @Throws(IOException::class) override fun write(out: JsonWriter, map: Map?) { if (map == null) { @@ -53,74 +54,80 @@ class MapTypeAdapter : TypeAdapter?>() { return null } - @Throws(IOException::class) - private fun writeObject(out: JsonWriter, value: Any?) { - if (value is Number) { - out.value(value as Number?) - } else if (value is Boolean) { - out.value(value as Boolean?) - } else if (value is String) { - out.value(value as String?) - } else if (value is ArrayList<*>) { - out.beginArray() - val iterator: Iterator = (value as ArrayList).iterator() - while (iterator.hasNext()) { - writeObject(out, iterator.next()) - } - out.endArray() - } else if (value is Map<*, *>) { - out.beginObject() - val iterator: Iterator> = (value as Map) - .entries - .iterator() - while (iterator.hasNext()) { - val e = iterator.next() - out.name(e.key) - writeObject(out, e.value) + companion object { + @Throws(IOException::class) + fun writeObject(out: JsonWriter, value: Any?) { + if (value is Number) { + out.value(value as Number?) + } else if (value is Boolean) { + out.value(value as Boolean?) + } else if (value is String) { + out.value(value as String?) + } else if (value is ArrayList<*>) { + out.beginArray() + val iterator: Iterator = (value as ArrayList).iterator() + while (iterator.hasNext()) { + writeObject(out, iterator.next()) + } + out.endArray() + } else if (value is Map<*, *>) { + out.beginObject() + val iterator: Iterator> = (value as Map) + .entries + .iterator() + while (iterator.hasNext()) { + val e = iterator.next() + out.name(e.key) + writeObject(out, e.value) + } + out.endObject() + } else if (value is RawJson) { + out.jsonValue(value.rawJson) + } else if (value == null) { + out.nullValue() + } else { + out.jsonValue(JsonSerializer.serialize(value)) } - out.endObject() - } else if (value == null) { - out.nullValue() } - } - @Throws(IOException::class) - private fun readObject(`in`: JsonReader): Any? { - return when (`in`.peek()) { - JsonToken.NUMBER -> { - val number = `in`.nextString() - LazilyParsedNumber(number) - } - JsonToken.BOOLEAN -> `in`.nextBoolean() - JsonToken.STRING -> `in`.nextString() - JsonToken.NULL -> { - `in`.nextNull() - null - } - JsonToken.BEGIN_ARRAY -> { - val array = ArrayList() - `in`.beginArray() - while (`in`.hasNext()) { - array.add(readObject(`in`)) + @Throws(IOException::class) + fun readObject(`in`: JsonReader): Any? { + return when (`in`.peek()) { + JsonToken.NUMBER -> { + val number = `in`.nextString() + LazilyParsedNumber(number) } - `in`.endArray() - array - } - JsonToken.BEGIN_OBJECT -> { - val map = KuzzleMap() - `in`.beginObject() - while (`in`.hasNext()) { - val key = `in`.nextName() - val `object` = readObject(`in`) - if (`object` != null) { - map.put(key, `object`) + JsonToken.BOOLEAN -> `in`.nextBoolean() + JsonToken.STRING -> `in`.nextString() + JsonToken.NULL -> { + `in`.nextNull() + null + } + JsonToken.BEGIN_ARRAY -> { + val array = ArrayList() + `in`.beginArray() + while (`in`.hasNext()) { + array.add(readObject(`in`)) + } + `in`.endArray() + array + } + JsonToken.BEGIN_OBJECT -> { + val map = KuzzleMap() + `in`.beginObject() + while (`in`.hasNext()) { + val key = `in`.nextName() + val `object` = readObject(`in`) + if (`object` != null) { + map.put(key, `object`) + } } + `in`.endObject() + map } - `in`.endObject() - map + JsonToken.END_DOCUMENT, JsonToken.NAME, JsonToken.END_OBJECT, JsonToken.END_ARRAY -> throw IllegalArgumentException() + else -> throw IllegalArgumentException() } - JsonToken.END_DOCUMENT, JsonToken.NAME, JsonToken.END_OBJECT, JsonToken.END_ARRAY -> throw IllegalArgumentException() - else -> throw IllegalArgumentException() } } } diff --git a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/JsonSerializer.kt b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/JsonSerializer.kt index 7a010a71..80f66889 100644 --- a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/JsonSerializer.kt +++ b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/JsonSerializer.kt @@ -2,6 +2,7 @@ package io.kuzzle.sdk.coreClasses.json import com.google.gson.Gson import com.google.gson.GsonBuilder +import io.kuzzle.sdk.coreClasses.RequestPayload object JsonSerializer { private var gson: Gson? = null @@ -9,8 +10,14 @@ object JsonSerializer { return gson!!.fromJson(rawJson, Map::class.java) } - fun serialize(map: Map?): String { - return gson!!.toJson(map, Map::class.java) + fun serialize(obj: Any): String { + if (obj is Map<*, *>) { + return gson!!.toJson(obj, Map::class.java) + } + if (obj is RawJson) { + return obj.rawJson + } + return gson!!.toJson(obj) } init { @@ -22,6 +29,10 @@ object JsonSerializer { Map::class.java, MapTypeAdapter() ) + .registerTypeAdapter( + RequestPayload::class.java, + RequestTypeAdapter() + ) .create() } } diff --git a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RawJson.kt b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RawJson.kt new file mode 100644 index 00000000..842532e3 --- /dev/null +++ b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RawJson.kt @@ -0,0 +1,3 @@ +package io.kuzzle.sdk.coreClasses.json + +data class RawJson(val rawJson: String) diff --git a/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RequestTypeAdapter.kt b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RequestTypeAdapter.kt new file mode 100644 index 00000000..3ac7013d --- /dev/null +++ b/src/main/kotlin/io/kuzzle/sdk/coreClasses/json/RequestTypeAdapter.kt @@ -0,0 +1,137 @@ +package io.kuzzle.sdk.coreClasses.json + +import com.google.gson.TypeAdapter +import com.google.gson.stream.JsonReader +import com.google.gson.stream.JsonToken +import com.google.gson.stream.JsonWriter +import io.kuzzle.sdk.coreClasses.RequestPayload +import java.io.IOException + +class RequestTypeAdapter : TypeAdapter() { + + @Throws(IOException::class) + override fun write(out: JsonWriter, value: RequestPayload?) { + if (value == null) { + out.nullValue() + return + } + + out.beginObject() + + if (value.controller != null) { + out.name("controller") + out.value(value.controller) + } + + if (value.action != null) { + out.name("action") + out.value(value.action) + } + + if (value.index != null) { + out.name("index") + out.value(value.index) + } + + if (value.collection != null) { + out.name("collection") + out.value(value.collection) + } + + if (value._id != null) { + out.name("_id") + out.value(value._id) + } + + if (value.jwt != null) { + out.name("jwt") + out.value(value.jwt) + } + + if (value.body != null) { + out.name("body") + out.jsonValue(JsonSerializer.serialize(value.body!!)) + } + + if (value.volatile != null) { + out.name("volatile") + out.jsonValue(JsonSerializer.serialize(value.volatile!!)) + } + + if (value.requestId != null) { + out.name("requestId") + out.value(value.requestId) + } + + if (value.other != null) { + out.name("action") + MapTypeAdapter.writeObject(out, value.other) + } + out.endObject() + } + + @Throws(IOException::class) + override fun read(`in`: JsonReader): RequestPayload? { + val peek = `in`.peek() + if (peek != JsonToken.BEGIN_OBJECT) { + `in`.nextNull() + return null + } + val request = RequestPayload() + + val other = HashMap() + + `in`.beginObject() + while (`in`.hasNext()) { + val key = `in`.nextName() + when (key) { + "controller" -> { + request.controller = readType(`in`, JsonToken.STRING) + } + "action" -> { + request.action = readType(`in`, JsonToken.STRING) + } + "index" -> { + request.index = readType(`in`, JsonToken.STRING) + } + "collection" -> { + request.collection = readType(`in`, JsonToken.STRING) + } + "_id" -> { + request._id = readType(`in`, JsonToken.STRING) + } + "jwt" -> { + request.jwt = readType(`in`, JsonToken.STRING) + } + "volatile" -> { + request.volatile = readType>(`in`, JsonToken.BEGIN_OBJECT) + } + "body" -> { + request.body = readType>(`in`, JsonToken.BEGIN_OBJECT) + } + "requestId" -> { + request.requestId = readType(`in`, JsonToken.STRING) + } + else -> { + other.put(key, MapTypeAdapter.readObject(`in`)) + } + } + } + `in`.endObject() + + if (other.size > 0) { + request.other = other + } + + return request + } + + fun readType(`in`: JsonReader, type: JsonToken): T? { + val token = `in`.peek() + if (type != token) { + return null + } + + return MapTypeAdapter.readObject(`in`) as T + } +} From c10e6e305c0a148d0906b54f9407e1f3f5b69257 Mon Sep 17 00:00:00 2001 From: Shiranuit Date: Mon, 14 Mar 2022 10:25:29 +0100 Subject: [PATCH 4/6] open Kuzzle class so it can be extended --- src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt index d0479455..76355d66 100644 --- a/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt +++ b/src/main/kotlin/io/kuzzle/sdk/Kuzzle.kt @@ -19,7 +19,7 @@ import java.util.UUID import java.util.concurrent.CompletableFuture import kotlin.collections.HashMap -class Kuzzle { +open class Kuzzle { val protocol: AbstractProtocol val autoResubscribe: Boolean private val queries: HashMap> = HashMap() From 27fc6963234e50eb5176951e05500b7bcc7be6a8 Mon Sep 17 00:00:00 2001 From: Shiranuit Date: Mon, 14 Mar 2022 11:13:12 +0100 Subject: [PATCH 5/6] Release 1.2.3 --- build.gradle.kts | 2 +- doc/1/core-classes/kuzzle/query/index.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 12e54bf5..c10c4c11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ val pomDeveloperId = "kuzzleio" val pomDeveloperName = "kuzzle" group = "io.kuzzle.sdk" -version = "1.2.2" +version = "1.2.3" val ktorVersion = "1.5.2" repositories { diff --git a/doc/1/core-classes/kuzzle/query/index.md b/doc/1/core-classes/kuzzle/query/index.md index 9bc2a97b..b5a9385f 100644 --- a/doc/1/core-classes/kuzzle/query/index.md +++ b/doc/1/core-classes/kuzzle/query/index.md @@ -24,7 +24,7 @@ public CompletableFuture query( throws InternalException, NotConnectedException ``` - + ```java public CompletableFuture query( @@ -50,7 +50,7 @@ public CompletableFuture query( | --------- | ----------------- | ---------------------- | | `query` |
Map | API request    |
 
-
+
 
 | Argument  | Type              | Description            |
 | --------- | ----------------- | ---------------------- |
@@ -101,7 +101,7 @@ Returns a [Response](/sdk/jvm/1/core-classes/response) object which represents a
 fun query(query: Map): CompletableFuture
 ```
 
-
+
 
 ```kotlin
 fun query(query: RawJson): CompletableFuture
@@ -116,7 +116,7 @@ fun query(query: Any): CompletableFuture
 | --------- | ----------------- | ---------------------- |
 | `query` | 
Map | API request    |
 
-
+
 
 | Argument  | Type              | Description            |
 | --------- | ----------------- | ---------------------- |

From b0bfb7fab5732101b46e3dfaa972b6bfde383a89 Mon Sep 17 00:00:00 2001
From: Shiranuit 
Date: Mon, 14 Mar 2022 11:16:46 +0100
Subject: [PATCH 6/6] bump version to 1.2.3

---
 .ci/doc/test-snippet.sh               | 4 ++--
 README.md                             | 8 ++++----
 build.gradle.kts                      | 2 +-
 doc/1/getting-started/java/index.md   | 6 +++---
 doc/1/getting-started/kotlin/index.md | 6 +++---
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/.ci/doc/test-snippet.sh b/.ci/doc/test-snippet.sh
index 5ccb93ac..d121fd3b 100755
--- a/.ci/doc/test-snippet.sh
+++ b/.ci/doc/test-snippet.sh
@@ -4,7 +4,7 @@ set -e
 
 if [ ${1: -3} == ".kt" ]
 then
-  cp /mnt/build/libs/sdk-jvm-[0-9+].[0-9+].[0-9+]-without-dependencies.jar /mnt/.ci/doc/kotlin-project/libs/ && cp $1 /mnt/.ci/doc/kotlin-project/src/main/java/SnippetTest.kt && cd /mnt/.ci/doc/kotlin-project/ && ./gradlew build && java -classpath 'libs/sdk-jvm-1.2.2-without-dependencies.jar:' -jar build/libs/project-1.jar
+  cp /mnt/build/libs/sdk-jvm-[0-9+].[0-9+].[0-9+]-without-dependencies.jar /mnt/.ci/doc/kotlin-project/libs/ && cp $1 /mnt/.ci/doc/kotlin-project/src/main/java/SnippetTest.kt && cd /mnt/.ci/doc/kotlin-project/ && ./gradlew build && java -classpath 'libs/sdk-jvm-1.2.3-without-dependencies.jar:' -jar build/libs/project-1.jar
 else
-  cp /mnt/build/libs/sdk-jvm-[0-9+].[0-9+].[0-9+]-without-dependencies.jar /mnt/.ci/doc/java-project/libs/ && cp $1 /mnt/.ci/doc/java-project/src/main/java/SnippetTest.java && cd /mnt/.ci/doc/java-project/ && ./gradlew build && java -classpath 'libs/sdk-jvm-1.2.2-without-dependencies.jar:' -jar build/libs/project-1.jar
+  cp /mnt/build/libs/sdk-jvm-[0-9+].[0-9+].[0-9+]-without-dependencies.jar /mnt/.ci/doc/java-project/libs/ && cp $1 /mnt/.ci/doc/java-project/src/main/java/SnippetTest.java && cd /mnt/.ci/doc/java-project/ && ./gradlew build && java -classpath 'libs/sdk-jvm-1.2.3-without-dependencies.jar:' -jar build/libs/project-1.jar
 fi
diff --git a/README.md b/README.md
index 13447183..9b3c8760 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,7 @@ https://bintray.com/kuzzle/maven
 
   io.kuzzle
   sdk-jvm
-  1.2.2
+  1.2.3
   pom
 
 ```
@@ -54,19 +54,19 @@ https://bintray.com/kuzzle/maven
 ### Gradle
 
 ```groovy
-compile 'io.kuzzle:sdk-jvm:1.2.2'
+compile 'io.kuzzle:sdk-jvm:1.2.3'
 ```
 
 For amd64:
 
 ```groovy
-compile 'io.kuzzle:sdk-jvm:1.2.2'
+compile 'io.kuzzle:sdk-jvm:1.2.3'
 ```
 
 ### Ivy
 
 ```html
-
+
   
 
 ```
diff --git a/build.gradle.kts b/build.gradle.kts
index c10c4c11..7c616a42 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -15,7 +15,7 @@ plugins {
 
 val artifactName = "sdk-jvm"
 val artifactGroup = "io.kuzzle"
-val artifactVersion = "1.2.2"
+val artifactVersion = "1.2.3"
 
 val pomUrl = "https://github.com/kuzzleio/sdk-jvm"
 val pomScmUrl = "https://github.com/kuzzleio/sdk-jvm"
diff --git a/doc/1/getting-started/java/index.md b/doc/1/getting-started/java/index.md
index 4743e37b..b2db82e2 100644
--- a/doc/1/getting-started/java/index.md
+++ b/doc/1/getting-started/java/index.md
@@ -61,7 +61,7 @@ To build the project, add the following lines:
 
   io.kuzzle
   sdk-jvm
-  1.2.2
+  1.2.3
   pom
 
 ```
@@ -70,14 +70,14 @@ To build the project, add the following lines:
 
 ```groovy
 dependencies {
-  compile 'io.kuzzle:sdk-jvm:1.2.2'
+  compile 'io.kuzzle:sdk-jvm:1.2.3'
 }
 ```
 
 ### Ivy
 
 ```html
-
+
   
 
 ```
diff --git a/doc/1/getting-started/kotlin/index.md b/doc/1/getting-started/kotlin/index.md
index f0d5d88a..4dd2a5c3 100644
--- a/doc/1/getting-started/kotlin/index.md
+++ b/doc/1/getting-started/kotlin/index.md
@@ -73,7 +73,7 @@ To build the project, add the following lines:
 
   io.kuzzle
   sdk-jvm
-  1.2.2
+  1.2.3
   pom
 
 ```
@@ -82,14 +82,14 @@ To build the project, add the following lines:
 
 ```groovy
 dependencies {
-  compile 'io.kuzzle:sdk-jvm:1.2.2'
+  compile 'io.kuzzle:sdk-jvm:1.2.3'
 }
 ```
 
 ### Ivy
 
 ```html
-
+
   
 
 ```