73 lines
1.4 KiB
TypeScript
73 lines
1.4 KiB
TypeScript
//
|
|
// Responses
|
|
//
|
|
|
|
export interface BaseResponse {
|
|
statusCode: number;
|
|
}
|
|
|
|
export interface ErrorResponse extends BaseResponse {
|
|
statusCode: 400 | 401 | 403;
|
|
message?: string;
|
|
}
|
|
|
|
export type RefreshResponse = LoginResponse;
|
|
export interface LoginResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
jwt: string;
|
|
}
|
|
|
|
export interface GetRootResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
rootId: number;
|
|
}
|
|
|
|
export interface GetNodeResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
id: number;
|
|
name: string;
|
|
isFile: boolean;
|
|
parent: number | null;
|
|
children?: number[];
|
|
size?: number;
|
|
}
|
|
|
|
export interface GetPathResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
path: string;
|
|
}
|
|
|
|
export type CreateFileResponse = CreateFolderResponse;
|
|
export interface CreateFolderResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
id: number;
|
|
}
|
|
|
|
export type UploadFileResponse = DeleteResponse;
|
|
export interface DeleteResponse extends BaseResponse {
|
|
statusCode: 200;
|
|
}
|
|
|
|
//
|
|
// Requests
|
|
//
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
export interface BaseRequest {}
|
|
|
|
export type AuthSignUpRequest = AuthLoginRequest;
|
|
export interface AuthLoginRequest extends BaseRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export type CreateFileRequest = CreateFolderRequest;
|
|
export interface CreateFolderRequest extends BaseRequest {
|
|
parent: number;
|
|
name: string;
|
|
}
|
|
|
|
export interface DeleteRequest extends BaseRequest {
|
|
node: number;
|
|
}
|