diff --git a/.doc/1/.vuepress b/.doc/1/.vuepress deleted file mode 120000 index c7af454d..00000000 --- a/.doc/1/.vuepress +++ /dev/null @@ -1 +0,0 @@ -../framework/src/.vuepress \ No newline at end of file diff --git a/.doc/1/controllers/auth/check-token/index.md b/.doc/1/controllers/auth/check-token/index.md deleted file mode 100644 index 3fa4b4ed..00000000 --- a/.doc/1/controllers/auth/check-token/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -code: true -type: page -title: CheckToken -description: Checks the validity of an authentication token. ---- - -# CheckToken - -Checks the validity of an authentication token. - -## Arguments - -```go -func (a *Auth) CheckToken(token string) (*TokenValidity, error) -``` - -| Arguments | Type | Description | Required | -| --------- | ------ | ----------- | -------- | -| `token` |
string| the token | yes | - -## Return - -A TokenValidity struct which contains: - -| Name | Type | Description | -| ----------- | ------- | --------------------------------- | -| `Valid` |
boolean| Tell if the token is valid or not | -| `State` |
string| Explain why the token is invalid | -| `Expires_at` |
int| Tells when the token expires | - -## Usage - -<<< ./snippets/check-token.go diff --git a/.doc/1/controllers/auth/check-token/snippets/check-token.go b/.doc/1/controllers/auth/check-token/snippets/check-token.go deleted file mode 100644 index e732e7cc..00000000 --- a/.doc/1/controllers/auth/check-token/snippets/check-token.go +++ /dev/null @@ -1,12 +0,0 @@ -jwt, _ := kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) - -res, err := kuzzle.Auth.CheckToken(jwt) - -if err != nil { - log.Fatal(err) -} else { - if res.Valid != true { - log.Fatal("Invalid token") - } - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/check-token/snippets/check-token.test.yml b/.doc/1/controllers/auth/check-token/snippets/check-token.test.yml deleted file mode 100644 index a502b7c3..00000000 --- a/.doc/1/controllers/auth/check-token/snippets/check-token.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#checkToken -description: Checks a JWT 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/create-my-credentials/index.md b/.doc/1/controllers/auth/create-my-credentials/index.md deleted file mode 100644 index 280b1569..00000000 --- a/.doc/1/controllers/auth/create-my-credentials/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: CreateMyCredentials -description: Creates the current user's credentials for the specified `
string| the strategy to use | -| `credentials` |
json.RawMessage| the new credentials | -| `options` |
QueryOptions| QueryOptions object containing query options | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -A JSON representing the new credentials and an error or `nil`. - -## Usage - -<<< ./snippets/create-my-credentials.go diff --git a/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.go b/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.go deleted file mode 100644 index 057ffa8a..00000000 --- a/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.go +++ /dev/null @@ -1,4 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -kuzzle.Auth.CreateMyCredentials("other", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) - -fmt.Println("Success") \ No newline at end of file diff --git a/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.test.yml b/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.test.yml deleted file mode 100644 index e0e42377..00000000 --- a/.doc/1/controllers/auth/create-my-credentials/snippets/create-my-credentials.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#createMyCredentials -description: Create the current user's credentials for the specified `
string| Strategy to use | yes | -| `options` |
QueryOptions| A structure containing query options | yes | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ------- | --------------------------------- | ------- | -| `Queuable` |
boolean| Make this request queuable or not | `true` | - -## Return - -True if exists, false if not. - -## Usage - -<<< ./snippets/credentials-exist.go diff --git a/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.go b/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.go deleted file mode 100644 index d5cd6ebc..00000000 --- a/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.go +++ /dev/null @@ -1,12 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -res, err := kuzzle.Auth.CredentialsExist("local", nil) - -if err != nil { - log.Fatal(err) -} else { - if res == true { - fmt.Println("Success") - } else { - log.Fatal("Error") - } -} diff --git a/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.test.yml b/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.test.yml deleted file mode 100644 index 0695c926..00000000 --- a/.doc/1/controllers/auth/credentials-exist/snippets/credentials-exist.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#credentialsExist -description: Check 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/delete-my-credentials/index.md b/.doc/1/controllers/auth/delete-my-credentials/index.md deleted file mode 100644 index 72121b5e..00000000 --- a/.doc/1/controllers/auth/delete-my-credentials/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -code: true -type: page -title: DeleteMyCredentials -description: Deletes the current user's credentials for the specified strategy ---- - -# DeleteMyCredentials - -Deletes the current user's credentials for the specified `
string| the strategy to use | yes | -| `options` |
QueryOptions| QueryOptions object containing query options | yes | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil` if the credentials are successfully deleted - -## Usage - -<<< ./snippets/delete-my-credentials.go diff --git a/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.go b/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.go deleted file mode 100644 index ca5ffec7..00000000 --- a/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -err := kuzzle.Auth.DeleteMyCredentials("local", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.test.yml b/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.test.yml deleted file mode 100644 index 40c1482e..00000000 --- a/.doc/1/controllers/auth/delete-my-credentials/snippets/delete-my-credentials.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: auth#deleteMyCredentials -description: Delete 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 -template: default -expected: Success -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/get-current-user/index.md b/.doc/1/controllers/auth/get-current-user/index.md deleted file mode 100644 index 2f8a22d4..00000000 --- a/.doc/1/controllers/auth/get-current-user/index.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -code: true -type: page -title: GetCurrentUser -description: Returns the profile object for the user linked to the `JSON Web Token` ---- - -# GetCurrentUser - -Returns the profile object for the user linked to the `JSON Web Token`, provided in the query or the `Authorization` header. - -## Arguments - -```go -func (a *Auth) GetCurrentUser() (*security.User, error) -``` - -## Return - -A pointer to security.User object containing: - -| Property | Type | Description | -| ------------ | ---------------------- | ----------------------------------- | -| `Id` |
string| The user ID | -| `Content` |
map[string]interface{}| The user content | -| `ProfileIds` |
[]string| An array containing the profile ids | - -## Usage - -<<< ./snippets/get-current-user.go diff --git a/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.go b/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.go deleted file mode 100644 index c445a98d..00000000 --- a/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.GetCurrentUser() - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.test.yml b/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.test.yml deleted file mode 100644 index a9d23a50..00000000 --- a/.doc/1/controllers/auth/get-current-user/snippets/get-current-user.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/get-my-credentials/index.md b/.doc/1/controllers/auth/get-my-credentials/index.md deleted file mode 100644 index 02e6bbd6..00000000 --- a/.doc/1/controllers/auth/get-my-credentials/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -code: true -type: page -title: GetMyCredentials ---- - -# GetMyCredentials - -Returns the current user's credential information for the specified `
string| the strategy to use | yes | -| `options` |
QueryOptions| QueryOptions object containing query options | yes | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns a string representing a JSON with the credentials for the provided authentication strategy and an error or nil. - -## Usage - -<<< ./snippets/get-my-credentials.go diff --git a/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.go b/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.go deleted file mode 100644 index e451ded1..00000000 --- a/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.GetMyCredentials("local", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.test.yml b/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.test.yml deleted file mode 100644 index 395679cf..00000000 --- a/.doc/1/controllers/auth/get-my-credentials/snippets/get-my-credentials.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#getMyCredentials -description: Returns the current user's credential information for the specified `
QueryOptions| QueryOptions object containing query options | yes | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -A pointer to an array of UserRight object containing: - -| Property | Type | Description | -| ------------- | ------ | ----------------------------------------- | -| `Controller` |
string| Controller on wich the rights are applied | -| `Action` |
string| Action on wich the rights are applied | -| `Index` |
string| Index on wich the rights are applied | -| `Collection` |
string| Collection on wich the rights are applied | -| `Value` |
string| Rights (`allowed|denied|conditional`) | - -and an error or `nil` - -## Usage - -<<< ./snippets/get-my-rights.go diff --git a/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.go b/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.go deleted file mode 100644 index 5aaf2750..00000000 --- a/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.GetMyRights(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.test.yml b/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.test.yml deleted file mode 100644 index 7d0b6445..00000000 --- a/.doc/1/controllers/auth/get-my-rights/snippets/get-my-rights.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/get-strategies/index.md b/.doc/1/controllers/auth/get-strategies/index.md deleted file mode 100644 index 7dbe3831..00000000 --- a/.doc/1/controllers/auth/get-strategies/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -code: true -type: page -title: GetStrategies -description: Gets all authentication strategies registered in Kuzzle. ---- - -# GetStrategies - -Gets all authentication strategies registered in Kuzzle. - -## Arguments - -```go -func (a *Auth) GetStrategies(options types.QueryOptions) ([]string, error) -``` - -| Arguments | Type | Description | -| --------- | --------------- | ----------------------------------------------------------------- | -| `options` |
query_options\*| A pointer to a `kuzzleio::query_options` containing query options | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -An array of string containing the list of strategies and an error or nil. - -## Usage - -<<< ./snippets/get-strategies.go diff --git a/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.go b/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.go deleted file mode 100644 index cb41f39e..00000000 --- a/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.GetStrategies(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.test.yml b/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.test.yml deleted file mode 100644 index 2c533aed..00000000 --- a/.doc/1/controllers/auth/get-strategies/snippets/get-strategies.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#getStrategies -description: Get all authentication strategies registered 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/index.md b/.doc/1/controllers/auth/index.md deleted file mode 100644 index 8efaee1c..00000000 --- a/.doc/1/controllers/auth/index.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -code: true -type: branch -title: Auth -description: Auth controller documentation ---- diff --git a/.doc/1/controllers/auth/login/index.md b/.doc/1/controllers/auth/login/index.md deleted file mode 100644 index 1997e6fd..00000000 --- a/.doc/1/controllers/auth/login/index.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -code: true -type: page -title: Login -description: Authenticates a user ---- - -# Login - -Authenticates a user. - -If this action is successful, all further requests emitted by this SDK instance will be in the name of the authenticated user, until either the authenticated token expires, the [logout](/sdk/go/1/controllers/auth/logout) action is called, or the `jwt` property is manually unset. - -## Arguments - -```go -func (a *Auth) Login( - strategy string, - credentials json.RawMessage, - expiresIn *int) (string, error) -``` - - -| Arguments | Type | Description | Required | -| ------------- | ------ | -------------------------------- | -------- | -| `strategy` |
string| Name of the strategy to use | yes | -| `credentials` |
string| Credentials for that strategy | yes | -| `expiresIn` |
int| Expiration time, in milliseconds | no | - -#### strategy - -The name of the authentication [strategy](/core/1/guides/kuzzle-depth/authentication/#authentication) used to log the user in. - -Depending on the chosen authentication `strategy`, additional [credential arguments](/core/1/guides/kuzzle-depth/authentication/#authentication) may be required. -The API request example in this page provides the necessary arguments for the [`local` authentication plugin](https://github.com/kuzzleio/kuzzle-plugin-auth-passport-local). - -Check the appropriate [authentication plugin](/core/1/plugins/guides/strategies/overview/) documentation to get the list of additional arguments to provide. - -### expiresIn - The default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/1/guides/essentials/configuration/). - - -## Return - -The **login** action returns an encrypted JSON Web Token, that must then be sent in the [requests headers](/core/1/api/essentials/query-syntax/). - -## Usage - -<<< ./snippets/login.go diff --git a/.doc/1/controllers/auth/login/snippets/login.go b/.doc/1/controllers/auth/login/snippets/login.go deleted file mode 100644 index 03378bf2..00000000 --- a/.doc/1/controllers/auth/login/snippets/login.go +++ /dev/null @@ -1,7 +0,0 @@ -_, err := kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Printf("Success") -} diff --git a/.doc/1/controllers/auth/login/snippets/login.test.yml b/.doc/1/controllers/auth/login/snippets/login.test.yml deleted file mode 100644 index a5a31c8f..00000000 --- a/.doc/1/controllers/auth/login/snippets/login.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: auth#login -description: Authenticate 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/logout/index.md b/.doc/1/controllers/auth/logout/index.md deleted file mode 100644 index 89307bb3..00000000 --- a/.doc/1/controllers/auth/logout/index.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -code: true -type: page -title: Logout -description: Revokes the user's token & unsubscribe them from registered rooms. ---- - -# Logout - -Revokes the user's token & unsubscribe them from registered rooms. - -## Arguments - -```go -func (a *Auth) Logout() error -``` - -## Return - -Return an error or `nil` if the credentials are successfully deleted - -## Usage - -<<< ./snippets/logout.go diff --git a/.doc/1/controllers/auth/logout/snippets/logout.go b/.doc/1/controllers/auth/logout/snippets/logout.go deleted file mode 100644 index d508dc4d..00000000 --- a/.doc/1/controllers/auth/logout/snippets/logout.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -err := kuzzle.Auth.Logout() - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/logout/snippets/logout.test.yml b/.doc/1/controllers/auth/logout/snippets/logout.test.yml deleted file mode 100644 index 4a3695d7..00000000 --- a/.doc/1/controllers/auth/logout/snippets/logout.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/update-my-credentials/index.md b/.doc/1/controllers/auth/update-my-credentials/index.md deleted file mode 100644 index 18269fd0..00000000 --- a/.doc/1/controllers/auth/update-my-credentials/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: UpdateMyCredentials -description: Updates the current user's credentials for the specified strategy. ---- - -# UpdateMyCredentials - -Updates the current user's credentials for the specified `
string| the strategy to use | -| `credentials` |
json.RawMessage| the new credentials | -| `options` |
QueryOptions| QueryOptions object containing query options | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -A JSON representing the new credentials and an error or `nil`. - -## Usage - -<<< ./snippets/update-my-credentials.go diff --git a/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.go b/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.go deleted file mode 100644 index dd324115..00000000 --- a/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.UpdateMyCredentials("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\",\"other\":\"value\"}"), nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.test.yml b/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.test.yml deleted file mode 100644 index e91e2c64..00000000 --- a/.doc/1/controllers/auth/update-my-credentials/snippets/update-my-credentials.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#updateMyCredentials -description: Update the current user's credentials for the specified `
string| the new credentials | -| `options` |
QueryOptions| QueryOptions object containing query options | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -A pointer to a security.User object and an error or `nil` - -## Usage - -<<< ./snippets/update-self.go diff --git a/.doc/1/controllers/auth/update-self/snippets/update-self.go b/.doc/1/controllers/auth/update-self/snippets/update-self.go deleted file mode 100644 index d7d9aa35..00000000 --- a/.doc/1/controllers/auth/update-self/snippets/update-self.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.UpdateSelf(json.RawMessage("{\"foo\":\"bar\"}"), nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/update-self/snippets/update-self.test.yml b/.doc/1/controllers/auth/update-self/snippets/update-self.test.yml deleted file mode 100644 index 3969ef09..00000000 --- a/.doc/1/controllers/auth/update-self/snippets/update-self.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 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 -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/auth/validate-my-credentials/index.md b/.doc/1/controllers/auth/validate-my-credentials/index.md deleted file mode 100644 index 2ea88ca2..00000000 --- a/.doc/1/controllers/auth/validate-my-credentials/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -code: true -type: page -title: ValidateMyCredentials -description: Validates the current user's credentials for the specified `
string| the strategy to use | -| `credentials` |
string| the new credentials | -| `options` |
QueryOptions| QueryOptions object containing query options | - -### **Options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ------- | --------------------------------- | ------- | -| `Queuable` |
boolean| Make this request queuable or not | `true` | - -## Usage - -<<< ./snippets/validate-my-credentials.go diff --git a/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.go b/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.go deleted file mode 100644 index 834ea589..00000000 --- a/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.go +++ /dev/null @@ -1,8 +0,0 @@ -kuzzle.Auth.Login("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) -_, err := kuzzle.Auth.ValidateMyCredentials("local", json.RawMessage("{\"username\":\"foo\",\"password\":\"bar\"}"), nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.test.yml b/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.test.yml deleted file mode 100644 index 53706942..00000000 --- a/.doc/1/controllers/auth/validate-my-credentials/snippets/validate-my-credentials.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: auth#validateMyCredentials -description: Validate the current user's credentials for the specified `
string| Index name | -| `collection` |
string| Collection name | -| `mapping` |
json.RawMessage| Collection data mapping in JSON format | -| `options` |
QueryOptions| Query options | - -### **mapping** - -An string containing the JSON representation of the collection data mapping. - -The mapping must have a root field `properties` that contain the mapping definition: - -```json -{ - "properties": { - "field1": { "type": "text" }, - "field2": { - "properties": { - "nestedField": { "type": "keyword" } - } - } - } -} -``` - -More informations about database mappings [here](/core/1/guides/essentials/database-mappings). - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil` if collection successfully created. - -## Usage - -<<< ./snippets/create.go diff --git a/.doc/1/controllers/collection/create/snippets/create.go b/.doc/1/controllers/collection/create/snippets/create.go deleted file mode 100644 index aa560825..00000000 --- a/.doc/1/controllers/collection/create/snippets/create.go +++ /dev/null @@ -1,8 +0,0 @@ -mapping := json.RawMessage(`{"properties":{"license": {"type": "text"}}}`) -err := kuzzle.Collection.Create("nyc-open-data", "yellow-taxi", mapping, nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/create/snippets/create.test.yml b/.doc/1/controllers/collection/create/snippets/create.test.yml deleted file mode 100644 index 1b5dcb85..00000000 --- a/.doc/1/controllers/collection/create/snippets/create.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#create -description: Create a new collection -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/delete-specifications/index.md b/.doc/1/controllers/collection/delete-specifications/index.md deleted file mode 100644 index 7a656a87..00000000 --- a/.doc/1/controllers/collection/delete-specifications/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: deleteSpecifications -description: Deletes validation specifications for a collection ---- - -# DeleteSpecifications - -Deletes the validation specifications associated with the collection. - -## Arguments - -```go -DeleteSpecifications(index string, collection string, options types.QueryOptions) error -``` - -| Arguments | Type | Description | -| ------------ | ------------------ | --------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `options` |
types.QueryOptions| Query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil` if collection successfully created. - -## Usage - -<<< ./snippets/delete-specifications.go diff --git a/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.go b/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.go deleted file mode 100644 index bc3abb5b..00000000 --- a/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Collection.DeleteSpecifications("nyc-open-data", "yellow-taxi", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.test.yml b/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.test.yml deleted file mode 100644 index 46060d9c..00000000 --- a/.doc/1/controllers/collection/delete-specifications/snippets/delete-specifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#deleteSpecifications -description: Delete validation specifications for a collection -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/exists/index.md b/.doc/1/controllers/collection/exists/index.md deleted file mode 100644 index 6dbe9f42..00000000 --- a/.doc/1/controllers/collection/exists/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: exists -description: Checks if collection exists ---- - -# Exists - -Checks if a collection exists in Kuzzle. - -## Arguments - -```go -Exists(index string, collection string, options types.QueryOptions) (bool, error) -``` - -| Arguments | Type | Description -| ------------ | ------------------ | ---------------------------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `options` |
types.QueryOptions| An object containing query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -True if the collection exists - -## Usage - -<<< ./snippets/exists.go diff --git a/.doc/1/controllers/collection/exists/snippets/exists.go b/.doc/1/controllers/collection/exists/snippets/exists.go deleted file mode 100644 index b3bc0728..00000000 --- a/.doc/1/controllers/collection/exists/snippets/exists.go +++ /dev/null @@ -1,7 +0,0 @@ -exists, err := kuzzle.Collection.Exists("nyc-open-data", "green-taxi", nil) - -if err != nil { - log.Fatal(err) -} else if exists { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/exists/snippets/exists.test.yml b/.doc/1/controllers/collection/exists/snippets/exists.test.yml deleted file mode 100644 index 62a8a739..00000000 --- a/.doc/1/controllers/collection/exists/snippets/exists.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#exists -description: Check if collection exists -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/green-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/get-mapping/index.md b/.doc/1/controllers/collection/get-mapping/index.md deleted file mode 100644 index 3fa478d1..00000000 --- a/.doc/1/controllers/collection/get-mapping/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: getMapping -description: Returns collection mapping ---- - -# GetMapping - -Returns the mapping for the given `collection`. - -## Arguments - -```go -GetMapping(index string, collection string, options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| ------------ | ------------------ | --------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `options` |
types.QueryOptions| Query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return a json representation of the mapping and an error is something was wrong. - -## Usage - -<<< ./snippets/get-mapping.go diff --git a/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.go b/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.go deleted file mode 100644 index 08e08fbf..00000000 --- a/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.go +++ /dev/null @@ -1,7 +0,0 @@ -mapping, err := kuzzle.Collection.GetMapping("nyc-open-data", "yellow-taxi", nil) - -if err != nil { - log.Fatal(err) -} else if mapping != nil { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.test.yml b/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.test.yml deleted file mode 100644 index 81bef456..00000000 --- a/.doc/1/controllers/collection/get-mapping/snippets/get-mapping.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#getMapping -description: Return collection mapping -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/get-specifications/index.md b/.doc/1/controllers/collection/get-specifications/index.md deleted file mode 100644 index 19da7172..00000000 --- a/.doc/1/controllers/collection/get-specifications/index.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -code: true -type: page -title: getSpecifications -description: Returns the validation specifications ---- - -# GetSpecifications - -Returns the validation specifications associated to the collection. - -## Arguments - -```go -GetSpecifications(index string, collection string, options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| ------------ | ------------------ | --------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `options` |
types.QueryOptions| Query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return a json representation of the specifications and an error is something was wrong. - -## Usage - -<<< ./snippets/get-specifications.go diff --git a/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.go b/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.go deleted file mode 100644 index e7ce1fec..00000000 --- a/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.go +++ /dev/null @@ -1,7 +0,0 @@ -specifications, err := kuzzle.Collection.GetSpecifications("nyc-open-data", "yellow-taxi", nil) - -if err != nil { - log.Fatal(err) -} else if specifications != nil { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.test.yml b/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.test.yml deleted file mode 100644 index f1b60ada..00000000 --- a/.doc/1/controllers/collection/get-specifications/snippets/get-specifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#getSpecifications -description: Returns the validation specifications -hooks: - before: "curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi && curl -X PUT -H \"Content-Type: application/json\" -d '{\"nyc-open-data\": {\"yellow-taxi\": {\"strict\": false,\"fields\": {\"license\": {\"type\": \"string\"}}}}}' kuzzle:7512/_specifications" - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/index.md b/.doc/1/controllers/collection/index.md deleted file mode 100644 index 08ca6d71..00000000 --- a/.doc/1/controllers/collection/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -code: true -type: branch -title: Collection -description: Collection Controller ---- - -# Collection Controller diff --git a/.doc/1/controllers/collection/list/index.md b/.doc/1/controllers/collection/list/index.md deleted file mode 100644 index fb97f174..00000000 --- a/.doc/1/controllers/collection/list/index.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -code: true -type: page -title: list -description: Returns the collection list of an index ---- - -# List - -Returns the complete list of realtime and stored collections in requested index sorted by name in alphanumerical order. -The `from` and `size` arguments allow pagination. They are returned in the response if provided. - -## Arguments - -```go -List(index string, options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | ---------------------------------- | -| `index` |
string| Index name | -| `options` |
types.QueryOptions| An object containing query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | ---------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | -| `from` |
int| Offset of the first result | `0` | -| `size` |
int| Maximum number of returned results | `10` | - -## Return - -Return a json representation of the API return containing the collection list and an error is something was wrong. - -## Usage - -<<< ./snippets/list.go diff --git a/.doc/1/controllers/collection/list/snippets/list.go b/.doc/1/controllers/collection/list/snippets/list.go deleted file mode 100644 index c998b991..00000000 --- a/.doc/1/controllers/collection/list/snippets/list.go +++ /dev/null @@ -1,11 +0,0 @@ -options := types.NewQueryOptions() -options.SetFrom(1) -options.SetSize(1) - -list, err := kuzzle.Collection.List("mtp-open-data", options) - -if err != nil { - log.Fatal(err) -} else if list != nil { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/list/snippets/list.test.yml b/.doc/1/controllers/collection/list/snippets/list.test.yml deleted file mode 100644 index c86ea995..00000000 --- a/.doc/1/controllers/collection/list/snippets/list.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#list -description: Returns the collection list of an index -hooks: - before: curl -X POST kuzzle:7512/mtp-open-data/_create && curl -X PUT kuzzle:7512/mtp-open-data/pink-taxi && curl -X PUT kuzzle:7512/mtp-open-data/dark-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/search-specifications/index.md b/.doc/1/controllers/collection/search-specifications/index.md deleted file mode 100644 index c02f0490..00000000 --- a/.doc/1/controllers/collection/search-specifications/index.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -code: true -type: page -title: searchSpecifications -description: Searches collection specifications ---- - -# SearchSpecifications - -Searches collection specifications. - -There is a limit to how many items can be returned by a single search query. -That limit is by default set at 10000, and you can't get over it even with the from and size pagination options. - -:::info -When processing a large number of items (i.e. more than 1000), it is advised to paginate the results using [SearchResult.next](/sdk/go/1/core-structs/search-result/#methods) rather than increasing the size parameter. -::: - -## Arguments - -```go -SearchSpecifications( - query json.RawMessage, - options types.QueryOptions) (*types.SearchResult, error) -``` - -
json.RawMessage| Query to match | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -| Options | Type (default) | Description | -| ---------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `queuable` |
boolean(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | -| `from` |
int
int
string
string| Index name | -| `collection` |
string| Collection name | -| `options` |
types.QueryOptions| Query options | - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error is something was wrong. - -## Usage - -<<< ./snippets/truncate.go diff --git a/.doc/1/controllers/collection/truncate/snippets/truncate.go b/.doc/1/controllers/collection/truncate/snippets/truncate.go deleted file mode 100644 index 49681b5b..00000000 --- a/.doc/1/controllers/collection/truncate/snippets/truncate.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Collection.Truncate("nyc-open-data", "yellow-taxi", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/truncate/snippets/truncate.test.yml b/.doc/1/controllers/collection/truncate/snippets/truncate.test.yml deleted file mode 100644 index 65e8665c..00000000 --- a/.doc/1/controllers/collection/truncate/snippets/truncate.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#truncate -description: Remove all documents from collection -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/update-mapping/index.md b/.doc/1/controllers/collection/update-mapping/index.md deleted file mode 100644 index 3cef71d9..00000000 --- a/.doc/1/controllers/collection/update-mapping/index.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -code: true -type: page -title: updateMapping -description: Update the collection mapping ---- - -# UpdateMapping - -Update the collection mapping. -Mapping allow you to exploit the full capabilities of our -persistent data storage layer, [ElasticSearch](https://www.elastic.co/products/elasticsearch) (check here the [mapping capabilities of ElasticSearch](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/mapping.html)). - -## Arguments - -```go -UpdateMapping(index string, collection string, mapping json.RawMessage, options types.QueryOptions) error -``` - -| Arguments | Type | Description | -| ------------ | --------------- | -------------------------------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `mapping` |
json.RawMessage| Collection data mapping in JSON format | -| `options` |
QueryOptions| Query options | - -### **mapping** - -An string containing the JSON representation of the collection data mapping. - -The mapping must have a root field `properties` that contain the mapping definition: - -```json -{ - "properties": { - "field1": { "type": "text" }, - "field2": { - "properties": { - "nestedField": { "type": "keyword" } - } - } - } -} -``` - -More informations about database mappings [here](/core/1/guides/essentials/database-mappings). - -### **options** - -Additional query options - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error if something went wrong. - -## Usage - -<<< ./snippets/update-mapping.go diff --git a/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.go b/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.go deleted file mode 100644 index fe0dfa68..00000000 --- a/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.go +++ /dev/null @@ -1,8 +0,0 @@ -mapping := json.RawMessage(`{"properties":{"plate": {"type": "keyword"}}}`) -err := kuzzle.Collection.UpdateMapping("nyc-open-data", "yellow-taxi", mapping, nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.test.yml b/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.test.yml deleted file mode 100644 index 899d4a6b..00000000 --- a/.doc/1/controllers/collection/update-mapping/snippets/update-mapping.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#updateMapping -description: Update the collection mapping -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/update-specifications/index.md b/.doc/1/controllers/collection/update-specifications/index.md deleted file mode 100644 index 8b3b5ca8..00000000 --- a/.doc/1/controllers/collection/update-specifications/index.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -code: true -type: page -title: updateSpecifications -description: Updates the validation specifications ---- - -# UpdateSpecifications - -The updateSpecifications method allows you to create or update the validation specifications for one or more index/collection pairs. - -When the validation specification is not formatted correctly, a detailed error message is returned to help you to debug. - -## Arguments - -```go -UpdateSpecifications(index string, collection string, specifications json.RawMessage, options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| ---------------- | --------------- | ----------------------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `specifications` |
json.RawMessage| Specifications in JSON format | -| `options` |
QueryOptions| Query options | - -### **specifications** - -A JSON representation of the specifications. - -The JSON must follow the [Specification Structure](/core/1/guides/cookbooks/datavalidation): - -```json -{ - "strict": "
bool| Make this request queuable or not | `true` | - -## Return - -Return a JSON representation of the specifications. -Return an error with a global description of errors. - -## Usage - -<<< ./snippets/update-specifications.go diff --git a/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.go b/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.go deleted file mode 100644 index 59abf3ac..00000000 --- a/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.go +++ /dev/null @@ -1,8 +0,0 @@ -specifications := json.RawMessage(`{ "strict": false, "fields": { "license": { "mandatory": true, "type": "string" } } }`) -response, err := kuzzle.Collection.UpdateSpecifications("nyc-open-data", "yellow-taxi", specifications, nil) - -if err != nil { - log.Fatal(err) -} else if response != nil { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.test.yml b/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.test.yml deleted file mode 100644 index 0dfcb58b..00000000 --- a/.doc/1/controllers/collection/update-specifications/snippets/update-specifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#updateSpecifications -description: Update the validation specifications -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/green-taxi - after: curl -X DELETE kuzzle:7512/nyc-open-data/yellow-taxi/_specifications -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/collection/validate-specifications/index.md b/.doc/1/controllers/collection/validate-specifications/index.md deleted file mode 100644 index 828a3eea..00000000 --- a/.doc/1/controllers/collection/validate-specifications/index.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -code: true -type: page -title: validateSpecifications -description: Validates specifications format ---- - -# ValidateSpecifications - -The validateSpecifications method checks if a validation specification is well formatted. It does not store nor modify the existing specification. - -When the validation specification is not formatted correctly, a detailed error message is returned to help you to debug. - -## Arguments - -```go -ValidateSpecifications(index string, collection string, specifications json.RawMessage, options types.QueryOptions) (types.ValidationResponse, error) -``` - -| Arguments | Type | Description | -| ---------------- | --------------- | -------------------------------------- | -| `index` |
string| Index name | -| `collection` |
string| Collection name | -| `specifications` |
json.RawMessage| Collection data mapping in JSON format | -| `options` |
QueryOptions| Query options | - -### **specifications** - -A JSON representation of the specifications. - -The JSON must follow the [Specification Structure](/core/1/guides/cookbooks/datavalidation): - -```json -{ - "myindex": { - "mycollection": { - "strict": "
bool| Make this request queuable or not | `true` | - -## Return - -A `types.ValidationResponse` which contain information about the specifications validity. - -| Property | Type | Description | -| ------------- | ------------------- | --------------------------------------- | -| `Valid` | bool | Specification validity | -| `Details` |
[]string| Details about each specification errors | -| `Description` | string | General error message | - -## Usage - -<<< ./snippets/validate-specifications.go diff --git a/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.go b/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.go deleted file mode 100644 index a988e248..00000000 --- a/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.go +++ /dev/null @@ -1,8 +0,0 @@ -specifications := json.RawMessage(`{ "strict": false, "fields": { "license": { "mandatory": true, "type": "string" } } }`) -vr, err := kuzzle.Collection.ValidateSpecifications("nyc-open-data", "yellow-taxi", specifications, nil) - -if err != nil { - log.Fatal(err) -} else if vr.Valid == true { - fmt.Println("Success") -} diff --git a/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.test.yml b/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.test.yml deleted file mode 100644 index a0e2f0e2..00000000 --- a/.doc/1/controllers/collection/validate-specifications/snippets/validate-specifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: collection#validateSpecifications -description: Validate specifications format -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create && curl -X PUT kuzzle:7512/nyc-open-data/green-taxi - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/document/count/index.md b/.doc/1/controllers/document/count/index.md deleted file mode 100644 index 6f82657e..00000000 --- a/.doc/1/controllers/document/count/index.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -code: true -type: page -title: count -description: Counts documents matching the given query ---- - -# Count - -Counts documents in a collection. - -A query can be provided to alter the count result, otherwise returns the total number of documents in the collection. - -Kuzzle uses the [ElasticSearch Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-dsl.html) syntax. - -## Arguments - -```go -Count( - index string, - collection string, - query json.RawMessage, - options types.QueryOptions) (int, error) -``` - -
string| Index name | -| `collection` |
string| Collection name | -| `query` |
json.RawMessage| Query to match | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Optional document id. If set to a blank string, will use a auto-generated id | -| `document` |
json.RawMessage| Document content | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Set to `created` in case of success and `updated` if the document already exists | - -## Usage - -<<< ./snippets/create.go diff --git a/.doc/1/controllers/document/create/snippets/create.go b/.doc/1/controllers/document/create/snippets/create.go deleted file mode 100644 index aa1edc9a..00000000 --- a/.doc/1/controllers/document/create/snippets/create.go +++ /dev/null @@ -1,34 +0,0 @@ -response, err := kuzzle.Document.Create("nyc-open-data", "yellow-taxi", "some-id", json.RawMessage(`{"lastName": "Eggins"}`), nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println(string(response)) - /* - { - "_index": "nyc-open-data", - "_type": "yellow-taxi", - "_id": "some-id", - "_version": 1, - "result": "created", - "_shards": { - "total": 2, - "successful": 1, - "failed": 0 - }, - "created": true, - "_source": { - "lastName": "Eggins", - "_kuzzle_info": { - "author": "-1", - "createdAt": 1537445737667, - "updatedAt": null, - "updater": null, - "active": true, - "deletedAt": null - } - } - } - */ - fmt.Println("Success") -} diff --git a/.doc/1/controllers/document/create/snippets/create.test.yml b/.doc/1/controllers/document/create/snippets/create.test.yml deleted file mode 100644 index 0222d9c0..00000000 --- a/.doc/1/controllers/document/create/snippets/create.test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: document#create -description: Create a new document -hooks: - before: | - curl -XDELETE kuzzle:7512/nyc-open-data - curl -XPOST kuzzle:7512/nyc-open-data/_create - curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi - after: | - curl -XDELETE kuzzle:7512/nyc-open-data -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/document/createOrReplace/index.md b/.doc/1/controllers/document/createOrReplace/index.md deleted file mode 100644 index 0182b5dc..00000000 --- a/.doc/1/controllers/document/createOrReplace/index.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -code: true -type: page -title: createOrReplace -description: Creates or replaces a document ---- - -# CreateOrReplace - -Creates a new document in the persistent data storage, or replaces its content if it already exists. - -The optional parameter `refresh` can be used with the value `wait_for` in order to wait for the document to be indexed (indexed documents are available for `search`). - -## Arguments - -```go -CreateOrReplace( - index string, - collection string, - _id string, - document json.RawMessage, - options types.QueryOptions) (json.RawMessage, error) -``` - -
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Document ID | -| `document` |
json.RawMessage| Document content | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Set to `created` in case of success and `updated` if the document already exists | - -## Usage - -<<< ./snippets/create-or-replace.go diff --git a/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.go b/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.go deleted file mode 100644 index 6adf30d9..00000000 --- a/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.go +++ /dev/null @@ -1,40 +0,0 @@ -response, err := kuzzle.Document.CreateOrReplace( - "nyc-open-data", - "yellow-taxi", - "some-id", - json.RawMessage(`{"lastName": "McHan"}`), - nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println(string(response)) - /* - { - "_index": "nyc-open-data", - "_type": "yellow-taxi", - "_id": "some-id", - "_version": 1, - "result": "created", - "_shards": { - "total": 2, - "successful": 1, - "failed": 0 - }, - "created": true, - "_source": { - "lastName": "McHan", - "_kuzzle_info": { - "author": "-1", - "createdAt": 1537445737667, - "updatedAt": null, - "updater": null, - "active": true, - "deletedAt": null - } - } - } - */ - fmt.Println("Success") -} - diff --git a/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.test.yml b/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.test.yml deleted file mode 100644 index 158e88fb..00000000 --- a/.doc/1/controllers/document/createOrReplace/snippets/create-or-replace.test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: document#createOrReplace -description: Creates or replaces a document -hooks: - before: | - curl -XDELETE kuzzle:7512/nyc-open-data - curl -XPOST kuzzle:7512/nyc-open-data/_create - curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi - after: | - curl -XDELETE kuzzle:7512/index -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/controllers/document/delete/index.md b/.doc/1/controllers/document/delete/index.md deleted file mode 100644 index ef452bda..00000000 --- a/.doc/1/controllers/document/delete/index.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -code: true -type: page -title: delete -description: Deletes a document from kuzzle ---- - -# Delete - -Deletes a document. - -The optional parameter `refresh` can be used with the value `wait_for` in order to wait for the document to be indexed (and to no longer be available in search). - -## Arguments - -```go -Delete( - index string, - collection string, - _id string, - options types.QueryOptions) (string, error) -``` - -
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Document ID | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `query` |
string| Query to match | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Document ID | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `collection` |
string| Collection name | -| `documents` |
json.RawMessage| JSON array of documents to create | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `documents` |
json.RawMessage| JSON array of documents to create | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `ids` |
[]string| The ids of the documents to delete | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `ids` |
[]string| Document IDs | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `collection` |
string| Collection name | -| `documents` |
json.RawMessage| Document contents to update | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `documents` |
json.RawMessage| Document contents to update | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
int
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Document ID | -| `document` |
string| Document body | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
string| Index name | -| `collection` |
string| Collection name | -| `query` |
json.RawMessage| Search query | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
int
int
string
string| Index name | -| `collection` |
string| Collection name | -| `id` |
string| Document ID | -| `document` |
string| Document body | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string
int
string| Newly created document ID | -| \_version | int | Version of the document in the persistent data storage | -| result |
string| Set to `updated` in case of success | - -## Usage - -<<< ./snippets/update.go diff --git a/.doc/1/controllers/document/update/snippets/update.go b/.doc/1/controllers/document/update/snippets/update.go deleted file mode 100644 index 26c40944..00000000 --- a/.doc/1/controllers/document/update/snippets/update.go +++ /dev/null @@ -1,33 +0,0 @@ -kuzzle.Document.Create( - "nyc-open-data", - "yellow-taxi", - "some-id", - json.RawMessage(`{"capacity": 4}`), - nil) - -response, err := kuzzle.Document.Update( - "nyc-open-data", - "yellow-taxi", - "some-id", - json.RawMessage(`{"category": "suv"}`), - nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println(string(response)) - /* - { - "_index": "nyc-open-data", - "_type": "yellow-taxi", - "_id": "some-id", - "_version": 2, - "result": "updated", - "_shards": { - "total": 2, - "successful": 1, - "failed": 0 - } - } - */ -} diff --git a/.doc/1/controllers/document/update/snippets/update.test.yml b/.doc/1/controllers/document/update/snippets/update.test.yml deleted file mode 100644 index ea5ca64c..00000000 --- a/.doc/1/controllers/document/update/snippets/update.test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: document#update -description: Update a document -hooks: - before: | - curl -XDELETE kuzzle:7512/nyc-open-data - curl -XPOST kuzzle:7512/nyc-open-data/_create - curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi - after: | - curl -XDELETE kuzzle:7512/nyc-open-data -template: default -expected: '{"_index":"nyc-open-data","_type":"yellow-taxi","_id":"some-id","_version":2,"result":"updated","' - -sdk: go -version: 1 diff --git a/.doc/1/controllers/document/validate/index.md b/.doc/1/controllers/document/validate/index.md deleted file mode 100644 index 631affac..00000000 --- a/.doc/1/controllers/document/validate/index.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -code: true -type: page -title: validate -description: Validates a document ---- - -# Validate - -Validates data against existing validation rules. - -Note that if no validation specifications are set for the `
string| Index name | -| `collection` |
string| Collection name | -| `document` |
string| Document body | -| `options` |
types.QueryOptions| A struct containing query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil` if index successfully created. - -## Usage - -<<< ./snippets/create.go diff --git a/.doc/1/controllers/index/create/snippets/create.go b/.doc/1/controllers/index/create/snippets/create.go deleted file mode 100644 index d5a11469..00000000 --- a/.doc/1/controllers/index/create/snippets/create.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Index.Create("nyc-open-data", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("index created") -} diff --git a/.doc/1/controllers/index/create/snippets/create.test.yml b/.doc/1/controllers/index/create/snippets/create.test.yml deleted file mode 100644 index e984d053..00000000 --- a/.doc/1/controllers/index/create/snippets/create.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#create -description: create a new index -hooks: - before: curl -X DELETE kuzzle:7512/nyc-open-data - after: -template: default -expected: index created - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/delete/index.md b/.doc/1/controllers/index/delete/index.md deleted file mode 100644 index 6a6a24b8..00000000 --- a/.doc/1/controllers/index/delete/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -code: true -type: page -title: delete -description: Deletes an index ---- - -# Delete - -Deletes an entire index from Kuzzle. - -## Arguments - -```go -Delete(index string, options types.QueryOptions) error -``` - -| Arguments | Type | Description | -| --------- | ------------ | ------------- | -| `index` |
string| Index name | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns an error or `nil` if the request succeed. - -## Usage - -<<< ./snippets/delete.go diff --git a/.doc/1/controllers/index/delete/snippets/delete.go b/.doc/1/controllers/index/delete/snippets/delete.go deleted file mode 100644 index 348e8893..00000000 --- a/.doc/1/controllers/index/delete/snippets/delete.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Index.Delete("nyc-open-data", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("index deleted") -} diff --git a/.doc/1/controllers/index/delete/snippets/delete.test.yml b/.doc/1/controllers/index/delete/snippets/delete.test.yml deleted file mode 100644 index cd1b7543..00000000 --- a/.doc/1/controllers/index/delete/snippets/delete.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#delete -description: delete an index -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: index deleted - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/exists/index.md b/.doc/1/controllers/index/exists/index.md deleted file mode 100644 index 8b6d71e6..00000000 --- a/.doc/1/controllers/index/exists/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -code: true -type: page -title: exists -description: Checks for index existence ---- - -# Exists - -Checks if the given index exists in Kuzzle. - -## Arguments - -```go -Exists(index string, options types.QueryOptions) (bool, error) -``` - -| Arguments | Type | Description | -| --------- | ------------ | ------------- | -| `index` |
string| Index name | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns a `bool` that indicate whether the index exists, or an error - -## Usage - -<<< ./snippets/exists.go diff --git a/.doc/1/controllers/index/exists/snippets/exists.go b/.doc/1/controllers/index/exists/snippets/exists.go deleted file mode 100644 index cbd92479..00000000 --- a/.doc/1/controllers/index/exists/snippets/exists.go +++ /dev/null @@ -1,9 +0,0 @@ -exists, err := kuzzle.Index.Exists("nyc-open-data", nil) - -if err != nil { - log.Fatal(err) -} else if exists == true { - fmt.Println("index exists") -} else { - fmt.Println("index does not exist") -} diff --git a/.doc/1/controllers/index/exists/snippets/exists.test.yml b/.doc/1/controllers/index/exists/snippets/exists.test.yml deleted file mode 100644 index 831d5585..00000000 --- a/.doc/1/controllers/index/exists/snippets/exists.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#exists -description: test if an index exists -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: index exists - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/get-auto-refresh/index.md b/.doc/1/controllers/index/get-auto-refresh/index.md deleted file mode 100644 index dbcef2a3..00000000 --- a/.doc/1/controllers/index/get-auto-refresh/index.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -code: true -type: page -title: getAutoRefresh -description: Returns the status of autorefresh flag ---- - -# GetAutoRefresh - -The getAutoRefresh action returns the current autorefresh status for the index. - -Each index has an autorefresh flag. -When set to true, each write request trigger a [refresh](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html) action on Elasticsearch. -Without a refresh after a write request, the documents may not be immediately visible in search. - -:::info -A refresh operation comes with some performance costs. -While forcing the autoRefresh can be convenient on a development or test environment, -we recommend that you avoid using it in production or at least carefully monitor its implications before using it. -::: - -## Arguments - -```go -GetAutoRefresh(index string, options types.QueryOptions) (bool, error) -``` - -| Arguments | Type | Description | -| --------- | ------------ | ------------- | -| `index` |
string| Index name | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns a `bool` that indicate the status of the **autoRefresh** flag. - -## Usage - -<<< ./snippets/getAutoRefresh.go diff --git a/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.go b/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.go deleted file mode 100644 index 83338dc5..00000000 --- a/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.go +++ /dev/null @@ -1,9 +0,0 @@ -status, err := kuzzle.Index.GetAutoRefresh("nyc-open-data", nil) - -if err != nil { - log.Fatal(err) -} else if status == true { - fmt.Println("autorefresh is true") -} else { - fmt.Println("autorefresh is false") -} diff --git a/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.test.yml b/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.test.yml deleted file mode 100644 index f8a84f53..00000000 --- a/.doc/1/controllers/index/get-auto-refresh/snippets/getAutoRefresh.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#getAutoRefresh -description: Return autorefresh status for index -hooks: - before: curl -X DELETE kuzzle:7512/nyc-open-data && curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: autorefresh is false - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/index.md b/.doc/1/controllers/index/index.md deleted file mode 100644 index 8d74e9c0..00000000 --- a/.doc/1/controllers/index/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -code: true -type: branch -title: Index -description: Index Controller ---- - -# Index Controller diff --git a/.doc/1/controllers/index/list/index.md b/.doc/1/controllers/index/list/index.md deleted file mode 100644 index dd87fa39..00000000 --- a/.doc/1/controllers/index/list/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -code: true -type: page -title: list -description: Lists the indexes ---- - -# List - -Gets the complete list of indexes handled by Kuzzle. - -## Arguments - -```go -List(options types.QueryOptions) ([]string, error) -``` - -| Arguments | Type | Description | -| --------- | ------------ | ------------- | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns an `Array` of strings containing the list of indexes names present in Kuzzle or an error - -## Usage - -<<< ./snippets/list.go diff --git a/.doc/1/controllers/index/list/snippets/list.go b/.doc/1/controllers/index/list/snippets/list.go deleted file mode 100644 index f2c71c64..00000000 --- a/.doc/1/controllers/index/list/snippets/list.go +++ /dev/null @@ -1,7 +0,0 @@ -indexes, err := kuzzle.Index.List(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Printf("Kuzzle contains %d indexes", len(indexes)) -} diff --git a/.doc/1/controllers/index/list/snippets/list.test.yml b/.doc/1/controllers/index/list/snippets/list.test.yml deleted file mode 100644 index 46eda29f..00000000 --- a/.doc/1/controllers/index/list/snippets/list.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#list -description: list indexes handled by Kuzzle -hooks: - before: curl -X POST kuzzle:7512/admin/_resetDatabase && curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: Kuzzle contains 1 indexes - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/m-delete/index.md b/.doc/1/controllers/index/m-delete/index.md deleted file mode 100644 index eed7a44b..00000000 --- a/.doc/1/controllers/index/m-delete/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -code: true -type: page -title: mDelete -description: Deletes multiple indexes ---- - -# mDelete - -Deletes multiple indexes at once. - -## Arguments - -```go -MDelete(indexes []string, options types.QueryOptions) ([]string, error) -``` - -| Arguments | Type | Description | -| --------- | ------------ | --------------------------------------------- | -| `indexes` |
Array| An array of strings containing indexes names. | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Returns an `Array` of strings containing the list of indexes names deleted or an error - -## Usage - -<<< ./snippets/mDelete.go diff --git a/.doc/1/controllers/index/m-delete/snippets/mDelete.go b/.doc/1/controllers/index/m-delete/snippets/mDelete.go deleted file mode 100644 index 6ee8cf59..00000000 --- a/.doc/1/controllers/index/m-delete/snippets/mDelete.go +++ /dev/null @@ -1,9 +0,0 @@ -indexes := []string{"nyc-open-data", "mtp-open-data"} - -deleted, err := kuzzle.Index.MDelete(indexes, nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Printf("Successfully deleted %d indexes", len(deleted)) -} diff --git a/.doc/1/controllers/index/m-delete/snippets/mDelete.test.yml b/.doc/1/controllers/index/m-delete/snippets/mDelete.test.yml deleted file mode 100644 index 9a364e19..00000000 --- a/.doc/1/controllers/index/m-delete/snippets/mDelete.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#mDelete -description: Delete multiple indexes -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X POST kuzzle:7512/mtp-open-data/_create - after: -template: default -expected: Successfully deleted 2 indexes - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/refresh-internal/index.md b/.doc/1/controllers/index/refresh-internal/index.md deleted file mode 100644 index f222d95b..00000000 --- a/.doc/1/controllers/index/refresh-internal/index.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -code: true -type: page -title: refreshInternal -description: Forces refresh of Kuzzle internal index ---- - -# RefreshInternal - -When writing or deleting security and internal documents (users, roles, profiles, configuration, etc.) in Kuzzle, the update needs to be indexed before being reflected in the search index. - -The `refreshInternal` action forces a [refresh](/sdk/go/1/controllers/index/refresh/), on the internal index, making the documents available to search immediately. - -::: info -A refresh operation comes with some performance costs. - -From [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html): -"While a refresh is much lighter than a commit, it still has a performance cost. A manual refresh can be useful when writing tests, but don’t do a manual refresh every time you index a document in production; it will hurt your performance. Instead, your application needs to be aware of the near real-time nature of Elasticsearch and make allowances for it." -::: - -## Arguments - -```go -RefreshInternal(options types.QueryOptions) error -``` - -
QueryOptions| Query options | - -### Options - -The `options` arguments can contain the following option properties: - -| Option | Type (default) | Description | -| ---------- | -------------- | --------------------------------- | -| `queuable` |
bool (true)| If true, queues the request during downtime, until connected to Kuzzle again | - -## Return - -Return an error or `nil` if index successfully refreshed. - -## Usage - -<<< ./snippets/refreshInternal.go diff --git a/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.go b/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.go deleted file mode 100644 index bda8d77d..00000000 --- a/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Index.RefreshInternal(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Internal index successfully refreshed") -} diff --git a/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.test.yml b/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.test.yml deleted file mode 100644 index 1e03bcf0..00000000 --- a/.doc/1/controllers/index/refresh-internal/snippets/refreshInternal.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#refreshInternal -description: Force refresh of Kuzzle internal index -hooks: - before: - after: -template: default -expected: Internal index successfully refreshed - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/refresh/index.md b/.doc/1/controllers/index/refresh/index.md deleted file mode 100644 index 5d80b1c8..00000000 --- a/.doc/1/controllers/index/refresh/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -code: true -type: page -title: refresh -description: Forces Elasticsearch search index update ---- - -# Refresh - -When writing or deleting documents in Kuzzle, the update needs to be indexed before being available in search results. - -:::info -A refresh operation comes with some performance costs. - -From [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docs-refresh.html): -> "While a refresh is much lighter than a commit, it still has a performance cost. A manual refresh can be useful when writing tests, but don’t do a manual refresh every time you index a document in production; it will hurt your performance. Instead, your application needs to be aware of the near real-time nature of Elasticsearch and make allowances for it." -::: - -## Arguments - -```go -Refresh(index string, options types.QueryOptions) error -``` - -| Arguments | Type | Description | -| --------- | ------------ | ------------- | -| `index` |
string| Index name | -| `options` |
QueryOptions| Query options | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil` if index successfully refreshed. - -## Usage - -<<< ./snippets/refresh.go diff --git a/.doc/1/controllers/index/refresh/snippets/refresh.go b/.doc/1/controllers/index/refresh/snippets/refresh.go deleted file mode 100644 index b6344a7c..00000000 --- a/.doc/1/controllers/index/refresh/snippets/refresh.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Index.Refresh("nyc-open-data", nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("0 shards fail to refresh") -} diff --git a/.doc/1/controllers/index/refresh/snippets/refresh.test.yml b/.doc/1/controllers/index/refresh/snippets/refresh.test.yml deleted file mode 100644 index 0169d00f..00000000 --- a/.doc/1/controllers/index/refresh/snippets/refresh.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#refresh -description: Force Elasticsearch search index update -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: 0 shards fail to refresh - -sdk: go -version: 1 diff --git a/.doc/1/controllers/index/set-auto-refresh/index.md b/.doc/1/controllers/index/set-auto-refresh/index.md deleted file mode 100644 index f642ec60..00000000 --- a/.doc/1/controllers/index/set-auto-refresh/index.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -code: true -type: page -title: setAutoRefresh -description: Sets the autorefresh flag ---- - -# setAutoRefresh(index, autorefresh, [options]) - -The setAutoRefresh action allows to set the autorefresh flag for the index. - -Each index has an autorefresh flag. -When set to true, each write request trigger a [refresh](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html) action on Elasticsearch. -Without a refresh after a write request, the documents may not be immediately visible in search. - -:::info -A refresh operation comes with some performance costs. -While forcing the autoRefresh can be convenient on a development or test environment, -we recommend that you avoid using it in production or at least carefully monitor its implications before using it. -::: - -## Arguments - -```go -SetAutoRefresh(index string, autoRefresh bool, options types.QueryOptions) error -``` - -| Arguments | Type | Description | -| ------------- | ------------ | ---------------- | -| `index` |
string| Index name | -| `autoRefresh` |
Boolean| autoRefresh flag | -| `options` |
QueryOptions| Query options | no | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `queuable` |
bool| Make this request queuable or not | `true` | - -## Return - -Return an error or `nil`. - -## Usage - -<<< ./snippets/setAutoRefresh.go diff --git a/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.go b/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.go deleted file mode 100644 index fd177158..00000000 --- a/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Index.SetAutoRefresh("nyc-open-data", true, nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("autorefresh flag is set to true") -} diff --git a/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.test.yml b/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.test.yml deleted file mode 100644 index 0501ffbc..00000000 --- a/.doc/1/controllers/index/set-auto-refresh/snippets/setAutoRefresh.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: index#setAutoRefresh -description: Set the autorefresh flag for the index -hooks: - before: curl -X DELETE kuzzle:7512/nyc-open-data && curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: autorefresh flag is set to true - -sdk: go -version: 1 diff --git a/.doc/1/controllers/realtime/count/index.md b/.doc/1/controllers/realtime/count/index.md deleted file mode 100644 index fed7e3c9..00000000 --- a/.doc/1/controllers/realtime/count/index.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -code: true -type: page -title: Count -description: Counts subscribers for a subscription room ---- - -# Count - -Returns the number of other connections sharing the same subscription. - -## Arguments - -```go -func (r *Realtime) Count(roomID string, options types.QueryOptions) (int, error) -``` - -
string| Subscription room ID | -| `options` |
types.QueryOptions| Query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `collection` |
string| Collection name | -| `message` |
json.RawMessage| Message to send | -| `options` |
types.QueryOptions| Query options | - -### options - -Additional query options - -| Option | Type
bool
string| Index name | -| `collection` |
string| Collection name | -| `filters` |
json.RawMessage| A set of filters following [Koncorde syntax](/core/1/guides/cookbooks/realtime-api/) | -| `listener` |
chan<- types.NotificationResult| Channel receiving the notification | -| `options` |
types.RoomOptions| A struct containing subscription options | - -### listener - -A channel for [types.NotificationResult](/sdk/go/1/essentials/realtime-notifications) objects. -The channel will receive an object each time a new notifications is received. - -### options - -Additional subscription options. - -| Property | Type
string
string
bool
json.RawMessage
string| The room ID | -| `Channel` |
string| The channel ID | - -## Usage - -_Simple subscription to document notifications_ - -<<< ./snippets/document-notifications.go - -_Subscription to document notifications with scope option_ - -<<< ./snippets/document-notifications-leave-scope.go - -_Subscription to message notifications_ - -<<< ./snippets/message-notifications.go - -_Subscription to user notifications_ - -<<< ./snippets/user-notifications.go diff --git a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.go b/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.go deleted file mode 100644 index d45c034c..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.go +++ /dev/null @@ -1,42 +0,0 @@ -// Subscribe to notifications for documents containing a 'name' property -filters := json.RawMessage(`{ "range": { "age": { "lte": 20 } } }`) - -// Start an async listener -listener := make(chan types.NotificationResult) -go func() { - notification := <-listener - - fmt.Printf("Document moved %s from the scope\n", notification.Scope) -}() - -options := types.NewRoomOptions() -options.SetScope(types.SCOPE_OUT) - -_, err := kuzzle.Realtime.Subscribe( - "nyc-open-data", - "yellow-taxi", - filters, - listener, - options) - -if err != nil { - log.Fatal(err) -} - -document := json.RawMessage(`{ "name": "nina vkote", "age": 19 }`) - -// The document is in the scope -kuzzle.Document.Create( - "nyc-open-data", - "yellow-taxi", - "nina-vkote", - document, - nil) - -// The document isn't in the scope anymore -kuzzle.Document.Update( - "nyc-open-data", - "yellow-taxi", - "nina-vkote", - json.RawMessage(`{ "age": 42 }`), - nil) diff --git a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.test.yml b/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.test.yml deleted file mode 100644 index 0d145198..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications-leave-scope.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: realtime#subscribe-documents-leave-scope -description: Subscribe to documents leaving the scope -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/; curl -X DELETE kuzzle:7512/nyc-open-data/yellow-taxi/nina-vkote - after: -template: realtime -expected: Document moved out from the scope - -sdk: go -version: 1 diff --git a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.go b/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.go deleted file mode 100644 index a18efdf2..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.go +++ /dev/null @@ -1,33 +0,0 @@ -// Subscribe to notifications for documents containing a 'name' property -filters := json.RawMessage(`{ "exists": "name" }`) - -// Start an async listener -listener := make(chan types.NotificationResult) -go func() { - notification := <-listener - - if notification.Scope == "in" { - fmt.Printf("Document %s enter the scope\n", notification.Result.Id) - } else { - fmt.Printf("Document %s leave the scope\n", notification.Result.Id) - } -}() - -_, err := kuzzle.Realtime.Subscribe( - "nyc-open-data", - "yellow-taxi", - filters, - listener, - nil) - -if err != nil { - log.Fatal(err) -} - -document := json.RawMessage(`{ "name": "nina vkote", "age": 19 }`) -kuzzle.Document.Create( - "nyc-open-data", - "yellow-taxi", - "nina-vkote", - document, - nil) diff --git a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.test.yml b/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.test.yml deleted file mode 100644 index 825a7f3e..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/document-notifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: realtime#subscribe-documents -description: Simple subscribe to document notifications -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ ; curl -X DELETE kuzzle:7512/nyc-open-data/yellow-taxi/nina-vkote - after: -template: realtime -expected: Document nina-vkote enter the scope - -sdk: go -version: 1 diff --git a/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.go b/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.go deleted file mode 100644 index ae0189b1..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.go +++ /dev/null @@ -1,23 +0,0 @@ -// Start an async listener -listener := make(chan types.NotificationResult) -go func() { - <-listener - - fmt.Printf("Message notification received") -}() - -// Subscribe to a room -_, err := kuzzle.Realtime.Subscribe( - "i-dont-exist", - "i-database", - json.RawMessage(`{}`), - listener, - nil) - -if err != nil { - log.Fatal(err) -} - -message := json.RawMessage(`{ "metAt": "Insane", "hello": "world" }`) -// Publish a message to this room -kuzzle.Realtime.Publish("i-dont-exist", "i-database", message, nil) diff --git a/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.test.yml b/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.test.yml deleted file mode 100644 index 80761808..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/message-notifications.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: realtime#subscribe-messages -description: Subscribe to message notifications -hooks: - before: - after: -template: realtime -expected: Message notification received - -sdk: go -version: 1 diff --git a/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.go b/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.go deleted file mode 100644 index 3f75da7f..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.go +++ /dev/null @@ -1,51 +0,0 @@ -// Subscribe to notifications for documents containing a 'name' property -filters := json.RawMessage(`{ "exists": "name" }`) - -// Start an async listener -listener := make(chan types.NotificationResult) -go func() { - notification := <-listener - - if notification.Type == "user" { - fmt.Printf("Volatile data: %s\n", notification.Volatile) - // Volatile data: {"sdkVersion":"1.0.0","username":"nina vkote"} - fmt.Printf("Currently %d users in the room\n", notification.Result.Count) - } -}() - -options := types.NewRoomOptions() -options.SetUsers(types.USERS_ALL) - -_, err := kuzzle.Realtime.Subscribe( - "nyc-open-data", - "yellow-taxi", - filters, - listener, - options) - -if err != nil { - log.Fatal(err) -} - -// Instantiates a second kuzzle client: multiple subscriptions -// made by the same user will not trigger "new user" notifications -ws2 := websocket.NewWebSocket("kuzzle", nil) -kuzzle2, _ := kuzzlepkg.NewKuzzle(ws2, nil) - -connectErr = kuzzle2.Connect() -if connectErr != nil { - log.Fatal(connectErr) - os.Exit(1) -} - -// Set some volatile data -options2 := types.NewRoomOptions() -options2.SetVolatile(json.RawMessage(`{ "username": "nina vkote" }`)) - -// Subscribe to the same room with the second client -kuzzle2.Realtime.Subscribe( - "nyc-open-data", - "yellow-taxi", - filters, - make(chan types.NotificationResult), - options2) diff --git a/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.test.yml b/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.test.yml deleted file mode 100644 index ef150d53..00000000 --- a/.doc/1/controllers/realtime/subscribe/snippets/user-notifications.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: realtime#subscribe-users -description: Subscribe to users joining or leaving the room -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ - after: -template: realtime -expected: "\"username\":\"nina vkote\"" -sdk: go -version: 1 diff --git a/.doc/1/controllers/realtime/unsubscribe/index.md b/.doc/1/controllers/realtime/unsubscribe/index.md deleted file mode 100644 index 228cf75b..00000000 --- a/.doc/1/controllers/realtime/unsubscribe/index.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -code: true -type: page -title: Unsubscribe -description: Removes a subscription ---- - -# Unsubscribe - -Removes a subscription. - -## Arguments - -```go -func (r *Realtime) Unsubscribe(roomID string, options types.QueryOptions) error -``` - -
string| Subscription room ID | -| `options` |
types.QueryOptions| Query options | - -### options - -Additional query options - -| Option | Type
bool
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns a `bool` set to `true` if an admin exists and `false` if it does not, or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/admin-exists.go diff --git a/.doc/1/controllers/server/admin-exists/snippets/admin-exists.go b/.doc/1/controllers/server/admin-exists/snippets/admin-exists.go deleted file mode 100644 index 7e80467f..00000000 --- a/.doc/1/controllers/server/admin-exists/snippets/admin-exists.go +++ /dev/null @@ -1,7 +0,0 @@ -exists, err := kuzzle.Server.AdminExists(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Admin exists?", exists) -} diff --git a/.doc/1/controllers/server/admin-exists/snippets/admin-exists.test.yml b/.doc/1/controllers/server/admin-exists/snippets/admin-exists.test.yml deleted file mode 100644 index 712fab93..00000000 --- a/.doc/1/controllers/server/admin-exists/snippets/admin-exists.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#adminExists -description: Checks that an administrator account exists. -hooks: - before: - after: -template: default -expected: ^(Admin exists\?) (true|false)$ - -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/get-all-stats/index.md b/.doc/1/controllers/server/get-all-stats/index.md deleted file mode 100644 index e1607f46..00000000 --- a/.doc/1/controllers/server/get-all-stats/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -code: true -type: page -title: GetAllStats -description: Gets all stored internal statistic snapshots. ---- - -# GetAllStats - -Gets all stored internal statistic snapshots. -By default, snapshots are made every 10 seconds and they are stored for 1 hour. - -These statistics include: - -- the number of connected users per protocol (not available for all protocols) -- the number of ongoing requests -- the number of completed requests since the last frame -- the number of failed requests since the last frame - -## Arguments - -```go -func (s *Server) GetAllStats(options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | ----------------------------------- | -| `options` |
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns all stored internal statistic snapshots as a `json.RawMessage` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/get-all-stats.go diff --git a/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.go b/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.go deleted file mode 100644 index 1a894373..00000000 --- a/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.go +++ /dev/null @@ -1,7 +0,0 @@ -as, err := kuzzle.Server.GetAllStats(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("All Kuzzle Stats as JSON string:", string(as)) -} diff --git a/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.test.yml b/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.test.yml deleted file mode 100644 index c10efcd0..00000000 --- a/.doc/1/controllers/server/get-all-stats/snippets/get-all-stats.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#getAllStats -description: Gets all stored internal statistic snapshots. -hooks: - before: - after: -template: default -expected: ^(All Kuzzle Stats as JSON string:) {"hits":\[({"connections":{.*},"ongoingRequests":{.*},"completedRequests":{.*},"failedRequests":{.*},"timestamp":[0-9]{13}}(,)*\]),"total":[0-9]+}$ - -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/get-config/index.md b/.doc/1/controllers/server/get-config/index.md deleted file mode 100644 index 40a8508c..00000000 --- a/.doc/1/controllers/server/get-config/index.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -code: true -type: page -title: GetConfig -description: Returns the current Kuzzle configuration. ---- - -# GetConfig - -Returns the current Kuzzle configuration. - -:::warning -This route should only be accessible to administrators, as it might return sensitive information about the backend. -::: - -## Arguments - -```go -func (s *Server) GetConfig(options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | ----------------------------------- | -| `options` |
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns server configuration as a `json.RawMessage` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/get-config.go diff --git a/.doc/1/controllers/server/get-config/snippets/get-config.go b/.doc/1/controllers/server/get-config/snippets/get-config.go deleted file mode 100644 index 8f83728a..00000000 --- a/.doc/1/controllers/server/get-config/snippets/get-config.go +++ /dev/null @@ -1,7 +0,0 @@ -conf, err := kuzzle.Server.GetConfig(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Kuzzle Server configuration as JSON string:", string(conf)) -} diff --git a/.doc/1/controllers/server/get-config/snippets/get-config.test.yml b/.doc/1/controllers/server/get-config/snippets/get-config.test.yml deleted file mode 100644 index a27f9834..00000000 --- a/.doc/1/controllers/server/get-config/snippets/get-config.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#getConfig -description: Returns the current Kuzzle configuration. -hooks: - before: - after: -template: default -expected: ^(Kuzzle Server configuration as JSON string:) {("dump":{.*}),("limits":{.*}),("plugins":{.*}),("queues":{.*}),("repositories":{.*}),("server":{.*}),("services":{.*}),("stats":{.*}),("validation":{.*}),("_":.*),("internal":{.*}),("version":"[0-9]\.[0-9]\.[0-9]")}$ - -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/get-last-stats/index.md b/.doc/1/controllers/server/get-last-stats/index.md deleted file mode 100644 index aefb8b4c..00000000 --- a/.doc/1/controllers/server/get-last-stats/index.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -code: true -type: page -title: GetLastStats -description: Returns the most recent statistics snapshot. ---- - -# GetLastStats - -Returns the most recent statistics snapshot. -By default, snapshots are made every 10 seconds and they are stored for 1 hour. - -These statistics include: - -- the number of connected users per protocol (not available for all protocols) -- the number of ongoing requests -- the number of completed requests since the last frame -- the number of failed requests since the last frame - -## Arguments - -```go -func (s *Server) GetLastStats(options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | ----------------------------------- | -| `options` |
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns the most recent statistics snapshot as a `json.RawMessage` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Return - -## Usage - -<<< ./snippets/get-last-stats.go diff --git a/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.go b/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.go deleted file mode 100644 index 490d5a4b..00000000 --- a/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.go +++ /dev/null @@ -1,7 +0,0 @@ -ls, err := kuzzle.Server.GetLastStats(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Last Kuzzle Stats as JSON string:", string(ls)) -} diff --git a/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.test.yml b/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.test.yml deleted file mode 100644 index e3c04020..00000000 --- a/.doc/1/controllers/server/get-last-stats/snippets/get-last-stats.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#getLastStats -description: Returns the most recent statistics snapshot. -hooks: - before: - after: -template: default -expected: ^(Last Kuzzle Stats as JSON string:) {("connections":{.*}),("ongoingRequests":{.*}),("completedRequests":{.*}),("failedRequests":{.*}),("timestamp":[0-9]{13})}$ - -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/get-stats/index.md b/.doc/1/controllers/server/get-stats/index.md deleted file mode 100644 index 368e8096..00000000 --- a/.doc/1/controllers/server/get-stats/index.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -code: true -type: page -title: GetStats -description: Returns statistics snapshots within a provided timestamp range. ---- - -# GetStats - -Returns statistics snapshots within a provided timestamp range. -By default, snapshots are made every 10 seconds and they are stored for 1 hour. - -These statistics include: - -- the number of connected users per protocol (not available for all protocols) -- the number of ongoing requests -- the number of completed requests since the last frame -- the number of failed requests since the last frame - -## Arguments - -```go -func (s *Server) GetStats( - startTime *time.Time, - stopTime *time.Time, - options types.QueryOptions -) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| ----------- | ------------------ | --------------------------------------------------------------- | -| `startTime` |
time.Time| begining of statistics frame set (timestamp or datetime format) | -| `stopTime` |
time.Time| end of statistics frame set (timestamp or datetime format) | -| `options` |
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns snapshots within the provided timestamp range as a `json.RawMessage` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/get-stats.go diff --git a/.doc/1/controllers/server/get-stats/snippets/get-stats.go b/.doc/1/controllers/server/get-stats/snippets/get-stats.go deleted file mode 100644 index c832a63d..00000000 --- a/.doc/1/controllers/server/get-stats/snippets/get-stats.go +++ /dev/null @@ -1,10 +0,0 @@ -start := time.Date(2001, time.September, 9, 1, 46, 40, 0, time.UTC) -stop := time.Now() - -stats, err := kuzzle.Server.GetStats(&start, &stop, nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Kuzzle Stats as JSON string:", string(stats)) -} diff --git a/.doc/1/controllers/server/get-stats/snippets/get-stats.test.yml b/.doc/1/controllers/server/get-stats/snippets/get-stats.test.yml deleted file mode 100644 index 3613894d..00000000 --- a/.doc/1/controllers/server/get-stats/snippets/get-stats.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#getStats -description: Returns statistics snapshots within a provided timestamp range. -hooks: - before: - after: -template: default -expected: ^(Kuzzle Stats as JSON string:) {"hits":\[({"connections":{.*},"ongoingRequests":{.*},"completedRequests":{.*},"failedRequests":{.*},"timestamp":[0-9]{13}}(,)*)*\],"total":[0-9]+}$ - -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/index.md b/.doc/1/controllers/server/index.md deleted file mode 100644 index e351bc14..00000000 --- a/.doc/1/controllers/server/index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -code: true -type: branch -title: Server -description: Server Controller ---- - -# Server Controller diff --git a/.doc/1/controllers/server/info/index.md b/.doc/1/controllers/server/info/index.md deleted file mode 100644 index 5251992e..00000000 --- a/.doc/1/controllers/server/info/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -code: true -type: page -title: Info -description: Returns information about Kuzzle server. ---- - -# Info - -Returns information about Kuzzle: available API (base + extended), plugins, external services (Redis, Elasticsearch, ...), servers, etc. - -## Arguments - -```go -func (s* Server) Info(options types.QueryOptions) (json.RawMessage, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | ----------------------------------- | -| `options` |
types.QueryOptions| An object containing query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns server informations as a `json.RawMessage` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/info.go diff --git a/.doc/1/controllers/server/info/snippets/info.go b/.doc/1/controllers/server/info/snippets/info.go deleted file mode 100644 index 2cbc598b..00000000 --- a/.doc/1/controllers/server/info/snippets/info.go +++ /dev/null @@ -1,7 +0,0 @@ -info, err := kuzzle.Server.Info(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Kuzzle Server information as JSON string:", string(info)) -} diff --git a/.doc/1/controllers/server/info/snippets/info.test.yml b/.doc/1/controllers/server/info/snippets/info.test.yml deleted file mode 100644 index 3e09f819..00000000 --- a/.doc/1/controllers/server/info/snippets/info.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: server#info -description: Retrieves information about Kuzzle plugins and active services. -hooks: - before: - after: -template: default -expected: "^Kuzzle Server information as JSON string: {\"serverInfo\":{\"kuzzle\":{\"version\":\"[0-9]\\.[0-9]\\.[0-9]\",\"api\":{.*" -sdk: go -version: 1 diff --git a/.doc/1/controllers/server/now/index.md b/.doc/1/controllers/server/now/index.md deleted file mode 100644 index a26d45f3..00000000 --- a/.doc/1/controllers/server/now/index.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -code: true -type: page -title: Now -description: Returns the current server timestamp, in Epoch-millis ---- - -# Now - -Returns the current server timestamp, in Epoch-millis format. - -## Arguments - -```go -func (s *Server) Now(options types.QueryOptions) (int64, error) -``` - -| Arguments | Type | Description | -| --------- | ------------------ | -------------- | -| `options` |
types.QueryOptions| Query options. | - -### **Options** - -Additional query options - -| Option | Type | Description | Default | -| ---------- | ---- | ---------------------------------------------------------------------------- | ------- | -| `Queuable` |
bool| If true, queues the request during downtime, until connected to Kuzzle again | `true` | - -## Return - -Returns current server timestamp as `int64` or a `KuzzleError`. See how to [handle error](/sdk/go/1/essentials/error-handling). - -## Usage - -<<< ./snippets/now.go diff --git a/.doc/1/controllers/server/now/snippets/now.go b/.doc/1/controllers/server/now/snippets/now.go deleted file mode 100644 index f1cb0389..00000000 --- a/.doc/1/controllers/server/now/snippets/now.go +++ /dev/null @@ -1,7 +0,0 @@ -ts, err := kuzzle.Server.Now(nil) - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Epoch-millis timestamp:", ts) -} diff --git a/.doc/1/controllers/server/now/snippets/now.test.yml b/.doc/1/controllers/server/now/snippets/now.test.yml deleted file mode 100644 index f61df8d2..00000000 --- a/.doc/1/controllers/server/now/snippets/now.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: server#now -description: Fetch the current server timestamp, in Epoch-millis format. -hooks: - before: - after: -template: default -expected: ^(Epoch-millis timestamp:) [0-9]{13}$ - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/index.md b/.doc/1/core-structs/index.md deleted file mode 100644 index 17c49d75..00000000 --- a/.doc/1/core-structs/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -code: false -type: branch -order: 10 -title: Core structs -description: Core structs ---- diff --git a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/index.md b/.doc/1/core-structs/kuzzle-event-emitter/add-listener/index.md deleted file mode 100644 index 191656f6..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/index.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -code: true -type: page -title: AddListener -description: Adds a new channel for an event ---- - -# AddListener - -Adds a channel at the end of list of registered channels for that event. -Whenever an event is triggered, registered channels are fed in the order they were registered. - -## Arguments - -```js -AddListener(event int, channel chan<- interface{}) -``` - -
int| Event constant from the `event` package | -| `channel` |
channel| Event payload channel | - -## Usage - -<<< ./snippets/add-listener.go diff --git a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.go b/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.go deleted file mode 100644 index dde149c4..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.go +++ /dev/null @@ -1,9 +0,0 @@ -ch := make(chan json.RawMessage) - -kuzzle.AddListener(event.Connected, ch) - -go func() { - for range ch { - fmt.Println("Connected to Kuzzle") - } -}() diff --git a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.test.yml b/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.test.yml deleted file mode 100644 index a4fd843c..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/add-listener/snippets/add-listener.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: kuzzleEventEmitter#add-listener -description: Adds new listener for the given event -hooks: - before: - after: -template: before-connect -expected: "Connected to Kuzzle" -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle-event-emitter/index.md b/.doc/1/core-structs/kuzzle-event-emitter/index.md deleted file mode 100644 index 1d769af9..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -code: true -type: branch -title: KuzzleEventEmitter -description: KuzzleEventEmitter interface documentation -order: 400 ---- diff --git a/.doc/1/core-structs/kuzzle-event-emitter/introduction/index.md b/.doc/1/core-structs/kuzzle-event-emitter/introduction/index.md deleted file mode 100644 index 775020c6..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/introduction/index.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -code: true -type: page -title: Introduction -description: KuzzleEventEmitter class -order: 0 ---- - -# KuzzleEventEmitter - -An interface standardizing the listening of events. - -The [Kuzzle](/sdk/go/1/core-structs/kuzzle) class implements the `KuzzleEventEmitter` interface. diff --git a/.doc/1/core-structs/kuzzle-event-emitter/on/index.md b/.doc/1/core-structs/kuzzle-event-emitter/on/index.md deleted file mode 100644 index 7a1e47cd..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/on/index.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -code: true -type: page -title: On -description: Alias for addListener ---- - -# On - -Alias for [AddListener](/sdk/go/1/core-structs/kuzzle-event-emitter/add-listener). diff --git a/.doc/1/core-structs/kuzzle-event-emitter/once/index.md b/.doc/1/core-structs/kuzzle-event-emitter/once/index.md deleted file mode 100644 index 1459cd06..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/once/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -code: true -type: page -title: Once -description: Adds a one-time channel for an event ---- - -# Once - -Adds a **one-time** channel to an event. - -The next time the event is triggered, this channel is removed and then fed. - -Whenever an event is triggered, channels are fed in the order they were registered. - -Channels removed this way are **not** closed. - -## Arguments - -```go -Once(event int, channel chan<- interface{}) -``` - -
int| Event constant from the `event` package | -| `channel` |
channel| Event payload channel | - - -## Usage - -<<< ./snippets/once.go diff --git a/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.go b/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.go deleted file mode 100644 index 9e9e11f4..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.go +++ /dev/null @@ -1,9 +0,0 @@ -ch := make(chan json.RawMessage) - -kuzzle.Once(event.Connected, ch) - -go func() { - for range ch { - fmt.Println("Connected to Kuzzle") - } -}() diff --git a/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.test.yml b/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.test.yml deleted file mode 100644 index 42720913..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/once/snippets/once.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: kuzzleEventEmitter#add-listener -description: Adds a one-time listener for an event -hooks: - before: - after: -template: before-connect -expected: "Connected to Kuzzle" -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/index.md b/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/index.md deleted file mode 100644 index 2ec03aa0..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/index.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -code: true -type: page -title: RemoveAllListeners -description: Removes all channels, or all channels from an event ---- - -# RemoveAllListeners - -Removes all channels from an event. -If no eventName is specified, removes all channels from all events. - -Channels removed this way are **not** closed. - -## Arguments - -```go -RemoveAllListeners(event int) -``` - -
int| Event constant from the `event` package | - -## Usage - -<<< ./snippets/remove-all-listeners.go diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.go b/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.go deleted file mode 100644 index da7af55a..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.go +++ /dev/null @@ -1,14 +0,0 @@ -ch := make(chan json.RawMessage) - -kuzzle.On(event.Connected, ch) - -go func() { - for range ch { - fmt.Println("Connected to Kuzzle") - } - - fmt.Println("Stopped listening") -}() - -kuzzle.RemoveAllListeners(event.Connected) -close(ch) diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.test.yml b/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.test.yml deleted file mode 100644 index 2d86f178..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-all-listener/snippets/remove-all-listeners.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: kuzzleEventEmitter#remove-all-listeners -description: Removes all channels for the given event -hooks: - before: - after: -template: before-connect -expected: Stopped listening -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/index.md b/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/index.md deleted file mode 100644 index e3b8a69b..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/index.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -code: true -type: page -title: RemoveListener -description: Removes a channel from an event ---- - -# RemoveListener - -Removes a channel from an event. - -## Arguments - -```go -RemoveListener(event int, channel chan<- interface{}) -``` - -
int| Event constant from the `event` package | -| `channel` |
channel| Channel to unregister | - -## Usage - -<<< ./snippets/remove-listener.go diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.go b/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.go deleted file mode 100644 index 9ce4e7fa..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.go +++ /dev/null @@ -1,14 +0,0 @@ -ch := make(chan json.RawMessage) - -kuzzle.On(event.Connected, ch) - -go func() { - for range ch { - fmt.Println("Connected to Kuzzle") - } - - fmt.Println("Stopped listening") -}() - -kuzzle.RemoveListener(event.Connected, ch) -close(ch) diff --git a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.test.yml b/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.test.yml deleted file mode 100644 index bb4be75d..00000000 --- a/.doc/1/core-structs/kuzzle-event-emitter/remove-listener/snippets/remove-listener.test.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: kuzzleEventEmitter#remove-listener -description: Removes a channel for the given event -hooks: - before: - after: -template: before-connect -expected: Stopped listening -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/connect/index.md b/.doc/1/core-structs/kuzzle/connect/index.md deleted file mode 100644 index c9ff8a9b..00000000 --- a/.doc/1/core-structs/kuzzle/connect/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -code: true -type: page -title: connect -description: Connects the SDK to Kuzzle ---- - -# Connect - -Connects to Kuzzle using the `host` argument provided to the `connection.Connection` (see [Kuzzle constructor](/sdk/go/1/core-structs/kuzzle/constructor/#usage-go)). -Subsequent call have no effect if the SDK is already connected. - -## Arguments - -```go -Connect() error -``` - -## Return - -Return a [Kuzzle error](/sdk/go/1/essentials/error-handling) if the SDK can not connect to Kuzzle. - -## Usage - -<<< ./snippets/connect.go diff --git a/.doc/1/core-structs/kuzzle/connect/snippets/connect.go b/.doc/1/core-structs/kuzzle/connect/snippets/connect.go deleted file mode 100644 index 15c1ba92..00000000 --- a/.doc/1/core-structs/kuzzle/connect/snippets/connect.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Connect() - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Successfully connected") -} diff --git a/.doc/1/core-structs/kuzzle/connect/snippets/connect.test.yml b/.doc/1/core-structs/kuzzle/connect/snippets/connect.test.yml deleted file mode 100644 index edbe1c44..00000000 --- a/.doc/1/core-structs/kuzzle/connect/snippets/connect.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#connect -description: Connects the SDK to Kuzzle -hooks: - before: - after: -template: without-connect -expected: Successfully connected - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/constructor/index.md b/.doc/1/core-structs/kuzzle/constructor/index.md deleted file mode 100644 index 7bff56ca..00000000 --- a/.doc/1/core-structs/kuzzle/constructor/index.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -code: true -type: page -title: Constructor -description: Creates a new Kuzzle object connected to the backend -order: 100 ---- - -# Constructor - -This is the main entry point to communicate with Kuzzle. -Each instance represents a connection to Kuzzle with specific options. - -This interface implements the [KuzzleEventEmitter](/sdk/go/1/core-structs/kuzzle-event-emitter) interface - -## Arguments - -```go -NewKuzzle(protocol connection.Connection) (*Kuzzle, error) -``` - -| Argument | Type | Description | -| ---------- | --------------------- | ------------------------------------- | -| `protocol` |
connection.Connection| The protocol used by the SDK instance | - -### **protocol** - -A [Protocol](/sdk/go/1/protocols/) is a structure implementing the `connection.Connection` interface. -The available protocols are: - -- `websocket.Websocket` - -The protocol must be instantiated and passed to the constructor. -It takes the following arguments: - -| Argument | Type | Description | Required | -| --------- | ------------- | ------------------------------- | -------- | -| `host` |
string| Kuzzle hostname to connect to | yes | -| `options` |
types.Options| Kuzzle connection configuration | yes | - -The `options` parameter of the protocol constructor has the following properties. -You can use standard getter/setter to use these properties. - -| Option | Type | Description | Default | Required | -| ------------------- | ------------ | ------------------------------------------------------------------ | -------------- | -------- | -| `autoQueue` |
bool| Automatically queue all requests during offline mode | `false` | no | -| `autoReconnect` |
bool| Automatically reconnect after a connection loss | `true` | no | -| `autoReplay` |
bool| Automatically replay queued requests on a `reconnected` event | `false` | no | -| `autoResubscribe` |
bool| Automatically renew all subscriptions on a `reconnected` event | `true` | no | -| `offlineMode` |
int| Offline mode configuration. `types.Manual` or `types.Auto` | `types.Manual` | no | -| `port` |
int| Target Kuzzle port | `7512` | no | -| `queueTTL` |
int| Time a queued request is kept during offline mode, in milliseconds | `120000` | no | -| `queueMaxSize` |
int| Number of maximum requests kept during offline mode | `500` | no | -| `replayInterval` |
Duration| Delay between each replayed requests, in milliseconds | `10` | no | -| `reconnectionDelay` |
Duration| number of milliseconds between reconnection attempts | `1000` | no | -| `sslConnection` |
bool| Switch Kuzzle connection to SSL mode | `false` | no | -| `volatile` |
VolatileData| Common volatile data, will be sent to all future requests | - | no | - -## Getter & Setter - -These properties of the Kuzzle struct can be writable. -For example, you can read the `volatile` property via `getVolatile()` and set it via `setVolatile()`. - -| Property name | Type | Description | Availability | -| -------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------- | :----------: | -| `autoQueue` |
bool| Automatically queue all requests during offline mode | Get/Set | -| `autoReconnect` |
bool| Automatically reconnect after a connection loss | Get | -| `autoReplay` |
bool| Automatically replay queued requests on a `reconnected` event | Get/Set | -| `autoResubscribe` |
bool| Automatically renew all subscriptions on a `reconnected` event | Get/Set | -| `host` |
string| Target Kuzzle host | Get | -| `port` |
int| Target Kuzzle port | Get | -| `jwt` |
string| Token used in requests for authentication. | Get/Set | -| `offlineQueue` |
QueryObject| Contains the queued requests during offline mode | Get | -| `offlineQueueLoader` |
OfflineQueueLoader| Called before dequeuing requests after exiting offline mode, to add items at the beginning of the offline queue | Get/Set | -| `queueFilter` |
QueueFilter| Called during offline mode. Takes a request object as arguments and returns a bool, indicating if a request can be queued | Get/Set | -| `queueMaxSize` |
int| Number of maximum requests kept during offline mode | Get/Set | -| `queueTTL` |
Duration| Time a queued request is kept during offline mode, in milliseconds | Get/Set | -| `replayInterval` |
Duration| Delay between each replayed requests | Get/Set | -| `reconnectionDelay` |
Duration| Number of milliseconds between reconnection attempts | Get | -| `sslConnection` |
bool| Connect to Kuzzle using SSL | Get | -| `volatile` |
VolatileData| Common volatile data, will be sent to all future requests | Get/Set | - -**Notes:** - -- multiple methods allow passing specific `volatile` data. These `volatile` data will be merged with the global Kuzzle `volatile` object when sending the request, with the request specific `volatile` taking priority over the global ones. -- the `queueFilter` property is a function taking a `QueryObject` as an argument. This object is the request sent to Kuzzle, following the [Kuzzle API](/core/1/api/essentials/query-syntax) format -- if `queueTTL` is set to `0`, requests are kept indefinitely -- The offline buffer acts like a first-in first-out (FIFO) queue, meaning that if the `queueMaxSize` limit is reached, older requests are discarded to make room for new requests -- if `queueMaxSize` is set to `0`, an unlimited number of requests is kept until the buffer is flushed -- the `offlineQueueLoader` must be set with a function, taking no argument, and returning an array of objects containing a `query` member with a Kuzzle query to be replayed, and an optional `cb` member with the corresponding callback to invoke with the query result -- updates to `autoReconnect`, `reconnectionDelay` and `sslConnection` properties will only take effect on next `connect` call - -## Return - -A `Kuzzle` struct and an [error struct](/sdk/go/1/essentials/error-handling). -The `error` struct is nil if everything was ok. - -## Usage - -In a first step, you have to create a new `connection.Connection` and pass it to the constructor. -By now the only connection available is `websocket.Websocket`. - -<<< ./snippets/constructor.go diff --git a/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.go b/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.go deleted file mode 100644 index 1ebcb7f0..00000000 --- a/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.go +++ /dev/null @@ -1,6 +0,0 @@ -copts := types.NewOptions() -copts.SetPort(7512) -copts.SetAutoResubscribe(false) -conn := websocket.NewWebSocket("kuzzle", copts) - -k, _ := kuzzle.NewKuzzle(conn, nil) diff --git a/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.test.yml b/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.test.yml deleted file mode 100644 index 13d9a79a..00000000 --- a/.doc/1/core-structs/kuzzle/constructor/snippets/constructor.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#constructor -description: Create a new Kuzzle instance connected to Kuzzle -hooks: - before: - after: -template: blank -expected: Everything is ok - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/disconnect/index.md b/.doc/1/core-structs/kuzzle/disconnect/index.md deleted file mode 100644 index f07c349c..00000000 --- a/.doc/1/core-structs/kuzzle/disconnect/index.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -code: true -type: page -title: disconnect -description: Disconnects the SDK ---- - -# Disconnect - -Closes the current connection to Kuzzle. -The SDK is now in `offline` state. -A call to `disconnect()` will not trigger a `disconnected` event. This event is only triggered on unexpected disconnection. - -## Arguments - -```go -Disconnect() error -``` - -## Return - -Return a [Kuzzle error](/sdk/go/1/essentials/error-handling) if the connection can't be closed. - -## Usage - -<<< ./snippets/disconnect.go diff --git a/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.go b/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.go deleted file mode 100644 index 246da7b4..00000000 --- a/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.go +++ /dev/null @@ -1,7 +0,0 @@ -err := kuzzle.Disconnect() - -if err != nil { - log.Fatal(err) -} else { - fmt.Println("Success") -} diff --git a/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.test.yml b/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.test.yml deleted file mode 100644 index 83c43ab1..00000000 --- a/.doc/1/core-structs/kuzzle/disconnect/snippets/disconnect.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#disconnect -description: Disconnect the SDK -hooks: - before: - after: -template: default -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/flush-queue/index.md b/.doc/1/core-structs/kuzzle/flush-queue/index.md deleted file mode 100644 index 55395d07..00000000 --- a/.doc/1/core-structs/kuzzle/flush-queue/index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -code: true -type: page -title: flushQueue -description: Empties the offline request queue ---- - -# FlushQueue - -Empties the offline request queue without playing it. - -## Arguments - -```go -FlushQueue() -``` - -## Usage - -<<< ./snippets/flush-queue.go diff --git a/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.go b/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.go deleted file mode 100644 index 8db03099..00000000 --- a/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.go +++ /dev/null @@ -1 +0,0 @@ -kuzzle.FlushQueue() diff --git a/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.test.yml b/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.test.yml deleted file mode 100644 index 80636c9e..00000000 --- a/.doc/1/core-structs/kuzzle/flush-queue/snippets/flush-queue.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#flushQueue -description: Empties the offline request queue -hooks: - before: - after: -template: without-connect -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/index.md b/.doc/1/core-structs/kuzzle/index.md deleted file mode 100644 index a53aa9d0..00000000 --- a/.doc/1/core-structs/kuzzle/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -code: true -type: branch -title: Kuzzle -description: Kuzzle object -order: 400 ---- - -# Kuzzle object diff --git a/.doc/1/core-structs/kuzzle/play-queue/index.md b/.doc/1/core-structs/kuzzle/play-queue/index.md deleted file mode 100644 index c893a44a..00000000 --- a/.doc/1/core-structs/kuzzle/play-queue/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -code: true -type: page -title: playQueue -description: Plays the offline request queue ---- - -# PlayQueue - -Plays the requests queued during `offline` state. -Works only if the SDK is not in a `offline` state, and if the `autoReplay` option is set to `false`. - -## Arguments - -```go -PlayQueue() -``` - -## Usage - -<<< ./snippets/play-queue.go diff --git a/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.go b/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.go deleted file mode 100644 index 68c31ebb..00000000 --- a/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.go +++ /dev/null @@ -1 +0,0 @@ -kuzzle.PlayQueue() diff --git a/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.test.yml b/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.test.yml deleted file mode 100644 index b8db0e92..00000000 --- a/.doc/1/core-structs/kuzzle/play-queue/snippets/play-queue.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#playQueue -description: Play the requests queued -hooks: - before: - after: -template: without-connect -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/query/index.md b/.doc/1/core-structs/kuzzle/query/index.md deleted file mode 100644 index eabd9df6..00000000 --- a/.doc/1/core-structs/kuzzle/query/index.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -code: true -type: page -title: query -description: Base method to send API query to Kuzzle ---- - -# Query - -Base method used to send queries to Kuzzle, following the [API Documentation](/core/1/api). - -:::warning -This is a low-level method, exposed to allow advanced SDK users to bypass high-level methods. -::: - -## Arguments - -```go -Query(request *types.KuzzleRequest, options types.QueryOptions, responseChannel chan<- *types.KuzzleResponse) -``` - -| Argument | Type | Description | -| ----------------- | ----------------------------- | ------------------------------------- | -| `request` |
\*types.KuzzleRequest| API request options | -| `options` |
types.QueryOptions| Additional query options | -| `responseChannel` |
chan<- \*types.KuzzleResponse| A channel to receive the API response | - -### **request** - -Properties required for the Kuzzle API can be set in the [KuzzleRequest](https://github.com/kuzzleio/sdk-go/blob/master/types/kuzzle_request.go). -The following properties are the most common. - -| Property | Type | Description | -| ------------ | ------------ | ---------------------------------------- | -| `Controller` |
string| Controller name | -| `Action` |
string| Action name | -| `Body` |
interface{}| 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` |
VolatileData| Additional information to send to Kuzzle | - -### **options** - -A [QueryOptions](https://github.com/kuzzleio/sdk-go/blob/master/types/query_options.go) containing additional query options -Theses properties can bet Get/Set. -The following properties are the most common. - -| Property | Type | Description | Default | -| ---------- | ---- | --------------------------------- | ------- | -| `Queuable` |
bool| Make this request queuable or not | true | - -### **responseChannel** - -A channel to receive the API response. -This channel will receive a [KuzzleResponse](https://github.com/kuzzleio/sdk-go/blob/master/types/kuzzle_response.go) - -## Usage - -<<< ./snippets/query.go diff --git a/.doc/1/core-structs/kuzzle/query/snippets/query.go b/.doc/1/core-structs/kuzzle/query/snippets/query.go deleted file mode 100644 index a99cbba5..00000000 --- a/.doc/1/core-structs/kuzzle/query/snippets/query.go +++ /dev/null @@ -1,22 +0,0 @@ -request := types.KuzzleRequest{ - Controller: "document", - Action: "create", - Id: "my-custom-document-id", - Index: "nyc-open-data", - Collection: "yellow-taxi", - Body: json.RawMessage("{\"trip_distance\": 4.23, \"passenger_count\": 2}"), -} - -options := types.NewQueryOptions() -options.SetRefresh("wait_for") - -ch := make(chan *types.KuzzleResponse) - -go kuzzle.Query(&request, options, ch) -response := <-ch - -if response.Status == 200 { - fmt.Println("Document created") -} else { - fmt.Println(response.Error.Message) -} diff --git a/.doc/1/core-structs/kuzzle/query/snippets/query.test.yml b/.doc/1/core-structs/kuzzle/query/snippets/query.test.yml deleted file mode 100644 index fbaa696c..00000000 --- a/.doc/1/core-structs/kuzzle/query/snippets/query.test.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: kuzzle#query -description: Send a request to Kuzzle API -hooks: - before: curl -X DELETE kuzzle:7512/nyc-open-data ; curl -X POST kuzzle:7512/nyc-open-data/_create - ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi - after: -template: default -expected: Document created - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/start-queuing/index.md b/.doc/1/core-structs/kuzzle/start-queuing/index.md deleted file mode 100644 index 5030983b..00000000 --- a/.doc/1/core-structs/kuzzle/start-queuing/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -code: true -type: page -title: startQueuing -description: Starts the requests queuing ---- - -# StartQueuing - -Starts the requests queuing. -Works only in `offline` state, and if the `autoQueue` option is set to false. - -## Arguments - -```go -StartQueuing() -``` - -## Usage - -<<< ./snippets/start-queuing.go diff --git a/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.go b/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.go deleted file mode 100644 index e860f687..00000000 --- a/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.go +++ /dev/null @@ -1 +0,0 @@ -kuzzle.StartQueuing() diff --git a/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.test.yml b/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.test.yml deleted file mode 100644 index 7e52ab27..00000000 --- a/.doc/1/core-structs/kuzzle/start-queuing/snippets/start-queuing.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#startQueuing -description: Starts the requests queuing -hooks: - before: - after: -template: without-connect -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/kuzzle/stop-queuing/index.md b/.doc/1/core-structs/kuzzle/stop-queuing/index.md deleted file mode 100644 index 3c4a78d3..00000000 --- a/.doc/1/core-structs/kuzzle/stop-queuing/index.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -code: true -type: page -title: stopQueuing -description: Stops the requests queuing ---- - -# StopQueuing - -Stops the requests queuing. -Works only in `offline` state, and if the `autoQueue` option is set to false. - -## Arguments - -```go -StopQueuing() -``` - -## Usage - -<<< ./snippets/stop-queuing.go diff --git a/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.go b/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.go deleted file mode 100644 index 16db368b..00000000 --- a/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.go +++ /dev/null @@ -1 +0,0 @@ -kuzzle.StopQueuing() diff --git a/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.test.yml b/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.test.yml deleted file mode 100644 index ad669afe..00000000 --- a/.doc/1/core-structs/kuzzle/stop-queuing/snippets/stop-queuing.test.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: kuzzle#stopQueuing -description: Stops the requests queuing -hooks: - before: - after: -template: without-connect -expected: Success - -sdk: go -version: 1 diff --git a/.doc/1/core-structs/search-result/index.md b/.doc/1/core-structs/search-result/index.md deleted file mode 100644 index ccada5cf..00000000 --- a/.doc/1/core-structs/search-result/index.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -code: true -type: page -title: SearchResult -description: How to deal with Kuzzle search results -order: 600 ---- - -# SearchResult - -When performing a [search](/sdk/go/1/controllers/document/search/), Kuzzle returns an `SearchResult` struct, which holds the items matching the given query and allows to drill through next result pages if applicable. - -## Properties - -| Property | Type | Description | -| -------------- | -------------------------- | --------------------------------------------------------------------- | -| `Aggregations` |
json.RawMessage| The search` aggregations if any | -| `Hits` |
json.RawMessage| A JSON string containing the retrieved items for the current page | -| `Total` |
int| The total number of items matching the given query in Kuzzle database | -| `Fetched` |
int| The number of retrieved items so far | -| `ScrollId` |
string| A scroll identifier if the search was given a `scroll` parameter | - -## Methods - -The `SearchResult` struct exposes an unique `Next` method, which returns a new `SearchResult` struct. - -```cpp -Next() (*SearchResult, error) -``` - -## Behavior of the next method - -In order to be able to compute the next search page, some initial conditions must be met. - -Depending on the arguments given to the initial search, thhe `Next` method will pick one of the following policies, by decreasing order of priority (i.e. a search including a `scroll`, `sort` and `size` will use the `scroll` policy). - -If no policy is applicable, the `next` method will throw an exception. - -:::info -When processing a large number of documents (i.e. more than 1000), it is advised to use a scroll cursor. - -It is also the only method that garantees all matching documents will be retrieved and no duplicates will be included. -::: - -### 1. scroll - -**This is the preferred way to get some paginated results**. - -If the original search is given a `scroll` parameter, the `next` method will use a cursor to paginate results. - -The results that are returned from a scroll request reflect the state of the index at the time the initial `search` request was performed, like a snapshot in time. - -As such, even if some documents are added or deleted from the database between two calls to `Next`, the result is garanteed to include all items matching the query at the time the initial `search` was sent and to not get any duplicate between two search pages. - -### 2. sort / size - -If the initial search is given some `sort` and `size` parameters, the `Next` method will retrieve the next items matching the sort. - -To avoid too many duplicates, it is advised to provide a sort combination that will always identify one item only. The recommended way is to use the field `_uid` which is certain to contain one unique value for each document. - -Because this method does not freeze the research between two calls, if some updates are applied to the database between two calls, it is still possible to miss some documents and/or to get some duplicates between search pages. - -### 3. from / size - -If the initial search is given some `from` and `size` parameters, the `Next` method will increment the `from` parameter to retrieved the next results. - -Because this method does not freeze the research between two calls, if some updates are applied to the database between two calls, it is possible to miss some documents and/or to get some duplicates between search pages. - -:::info -It is not possible to retrieve more than 10000 items using this method. Above that limit, any call to `Next` will return an error -::: - -## Usage - -<<< ./snippets/search-result.go diff --git a/.doc/1/core-structs/search-result/snippets/search-result.go b/.doc/1/core-structs/search-result/snippets/search-result.go deleted file mode 100644 index 7f313f35..00000000 --- a/.doc/1/core-structs/search-result/snippets/search-result.go +++ /dev/null @@ -1,31 +0,0 @@ -for i := 0; i < 5; i++ { - kuzzle.Document.Create("nyc-open-data", "yellow-taxi", "", json.RawMessage(`{ - "category": "suv" - }`), nil) -} -for i := 5; i < 15; i++ { - kuzzle.Document.Create("nyc-open-data", "yellow-taxi", "", json.RawMessage(`{ - "category": "limousine" - }`), nil) -} -kuzzle.Index.Refresh("nyc-open-data", nil) - -options := types.NewQueryOptions() -options.SetScroll("1m") -options.SetSize(2) - -response, err := kuzzle.Document.Search("nyc-open-data", "yellow-taxi", json.RawMessage(`{ - "query": { - "match": { - "category": "suv" - } - } -}`), options) - -nextPage, err := response.Next() - -if err != nil { - log.Fatal(err) -} else { - fmt.Printf("Successfully retrieved %d documents", nextPage.Fetched) -} \ No newline at end of file diff --git a/.doc/1/core-structs/search-result/snippets/search-result.test.yml b/.doc/1/core-structs/search-result/snippets/search-result.test.yml deleted file mode 100644 index 235290ad..00000000 --- a/.doc/1/core-structs/search-result/snippets/search-result.test.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: essentials#searchResult -description: How to handle Kuzzle search results -hooks: - before: | - curl -XDELETE kuzzle:7512/nyc-open-data - curl -XPOST kuzzle:7512/nyc-open-data/_create - curl -XPUT kuzzle:7512/nyc-open-data/yellow-taxi - after: | - curl -XDELETE kuzzle:7512/nyc-open-data -template: default -expected: Successfully retrieved 4 documents -sdk: go -version: 1 diff --git a/.doc/1/essentials/error-handling/index.md b/.doc/1/essentials/error-handling/index.md deleted file mode 100644 index 3a19330a..00000000 --- a/.doc/1/essentials/error-handling/index.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -code: false -type: page -title: Error Handling -description: How to handle errors with the SDK -order: 100 ---- - -# Error Handling - -All methods return an "error" struct, which holds a non-nil value if the call failed. -Error structs are all of type `KuzzleError`. - -The `KuzzleError` type implements the standard `error` interface, and adds the following properties to it: - -| Property | Type | Description | -| -------- | ------ | ------------------------------------------------------------------------------------------ | -| `Status` | int | Status following [HTTP Standards](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) | -| `Stack` | string | Error stacktrace (Only in development mode) | - -You can find a detailed list of possible errors messages and statuses in the [documentation API](/core/1/api/essentials/errors). - -#### Example - -<<< ./snippets/error-handling.go diff --git a/.doc/1/essentials/error-handling/snippets/error-handling.go b/.doc/1/essentials/error-handling/snippets/error-handling.go deleted file mode 100644 index aae0e4e0..00000000 --- a/.doc/1/essentials/error-handling/snippets/error-handling.go +++ /dev/null @@ -1,10 +0,0 @@ -err := kuzzle.Index.Create("nyc-open-data", nil) - -if err != nil { - fmt.Println(err.Error()) - - // Type assertion of error to KuzzleError - if err.(types.KuzzleError).Status == 400 { - fmt.Println("Try with another name!") - } -} diff --git a/.doc/1/essentials/error-handling/snippets/error-handling.test.yml b/.doc/1/essentials/error-handling/snippets/error-handling.test.yml deleted file mode 100644 index 93f469c6..00000000 --- a/.doc/1/essentials/error-handling/snippets/error-handling.test.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: essentials#errorHandling -description: How to handle SDK errors -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create - after: -template: default -expected: Try with another name! - -sdk: go -version: 1 diff --git a/.doc/1/essentials/events/index.md b/.doc/1/essentials/events/index.md deleted file mode 100644 index a1658862..00000000 --- a/.doc/1/essentials/events/index.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -code: false -type: page -title: Events -description: SDK events system -order: 100 ---- - -# Events - -An event system allows to be notified when the SDK status changes. These events are issued by the [Kuzzle](/sdk/go/1/core-structs/kuzzle) interface. - -The API for interacting with events is described by our [KuzzleEventEmitter](/sdk/go/1/core-structs/kuzzle-event-emitter) interface documentation. - -# Emitted Events - -The following event identifiers are constants declared in the `event` package. - -## Connected - -Triggered when the SDK has successfully connected to Kuzzle. - -## Discarded - -Triggered when Kuzzle rejects a request (e.g. request can't be parsed, request too large, ...). - -**Channel signature:** `chan<- *types.KuzzleResponse)` - -## Disconnected - -Triggered when the current session has been unexpectedly disconnected. - -**Channel signature:** `chan<- interface{}` (will receive nil) - -## LoginAttempt - -Triggered when a login attempt completes, either with a success or a failure result. - -**Channel signature:** `chan<- *types.LoginAttempt` - -## NetworkError - -Triggered when the SDK has failed to connect to Kuzzle. -This event does not trigger the offline mode. - -**Channel signature:** `chan<- error` - -## OfflineQueuePop - -Triggered whenever a request is removed from the offline queue. - -**Channel signature:** `chan<- *types.QueryObject` - -## OfflineQueuePush - -Triggered whenever a request is added to the offline queue. - -**Channel signature:** `chan<- *types.QueryObject` - -## QueryError - -Triggered whenever Kuzzle responds with an error - -**Channel signature:** `chan<- *types.QueryObject` - -## Reconnected - -Triggered when the current session has reconnected to Kuzzle after a disconnection, and only if ``AutoReconnect`` is set to ``true``. - -**Channel signature:** `chan<- interface{}` (will receive nil) - -## TokenExpired - -Triggered when Kuzzle rejects a request because the authentication token has expired. - -**Channel signature:** `chan<- interface{}` (will receive nil) diff --git a/.doc/1/essentials/getting-started/index.md b/.doc/1/essentials/getting-started/index.md deleted file mode 100644 index 41c0deaf..00000000 --- a/.doc/1/essentials/getting-started/index.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -code: false -type: page -title: Getting started -description: Getting started -order: 99 ---- - -# Getting Started - -In this tutorial you will learn how to install the Kuzzle **Go SDK**. -This page shows examples of scripts that **store** documents in Kuzzle, and of scripts that subcribe to real-time **notifications** for each new document created. - -::: success -Before proceeding, please make sure your system meets the following requirements: - -- **Go** version 1.9 or higher ([Go installation instructions](https://golang.org/doc/install)) -- A running Kuzzle server ([Kuzzle installation guide](/core/1/guides/essentials/installing-kuzzle/)) - ::: - -::: info -Having trouble? Get in touch with us on [Gitter](https://gitter.im/kuzzleio/kuzzle)! -::: - -## Installation - -To easily install the Go SDK: - -```bash -$ go get github.com/kuzzleio/sdk-go -``` - -This fetches the SDK and installs it in your `GOPATH` directory. - -## First connection - -Initialize a new Go project as described in the [Go Documentation](https://golang.org/doc/code.html#Command). -Then create a `init.go` file and start by adding the code below: - -<<< ./snippets/init.go - -This program initializes the Kuzzle server storage by creating a index, and a collection inside it -Run the program with the following command: - -```bash -$ go run init.go -Connected! -Index nyc-open-data created! -Collection yellow-taxi created! -``` - -Congratulations, you performed a first connection to Kuzzle with a Go program. -You are now able to: - -- Load the `Kuzzle Go SDK` from your `GOPATH` directory -- Instantiate a protocol (here `websocket`) and a Kuzzle SDK instance -- Connect to a Kuzzle instance running on `localhost`, with the WebSocket protocol -- Create a index -- Create a collection within an existing index - -## Create your first document - -Now that you successfully connected to your Kuzzle server with the Go SDK, and created an index and a collection, it's time to manipulate data. - -Here is how Kuzzle structures its storage space: - -- indexes contain collections -- collections contain documents - Create a `document.go` file in the playground and add this code: - -<<< ./snippets/document.go - -As you did before, run your program: - -```bash -$ go run document.go -Connected! -New document added to yellow-taxi collection! -``` - -You can perform other actions such as [delete](/sdk/go/1/controllers/document/delete/), -[replace](/sdk/go/1/controllers/document/replace/) or [search](/sdk/go/1/controllers/document/search/) documents. There are also other ways to interact with Kuzzle like our [Admin Console](/core/1/guides/essentials/admin-console/), the [Kuzzle HTTP API](/core/1/api/essentials/connecting-to-kuzzle/) or by using your [own protocol](/core/1/protocols/essentials/getting-started/). - -Now you know how to: - -- Store documents in a Kuzzle server, and access those - -## Subscribe to realtime document notifications (pub/sub) - -Time to use realtime with Kuzzle. Create a new file `realtime.go` with the following code: - -<<< ./snippets/realtime.go - -This program subscribes to changes made to documents with a `license` field set to `B`, within the `yellow-taxi` collection. Whenever a document matching the provided filters changes, a new notification is received from Kuzzle. -Run your program: - -```bash -$ go run realtime.go -Connected! -Successfully subscribing! -New document added to yellow-taxi collection! -Driver John born on 1995-11-27 got a B license. -``` - -Now, you know how to: - -- Create realtime filters -- Subscribe to notifications - -## Where do we go from here? - -Now that you're more familiar with the Go SDK, you can dive even deeper to learn how to leverage its full capabilities: - -- discover what this SDK has to offer by browsing other sections of this documentation -- learn how to use [Koncorde](/core/1/guides/cookbooks/realtime-api) to create incredibly fine-grained and blazing-fast subscriptions -- follow our guide to learn how to perform [basic authentication](/core/1/guides/essentials/user-authentication/#local-strategy) -- follow our guide to learn how to [manage users and how to set up fine-grained access control](/core/1/guides/essentials/security/) diff --git a/.doc/1/essentials/getting-started/snippets/document.go b/.doc/1/essentials/getting-started/snippets/document.go deleted file mode 100644 index afd331ec..00000000 --- a/.doc/1/essentials/getting-started/snippets/document.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "os" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/protocol/websocket" -) - -func main() { - // Creates a WebSocket connection. - // Replace "kuzzle" with - // your Kuzzle hostname like "localhost" - c := websocket.NewWebSocket("kuzzle", nil) - // Instantiates a Kuzzle client - kuzzle, _ := kuzzle.NewKuzzle(c, nil) - - // Connects to the server. - if err := kuzzle.Connect(); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Connected!") - - // New document content - content := json.RawMessage(` - { - "name": "Sirkis", - "birthday": "1959-06-22", - "license": "B" - } - `) - - // Stores the document in the "yellow-taxi" collection. - if _, err := kuzzle.Document.Create( - "nyc-open-data", - "yellow-taxi", - "some-id", - content, - nil, - ); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("New document added to the yellow-taxi collection!") - - // Disconnects the SDK. - kuzzle.Disconnect() -} diff --git a/.doc/1/essentials/getting-started/snippets/document.test.yml b/.doc/1/essentials/getting-started/snippets/document.test.yml deleted file mode 100644 index 950aabfb..00000000 --- a/.doc/1/essentials/getting-started/snippets/document.test.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: getting-started#storage -description: Data manipulation -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/; curl -X DELETE kuzzle:7512/nyc-open-data/yellow-taxi/some-id - after: -template: standalone -expected: -- Connected! -- New document added to the yellow-taxi collection! - -sdk: go -version: 1 - diff --git a/.doc/1/essentials/getting-started/snippets/init.go b/.doc/1/essentials/getting-started/snippets/init.go deleted file mode 100644 index 341fa174..00000000 --- a/.doc/1/essentials/getting-started/snippets/init.go +++ /dev/null @@ -1,50 +0,0 @@ -package main - -import ( - "fmt" - "os" - "log" - - "github.com/kuzzleio/sdk-go/protocol/websocket" - "github.com/kuzzleio/sdk-go/kuzzle" -) - -func main() { - // Creates a WebSocket connection. - // Replace "kuzzle" with - // your Kuzzle hostname like "localhost" - c := websocket.NewWebSocket("kuzzle", nil) - // Instantiates a Kuzzle client - kuzzle, _ := kuzzle.NewKuzzle(c, nil) - - // Connects to the server. - err := kuzzle.Connect() - if err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Connected!") - - // Freshly installed Kuzzle servers are empty: we need to create - // a new index. - if err := kuzzle.Index.Create("nyc-open-data", nil); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Index nyc-open-data created!") - - // Creates a collection - if err := kuzzle.Collection.Create( - "nyc-open-data", - "yellow-taxi", - nil, - nil, - ); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Collection yellow-taxi created!") - - // Disconnects the SDK - kuzzle.Disconnect() -} diff --git a/.doc/1/essentials/getting-started/snippets/init.test.yml b/.doc/1/essentials/getting-started/snippets/init.test.yml deleted file mode 100644 index b580a726..00000000 --- a/.doc/1/essentials/getting-started/snippets/init.test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: getting-started#connection -description: First connection -hooks: - before: curl -X DELETE kuzzle:7512/nyc-open-data - after: -template: standalone -expected: -- Connected! -- Index nyc-open-data created! -- Collection yellow-taxi created! - -sdk: go -version: 1 - diff --git a/.doc/1/essentials/getting-started/snippets/realtime.go b/.doc/1/essentials/getting-started/snippets/realtime.go deleted file mode 100644 index 834f648b..00000000 --- a/.doc/1/essentials/getting-started/snippets/realtime.go +++ /dev/null @@ -1,103 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "os" - - "github.com/kuzzleio/sdk-go/kuzzle" - "github.com/kuzzleio/sdk-go/protocol/websocket" - "github.com/kuzzleio/sdk-go/types" -) - -func main() { - // Creates a WebSocket connection. - // Replace "kuzzle" with - // your Kuzzle hostname like "localhost" - c := websocket.NewWebSocket("kuzzle", nil) - // Instantiates a Kuzzle client - kuzzle, _ := kuzzle.NewKuzzle(c, nil) - - // Connects to the server. - if err := kuzzle.Connect(); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Connected!") - - // Prevents the program from exiting before receiving a notification - exit := make(chan bool) - - // Starts an async listener - listener := make(chan types.NotificationResult) - go func() { - notification := <-listener - - // Parses the document content embedded in the notification. - var doc struct { - Name string `json:"name"` - Birthday string `json:"birthday"` - License string `json:"license"` - } - - json.Unmarshal(notification.Result.Content, &doc) - fmt.Printf("Driver %s born on %s got a %s license.\n", - doc.Name, - doc.Birthday, - doc.License, - ) - - // Allows the program to exit - exit <- true - }() - - // Subscribes to notifications for drivers having a "B" driver license. - filters := json.RawMessage(` - { - "equals": { - "license":"B" - } - } - `) - - // Sends the subscription - if _, err := kuzzle.Realtime.Subscribe( - "nyc-open-data", - "yellow-taxi", - filters, - listener, - nil, - ); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("Successfully subscribed!") - - // Writes a new document. This triggers a notification sent to our subscription. - content := json.RawMessage(` - { - "name": "John", - "birthday": "1995-11-27", - "license": "B" - } - `) - - if _, err := kuzzle.Document.Create( - "nyc-open-data", - "yellow-taxi", - "", - content, - nil, - ); err != nil { - log.Fatal(err) - os.Exit(1) - } - fmt.Println("New document added to the yellow-taxi collection!") - - // Waits for a notification to be received - <-exit - - // Disconnects the SDK. - kuzzle.Disconnect() -} diff --git a/.doc/1/essentials/getting-started/snippets/realtime.test.yml b/.doc/1/essentials/getting-started/snippets/realtime.test.yml deleted file mode 100644 index 0fe5e4db..00000000 --- a/.doc/1/essentials/getting-started/snippets/realtime.test.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: getting-started#realtime -description: Realtime interactions -hooks: - before: curl -X POST kuzzle:7512/nyc-open-data/_create ; curl -X PUT kuzzle:7512/nyc-open-data/yellow-taxi/ - after: -template: standalone -expected: -- Connected! -- Successfully subscribed! -- Driver John born on 1995-11-27 got a B license. - -sdk: go -version: 1 - diff --git a/.doc/1/essentials/index.md b/.doc/1/essentials/index.md deleted file mode 100644 index a75e1c5c..00000000 --- a/.doc/1/essentials/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -code: false -type: branch -order: 0 -title: Essentials -description: Essentials ---- diff --git a/.doc/1/essentials/offline-tools/index.md b/.doc/1/essentials/offline-tools/index.md deleted file mode 100644 index 6c600802..00000000 --- a/.doc/1/essentials/offline-tools/index.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -code: false -type: page -title: Offline Tools -description: Tools to handle the loss of connection to the Kuzzle server -order: 100 ---- - -# Offline tools - -The Kuzzle SDK provides a set of properties that help your application to be resilient to the loss of network connection -during its lifespan. - -## offlineQueue - -A read-only list of `QueryObject` containing the requests queued while the SDK is in the `offline` state (it behaves like a FIFO queue). - -## queueMaxSize - -A writable `int` defining the maximun size of the `offlineQueue`. - -## queueTTL - -A writable `Duration` defining the time in milliseconds a queued request is kept in the `offlineQueue`. - -## StartQueuing() - -Starts the requests queuing. Request will be put in the `offlineQueue` instead of being discarded, until `stopQueuing` is called. -Works only in `offline` state, and if the `autoQueue` option is set to false. Call `playQueue` to send to Kuzzle the -requests in the queue, once the SDK state passes to `online`. Call `flushQueue` to empty the queue without sendint the requests. - -## StopQueuing() - -Stop queuing the requests. Requests will no more be put in the `offlineQueue`, they will be discarded. -Works only in the `offline` state, and if the `autoQueue` option is set to `false`. - -## PlayQueue() - -Sends to Kuzzle all the requests in the `offlineQueue`. Works only if the SDK is not in a `offline` state, and if the -`autoReplay` option is set to false. - -## FlushQueue() - -Empties the `offlineQueue` without sending the requests to Kuzzle. - -## autoQueue - -A writable `bool` telling the SDK whether to automatically queue requests during the `offline` state or not. - -## autoReplay - -A writable `bool` telling the SDK whether to automatically send or not the requests in the `offlineQueue` on a -`reconnected` event. - -## autoReconnect - -A writable `bool` telling the SDK whether to automatically reconnect or not to Kuzzle after a connection loss. - -## reconnectionDelay - -A read-only `Duration` specifying the time in milliseconds between different reconnection attempts. - -## autoResubscribe - -A writable `bool` telling the SDK whether to automatically renew or not all subscriptions on a reconnected event. - -## queueFilter - -A writable `QueueFilter` called by the SDK each time a `Request` need to be queued. The `Request` is passed as the only argument -to the function and is queued only if the function returns `true`. Use it to define which requests are allowed to be queued. - -## offlineQueueLoader - -A writable `OfflineQueueLoader` called by the SDK before playing the requests in the `offlineQueue`. This function takes no arguments -and returns an array of `KuzzleRequest` that are added on top of the `offlineQueue`. Use it to inject new requests to be played -before the queue. diff --git a/.doc/1/essentials/realtime-notifications/index.md b/.doc/1/essentials/realtime-notifications/index.md deleted file mode 100644 index c6243ca7..00000000 --- a/.doc/1/essentials/realtime-notifications/index.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -code: false -type: page -title: Realtime notifications -description: List of realtime notifications sent by Kuzzle -order: 100 ---- - -# Notifications - -The [Realtime.Subscribe](/sdk/go/1/controllers/realtime/subscribe/) method takes a channel for `types.NotificationResult` objects, whose content depend on the type of notification received. - -## Document & messages - -These notifications represent [documents changes & messages](/core/1/api/essentials/notifications#documents-changes-messages). - -| Property | Type | Description | -| ------------ | -------------------------- | ----------------------------------------------------------------------------------------------------- | -| `Action` | string | API controller's action | -| `Collection` | string | Data collection | -| `Controller` | string | API controller | -| `Index` | string | Data index | -| `Protocol` | string | Network protocol used to modify the document | -| `Result` | \*types.NotificationResult | Notification content | -| `RoomId` | string | Subscription channel identifier. Can be used to link a notification to its corresponding subscription | -| `Scope` | string | `in`: document enters (or stays) in the scope