Skip to content

Commit 481691c

Browse files
committed
adding get csv api
1 parent 437849b commit 481691c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

lib/const.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ module.exports = Object.freeze({
3535
RESET: 'reset',
3636
BRANCH: 'branch',
3737
ADD_CSV: 'add_csv',
38-
GET_CSV: 'get_csv'
38+
GET_CSV: 'get_csv',
39+
UPDATE_CSV: 'update_csv'
3940
})

lib/dispatchRequest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function DispatchRequest(url, action, payload, local_auth, remote_auth = null) {
7373
case CONST.READ_DATABASE:
7474
case CONST.READ_ORGANIZATION:
7575
case CONST.CONNECT:
76+
case CONST.GET_CSV:
7677
case CONST.CLASS_FRAME:
7778
if (payload) {
7879
const ext = UTILS.URIEncodePayload(payload)

lib/woqlClient.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,29 @@ WOQLClient.prototype.addCSV = function(gtype, gid, csv, commit_msg) {
413413
formData.append('payload', JSON.stringify(commit))
414414
return this.dispatch(
415415
CONST.ADD_CSV,
416-
this.connectionConfig.csvURL(),
416+
this.connectionConfig.csvURL(gtype, gid),
417417
formData,
418418
)
419419
}
420420
}
421421

422+
423+
/**
424+
* gets loaded csv
425+
*
426+
* @param {string} gtype Type of graph (instance|schema|inference)
427+
* schema get the database schema in owl
428+
* instance get all the database documents data in owl format
429+
* inference get all the constraints schema in owl
430+
*
431+
* @return {Promise}
432+
*
433+
*/
434+
WOQLClient.prototype.getCSV = function(gtype, gid) {
435+
return this.dispatch(CONST.GET_CSV, this.connectionConfig.csvURL(gtype, gid))
436+
}
437+
438+
422439
/**
423440
* Executes a WOQL query on the specified database and returns the results
424441
*

0 commit comments

Comments
 (0)