Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions src/types/custom-apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface CustomApiBase {
api_type: string
type: string
slug: string
allow_upserts: boolean
}

export interface CustomApi extends Identifiable, CustomApiBase {
Expand All @@ -28,18 +29,44 @@ export interface CustomApi extends Identifiable, CustomApiBase {
}

export type CustomFieldValidation =
| { string: { min_length?: number, max_length?: number, regex?: string, allow_null_values?: boolean } }
| { integer: { min_value?: number, max_value?: number, allow_null_values?: boolean } }
| { float: { min_value?: number, max_value?: number, allow_null_values?: boolean } }
| { boolean: { allow_null_values?: boolean } }
| { string: {
min_length?: number | null,
max_length?: number | null,
regex?: string | null,
allow_null_values?: boolean,
immutable?: boolean,
unique: "yes" | "no",
unique_case_insensitivity?: boolean
}
}
| { integer: {
min_value?: number | null,
max_value?: number | null,
allow_null_values?: boolean,
immutable?: boolean
}
}
| { float: {
min_value?: number | null,
max_value?: number | null,
allow_null_values?: boolean,
immutable?: boolean
}
}
| { boolean: {
allow_null_values?: boolean,
immutable?: boolean
}
}

export interface CustomApiFieldBase {
name: string
description: string
field_type: string
type: string
slug: string
validation?: CustomFieldValidation
validation?: CustomFieldValidation,
use_as_url_slug: boolean
}

export interface CustomApiField extends Identifiable, CustomApiFieldBase {
Expand Down Expand Up @@ -113,5 +140,4 @@ export interface CustomApisEndpoint {
): Promise<ResponseBody>

DeleteEntry<T = any>(customApiId: string, customApiEntryId: string): Promise<T>

}