# MessageRecipientService
> 消息接收人

---

## countAllEnabledMessageRecipients
> 计算接收人数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/countAllEnabledMessageRecipients`
- RPC：`rpc countAllEnabledMessageRecipients (CountAllEnabledMessageRecipientsRequest) returns (RPCCountResponse);`

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

```json
{
  "adminId": "int64 // 管理员ID",
  "mediaType": "string",
  "messageRecipientGroupId": "int64",
  "keyword": "string // 关键词"
}
```

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

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

**调用示例**

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

---

## createMessageRecipient
> 创建接收人

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/createMessageRecipient`
- RPC：`rpc createMessageRecipient (CreateMessageRecipientRequest) returns (CreateMessageRecipientResponse);`

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

```json
{
  "adminId": "int64 // 关联的管理员ID",
  "messageMediaInstanceId": "int64 // 媒介实例ID",
  "messageRecipientGroupIds": "[]int64 // 所属分组ID列表",
  "description": "string // 可选项，备注描述",
  "user": "string // 用户标识",
  "timeFrom": "string // 可选项，接收消息的，开始时间",
  "timeTo": "string // 可选项，接收消息的，结束时间",
  "nodeClusterIds": "[]int64 // 关联的CDN边缘节点集群ID列表"
}
```

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

```json
{
  "messageRecipientId": "int64"
}
```

**调用示例**

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

---

## deleteMessageRecipient
> 删除接收人

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/deleteMessageRecipient`
- RPC：`rpc deleteMessageRecipient (DeleteMessageRecipientRequest) returns (RPCSuccess);`

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

```json
{
  "messageRecipientId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findEnabledMessageRecipient
> 查找单个接收人信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/findEnabledMessageRecipient`
- RPC：`rpc findEnabledMessageRecipient (FindEnabledMessageRecipientRequest) returns (FindEnabledMessageRecipientResponse);`

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

```json
{
  "messageRecipientId": "int64"
}
```

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

```json
{
  "messageRecipient": "MessageRecipient"
}
```

**调用示例**

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

---

## listEnabledMessageRecipients
> 列出单页接收人

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/listEnabledMessageRecipients`
- RPC：`rpc listEnabledMessageRecipients (ListEnabledMessageRecipientsRequest) returns (ListEnabledMessageRecipientsResponse);`

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

```json
{
  "adminId": "int64 // 管理员ID",
  "mediaType": "string",
  "messageRecipientGroupId": "int64",
  "keyword": "string // 关键词",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "messageRecipients": "[]MessageRecipient"
}
```

**调用示例**

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

---

## updateMessageRecipient
> 修改接收人

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageRecipientService/updateMessageRecipient`
- RPC：`rpc updateMessageRecipient (UpdateMessageRecipientRequest) returns (RPCSuccess);`

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

```json
{
  "messageRecipientId": "int64",
  "adminId": "int64 // 管理员ID",
  "messageMediaInstanceId": "int64",
  "messageRecipientGroupIds": "[]int64",
  "description": "string // 描述（备注）",
  "isOn": "bool // 是否启用",
  "user": "string",
  "timeFrom": "string",
  "timeTo": "string",
  "nodeClusterIds": "[]int64 // 关联的CDN边缘节点集群ID列表"
}
```

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

```json
{}
```

**调用示例**

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

---
