-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponses.ts
More file actions
80 lines (72 loc) · 1.3 KB
/
responses.ts
File metadata and controls
80 lines (72 loc) · 1.3 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
import { UserI } from "@models";
import { FileI, FileTypes } from "./file";
/**
* the default response
*/
export interface DefRes {
statusCode: number;
/**
* the data object, where the type can be overridden by specific response types
*/
data: unknown;
message: string;
}
/**
* the data object when fetching the contents of a folder
*/
export interface FolderResInner {
name: string;
size: number;
type: FileTypes;
files: FileI[];
}
/**
* the response when fetching the contents of a folder
*/
export interface FolderRes extends DefRes {
data: FolderResInner;
}
/**
* the response when fetching suggestions
*/
export interface SuggestionsRes extends DefRes {
data: string[];
}
/**
* the response when fetching the token for a login
*/
export interface AuthRes extends DefRes {
data: {
token: string;
}
}
/**
* the response when fetching a token for file downloads
*/
export interface TokenRes extends DefRes {
data: {
token: string;
}
}
/**
* the response when fetching the user list for management purposes
*/
export interface UsersRes extends DefRes {
data: UserI[];
}
/**
* the response types for WebSocket messages
*/
export type WSData = {
cmd: string;
end: false;
error: false;
result: string;
} | {
cmd: string;
end: true;
error: false
} | {
cmd: string;
error: true
}