Skip to content
This repository was archived by the owner on Feb 22, 2019. It is now read-only.

Commit 278b4e0

Browse files
authored
Merge pull request #281 from kuzzleio/fix-android-prototypes
Replace JSONArray with native Arrays for arguments and returned values
2 parents 19cf35a + dbb6d91 commit 278b4e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+428
-356
lines changed

src/api-documentation/controller-memory-storage/hscan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ algolia: true
44
language-tab:
55
js: HTTP
66
json: Other protocols
7-
title: hmset
7+
title: hscan
88
---
99

1010
# hscan

src/api-documentation/controller-security/search-profiles.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ title: searchProfiles
2222

2323
```js
2424
{
25-
// A roles array containing a list of role Ids can be added
25+
// An array of roles used by the searched profiles
2626
"roles": [
2727
"firstRoleId",
2828
"admin"
@@ -41,7 +41,7 @@ title: searchProfiles
4141
"controller": "security",
4242
"action": "searchProfiles",
4343
"body": {
44-
"policies": [
44+
"roles": [
4545
"myRoleId",
4646
"admin"
4747
]
@@ -108,7 +108,7 @@ Retrieves profiles referring to a given set of roles in their policies.
108108

109109
Optional arguments:
110110

111-
* `body.policies` contains an array of role identifiers used to filters the search results
111+
* `body.roles` contains an array of role identifiers used to filters the search results
112112
* `size` controls the maximum number of documents returned in the response
113113
* `from` is usually used with the `size` argument, and defines the offset from the first result you want to fetch
114114
* `scroll` allows to fetch large result sets, and it must be set with a [time duration](https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units). If set, a forward-only cursor will be created (and automatically destroyed at the end of the set duration), and its identifier will be returned in the `scrollId` property, along with the first page of results. This cursor can then be moved forward using the [`scrollProfiles` API action]({{ site_base_path }}api-documentation/controller-security/scroll-profiles)

src/sdk-reference/kuzzle/get-all-statistics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ kuzzle
3131
```java
3232
kuzzle.getAllStatistics(new ResponseListener<JSONArray>() {
3333
@Override
34-
public void onSuccess(JSONArray object) {
34+
public void onSuccess(JSONObject[] frames) {
3535
// loop through all returned frames
3636
}
3737

src/sdk-reference/kuzzle/get-my-rights.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,30 @@ title: getMyRights
1414
// Using callbacks (NodeJS or Web Browser)
1515
kuzzle
1616
.security
17-
.getMyRights(function(error, result) {
18-
// result is a JSON object
17+
.getMyRights(function(error, rights) {
18+
// result is an array of objects
1919
});
2020

2121
// Using promises (NodeJS)
2222
kuzzle
2323
.security
2424
.getMyRightsPromise()
25-
.then((result) => {
26-
// result is a JSON object
25+
.then(rights => {
26+
// result is an array of objects
2727
});
2828
```
2929

3030
```java
3131

3232
kuzzle
3333
.security
34-
.getMyRights(new ResponseListener<JSONObject>() {
34+
.getMyRights(new ResponseListener<JSONObject[]>() {
3535
@Override
36-
public void onSuccess(JSONObject rights) {
37-
// result is a JSON object
36+
public void onSuccess(JSONObject[] rights) {
3837
}
3938

4039
@Override
4140
public void onError(JSONObject error) {
42-
// Handle error
4341
}
4442
});
4543
```
@@ -49,22 +47,28 @@ kuzzle
4947
use \Kuzzle\Kuzzle;
5048

5149
$kuzzle = new Kuzzle('localhost');
52-
$result = $kuzzle->security()->getMyRights();
50+
$rights = $kuzzle->security()->getMyRights();
5351

54-
// $result is an array
52+
// $rights is an array of associative arrays
5553
```
5654

57-
> Callback response example:
55+
> Callback response
5856
59-
```js
57+
```json
6058
[
6159
{
62-
controller: 'my-controller', action: 'my-action', index: '*', collection: '*',
63-
value: 'allowed'
60+
"controller": "my-controller",
61+
"action": "my-action",
62+
"index": "*",
63+
"collection": "*",
64+
"value": "allowed"
6465
},
6566
{
66-
controller: 'another-controller', action: '*', index: 'my-index', collection: '*',
67-
value: 'conditional'
67+
"controller": "another-controller",
68+
"action": "*",
69+
"index": "my-index",
70+
"collection": "*",
71+
"value": "conditional"
6872
}
6973
]
7074
```
@@ -92,4 +96,4 @@ Gets the rights of the current user
9296

9397
## Callback response
9498

95-
Resolves to a `JSON` object.
99+
Resolves to an array of rights.

src/sdk-reference/kuzzle/get-statistics.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@ title: getStatistics
1414
1515
```js
1616
// Using callbacks (NodeJS or Web Browser)
17-
kuzzle.getStatistics(function (err, stats) {
18-
// ...
17+
kuzzle.getStatistics(function (err, statistics) {
1918
});
2019

2120
// Using promises (NodeJS only)
2221
kuzzle
2322
.getStatisticsPromise()
24-
.then(stats => {
25-
// ...
23+
.then(statistics => {
2624
});
2725
```
2826

2927
```java
3028
kuzzle.getStatistics(new ResponseListener<JSONObject>() {
3129
@Override
32-
public void onSuccess(JSONObject object) {
30+
public void onSuccess(JSONObject[] statistics) {
3331
// ...
3432
}
3533

@@ -45,19 +43,23 @@ kuzzle.getStatistics(new ResponseListener<JSONObject>() {
4543
use \Kuzzle\Kuzzle;
4644

4745
$kuzzle = new Kuzzle('localhost');
48-
$result = $kuzzle->getStatistics();
46+
$statistics = $kuzzle->getStatistics();
4947

50-
// $result is an array
48+
// $statistics is an array of statistics
5149
```
5250

5351
> Callback response:
5452
5553
```json
56-
[{ "connections": { "socketio": 1 },
54+
[
55+
{
56+
"connections": { "socketio": 1 },
5757
"ongoingRequests": { "rest": 0, "socketio": 0 },
5858
"completedRequests": { "mqtt": 37, "socketio": 17 },
5959
"failedRequests": { "socketio": 1 },
60-
"timestamp": "1453110641308" }]
60+
"timestamp": "1453110641308"
61+
}
62+
]
6163
```
6264

6365
> When providing a timestamp, retrieves all frames recorded after that timestamp:
@@ -67,23 +69,23 @@ $result = $kuzzle->getStatistics();
6769
var ts = Date.parse('2015-10-26T12:19:10.213Z');
6870

6971
// Using callbacks (NodeJS or Web Browser)
70-
kuzzle.getStatistics(ts, function (err, stats) {
71-
// ...
72+
kuzzle.getStatistics(ts, function (error, statistics) {
73+
7274
});
7375

7476
// Using promises (NodeJS only)
7577
kuzzle
7678
.getStatisticsPromise(ts)
77-
.then(stats => {
78-
// ...
79+
.then(statistics => {
80+
7981
});
8082
```
8183

8284
```java
8385
// Date can be either in ISO format or a timestamp (utc, in milliseconds)
84-
kuzzle.getStatistics("2015-11-15T13:36:45.558Z", new KuzzleResponseListener<JSONArray>() {
86+
kuzzle.getStatistics("2015-11-15T13:36:45.558Z", new ResponseListener<JSONObject[]>() {
8587
@Override
86-
public void onSuccess(JSONArray results) {
88+
public void onSuccess(JSONObject[] statistics) {
8789
// ...
8890
}
8991

@@ -101,29 +103,37 @@ use \Kuzzle\Kuzzle;
101103
$kuzzle = new Kuzzle('localhost');
102104
// Date can be either in ISO format or a timestamp (utc, in milliseconds)
103105
$date = time() * 1000;
104-
$result = $kuzzle->getStatistics($date);
106+
$statistics = $kuzzle->getStatistics($date);
105107

106-
// $result is an array
108+
// $statistics is an array of statistics objects
107109
```
108110

109-
> Callback response:
111+
> Callback response
110112

111113
```json
112-
[{ "connections": { "socketio": 1 },
114+
[
115+
{
116+
"connections": { "socketio": 1 },
113117
"ongoingRequests": { "rest": 0, "socketio": 0 },
114118
"completedRequests": { "mqtt": 37, "socketio": 17 },
115119
"failedRequests": { "socketio": 1 },
116-
"timestamp": "1453110641308" },
117-
{ "connections": { "socketio": 1 },
120+
"timestamp": "1453110641308"
121+
},
122+
{
123+
"connections": { "socketio": 1 },
118124
"ongoingRequests": { "rest": 0, "socketio": 0 },
119125
"completedRequests": { "socketio": 34 },
120126
"failedRequests": { "socketio": 3 },
121-
"timestamp": "1453110642308" },
122-
{ "connections": {},
127+
"timestamp": "1453110642308"
128+
},
129+
{
130+
"connections": {},
123131
"ongoingRequests": { "rest": 0, "socketio": 0 },
124132
"completedRequests": { "socketio": 40 },
125133
"failedRequests": {},
126-
"timestamp": "1453110643308" }]
134+
"timestamp": "1453110643308"
135+
}
136+
]
127137
```
128138

129139
Kuzzle monitors active connections, and ongoing/completed/failed requests.

src/sdk-reference/kuzzle/list-collections.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ kuzzle
2525
```
2626

2727
```java
28-
kuzzle.listCollections("index", new ResponseListener<JSONObject>() {
28+
kuzzle.listCollections("index", new ResponseListener<JSONObject[]>() {
2929
@Override
30-
public void onSuccess(JSONObject object) {
30+
public void onSuccess(JSONObject[] collections) {
3131
// ...
3232
}
3333

@@ -95,4 +95,4 @@ If no `index` argument is provided, the `defaultIndex` property is used. If no d
9595

9696
## Callback response
9797

98-
Resolves to a `JSON object` containing the list of stored and/or realtime collections on the provided index.
98+
Resolves to an array of JSON objects containing the list of stored and/or realtime collections on the provided index.

src/sdk-reference/memory-storage/bitop.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ kuzzle.memoryStorage.bitopPromise('key', 'AND', ['srckey1', 'srckey2', '...'])
2424
```
2525

2626
```java
27-
JSONArray sourceKeys = new JSONArray().put("srckey1").put("srckey2").put("...");
27+
String[] sourceKeys = {"srckey1", "srckey2", "..."};
28+
2829
kuzzle.memoryStorage.bitop("key", "AND", sourceKeys, new ResponseListener<Long>() {
2930
@Override
3031
public void onSuccess(int length) {

src/sdk-reference/memory-storage/del.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ kuzzle.memoryStorage.delPromise(['key1', 'key2', '...'])
2424
```
2525

2626
```java
27-
JSONArray keys = new JSONArray().put("key1").put("key2").put("...");
27+
String[] keys = {"key1", "key2", "..."};
28+
2829
kuzzle.memoryStorage.del(keys, new ResponseListener<Long>() {
2930
@Override
3031
public void onSuccess(int count) {

src/sdk-reference/memory-storage/exists.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ kuzzle.memoryStorage.existsPromise(['key1', 'key2', '...'])
2424
```
2525

2626
```java
27-
JSONArray keys = new JSONArray().put("key1").put("key2").put("...");
27+
String[] keys = {"key1", "key2", "..."};
28+
2829
kuzzle.memoryStorage.exists(keys, new ResponseListener<Long>() {
2930
@Override
3031
public void onSuccess(int count) {

src/sdk-reference/memory-storage/geoadd.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ kuzzle.memoryStorage.geoaddPromise('key', points)
3737
```
3838

3939
```java
40-
JSONArray points = new JSONArray()
41-
.put(new JSONObject()
40+
JSONObject[] points = new JSONObject[]{
41+
new JSONObject()
4242
.put("lon", 13.361389)
4343
.put("lat", 38.115556)
44-
.put("name", "Palermo")
45-
)
46-
.put(new JSONObject()
44+
.put("name", "Palermo"),
45+
new JSONObject()
4746
.put("lon", 15.087269)
4847
.put("lat", 37.502669)
4948
.put("name", "Catania")
50-
);
49+
};
5150

5251
kuzzle.memoryStorage.geoadd("key", points, new ResponseListener<Long>() {
5352
@Override

0 commit comments

Comments
 (0)