Skip to content

Commit 20737e4

Browse files
authored
feat(custom apis): adds missing properties to custom apis (#23)
BREAKING CHANGE: adds a required `allow_upserts` to CustomApiBase and a required `use_as_url_slug` to CustomApiFieldBase
1 parent d5d8777 commit 20737e4

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

src/types/custom-apis.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface CustomApiBase {
1313
api_type: string
1414
type: string
1515
slug: string
16+
allow_upserts: boolean
1617
}
1718

1819
export interface CustomApi extends Identifiable, CustomApiBase {
@@ -28,18 +29,44 @@ export interface CustomApi extends Identifiable, CustomApiBase {
2829
}
2930

3031
export type CustomFieldValidation =
31-
| { string: { min_length?: number, max_length?: number, regex?: string, allow_null_values?: boolean } }
32-
| { integer: { min_value?: number, max_value?: number, allow_null_values?: boolean } }
33-
| { float: { min_value?: number, max_value?: number, allow_null_values?: boolean } }
34-
| { boolean: { allow_null_values?: boolean } }
32+
| { string: {
33+
min_length?: number | null,
34+
max_length?: number | null,
35+
regex?: string | null,
36+
allow_null_values?: boolean,
37+
immutable?: boolean,
38+
unique: "yes" | "no",
39+
unique_case_insensitivity?: boolean
40+
}
41+
}
42+
| { integer: {
43+
min_value?: number | null,
44+
max_value?: number | null,
45+
allow_null_values?: boolean,
46+
immutable?: boolean
47+
}
48+
}
49+
| { float: {
50+
min_value?: number | null,
51+
max_value?: number | null,
52+
allow_null_values?: boolean,
53+
immutable?: boolean
54+
}
55+
}
56+
| { boolean: {
57+
allow_null_values?: boolean,
58+
immutable?: boolean
59+
}
60+
}
3561

3662
export interface CustomApiFieldBase {
3763
name: string
3864
description: string
3965
field_type: string
4066
type: string
4167
slug: string
42-
validation?: CustomFieldValidation
68+
validation?: CustomFieldValidation,
69+
use_as_url_slug: boolean
4370
}
4471

4572
export interface CustomApiField extends Identifiable, CustomApiFieldBase {
@@ -113,5 +140,4 @@ export interface CustomApisEndpoint {
113140
): Promise<ResponseBody>
114141

115142
DeleteEntry<T = any>(customApiId: string, customApiEntryId: string): Promise<T>
116-
117143
}

0 commit comments

Comments
 (0)