udeServer.api 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. syntax = "v1"
  2. type Request {
  3. Name string `path:"name,options=you|me"`
  4. }
  5. type Response {
  6. Message string `json:"message"`
  7. }
  8. type DbPingResponse {
  9. Ok bool `json:"ok"`
  10. Version string `json:"version"`
  11. Database string `json:"database"`
  12. }
  13. type DeleteResp {
  14. Ok bool `json:"ok"`
  15. }
  16. type CreateDirectoryReq {
  17. Id int64 `json:"id"`
  18. ServiceId int64 `json:"serviceId,optional"`
  19. Directory string `json:"directory,optional"`
  20. }
  21. type UpdateDirectoryReq {
  22. Id int64 `path:"id"`
  23. ServiceId int64 `json:"serviceId,optional"`
  24. Directory string `json:"directory,optional"`
  25. }
  26. type DirectoryIdReq {
  27. Id int64 `path:"id"`
  28. }
  29. type DirectoryResp {
  30. Id int64 `json:"id"`
  31. ServiceId int64 `json:"serviceId"`
  32. Directory string `json:"directory"`
  33. }
  34. type ListDirectoryReq {
  35. Page int64 `form:"page,optional"`
  36. PageSize int64 `form:"pageSize,optional"`
  37. }
  38. type DirectoryListResp {
  39. List []DirectoryResp `json:"list"`
  40. Total int64 `json:"total"`
  41. }
  42. type CreateKeyReq {
  43. Name string `json:"name"`
  44. }
  45. type UpdateKeyReq {
  46. Id int64 `path:"id"`
  47. Iden string `json:"iden,optional"`
  48. Name string `json:"name,optional"`
  49. Content string `json:"content,optional"`
  50. Status string `json:"status,optional"`
  51. }
  52. type KeyIdReq {
  53. Id int64 `path:"id"`
  54. }
  55. type KeyResp {
  56. Id int64 `json:"id"`
  57. Iden string `json:"iden"`
  58. Name string `json:"name"`
  59. Content string `json:"content"`
  60. Status string `json:"status"`
  61. CreateAt string `json:"createAt"`
  62. }
  63. type ListKeysReq {
  64. Page int64 `form:"page,optional"`
  65. PageSize int64 `form:"pageSize,optional"`
  66. }
  67. type KeyListResp {
  68. List []KeyResp `json:"list"`
  69. Total int64 `json:"total"`
  70. }
  71. type CreateServiceReq {
  72. Id int64 `json:"id"`
  73. Name string `json:"name,optional"`
  74. Ip string `json:"ip,optional"`
  75. Port string `json:"port,optional"`
  76. Iden string `json:"iden,optional"`
  77. KeyIden string `json:"keyIden,optional"`
  78. KeyAlgo string `json:"keyAlgo,optional"`
  79. Status string `json:"status,optional"`
  80. }
  81. type UpdateServiceReq {
  82. Id int64 `path:"id"`
  83. Name string `json:"name,optional"`
  84. Ip string `json:"ip,optional"`
  85. Port string `json:"port,optional"`
  86. Iden string `json:"iden,optional"`
  87. KeyIden string `json:"keyIden,optional"`
  88. KeyAlgo string `json:"keyAlgo,optional"`
  89. Status string `json:"status,optional"`
  90. }
  91. type ServiceIdReq {
  92. Id int64 `path:"id"`
  93. }
  94. type ServiceResp {
  95. Id int64 `json:"id"`
  96. Name string `json:"name"`
  97. Ip string `json:"ip"`
  98. Port string `json:"port"`
  99. Iden string `json:"iden"`
  100. KeyIden string `json:"keyIden"`
  101. KeyAlgo string `json:"keyAlgo"`
  102. Status string `json:"status"`
  103. CreateAt string `json:"createAt"`
  104. }
  105. type ListServiceReq {
  106. Page int64 `form:"page,optional"`
  107. PageSize int64 `form:"pageSize,optional"`
  108. }
  109. type ServiceListResp {
  110. List []ServiceResp `json:"list"`
  111. Total int64 `json:"total"`
  112. }
  113. @server (
  114. prefix: /api/v1
  115. )
  116. service udeServer-api {
  117. @handler UdeServerHandler
  118. get /from/:name (Request) returns (Response)
  119. @handler DbPingHandler
  120. get /db/ping returns (DbPingResponse)
  121. @handler CreateDirectoryHandler
  122. post /directories (CreateDirectoryReq) returns (DirectoryResp)
  123. @handler ListDirectoriesHandler
  124. get /directories (ListDirectoryReq) returns (DirectoryListResp)
  125. @handler GetDirectoryHandler
  126. get /directories/:id (DirectoryIdReq) returns (DirectoryResp)
  127. @handler UpdateDirectoryHandler
  128. put /directories/:id (UpdateDirectoryReq) returns (DirectoryResp)
  129. @handler DeleteDirectoryHandler
  130. delete /directories/:id (DirectoryIdReq) returns (DeleteResp)
  131. @handler CreateKeyHandler
  132. post /keys (CreateKeyReq) returns (KeyResp)
  133. @handler ListKeysHandler
  134. get /keys (ListKeysReq) returns (KeyListResp)
  135. @handler GetKeyHandler
  136. get /keys/:id (KeyIdReq) returns (KeyResp)
  137. @handler UpdateKeyHandler
  138. put /keys/:id (UpdateKeyReq) returns (KeyResp)
  139. @handler DeleteKeyHandler
  140. delete /keys/:id (KeyIdReq) returns (DeleteResp)
  141. @handler CreateServiceHandler
  142. post /services (CreateServiceReq) returns (ServiceResp)
  143. @handler ListServicesHandler
  144. get /services (ListServiceReq) returns (ServiceListResp)
  145. @handler GetServiceHandler
  146. get /services/:id (ServiceIdReq) returns (ServiceResp)
  147. @handler UpdateServiceHandler
  148. put /services/:id (UpdateServiceReq) returns (ServiceResp)
  149. @handler DeleteServiceHandler
  150. delete /services/:id (ServiceIdReq) returns (DeleteResp)
  151. }