Skip to content

Commit 1e5eb56

Browse files
committed
adding delete csv
1 parent 7089f47 commit 1e5eb56

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

lib/const.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ module.exports = Object.freeze({
3737
ADD_CSV: 'add_csv',
3838
GET_CSV: 'get_csv',
3939
UPDATE_CSV: 'update_csv',
40+
DELETE_CSV: 'delete_csv',
4041
MESSAGE: 'message'
4142
})

lib/dispatchRequest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function DispatchRequest(url, action, payload, local_auth, remote_auth = null) {
6363
}
6464
switch (action) {
6565
case CONST.DELETE_DATABASE:
66+
case CONST.DELETE_CSV:
6667
case CONST.DELETE_GRAPH:
6768
case CONST.DELETE_USER:
6869
case CONST.DELETE_ORGANIZATION:

lib/woqlClient.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,22 @@ WOQLClient.prototype.getCSV = function(csvName, download, gtype, gid) {
478478
})
479479
}
480480

481+
/**
482+
* Deletes a csv into the specified path
483+
*
484+
* @param {array} csvName is an array of csv file names
485+
* @param {string} gtype type of graph |instance|schema|inference|
486+
* @param {string} gid TerminusDB Graph ID to update, main is the default value
487+
* @return {Promise} An API success message
488+
*/
489+
WOQLClient.prototype.deleteCSV = function(csvName, gtype, gid) {
490+
let options = {}, filePath
491+
options.name=csvName;
492+
return this.dispatch(CONST.DELETE_CSV, this.connectionConfig.csvURL(gtype, gid), options).then(results => {
493+
return results;
494+
})
495+
}
496+
481497
/**
482498
* sends a message to the server
483499
* @param {string} msg - textual string

0 commit comments

Comments
 (0)