diff --git a/server/schemas/internel/v1/schema.proto b/server/schemas/internel/v1/schema.proto new file mode 100644 index 0000000000..aa35ebbeaf --- /dev/null +++ b/server/schemas/internel/v1/schema.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; + +package reearth.cms.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "proto/v1"; + +service ReEarthCMS { + // Main operations + rpc CreateProject(CreateProjectRequest) returns (CreateProjectResponse) {} + rpc ListProjects(ListProjectsRequest) returns (ListProjectsResponse) {} + rpc ListModels(ListModelsRequest) returns (ListModelsResponse) {} + rpc GetModelGeoJSONExportURL(ExportRequest) returns (ExportURLResponse) {} +} + +// Implementation note: +// Authentication should be implemented using gRPC interceptors +// M2M tokens should be passed in metadata with key "authorization" +// Format: "Bearer " +// UserId should be passed in metadata with key "user-id" + +// Core messages +message Project { + string id = 1; + string name = 2; + string description = 3; + string workspace_id = 4; + ProjectPublication publication = 5; + google.protobuf.Timestamp created_at = 6; + google.protobuf.Timestamp updated_at = 7; +} + +message ProjectPublication { + ProjectPublicationScope scope = 1; + bool asset_public = 2; + optional string token = 3; +} + +enum ProjectPublicationScope { + SCOPE_UNSPECIFIED = 0; + PUBLIC = 1; + LIMITED = 2; + PRIVATE = 3; +} + +message Model { + string id = 1; + string project_id = 2; + string name = 3; + string description = 4; + string key = 5; + bool public = 6; + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; +} + +// Request messages +message CreateProjectRequest { + string workspace_id = 1; + string name = 2; + string description = 3; + string alias = 4; + ProjectPublication publication = 5; +} + +message ListProjectsRequest { + string workspace_id = 1; +} + +message ListModelsRequest { + string project_id = 1; +} + +message ExportRequest { + string project_id = 1; + string model_id = 2; +} + +// Response messages +message CreateProjectResponse { + Project project = 1; +} + +message ListProjectsResponse { + repeated Project projects = 1; + int32 total_count = 3; +} + +message ListModelsResponse { + repeated Model models = 1; + int32 total_count = 3; +} + +message ExportURLResponse { + string url = 1; +}