# UserTicketService
> 工单服务

---

## countUserTickets
> 计算工单数量

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/countUserTickets`
- RPC：`rpc countUserTickets(CountUserTicketsRequest) returns (RPCCountResponse);`

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

```json
{
  "userId": "int64 // 用户ID",
  "userTicketCategoryId": "int64",
  "status": "string"
}
```

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

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

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

---

## createUserTicket
> 创建工单

- 角色：`user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/createUserTicket`
- RPC：`rpc createUserTicket(CreateUserTicketRequest) returns (CreateUserTicketResponse);`

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

```json
{
  "userTicketCategoryId": "int64",
  "subject": "string",
  "body": "string"
}
```

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

```json
{
  "userTicketId": "int64"
}
```

**调用示例**

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

---

## deleteUserTicket
> 删除工单

- 角色：`user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/deleteUserTicket`
- RPC：`rpc deleteUserTicket(DeleteUserTicketRequest) returns (RPCSuccess);`

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

```json
{
  "userTicketId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findUserTicket
> 查找单个工单

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/findUserTicket`
- RPC：`rpc findUserTicket(FindUserTicketRequest) returns (FindUserTicketResponse);`

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

```json
{
  "userTicketId": "int64"
}
```

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

```json
{
  "userTicket": "UserTicket"
}
```

**调用示例**

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

---

## listUserTickets
> 列出单页工单

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/listUserTickets`
- RPC：`rpc listUserTickets(ListUserTicketsRequest) returns (ListUserTicketsResponse);`

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

```json
{
  "userId": "int64 // 用户ID",
  "userTicketCategoryId": "int64",
  "status": "string",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "userTickets": "[]UserTicket"
}
```

**调用示例**

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

---

## updateUserTicket
> 修改工单

- 角色：`user`
- HTTP：`POST https://backend.dooki.cloud/UserTicketService/updateUserTicket`
- RPC：`rpc updateUserTicket(UpdateUserTicketRequest) returns (RPCSuccess);`

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

```json
{
  "userTicketId": "int64",
  "userTicketCategoryId": "int64",
  "subject": "string",
  "body": "string"
}
```

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

```json
{}
```

**调用示例**

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

---
