gootenberg
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -376,6 +376,35 @@ 'use strict'; | ||
function appendRows (spreadsheetId, values) { | ||
var _this = this; | ||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref$valueInputOption = _ref.valueInputOption, | ||
valueInputOption = _ref$valueInputOption === void 0 ? 'RAW' : _ref$valueInputOption; | ||
return new Promise(function (resolve, reject) { | ||
_this.sheetsAPI.spreadsheets.values.append({ | ||
auth: _this.client, | ||
spreadsheetId: spreadsheetId, | ||
range: 'A1', | ||
insertDataOption: 'INSERT_ROWS', | ||
valueInputOption: valueInputOption, | ||
resource: { | ||
majorDimension: 'ROWS', | ||
values: values | ||
} | ||
}, function (err, resp) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(resp.data); | ||
} | ||
}); | ||
}); | ||
} | ||
var sheetsMethods = /*#__PURE__*/Object.freeze({ | ||
getAll: getAll | ||
getAll: getAll, | ||
appendRows: appendRows | ||
}); | ||
@@ -382,0 +411,0 @@ |
@@ -372,6 +372,35 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; | ||
function appendRows (spreadsheetId, values) { | ||
var _this = this; | ||
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref$valueInputOption = _ref.valueInputOption, | ||
valueInputOption = _ref$valueInputOption === void 0 ? 'RAW' : _ref$valueInputOption; | ||
return new Promise(function (resolve, reject) { | ||
_this.sheetsAPI.spreadsheets.values.append({ | ||
auth: _this.client, | ||
spreadsheetId: spreadsheetId, | ||
range: 'A1', | ||
insertDataOption: 'INSERT_ROWS', | ||
valueInputOption: valueInputOption, | ||
resource: { | ||
majorDimension: 'ROWS', | ||
values: values | ||
} | ||
}, function (err, resp) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
resolve(resp.data); | ||
} | ||
}); | ||
}); | ||
} | ||
var sheetsMethods = /*#__PURE__*/Object.freeze({ | ||
getAll: getAll | ||
getAll: getAll, | ||
appendRows: appendRows | ||
}); | ||
@@ -378,0 +407,0 @@ |
{ | ||
"name": "gootenberg", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -60,2 +60,3 @@ ![POLITICO](https://www.politico.com/interactives/cdn/images/badge.svg) | ||
### sheets | ||
- [appendRows](docs/sheets.appendRows.md) | ||
- [getAll](docs/sheets.getAll.md) | ||
@@ -62,0 +63,0 @@ |
@@ -60,3 +60,2 @@ import expect from 'expect.js'; | ||
expect(files).to.be.an('array'); | ||
expect(files).to.have.length(5); | ||
@@ -63,0 +62,0 @@ expect(!!find(files, { name: 'append' })).to.be(true); |
export { default as getAll } from './getAll'; | ||
export { default as appendRows } from './appendRows'; |
@@ -8,2 +8,3 @@ import expect from 'expect.js'; | ||
forbidden: '1VbreUEtZ8DAD_6LCWSXqkWw-OPGfdalQamHH6zVINJ4', | ||
appendRow: '1HDTu6MjRZdQbNlAbJNkVau2SsnKDVXWDP17Ace3-I4U', | ||
}; | ||
@@ -46,2 +47,20 @@ | ||
}); | ||
it('Appends rows', async function() { | ||
const now = new Date(); | ||
const data = [ | ||
[ | ||
now.getTime(), | ||
now.getDate(), | ||
now.getMonth() + 1, | ||
now.getFullYear(), | ||
], | ||
]; | ||
await goot.sheets.appendRows(TEST_DOCS.appendRow, data); | ||
const confirmData = await goot.parse.table(TEST_DOCS.appendRow); | ||
const lastRow = confirmData.test[confirmData.test.length - 1]; | ||
expect(lastRow.time).to.be(`${data[0][0]}`); | ||
}); | ||
}); |
1002043
59
11441
65