n8n-nodes-base
Version:
Base nodes of n8n
28 lines • 938 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.googleApiRequest = googleApiRequest;
const n8n_workflow_1 = require("n8n-workflow");
async function googleApiRequest(method, endpoint, body = {}, qs = {}, uri, option = {}) {
let options = {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
method,
body,
qs,
uri: uri || `https://language.googleapis.com${endpoint}`,
json: true,
};
options = Object.assign({}, options, option);
try {
if (Object.keys(body).length === 0) {
delete options.body;
}
return await this.helpers.requestOAuth2.call(this, 'googleCloudNaturalLanguageOAuth2Api', options);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=GenericFunctions.js.map