UNPKG

n8n-nodes-tripadvisor

Version:
82 lines 2.69 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.locationDetailsFields = exports.getLocationDetails = void 0; const https_1 = __importDefault(require("https")); async function getLocationDetails(locationId, apiKey, language, currency) { let url = `https://api.content.tripadvisor.com/api/v1/location/${locationId}/details?key=${apiKey}`; if (language) { url += `&language=${language}`; } if (currency) { url += `&currency=${currency}`; } return new Promise((resolve, reject) => { const options = { method: 'GET', headers: { Accept: 'application/json', }, }; const req = https_1.default.request(url, options, (response) => { let data = ''; response.on('data', (chunk) => { data += chunk; }); response.on('end', () => { resolve(JSON.parse(data)); }); }); req.on('error', (error) => { reject(error); }); req.end(); }); } exports.getLocationDetails = getLocationDetails; exports.locationDetailsFields = [ { displayName: 'Location ID', name: 'locationId', type: 'string', default: '', required: true, description: 'A unique identifier for a location on Tripadvisor. The location ID can be obtained using the Location Search.', displayOptions: { show: { resource: ['locationDetails'], }, }, }, { displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', default: {}, displayOptions: { show: { resource: ['locationDetails'], }, }, options: [ { displayName: 'Language', name: 'language', type: 'string', default: '', description: 'The language in which to return results (e.g. "en" for English or "es" for Spanish) from the list of our Supported Languages', }, { displayName: 'Currency', name: 'currency', type: 'string', default: '', description: 'The currency code to use for request and response (should follow ISO 4217)', }, ], }, ]; //# sourceMappingURL=locationDetails.js.map