Upgrade samples to v40 and use new requestBody key
Can I make a quick contribution to improving the docs? requestBody object to replace responses like so:
Pass ✔
const req = {
requestBody: {
properties: {
title : sheetTitle
}
},
auth
}
sheet.spreadsheets.create(req, callback)
//Using Promises
const creatSheet = await sheet.spreadsheets.create(req)
Fails ❌
const res = {
resource: {
properties: {
title : sheetTitle
}
},
auth
}
sheet.spreadsheets.create(res, callback)
// Using Promises
const creatSheet = await sheet.spreadsheets.create(res)
Link: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create
Where do you see the failing code in the documentation?
Updated the issue with the link. Sorry for missing that out. 😅
So using the key "responses" like you had in your original code will fail, but isn't what's shown on the page. The preferred key was recently changes to "requestBody", but it was a backwards compatible change and "resources" is still accepted.
https://github.com/googleapis/google-api-nodejs-client/pull/1149
Changing this to an enhancement to upgrade to v40 of the library and update our key to "requestBody".