A list of sort objects that specifies how the records will be ordered. Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either "asc" or "desc". The default direction is "asc"
async
(params, auths) => {
}
var sort = "";
if(params.sort){
var i = 0;
for (const s of params.sort) {
var prefix = i==0 ? "?" : "&";
var sort_param = `${prefix}sort[${i}][field]=${s.field}&sort[${i}][direction]=${s.direction}`;
sort = sort + sort_param;
i++;
}
}
const config = {
url: `https://api.airtable.com/v0/${params.base_id}/${encodeURIComponent(params.table_name)}${sort}`,
params: {
fields: params.fields,
filterByFormula: params.filterByFormula,
maxRecords: params.maxRecords,
pageSize: params.pageSize,
view: params.view,
cellFormat: params.cellFormat,
timeZone: params.timeZone,
userLocale: params.userLocale,
offset: params.offset,
},
headers: {
Authorization: `Bearer ${auths.airtable.api_key}`,
},
}
return await require("@pipedreamhq/platform").axios(this, config)