syntax = "v1" import "common.api" // 分类管理接口 // 获取分类列表请求 type GetCategoryListRequest { PageRequest Keyword string `form:"keyword,optional"` } // 获取分类列表响应 type GetCategoryListResponse { BaseResponse Data CategoryListData `json:"data"` } type CategoryListData { PageResponse Categories []Category `json:"categories"` } // 获取分类详情请求 type GetCategoryRequest { Id int64 `path:"id"` } // 获取分类详情响应 type GetCategoryResponse { BaseResponse Data Category `json:"data"` } // 创建分类请求 type CreateCategoryRequest { Name string `json:"name" validate:"required"` Description string `json:"description,optional"` } // 创建分类响应 type CreateCategoryResponse { BaseResponse Data Category `json:"data"` } // 更新分类请求 type UpdateCategoryRequest { Id int64 `path:"id"` Name string `json:"name,optional"` Description string `json:"description,optional"` } // 更新分类响应 type UpdateCategoryResponse { BaseResponse Data Category `json:"data"` } // 删除分类请求 type DeleteCategoryRequest { Id int64 `path:"id"` } // 删除分类响应 type DeleteCategoryResponse { BaseResponse } // 分类管理接口组 @server( group: category prefix: /api/v1/categories jwt: Auth ) service photography-api { @doc "获取分类列表" @handler getCategoryList get / (GetCategoryListRequest) returns (GetCategoryListResponse) @doc "创建分类" @handler createCategory post / (CreateCategoryRequest) returns (CreateCategoryResponse) @doc "获取分类详情" @handler getCategory get /:id (GetCategoryRequest) returns (GetCategoryResponse) @doc "更新分类" @handler updateCategory put /:id (UpdateCategoryRequest) returns (UpdateCategoryResponse) @doc "删除分类" @handler deleteCategory delete /:id (DeleteCategoryRequest) returns (DeleteCategoryResponse) }