Skip to content

Commit a76f9dd

Browse files
Merge pull request #14 from SlicingDice/feature/renaming
Feature/renaming
2 parents 04d5664 + 626ea91 commit a76f9dd

File tree

12 files changed

+30176
-31059
lines changed

12 files changed

+30176
-31059
lines changed

README.md

Lines changed: 91 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Official JavaScript client for [SlicingDice](http://www.slicingdice.com/), Data
99

1010
If you are new to SlicingDice, check our [quickstart guide](http://panel.slicingdice.com/docs/#quickstart-guide) and learn to use it in 15 minutes.
1111

12-
Please refer to the [SlicingDice official documentation](http://panel.slicingdice.com/docs/) for more information on [analytics databases](http://panel.slicingdice.com/docs/#analytics-concepts), [data modeling](http://panel.slicingdice.com/docs/#data-modeling), [indexing](http://panel.slicingdice.com/docs/#data-indexing), [querying](http://panel.slicingdice.com/docs/#data-querying), [limitations](http://panel.slicingdice.com/docs/#current-slicingdice-limitations) and [API details](http://panel.slicingdice.com/docs/#api-details).
12+
Please refer to the [SlicingDice official documentation](http://panel.slicingdice.com/docs/) for more information on [analytics databases](http://panel.slicingdice.com/docs/#analytics-concepts), [data modeling](http://panel.slicingdice.com/docs/#data-modeling), [data insertion](http://panel.slicingdice.com/docs/#data-insertion), [querying](http://panel.slicingdice.com/docs/#data-querying), [limitations](http://panel.slicingdice.com/docs/#current-slicingdice-limitations) and [API details](http://panel.slicingdice.com/docs/#api-details).
1313

1414
## Tests and Examples
1515

@@ -42,18 +42,19 @@ const client = new SlicingDice({
4242
readKey: 'READ_API_KEY'
4343
}, usesTestEndpoint = true);
4444

45-
// Indexing data
46-
const indexData = {
45+
// Inserting data
46+
const insertData = {
4747
"user1@slicingdice.com": {
4848
"age": 22
4949
},
50-
"auto-create-fields": true
50+
"auto-create": ["table", "column"]
5151
};
52-
client.index(indexData);
52+
client.insert(insertData);
5353

5454
// Querying data
5555
const queryData = {
56-
"users-between-20-and-40": [
56+
"query-name": "users-between-20-and-40",
57+
"query": [
5758
{
5859
"age": {
5960
"range": [
@@ -85,8 +86,8 @@ client.countEntity(queryData).then((resp) => {
8586
* `apiKeys (Object)` - [API key](http://panel.slicingdice.com/docs/#api-details-api-connection-api-keys) to authenticate requests with the SlicingDice API.
8687
* `usesTestEndpoint (boolean)` - If false the client will send requests to production end-point, otherwise to tests end-point.
8788

88-
### `getProjects()`
89-
Get all created projects, both active and inactive ones. This method corresponds to a [GET request at /project](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-project).
89+
### `getDatabase()`
90+
Get information about current database. This method corresponds to a [GET request at /database](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-database).
9091

9192
#### Request example
9293

@@ -97,7 +98,7 @@ const client = new SlicingDice({
9798
masterKey: 'MASTER_API_KEY'
9899
}, usesTestEndpoint = false);
99100

100-
client.getProjects().then((resp) => {
101+
client.getDatabase().then((resp) => {
101102
console.log(resp);
102103
}, (err) => {
103104
console.error(err);
@@ -108,27 +109,15 @@ client.getProjects().then((resp) => {
108109

109110
```json
110111
{
111-
"active": [
112-
{
113-
"name": "Project 1",
114-
"description": "My first project",
115-
"data-expiration": 30,
116-
"created-at": "2016-04-05T10:20:30Z"
117-
}
118-
],
119-
"inactive": [
120-
{
121-
"name": "Project 2",
122-
"description": "My second project",
123-
"data-expiration": 90,
124-
"created-at": "2016-04-05T10:20:30Z"
125-
}
126-
]
112+
"name": "Database 1",
113+
"description": "My first database",
114+
"data-expiration": 30,
115+
"created-at": "2016-04-05T10:20:30Z"
127116
}
128117
```
129118

130-
### `getFields()`
131-
Get all created fields, both active and inactive ones. This method corresponds to a [GET request at /field](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-field).
119+
### `getColumns()`
120+
Get all created columns, both active and inactive ones. This method corresponds to a [GET request at /column](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-column).
132121

133122
#### Request example
134123

@@ -139,7 +128,7 @@ const client = new SlicingDice({
139128
masterKey: 'MASTER_API_KEY'
140129
}, usesTestEndpoint = true);
141130

142-
client.getFields().then((resp) => {
131+
client.getColumns().then((resp) => {
143132
console.log(resp);
144133
}, (err) => {
145134
console.error(err);
@@ -174,8 +163,8 @@ client.getFields().then((resp) => {
174163
}
175164
```
176165

177-
### `createField(jsonData)`
178-
Create a new field. This method corresponds to a [POST request at /field](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-field).
166+
### `createColumn(jsonData)`
167+
Create a new column. This method corresponds to a [POST request at /column](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-column).
179168

180169
#### Request example
181170

@@ -186,15 +175,15 @@ const client = new SlicingDice({
186175
masterKey: 'MASTER_API_KEY'
187176
}, usesTestEndpoint = true);
188177

189-
field = {
178+
column = {
190179
"name": "Year",
191180
"api-name": "year",
192181
"type": "integer",
193182
"description": "Year of manufacturing",
194183
"storage": "latest-value"
195184
};
196185

197-
client.createField(field).then((resp) => {
186+
client.createColumn(column).then((resp) => {
198187
console.log(resp);
199188
}, (err) => {
200189
console.error(err);
@@ -210,8 +199,8 @@ client.createField(field).then((resp) => {
210199
}
211200
```
212201

213-
### `index(jsonData)`
214-
Index data to existing entities or create new entities, if necessary. This method corresponds to a [POST request at /index](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-index).
202+
### `insert(jsonData)`
203+
Insert data to existing entities or create new entities, if necessary. This method corresponds to a [POST request at /insert](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-insert).
215204

216205
#### Request example
217206

@@ -223,7 +212,7 @@ const client = new SlicingDice({
223212
writeKey: 'WRITE_API_KEY'
224213
}, usesTestEndpoint = true);
225214

226-
indexData = {
215+
const insertData = {
227216
"user1@slicingdice.com": {
228217
"car-model": "Ford Ka",
229218
"year": 2016
@@ -258,7 +247,7 @@ indexData = {
258247
}
259248
};
260249

261-
client.index(indexData, autoCreateFields = true).then((resp) => {
250+
client.insert(insertData).then((resp) => {
262251
console.log(resp);
263252
}, (err) => {
264253
console.error(err);
@@ -270,14 +259,14 @@ client.index(indexData, autoCreateFields = true).then((resp) => {
270259
```json
271260
{
272261
"status": "success",
273-
"indexed-entities": 4,
274-
"indexed-fields": 10,
262+
"inserted-entities": 4,
263+
"inserted-columns": 10,
275264
"took": 0.023
276265
}
277266
```
278267

279268
### `existsEntity(ids)`
280-
Verify which entities exist in a project given a list of entity IDs. This method corresponds to a [POST request at /query/exists/entity](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-query-exists-entity).
269+
Verify which entities exist in a database given a list of entity IDs. This method corresponds to a [POST request at /query/exists/entity](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-query-exists-entity).
281270

282271
#### Request example
283272

@@ -319,7 +308,7 @@ client.existsEntity(ids).then((resp) => {
319308
```
320309

321310
### `countEntityTotal()`
322-
Count the number of indexed entities. This method corresponds to a [GET request at /query/count/entity/total](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-query-count-entity-total).
311+
Count the number of inserted entities. This method corresponds to a [GET request at /query/count/entity/total](http://panel.slicingdice.com/docs/#api-details-api-endpoints-get-query-count-entity-total).
323312

324313
#### Request example
325314

@@ -363,29 +352,36 @@ const client = new SlicingDice({
363352
readKey: 'READ_KEY'
364353
}, usesTestEndpoint = true);
365354

366-
query = {
367-
"corolla-or-fit": [
368-
{
369-
"car-model": {
370-
"equals": "toyota corolla"
371-
}
372-
},
373-
"or",
374-
{
375-
"car-model": {
376-
"equals": "honda fit"
355+
const query = [
356+
{
357+
"query-name": "corolla-or-fit",
358+
"query": [
359+
{
360+
"car-model": {
361+
"equals": "toyota corolla"
362+
}
363+
},
364+
"or",
365+
{
366+
"car-model": {
367+
"equals": "honda fit"
368+
}
377369
}
378-
},
379-
],
380-
"ford-ka": [
381-
{
382-
"car-model": {
383-
"equals": "ford ka"
370+
],
371+
"bypass-cache": false
372+
},
373+
{
374+
"query-name": "ford-ka",
375+
"query": [
376+
{
377+
"car-model": {
378+
"equals": "ford ka"
379+
}
384380
}
385-
}
386-
],
387-
"bypass-cache": false
388-
};
381+
],
382+
"bypass-cache": false
383+
}
384+
];
389385

390386
client.countEntity(query).then((resp) => {
391387
console.log(resp);
@@ -420,31 +416,38 @@ const client = new SlicingDice({
420416
readKey: 'READ_KEY'
421417
}, usesTestEndpoint = true);
422418

423-
query = {
424-
"test-drives-in-ny": [
419+
const query = [
425420
{
426-
"test-drives": {
427-
"equals": "NY",
428-
"between": [
429-
"2016-08-16T00:00:00Z",
430-
"2016-08-18T00:00:00Z"
431-
]
432-
}
433-
}
434-
],
435-
"test-drives-in-ca": [
421+
"query-name": "test-drives-in-ny",
422+
"query": [
423+
{
424+
"test-drives": {
425+
"equals": "NY",
426+
"between": [
427+
"2016-08-16T00:00:00Z",
428+
"2016-08-18T00:00:00Z"
429+
]
430+
}
431+
}
432+
],
433+
"bypass-cache": true
434+
},
436435
{
437-
"test-drives": {
438-
"equals": "CA",
439-
"between": [
440-
"2016-04-04T00:00:00Z",
441-
"2016-04-06T00:00:00Z"
442-
]
443-
}
436+
"query-name": "test-drives-in-ca",
437+
"query": [
438+
{
439+
"test-drives": {
440+
"equals": "CA",
441+
"between": [
442+
"2016-04-04T00:00:00Z",
443+
"2016-04-06T00:00:00Z"
444+
]
445+
}
446+
}
447+
],
448+
"bypass-cache": true
444449
}
445-
],
446-
"bypass-cache": true
447-
}
450+
];
448451

449452
client.countEvent(query).then((resp) => {
450453
console.log(resp);
@@ -535,7 +538,7 @@ client.topValues(query).then((resp) => {
535538
```
536539

537540
### `aggregation(jsonData)`
538-
Return the aggregation of all fields in the given query. This method corresponds to a [POST request at /query/aggregation](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-query-aggregation).
541+
Return the aggregation of all columns in the given query. This method corresponds to a [POST request at /query/aggregation](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-query-aggregation).
539542

540543
#### Request example
541544

@@ -870,7 +873,7 @@ client.deleteSavedQuery("my-saved-query").then((resp) => {
870873
```
871874

872875
### `result(jsonData)`
873-
Retrieve indexed values for entities matching the given query. This method corresponds to a [POST request at /data_extraction/result](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-data-extraction-result).
876+
Retrieve inserted values for entities matching the given query. This method corresponds to a [POST request at /data_extraction/result](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-data-extraction-result).
874877

875878
#### Request example
876879

@@ -896,7 +899,7 @@ query = {
896899
}
897900
}
898901
],
899-
"fields": ["car-model", "year"],
902+
"columns": ["car-model", "year"],
900903
"limit": 2
901904
};
902905

@@ -929,7 +932,7 @@ client.result(query).then((resp) => {
929932
```
930933

931934
### `score(jsonData)`
932-
Retrieve indexed values as well as their relevance for entities matching the given query. This method corresponds to a [POST request at /data_extraction/score](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-data-extraction-score).
935+
Retrieve inserted values as well as their relevance for entities matching the given query. This method corresponds to a [POST request at /data_extraction/score](http://panel.slicingdice.com/docs/#api-details-api-endpoints-post-data-extraction-score).
933936

934937
#### Request example
935938

@@ -955,7 +958,7 @@ query = {
955958
}
956959
}
957960
],
958-
"fields": ["car-model", "year"],
961+
"columns": ["car-model", "year"],
959962
"limit": 2
960963
};
961964

0 commit comments

Comments
 (0)