mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 11:15:12 +00:00
83 lines
1.6 KiB
Protocol Buffer
83 lines
1.6 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 BatchSave(BatchSaveRequest) returns (BatchSaveResponse) {}
|
|
}
|
|
|
|
message Record {
|
|
// id of the record
|
|
string id = 1;
|
|
// A custom project to group files
|
|
// eg. file-of-mywebsite.com
|
|
string project = 2;
|
|
// Name of folder or file.
|
|
string name = 3;
|
|
// Path. Default is '/', ie. top level
|
|
string path = 4;
|
|
// whether its a directory
|
|
bool is_directory = 5;
|
|
// File contents. Empty for directories.
|
|
string data = 6;
|
|
// time the file was created
|
|
int64 created = 7;
|
|
// time the file was updated
|
|
int64 updated = 8;
|
|
// owner of the file e.g alice
|
|
string owner = 9;
|
|
// any other associated metadata
|
|
map<string,string> metadata = 10;
|
|
}
|
|
|
|
// Batch save multiple files in one call
|
|
message BatchSaveRequest {
|
|
repeated Record files = 1;
|
|
}
|
|
|
|
message BatchSaveResponse {
|
|
}
|
|
|
|
// Read a file by path
|
|
message ReadRequest {
|
|
// project name
|
|
string project = 1;
|
|
// path to the file
|
|
string path = 2;
|
|
// file name
|
|
string name = 3;
|
|
}
|
|
|
|
message ReadResponse {
|
|
// Returns the file
|
|
Record file = 1;
|
|
}
|
|
|
|
// Save a file
|
|
message SaveRequest {
|
|
Record file = 1;
|
|
}
|
|
|
|
message SaveResponse {
|
|
}
|
|
|
|
// List file 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 if of a folder if you want to list
|
|
// files inside that folder
|
|
// eg. '/docs'
|
|
string path = 2;
|
|
}
|
|
|
|
message ListResponse {
|
|
repeated Record files = 1;
|
|
}
|