mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
63 lines
1.2 KiB
Protocol Buffer
63 lines
1.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
option go_package = "./proto;location";
|
|
|
|
// The location service stores GPS points for tracking purposes
|
|
// and provides endpoints to query those points.
|
|
package location;
|
|
|
|
service Location {
|
|
// Read locations
|
|
rpc Read(ReadRequest) returns (ReadResponse) {}
|
|
// Save locations
|
|
rpc Save(SaveRequest) returns (SaveResponse) {}
|
|
rpc Search(SearchRequest) returns (SearchResponse) {}
|
|
}
|
|
|
|
// A point is a GPS coordinate.
|
|
message Point {
|
|
double latitude = 1;
|
|
double longitude = 2;
|
|
int64 timestamp = 3;
|
|
}
|
|
|
|
message Entity {
|
|
string id = 1;
|
|
string type = 2;
|
|
Point location = 3;
|
|
}
|
|
|
|
// Read an entity by its ID
|
|
message ReadRequest {
|
|
// the entity id
|
|
string id = 1;
|
|
}
|
|
|
|
message ReadResponse {
|
|
Entity entity = 1;
|
|
}
|
|
|
|
// Save an entity's current position
|
|
message SaveRequest {
|
|
Entity entity = 1;
|
|
}
|
|
|
|
message SaveResponse {
|
|
}
|
|
|
|
// Search for entities in a given radius
|
|
message SearchRequest {
|
|
// Central position to search from
|
|
Point center = 1;
|
|
// radius in meters
|
|
double radius = 2;
|
|
// type of entities to filter
|
|
string type = 3;
|
|
// Maximum number of entities to return
|
|
int64 numEntities = 4;
|
|
}
|
|
|
|
message SearchResponse {
|
|
repeated Entity entities = 1;
|
|
}
|