//Display object results as defined in the schema in the variable "data".
resultType: coda.ValueType.Object,
schema: TBSchema,
execute: async function ([Country], context) {
let url = "https://travelbriefing.org/" + Country + "?format=json";
let response = await context.fetcher.fetch({ method: 'GET', url });
let data = {
name: response.body.names.name,
continent: response.body.names.continent,
timezone: response.body.timezone.name,
electricityVolts: response.body.electricity.voltage,
electricityPlugs: response.body.electricity.plugs,
languages: response.body.language,
currency: response.body.currency,
telephoneCode: response.body.telephone.calling_code,
emergency: response.body.telephone.police,
};
return data;
}
});