category.api 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import "../base.api"
  2. type (
  3. // The data of category information | Category信息
  4. CategoryInfo {
  5. BaseIDInfo
  6. // name | 角色名称
  7. Name *string `json:"name,optional"`
  8. // organization_id | 租户ID
  9. OrganizationId *uint64 `json:"organizationId,optional"`
  10. }
  11. // The response data of category list | Category列表数据
  12. CategoryListResp {
  13. BaseDataInfo
  14. // Category list data | Category列表数据
  15. Data CategoryListInfo `json:"data"`
  16. }
  17. // Category list data | Category列表数据
  18. CategoryListInfo {
  19. BaseListInfo
  20. // The API list data | Category列表数据
  21. Data []CategoryInfo `json:"data"`
  22. }
  23. // Get category list request params | Category列表请求参数
  24. CategoryListReq {
  25. PageInfo
  26. // name | 角色名称
  27. Name *string `json:"name,optional"`
  28. }
  29. // Category information response | Category信息返回体
  30. CategoryInfoResp {
  31. BaseDataInfo
  32. // Category information | Category数据
  33. Data CategoryInfo `json:"data"`
  34. }
  35. )
  36. @server(
  37. group: category
  38. )
  39. service Wechat {
  40. // Get category list | 获取Category列表
  41. @handler getCategoryList
  42. post /category/list (CategoryListReq) returns (CategoryListResp)
  43. // Get category by ID | 通过ID获取Category
  44. @handler getCategoryById
  45. post /category (IDReq) returns (CategoryInfoResp)
  46. // Get category list | 获取 category 列表
  47. @handler getApiCategoryList
  48. post /api/category/list returns (CategoryListResp)
  49. }
  50. @server(
  51. jwt: Auth
  52. group: category
  53. middleware: Authority
  54. )
  55. service Wechat {
  56. // Create category information | 创建Category
  57. @handler createCategory
  58. post /category/create (CategoryInfo) returns (BaseMsgResp)
  59. // Update category information | 更新Category
  60. @handler updateCategory
  61. post /category/update (CategoryInfo) returns (BaseMsgResp)
  62. // Delete category information | 删除Category信息
  63. @handler deleteCategory
  64. post /category/delete (IDsReq) returns (BaseMsgResp)
  65. }