Files
services/file/proto/file.proto
2022-02-11 14:24:08 +00:00

81 lines
1.7 KiB
Protocol Buffer

syntax = "proto3";
package file;
option go_package = "./proto;file";
service File {
rpc Read(ReadRequest) returns (ReadResponse) {}
rpc List(ListRequest) returns (ListResponse) {}
rpc Save(SaveRequest) returns (SaveResponse) {}
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
}
message Record {
// A custom project to group files
// eg. file-of-mywebsite.com
string project = 1;
// Path to file or folder eg. '/documents/text-files/file.txt'.
string path = 2;
// File contents
string content = 3;
// Time the file was created e.g 2021-05-20T13:37:21Z
string created = 4;
// Time the file was updated e.g 2021-05-20T13:37:21Z
string updated = 5;
// Any other associated metadata as a map of key-value pairs
map<string,string> metadata = 6;
}
// Read a file by path
message ReadRequest {
// Project name
string project = 1;
// Path to the file
string path = 2;
}
message ReadResponse {
// Returns the file
Record file = 1;
}
// Save a file
message SaveRequest {
// The file to save
Record file = 1;
// Make the file public: true or false
bool public = 2;
}
message SaveResponse {
// The permalink for the file if made public
string url = 1;
}
// List files by their project and optionally a path.
message ListRequest {
// Project, required for listing.
string project = 1;
// Defaults to '/', ie. lists all files in a project.
// Supply path to a folder if you want to list
// files inside that folder
// eg. '/docs'
string path = 2;
}
message ListResponse {
repeated Record files = 1;
}
// Delete a file by project name/path
message DeleteRequest {
// The project name
string project = 1;
// Path to the file
string path = 2;
}
message DeleteResponse {}