-
Notifications
You must be signed in to change notification settings - Fork 1
/
notion.types.ts
185 lines (161 loc) · 3.35 KB
/
notion.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
declare type noColor = "default";
export type Pages = {
parent: Parent;
properties: PageStats;
id: string;
};
type Parent =
| {
database_id: string;
}
| {
page_id: string;
}
| {
block_id: string;
}
| {
workspace: true;
};
export type Platform = "원티드" | "로켓펀치";
export type SelectRequest =
| {
id: string;
name?: string;
color?: noColor | SelectColor;
}
| null
| {
name: string;
id?: string;
color?: noColor | SelectColor;
};
export type Annotations = {
bold: boolean;
italic: boolean;
strikethrough: boolean;
underline: boolean;
code: boolean;
color: noColor | AnnotationColor;
};
type PageProperties =
| {
type?: "title";
title: TextRichTextItem[];
}
| {
type?: "rich_text";
rich_text: TextRichTextItem[];
}
| {
type?: "number";
number: number | null;
}
| {
type?: "url";
url: string | null;
}
| {
type?: "select";
select: SelectRequest;
}
| {
type?: "multi_select";
multi_select: SelectRequest[];
}
| {
type?: "email";
email: string | null;
}
| {
type?: "phone_number";
phone_number: string | null;
}
| {
type?: "checkbox";
checkbox: boolean;
}
| {
type?: "files";
files: (
| {
type?: "file";
file: {
url: string;
expiry_time?: string;
};
name: string;
}
| {
type?: "external";
external: {
url: string;
};
name: string;
}
)[];
}
| {
type?: "text";
content: string;
link: { url: string } | null;
};
export declare type TextRichTextItem = {
type?: "text";
text: {
content: string;
link: {
url: string;
} | null;
};
annotations: Annotations;
plain_text: string;
href: string | null;
};
/** TypeScript Type Def Utils */
type Request<T> = Extract<PageProperties, { type?: T }>;
export type ArrayElement<ArrayType extends readonly unknown[]> =
ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
type Background<Color extends string> = `${Color}_background`;
/** TypeScript Type Def Utils */
export interface PageStats {
분야: NotionSelect;
URL: NotionURL;
주요업무: RichText;
회사타입: MultiSelect;
회사위치: RichText;
우대사항: RichText;
기술스택: MultiSelect;
회사설명: RichText;
자격요건: RichText;
포지션: RichText;
좋아요: Numeric;
썸네일: NotionFile;
회사명: RichText;
응답률: Numeric;
아이디: NotionTitle;
혜택및복지: RichText;
}
export type Prop = keyof PageStats;
export type NotionURL = Request<"url">;
export type RichText = Request<"rich_text">;
export type MultiSelect = Request<"multi_select">;
export type NotionSelect = Request<"select">;
export type Numeric = Request<"number">;
export type NotionTitle = Request<"title">;
export type NotionFile = Request<"files">;
export type NotionText = Request<"text">;
export declare type SelectColor =
| "gray"
| "brown"
| "orange"
| "yellow"
| "green"
| "blue"
| "purple"
| "pink"
| "red";
export declare type AnnotationColor =
| noColor
| SelectColor
| Background<SelectColor>;