-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtype.ts
More file actions
177 lines (152 loc) · 3.83 KB
/
type.ts
File metadata and controls
177 lines (152 loc) · 3.83 KB
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
export enum TeamVisibilityType {
PUBLIC = 'public',
PRIVATE = 'private',
}
export enum NotePublishType {
EDIT = 'edit',
VIEW = 'view',
SLIDE = 'slide',
BOOK = 'book'
}
export enum CommentPermissionType {
DISABLED = 'disabled',
FORBIDDEN = 'forbidden',
OWNERS = 'owners',
SIGNED_IN_USERS = 'signed_in_users',
EVERYONE = 'everyone'
}
export type CreateNoteOptions = {
title?: string
content?: string
description?: string
tags?: string[]
readPermission?: NotePermissionRole,
writePermission?: NotePermissionRole,
commentPermission?: CommentPermissionType,
permalink?: string
parentFolderId?: string
}
export type Team = {
id: string
ownerId: string
name: string
logo: string
path: string
description: string
hardBreaks: boolean
visibility: TeamVisibilityType
createdAt: Date
}
export type User = {
id: string
email: string | null
name: string
userPath: string
photo: string
teams: Team[]
}
export type SimpleUserProfile = {
name: string,
userPath: string
photo: string
biography: string | null
createdAt: Date
}
export enum NotePermissionRole {
OWNER = 'owner',
SIGNED_IN = 'signed_in',
GUEST = 'guest'
}
/** Folder breadcrumb segment as returned on notes (OpenAPI `FolderPath`). */
export type FolderPath = {
id: string
name: string
icon: string | null
color: string | null
parentId: string | null
clientId: string
}
export type Note = {
id: string
title: string
tags: string[]
lastChangedAt: string
createdAt: string
lastChangeUser: SimpleUserProfile | null
publishType: NotePublishType
publishedAt: string | null
userPath: string | null
teamPath: string | null
permalink: string | null
shortId: string
publishLink: string
readPermission: NotePermissionRole
writePermission: NotePermissionRole
folderPaths?: FolderPath[]
}
export type SingleNote = Note & {
content: string
}
export type UpdateNoteOptions = Partial<Pick<SingleNote, 'content' | 'title' | 'tags' | 'readPermission' | 'writePermission' | 'permalink'>> & {
parentFolderId?: string
}
// User
export type GetMe = User
// User notes
export type GetUserNotes = Note[]
export type GetUserNote = SingleNote
export type GetUserHistory = Note[]
export type CreateUserNote = SingleNote
export type UpdateUserNote = void
export type DeleteUserNote = void
// Teams
export type GetUserTeams = Team[]
// Team notes
export type GetTeamNotes = Note[]
export type CreateTeamNote = SingleNote
export type UpdateTeamNote = void
export type DeleteTeamNote = void
// Folders (user & team workspaces)
export type ApiFolder = {
id: string
name: string
description: string | null
icon: string | null
color: string | null
parentFolderId: string | null
createdAt: number
updatedAt: number
}
/** Maps each parent folder id or the literal `root` to ordered child folder ids. */
export type ApiFolderOrder = Record<string, string[]>
export type CreateUserFolderBody = {
name?: string
description?: string
icon?: string
color?: string
parentFolderId?: string
}
export type UpdateUserFolderBody = {
name?: string
description?: string | null
icon?: string | null
color?: string | null
parentFolderId?: string | null
}
export type CreateTeamFolderBody = CreateUserFolderBody
export type UpdateTeamFolderBody = UpdateUserFolderBody
export type UpdateFolderOrderBody = {
order: ApiFolderOrder
}
export type GetFolders = ApiFolder[]
export type GetTeamFolders = ApiFolder[]
export type GetFolder = ApiFolder
export type GetTeamFolder = ApiFolder
export type CreateFolderResult = ApiFolder
export type CreateTeamFolderResult = ApiFolder
export type UpdateFolderResult = ApiFolder
export type UpdateTeamFolderResult = ApiFolder
export type DeleteFolderResult = void
export type DeleteTeamFolderResult = void
export type GetFolderOrder = ApiFolderOrder
export type GetTeamFolderOrder = ApiFolderOrder