airtable: update SelectOptions to match airtable docs (#37364)

This commit is contained in:
Jonathon
2019-08-05 13:23:06 -07:00
committed by Nathan Shively-Sanders
parent 39c9df962a
commit 573ceaf1de
2 changed files with 34 additions and 1 deletions

View File

@@ -12,7 +12,27 @@ const base = airtable.base('app id');
const table = base('table name') as Airtable.Table<Row>;
async () => {
const query = table.select();
const query = table.select({
fields: [
'field1',
],
filterByFormula: `NOT({Example Text} = '')`,
maxRecords: 100,
pageSize: 10,
sort: [
{
field: 'field1',
},
{
field: 'attachments',
direction: 'asc',
},
],
view: 'test-view',
cellFormat: 'json',
timeZone: 'test-tz',
userLocale: 'test-locale',
});
{
const rows = await query.all();
for (const row of rows) {

View File

@@ -45,8 +45,21 @@ declare global {
destroy(...args: any[]): Promise<any>;
}
interface SortParameter {
field: string;
direction?: 'asc' | 'desc';
}
interface SelectOptions {
fields?: string[];
filterByFormula?: string;
maxRecords?: number;
pageSize?: number;
sort?: SortParameter[];
view?: string;
cellFormat?: 'json' | 'string';
timeZone?: string;
userLocale?: string;
}
interface Query<TFields extends object> {