-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.js
44 lines (38 loc) · 1020 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const readSheet = require("./src/read"),
appendRow = require("./src/append"),
deleteRows = require("./src/delete"),
editRows = require("./src/edit");
function SteinStore(storageURL) {
this.url = storageURL.endsWith("/") ? storageURL : storageURL + "/";
}
SteinStore.prototype.read = function(
sheetName,
{ limit, offset, search, authentication } = {}
) {
return readSheet(this.url, sheetName, {
limit,
offset,
search,
authentication
});
};
SteinStore.prototype.append = function(
sheetName,
rows,
{ authentication } = {}
) {
return appendRow(this.url, sheetName, rows, { authentication });
};
SteinStore.prototype.edit = function(
sheetName,
{ search, set, limit, authentication }
) {
return editRows(this.url, sheetName, { search, set, limit, authentication });
};
SteinStore.prototype.delete = function(
sheetName,
{ search, limit, authentication }
) {
return deleteRows(this.url, sheetName, { search, limit, authentication });
};
module.exports = SteinStore;