2021-12-03 22:04:09 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
option go_package = "gitea.benny.dog/torjus/ezshare/pb";
|
|
|
|
package ezshare;
|
|
|
|
|
|
|
|
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
|
|
|
|
message File {
|
|
|
|
string file_id = 1;
|
|
|
|
bytes data = 2;
|
|
|
|
|
|
|
|
message Metadata {
|
|
|
|
google.protobuf.Timestamp uploaded_on = 1;
|
|
|
|
google.protobuf.Timestamp expires_on = 2;
|
|
|
|
string original_filename = 3;
|
|
|
|
};
|
|
|
|
|
|
|
|
Metadata metadata = 3;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Service messages
|
|
|
|
// Upload
|
|
|
|
message UploadFileRequest {
|
|
|
|
bytes data = 1;
|
|
|
|
string original_filename = 2;
|
|
|
|
google.protobuf.Timestamp expires_on = 3;
|
|
|
|
}
|
|
|
|
message UploadFileResponse {
|
|
|
|
string id = 1;
|
|
|
|
string file_url = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get
|
|
|
|
message GetFileRequest {
|
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
message GetFileResponse {
|
|
|
|
File file = 1;
|
|
|
|
}
|
|
|
|
|
2021-12-04 10:30:42 +00:00
|
|
|
// Delete
|
|
|
|
message DeleteFileRequest {
|
|
|
|
string id = 1;
|
|
|
|
}
|
|
|
|
message DeleteFileResponse {
|
|
|
|
}
|
|
|
|
|
|
|
|
// List
|
|
|
|
message ListFilesRequest {}
|
|
|
|
message ListFilesResponse {
|
|
|
|
message ListFileInfo {
|
|
|
|
string file_id = 1;
|
|
|
|
File.Metadata metadata = 2;
|
|
|
|
}
|
|
|
|
repeated ListFileInfo files = 1;
|
|
|
|
}
|
2021-12-03 22:04:09 +00:00
|
|
|
|
|
|
|
service FileService {
|
|
|
|
rpc UploadFile(UploadFileRequest) returns (UploadFileResponse) {}
|
|
|
|
rpc GetFile(GetFileRequest) returns (GetFileResponse) {}
|
2021-12-04 10:30:42 +00:00
|
|
|
rpc DeleteFile(DeleteFileRequest) returns (DeleteFileResponse) {}
|
|
|
|
rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) {}
|
2021-12-03 22:04:09 +00:00
|
|
|
}
|