-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.tsx
302 lines (259 loc) · 6.31 KB
/
types.tsx
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
import { AndroidNotificationPriority, ChannelAwareTriggerInput, NotificationContentInput, NotificationRequestInput } from "expo-notifications";
import { GestureResponderEvent } from "react-native";
import { JSONResponse } from "./utils/JSONRequest";
export enum InitialRoute {
noHostname = "Connection Settings",
hostname = "Database"
}
export type DrawerParamList = {
Database: undefined
"File System": undefined
Clients: undefined
"Connection Settings": undefined
}
export type DatabaseParamList = {
Database: undefined
}
export type FileSystemParamList = {
"File System": undefined
}
export type ClientsParamList = {
Clients: undefined
}
export type ConnectionSettingsParamList = {
"Connection Settings": undefined
}
export type onPressFunc = (event: GestureResponderEvent) => void
export interface ScheduledNotifParams extends NotificationRequestInput {
identifier: string,
content: {
title: string,
body: string,
vibrate: number[],
priority: AndroidNotificationPriority,
sticky: boolean
},
trigger: ChannelAwareTriggerInput
};
export type SessionInfo = {
hostname: string,
sid: string
}
export interface GetSidSuccessResponse {
sid_was_valid: boolean
sid: string
logged_in: boolean
success: boolean
}
export type GerberaClient = {
ip: string
host: string
time: string
last: string
userAgent: string
name: string
match: string
flags: string
matchType: string
clientType: string
}
export interface GetClientsSuccessResponse {
clients: {
client: GerberaClient[]
}
success: boolean
}
export interface GerberaDirectory {
id: string
child_count: boolean
title: string
}
export interface GetDirectoriesSuccessResponse {
containers: {
parent_id: string
select_it: number
type: ('filesystem')
container: GerberaDirectory[]
}
success: boolean
}
export interface GerberaFile {
id: string
filename: string
}
export interface GetFilesSuccessResponse {
files: {
parent_id: string
location: string
file: GerberaFile[]
}
update_ids: {
pending: boolean
}
success: boolean
}
export interface AddFileToDbSuccessResponse {
success: boolean
}
export interface GerberaContainer {
id: number
child_count: number
autoscan_type: string
autoscan_mode: string
title: string
}
export interface GetContainersSuccessResponse {
containers: {
parent_id: number
type: string
select_it: number
container: GerberaContainer[]
}
success: boolean
}
export function isItem(i: GerberaItem | GerberaContainer): i is GerberaItem {
return (i as GerberaItem).res !== undefined;
}
export interface GerberaItem {
id: number
title: string
res: string
}
export interface GetItemsSuccessResponse {
items: {
parent_id: number
location: string
virtual: boolean
start: number
total_matches: number
autoscan_mode: string
autoscan_type: string
protect_container: false
protect_items: false
item: GerberaItem[]
}
update_ids: {
pending: boolean
}
success: boolean
}
// many of these numbers (except interval) are boolean bits (0|1)
export interface GetAutoscanSuccessResponse {
autoscan: {
from_fs: number
object_id: string
scan_mode: string
recursive: number
hidden: number
interval: number
persistent: number
}
success: boolean
}
export interface EditAutoScanSuccessResponse {
success: boolean
}
export interface Property {
value: string
editable: boolean
}
// horrible, but some of the values returned in the JSON response
// have leading spaces...
export interface ResourceData {
resname: '----RESOURCE----' | 'handlerType' | ' bitrate' | " duration" |
" nrAudioChannels" | " protocolInfo" | " resolution" | " sampleFrequency" |
" size" | "-4cc"
resvalue: string
editable: boolean
}
export interface GetItemPropertiesSuccessResponse {
item: {
object_id: number
title: Property
class: Property
obj_type: string
description: Property
location: Property
"mime-type": Property
metadata: {
metadata: object[]
}
auxdata: {
auxdata: object[]
}
resources: {
resources: ResourceData[]
}
update_ids: {
pending: boolean
}
}
success: boolean
}
export interface EditItemPropertiesSuccessResponse {
success: boolean
}
export interface DeleteItemSuccessResponse {
success: boolean
}
export interface InvalidSidResponse {
error: {
code: string,
text: 'invalid session id'
}
success: ('false')
}
export function isInvalidSidResponse(
data: GetDirectoriesSuccessResponse | GetFilesSuccessResponse |
AddFileToDbSuccessResponse | InvalidSidResponse
): data is InvalidSidResponse {
return (data as InvalidSidResponse).error !== undefined;
}
export interface GetSidResponse extends JSONResponse {
data?: GetSidSuccessResponse
error?: boolean
}
export interface GetClientsResponse extends JSONResponse {
data?: GetClientsSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetDirectoriesResponse extends JSONResponse {
data?: GetDirectoriesSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetFilesResponse extends JSONResponse {
data?: GetFilesSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface AddFileToDbResponse extends JSONResponse {
data?: AddFileToDbSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetContainersResponse extends JSONResponse {
data?: GetContainersSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetItemsResponse extends JSONResponse {
data?: GetItemsSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetAutoscanResponse extends JSONResponse {
data?: GetAutoscanSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface EditAutoscanResponse extends JSONResponse {
data?: EditAutoScanSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface GetItemPropertiesResponse extends JSONResponse {
data?: GetItemPropertiesSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface EditItemPropertiesResponse extends JSONResponse {
data?: EditItemPropertiesSuccessResponse | InvalidSidResponse
error?: boolean
}
export interface DeleteItemResponse extends JSONResponse {
data?: DeleteItemSuccessResponse | InvalidSidResponse
error?: boolean
}