Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. syntax = "proto3";
  2.  
  3. enum QRType {
  4. TARGET = 1;
  5. INTERSECTION = 2;
  6. }
  7.  
  8. message Location {
  9. string name = 2;
  10. repeated QR qrs = 1;
  11. }
  12.  
  13. message Array2D {}
  14.  
  15. message QR {
  16. int32 id = 1;
  17. int32 map_y = 5;
  18. int32 map_x = 6;
  19. QRType type = 4;
  20. }
  21.  
  22. // GET /search GetSearchRequest : GetSearchResponse
  23. // ini gunanya buat search di autocomplete, given a query string, return array of search result
  24. // yang di return cuma QR dengan type target, type intersection gk di return
  25. message GetSearchRequest {
  26. string query = 1;
  27. }
  28.  
  29. message GetSearchResponse {
  30. message SearchResult {
  31. int32 id = 1; // QR code id
  32. string name = 2;
  33. }
  34. repeated SearchResult result = 1;
  35. }
  36.  
  37. // GET /query/{qr_id}/ None : GetQueryQRResponse
  38. // ini gunanya buat given sebuah QR, tanpa target, return semua general direction dari posisi QR ini
  39. // yang di return adalah GeneralArrow untuk QR ini
  40.  
  41. message GetQueryQRResponse {
  42. message GeneralArrow {
  43. int32 id = 1;
  44. string name = 2;
  45. int32 direction = 3; // float multiplied by 10000
  46. }
  47. repeated GeneralArrow result = 1;
  48. }
  49.  
  50. // GET /query/{qr_id}/target/{target_qr_id} None : GetQueryTargetQRResponse
  51. // ini gunanya adalah untuk query direction yang dimunculin di sebuah qr dengan id {qr_id} untuk mencapai qr {target_qr_id}
  52.  
  53. message GetQueryTargetQRResponse {
  54. QR next_qr = 1;
  55. int32 direction = 3; // float multiplied by 10000
  56. }
  57.  
  58. // GET /query/{qr_id}/map None : GetQRMapResponse
  59. // ini gunanya adalah untuk ngambil map building dimana qr dengan id {qr_id} berada
  60.  
  61. message GetQRMapResponse {
  62. // sementara pake URL dulu, nanti kalo emang mau dibikin grid baru diganti
  63. string url = 1;
  64. }
  65.  
  66. // GET /admin/map : GetMapResponse
  67. // ini gunanya buat ambil map yg udh ke save
  68. message GetMapResponse {
  69. message TargetQR {
  70. int32 y = 1;
  71. int32 x = 2;
  72. }
  73.  
  74. message Location {
  75. string name = 1;
  76. repeated QR qrs = 2;
  77. }
  78.  
  79. Array2D grid = 1; // . # o x
  80. repeated Location locations = 2;
  81. }
  82.  
  83. // POST /admin/map/ EditMapRequest : GetMapResponse
  84. // ini gunanya buat edit map
  85. message EditMapRequest {
  86. message TargetQR {
  87. int32 y = 1;
  88. int32 x = 2;
  89. }
  90.  
  91. message Location {
  92. string name = 1;
  93. repeated QR qrs = 2;
  94. }
  95.  
  96. Array2D grid = 1; // . # o x
  97. repeated Location locations = 2;
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement