Skip to content

Commit 883f56d

Browse files
chore(server): add grpcurl doc (#1714)
Co-authored-by: yuya-soneda <soneda.yuya@gmail.com>
1 parent b7d049a commit 883f56d

File tree

1 file changed

+225
-0
lines changed

1 file changed

+225
-0
lines changed
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# ReEarth Visualizer gRPC Commands Example
2+
3+
## Setup gRPC server
4+
5+
```bash
6+
# 1. Add the following to .env
7+
REEARTH_VISUALIZER_INTERNALAPI_ACTIVE=true
8+
REEARTH_VISUALIZER_INTERNALAPI_PORT=50051
9+
REEARTH_VISUALIZER_INTERNALAPI_TOKEN=test-abc-123
10+
11+
# 2. start gRPC
12+
make run-app
13+
```
14+
15+
## Basic Configuration
16+
17+
```bash
18+
# Server address and proto file settings
19+
SERVER_ADDRESS="localhost:50051" # Change to your actual server address
20+
PROTO_FILE="schemas/internalapi/v1/schema.proto" # Specify the path to your proto file
21+
USER_ID="???User-ID???" # Change to your actual user ID
22+
```
23+
24+
## 1. GetProjectList - Retrieve Project List
25+
26+
```bash
27+
# Basic list retrieval
28+
grpcurl -plaintext \
29+
-H "user-id: ${USER_ID}" \
30+
-d '{
31+
"workspace_id": "???Workspace-ID???",
32+
"authenticated": true
33+
}' \
34+
-import-path . \
35+
-proto ${PROTO_FILE} \
36+
${SERVER_ADDRESS} \
37+
reearth.visualizer.v1.ReEarthVisualizer/GetProjectList
38+
39+
# With keyword search and sorting
40+
grpcurl -plaintext \
41+
-H "user-id: ${USER_ID}" \
42+
-d '{
43+
"workspace_id": "???Workspace-ID???",
44+
"authenticated": true,
45+
"keyword": "test",
46+
"sort": {
47+
"field": "UPDATEDAT",
48+
"direction": "DESC"
49+
},
50+
"pagination": {
51+
"limit": 10,
52+
"offset": 0
53+
}
54+
}' \
55+
-import-path . \
56+
-proto ${PROTO_FILE} \
57+
${SERVER_ADDRESS} \
58+
reearth.visualizer.v1.ReEarthVisualizer/GetProjectList
59+
```
60+
61+
## 2. GetProject - Retrieve Specific Project
62+
63+
```bash
64+
grpcurl -plaintext \
65+
-H "user-id: ${USER_ID}" \
66+
-d '{
67+
"project_id": "???project-ID???"
68+
}' \
69+
-import-path . \
70+
-proto ${PROTO_FILE} \
71+
${SERVER_ADDRESS} \
72+
reearth.visualizer.v1.ReEarthVisualizer/GetProject
73+
```
74+
75+
## 3. GetProjectByAlias - Retrieve Project by Alias
76+
77+
```bash
78+
grpcurl -plaintext \
79+
-H "user-id: ${USER_ID}" \
80+
-d '{
81+
"alias": "my-project-alias"
82+
}' \
83+
-import-path . \
84+
-proto ${PROTO_FILE} \
85+
${SERVER_ADDRESS} \
86+
reearth.visualizer.v1.ReEarthVisualizer/GetProjectByAlias
87+
```
88+
89+
## 4. ValidateProjectAlias - Validate Project Alias
90+
91+
```bash
92+
grpcurl -plaintext \
93+
-H "user-id: ${USER_ID}" \
94+
-d '{
95+
"project_id": "???project-ID???",
96+
"alias": "new-project-alias"
97+
}' \
98+
-import-path . \
99+
-proto ${PROTO_FILE} \
100+
${SERVER_ADDRESS} \
101+
reearth.visualizer.v1.ReEarthVisualizer/ValidateProjectAlias
102+
```
103+
104+
## 5. CreateProject - Create Project
105+
106+
```bash
107+
grpcurl -plaintext \
108+
-H "user-id: ${USER_ID}" \
109+
-H "authorization: Bearer test-abc-123" \
110+
-d '{
111+
"workspace_id": "???Workspace-ID???",
112+
"visualizer": "VISUALIZER_CESIUM",
113+
"name": "New Project",
114+
"description": "Project description",
115+
"core_support": true,
116+
"visibility": "private",
117+
"project_alias": "new-project",
118+
"readme": "# About This Project\n\nThis project is...",
119+
"license": "MIT",
120+
"topics": "visualization, 3D, mapping"
121+
}' \
122+
-import-path . \
123+
-proto ${PROTO_FILE} \
124+
${SERVER_ADDRESS} \
125+
reearth.visualizer.v1.ReEarthVisualizer/CreateProject
126+
```
127+
128+
## 6. UpdateProject - Update Project
129+
130+
```bash
131+
grpcurl -plaintext \
132+
-H "user-id: ${USER_ID}" \
133+
-H "authorization: Bearer test-abc-123" \
134+
-d '{
135+
"project_id": "???project-ID???",
136+
"name": "Updated Project Name",
137+
"description": "Updated description",
138+
"starred": true,
139+
"visibility": "public",
140+
"project_alias": "updated-alias"
141+
}' \
142+
-import-path . \
143+
-proto ${PROTO_FILE} \
144+
${SERVER_ADDRESS} \
145+
reearth.visualizer.v1.ReEarthVisualizer/UpdateProject
146+
```
147+
148+
## 7. PublishProject - Publish Project
149+
150+
```bash
151+
# Publish project
152+
grpcurl -plaintext \
153+
-H "user-id: ${USER_ID}" \
154+
-H "authorization: Bearer test-abc-123" \
155+
-d '{
156+
"project_id": "???project-ID???",
157+
"alias": "published-project",
158+
"publishment_status": "PUBLISHMENT_STATUS_PUBLIC"
159+
}' \
160+
-import-path . \
161+
-proto ${PROTO_FILE} \
162+
${SERVER_ADDRESS} \
163+
reearth.visualizer.v1.ReEarthVisualizer/PublishProject
164+
165+
# Unpublish project
166+
grpcurl -plaintext \
167+
-H "user-id: ${USER_ID}" \
168+
-H "authorization: Bearer test-abc-123" \
169+
-d '{
170+
"project_id": "???project-ID???",
171+
"publishment_status": "PUBLISHMENT_STATUS_PRIVATE"
172+
}' \
173+
-import-path . \
174+
-proto ${PROTO_FILE} \
175+
${SERVER_ADDRESS} \
176+
reearth.visualizer.v1.ReEarthVisualizer/PublishProject
177+
```
178+
179+
## 8. UpdateProjectMetadata - Update Project Metadata
180+
181+
```bash
182+
grpcurl -plaintext \
183+
-H "user-id: ${USER_ID}" \
184+
-H "authorization: Bearer test-abc-123" \
185+
-d '{
186+
"project_id": "???project-ID???",
187+
"readme": "# Updated README\n\nThis is new content.",
188+
"license": "Apache-2.0",
189+
"topics": "3D, visualization, GIS, mapping"
190+
}' \
191+
-import-path . \
192+
-proto ${PROTO_FILE} \
193+
${SERVER_ADDRESS} \
194+
reearth.visualizer.v1.ReEarthVisualizer/UpdateProjectMetadata
195+
```
196+
197+
## 9. DeleteProject - Delete Project
198+
199+
```bash
200+
grpcurl -plaintext \
201+
-H "user-id: ${USER_ID}" \
202+
-H "authorization: Bearer test-abc-123" \
203+
-d '{
204+
"project_id": "???project-ID???"
205+
}' \
206+
-import-path . \
207+
-proto ${PROTO_FILE} \
208+
${SERVER_ADDRESS} \
209+
reearth.visualizer.v1.ReEarthVisualizer/DeleteProject
210+
```
211+
212+
## 10. ExportProject - Export Project
213+
214+
```bash
215+
grpcurl -plaintext \
216+
-H "user-id: ${USER_ID}" \
217+
-H "authorization: Bearer test-abc-123" \
218+
-d '{
219+
"project_id": "???project-ID???"
220+
}' \
221+
-import-path . \
222+
-proto ${PROTO_FILE} \
223+
${SERVER_ADDRESS} \
224+
reearth.visualizer.v1.ReEarthVisualizer/ExportProject
225+
```

0 commit comments

Comments
 (0)