knack-object-api
Version:
Object based api calls in Knack
73 lines (67 loc) • 2.05 kB
TypeScript
interface Rules {
field: string;
operator: "is" | "is not" | "is blank" | "is not blank" | "contains" | "does not contain" | "starts with" | "ends with" | "is any" | "is during the current" | "is during the previous" | "is during the next" | "is before the previous" | "is after the next" | "is before" | "is after" | "is today" | "is today or before" | "is today or after" | "is before today" | "is after today" | "is before current time" | "is after current time" | "higher than" | "lower than" | "near";
value?: string;
range?: number;
type?: string;
}
interface Filters {
match: "and" | "or";
rules: Rules[];
}
interface Sort {
field: string;
order: "asc" | "desc";
}
interface getSettings {
objectKey: string;
recordId?: string;
filters?: Filters;
sort?: Sort[] | Sort;
debug?: boolean;
page?: number;
rowsPerPage?: number;
method?: string;
attempts?: number;
recordLimit?: number;
format?: "html" | "raw" | "both";
requestId?: string;
factory?: any;
host?: string;
}
interface putSettings {
objectKey: string;
recordId: string;
payload: any;
debug?: boolean;
attempts?: number;
method?: string;
requestId?: string;
factory?: any;
host?: string;
}
interface postSettings {
objectKey: string;
payload: any;
debug?: boolean;
attempts?: number;
method?: string;
requestId?: string;
factory?: any;
host?: string;
}
interface deleteSettings {
objectKey: string;
recordId: string;
debug?: boolean;
attempts?: number;
method?: string;
requestId?: string;
factory?: any;
host?: string;
}
declare const get: (settings: getSettings) => Promise<any>;
declare const post: (settings: postSettings) => Promise<any>;
declare const deletion: (settings: deleteSettings) => Promise<any>;
declare const put: (settings: putSettings) => Promise<any>;
export { Filters, Rules, Sort, deleteSettings, deletion, get, getSettings, post, postSettings, put, putSettings };