route/routerpc/routegrpc/route.proto

103 lines
1.8 KiB
Protocol Buffer
Raw Normal View History

syntax = "proto3";
import "google/api/annotations.proto";
message BaseAPICall {
string token = 1;
}
service Hosts {
rpc AddHost(AddHostRequest) returns (AddHostResponse) {
option (google.api.http) = {
post: "/v1/hosts/create"
};
}
rpc RemoveHost(RemoveHostRequest) returns (RemoveHostResponse) {
option (google.api.http) = {
delete: "/v1/hosts/{host}"
};
}
rpc GetHost(GetHostRequest) returns (GetHostResponse) {
option (google.api.http) = {
get: "/v1/hosts/{host}"
};
}
}
message Host {
string id = 1;
string hostname = 2;
string onionHostname = 3;
string token = 4;
bytes onionKey = 5;
int32 kind = 6;
string port = 7;
}
message AddHostRequest {
BaseAPICall base = 1;
string hostname = 2;
bytes onionKey = 3;
}
message AddHostResponse {
string id = 1;
string token = 2;
string hostname = 3;
string onionHostname = 4;
}
message RemoveHostRequest {
BaseAPICall base = 1;
string host = 2;
}
message RemoveHostResponse {
bool success = 1;
}
message GetHostRequest {
BaseAPICall base = 1;
string host = 2;
string onionHost = 3;
string id = 4;
}
message GetHostResponse {
Host host = 1;
}
service Tokens {
rpc CreateInitialToken(CreateInitialTokenRequest) returns (CreateInitialTokenResponse) {
option (google.api.http) = {
post: "/v1/tokens/createInitialToken"
};
}
}
message CreateInitialTokenRequest {
string username = 1;
}
message CreateInitialTokenResponse {
string token = 1;
string tokenid = 2;
}
service Users {
rpc Login(LoginRequest) returns (LoginResponse) {
option (google.api.http) = {
post: "/v1/users/login"
};
}
}
message LoginRequest {
string oauth2provider = 1;
}
message LoginResponse {
string token = 1;
string uid = 2;
}