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