-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(server): internal api v1 specification #1392
base: main
Are you sure you want to change the base?
Changes from 2 commits
da9b6b2
4a72882
6583574
9ab7f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -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 <token>" | ||||||||||||||||||||||||||||||||||||||||||
// 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; | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we return the token? 🤔 |
||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
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; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+47
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Rename the "public" field to avoid reserved word conflicts. The message Model {
string id = 1;
string project_id = 2;
string name = 3;
string description = 4;
string key = 5;
- bool public = 6;
+ bool is_public = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
// 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; | ||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+85
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix field numbering in response messages. The field numbers in ListProjectsResponse and ListModelsResponse are not sequential (skips number 2), which might indicate missing fields or a mistake. message ListProjectsResponse {
repeated Project projects = 1;
- int32 total_count = 3;
+ int32 total_count = 2;
}
message ListModelsResponse {
repeated Model models = 1;
- int32 total_count = 3;
+ int32 total_count = 2;
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
message ExportURLResponse { | ||||||||||||||||||||||||||||||||||||||||||
string url = 1; | ||||||||||||||||||||||||||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix directory structure and typo.
The directory structure needs to be adjusted:
Please move this file to the correct directory structure and fix the typo:
📝 Committable suggestion
🧰 Tools
🪛 Buf (1.47.2)
3-3: Files with package "reearth.cms.v1" must be within a directory "reearth/cms/v1" relative to root but were in directory "server/schemas/internel/v1".
(PACKAGE_DIRECTORY_MATCH)