udeServer.api 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 `json:"id"`
  47. Status string `json:"status"`
  48. }
  49. type KeyIdReq {
  50. Id int64 `json:"id"`
  51. }
  52. type KeyResp {
  53. Id int64 `json:"id"`
  54. Iden string `json:"iden"`
  55. Name string `json:"name"`
  56. Content string `json:"content"`
  57. Status string `json:"status"`
  58. CreateAt string `json:"createAt"`
  59. }
  60. type ListKeysReq {
  61. Page int64 `json:"page,optional"`
  62. PageSize int64 `json:"pageSize,optional"`
  63. Name string `json:"name,optional"`
  64. Status string `json:"status,optional"`
  65. }
  66. type KeyListResp {
  67. List []KeyResp `json:"list"`
  68. Total int64 `json:"total"`
  69. }
  70. type CreateServiceReq {
  71. Id int64 `json:"id"`
  72. Name string `json:"name,optional"`
  73. Ip string `json:"ip,optional"`
  74. Port string `json:"port,optional"`
  75. Iden string `json:"iden,optional"`
  76. KeyIden string `json:"keyIden,optional"`
  77. KeyAlgo string `json:"keyAlgo,optional"`
  78. Status string `json:"status,optional"`
  79. }
  80. type UpdateServiceReq {
  81. Id int64 `path:"id"`
  82. Name string `json:"name,optional"`
  83. Ip string `json:"ip,optional"`
  84. Port string `json:"port,optional"`
  85. Iden string `json:"iden,optional"`
  86. KeyIden string `json:"keyIden,optional"`
  87. KeyAlgo string `json:"keyAlgo,optional"`
  88. Status string `json:"status,optional"`
  89. }
  90. type ServiceIdReq {
  91. Id int64 `path:"id"`
  92. }
  93. type ServiceResp {
  94. Id int64 `json:"id"`
  95. Name string `json:"name"`
  96. Ip string `json:"ip"`
  97. Port string `json:"port"`
  98. Iden string `json:"iden"`
  99. KeyIden string `json:"keyIden"`
  100. KeyAlgo string `json:"keyAlgo"`
  101. Status string `json:"status"`
  102. CreateAt string `json:"createAt"`
  103. }
  104. type ListServiceReq {
  105. Page int64 `form:"page,optional"`
  106. PageSize int64 `form:"pageSize,optional"`
  107. }
  108. type ServiceListResp {
  109. List []ServiceResp `json:"list"`
  110. Total int64 `json:"total"`
  111. }
  112. @server (
  113. prefix: /api/v1
  114. )
  115. service udeServer-api {
  116. @handler UdeServerHandler
  117. get /from/:name (Request) returns (Response)
  118. @handler DbPingHandler
  119. get /db/ping returns (DbPingResponse)
  120. @handler CreateDirectoryHandler
  121. post /directories (CreateDirectoryReq) returns (DirectoryResp)
  122. @handler ListDirectoriesHandler
  123. get /directories (ListDirectoryReq) returns (DirectoryListResp)
  124. @handler GetDirectoryHandler
  125. get /directories/:id (DirectoryIdReq) returns (DirectoryResp)
  126. @handler UpdateDirectoryHandler
  127. put /directories/:id (UpdateDirectoryReq) returns (DirectoryResp)
  128. @handler DeleteDirectoryHandler
  129. delete /directories/:id (DirectoryIdReq) returns (DeleteResp)
  130. @handler CreateKeyHandler
  131. post /keys/create (CreateKeyReq) returns (KeyResp)
  132. @handler ListKeysHandler
  133. post /keys/list (ListKeysReq) returns (KeyListResp)
  134. @handler GetKeyHandler
  135. post /keys/detail (KeyIdReq) returns (KeyResp)
  136. @handler UpdateKeyHandler
  137. post /keys/update (UpdateKeyReq) returns (KeyResp)
  138. @handler DeleteKeyHandler
  139. post /keys/delete (KeyIdReq) returns (DeleteResp)
  140. @handler CreateServiceHandler
  141. post /services (CreateServiceReq) returns (ServiceResp)
  142. @handler ListServicesHandler
  143. get /services (ListServiceReq) returns (ServiceListResp)
  144. @handler GetServiceHandler
  145. get /services/:id (ServiceIdReq) returns (ServiceResp)
  146. @handler UpdateServiceHandler
  147. put /services/:id (UpdateServiceReq) returns (ServiceResp)
  148. @handler DeleteServiceHandler
  149. delete /services/:id (ServiceIdReq) returns (DeleteResp)
  150. }