-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
types.ts
89 lines (76 loc) · 1.7 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import * as Field from "./field-types.ts";
import { Timezone, UserLocale } from "./constants.ts";
export interface AirtableOptions {
apiKey?: string;
endpointUrl?: string;
baseId?: string;
tableName?: string;
useEnv?: boolean;
}
export interface AirtableRequestOptions extends RequestInit {
url: string;
jsonBody?: any;
}
export interface FieldSet<T extends string = string> {
[key: string]: FieldSetValue<T>;
}
export { Field };
export type FieldSetValue<T extends string = string> =
| undefined
| string
| string[]
| number
| boolean
| Field.RecordLink
| Field.SingleLineText
| Field.LongText
| Field.Checkbox
| Field.MultipleSelect<T>
| Field.SingleSelect<T>
| Field.Collaborator
| Field.Collaborators
| Field.Attachment[]
| Field.DateType
| Field.PhoneNumber
| Field.Email
| Field.URL
| Field.Number
| Field.Currency
| Field.Percent
| Field.Duration
| Field.Rating;
export interface SelectOptions<T extends FieldSet> {
fields?: (keyof T)[];
filterByFormula?: string;
maxRecords?: number;
pageSize?: number;
sort?: {
field: string;
direction?: "asc" | "desc";
}[];
view?: string;
cellFormat?: "json" | "string";
timeZone?: Timezone;
userLocale?: UserLocale;
}
export interface SelectResult<T extends FieldSet> extends TableRecords<T> {
offset: string;
}
export interface TableRecord<T extends FieldSet> {
id: string;
fields: T;
createdTime?: string;
}
export interface TableRecords<T extends FieldSet> {
records: TableRecord<T>[];
}
export interface DeletedRecord {
id: string;
deleted: boolean;
}
export interface DeletedRecords {
records: DeletedRecord[];
}
export interface RecordOptions {
typecast?: boolean;
}