# PostCategoryService
> 文章分类管理服务

---

## createPostCategory
> 创建分类

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/createPostCategory`
- RPC：`rpc createPostCategory(CreatePostCategoryRequest) returns (CreatePostCategoryResponse);`

**请求对象 (`CreatePostCategoryRequest`)**

```json
{
  "name": "string // 分类名称",
  "code": "string // 分类代号"
}
```

**响应对象 (`CreatePostCategoryResponse`)**

```json
{
  "postCategoryId": "int64 // 分类ID"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/createPostCategory" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deletePostCategory
> 删除分类

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/deletePostCategory`
- RPC：`rpc deletePostCategory(DeletePostCategoryRequest) returns (RPCSuccess);`

**请求对象 (`DeletePostCategoryRequest`)**

```json
{
  "postCategoryId": "int64 // 分类ID"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/deletePostCategory" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findAllPostCategories
> 列出所有分类

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/findAllPostCategories`
- RPC：`rpc findAllPostCategories(FindAllPostCategoriesRequest) returns (FindAllPostCategoriesResponse);`

**请求对象 (`FindAllPostCategoriesRequest`)**

```json
{}
```

**响应对象 (`FindAllPostCategoriesResponse`)**

```json
{
  "postCategories": "[]PostCategory // 分类列表"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/findAllPostCategories" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findPostCategory
> 查询单个分类

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/findPostCategory`
- RPC：`rpc findPostCategory(FindPostCategoryRequest) returns (FindPostCategoryResponse);`

**请求对象 (`FindPostCategoryRequest`)**

```json
{
  "postCategoryId": "int64 // 分类ID"
}
```

**响应对象 (`FindPostCategoryResponse`)**

```json
{
  "postCategory": "PostCategory // 分类信息"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/findPostCategory" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## sortPostCategories
> 对分类进行排序

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/sortPostCategories`
- RPC：`rpc sortPostCategories(SortPostCategoriesRequest) returns (RPCSuccess);`

**请求对象 (`SortPostCategoriesRequest`)**

```json
{
  "postCategoryIds": "[]int64 // 分类ID列表"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/sortPostCategories" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updatePostCategory
> 修改分类

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/PostCategoryService/updatePostCategory`
- RPC：`rpc updatePostCategory(UpdatePostCategoryRequest) returns (RPCSuccess);`

**请求对象 (`UpdatePostCategoryRequest`)**

```json
{
  "postCategoryId": "int64 // 分类ID",
  "name": "string // 分类名称",
  "code": "string // 分类代号",
  "isOn": "bool // 是否启用"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/PostCategoryService/updatePostCategory" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
