udeServer.api 4.0 KB

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