# MessageMediaInstanceService
> 消息媒介实例

---

## countAllEnabledMessageMediaInstances
> 计算消息媒介实例数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/countAllEnabledMessageMediaInstances`
- RPC：`rpc countAllEnabledMessageMediaInstances (CountAllEnabledMessageMediaInstancesRequest) returns (RPCCountResponse);`

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

```json
{
  "mediaType": "string",
  "keyword": "string // 关键词"
}
```

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

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

**调用示例**

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

---

## createMessageMediaInstance
> 创建消息媒介实例

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/createMessageMediaInstance`
- RPC：`rpc createMessageMediaInstance (CreateMessageMediaInstanceRequest) returns (CreateMessageMediaInstanceResponse);`

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

```json
{
  "name": "string // 名称",
  "mediaType": "string",
  "paramsJSON": "bytes",
  "groupIds": "[]int64",
  "description": "string // 描述（备注）",
  "rateJSON": "bytes",
  "hashLife": "int32"
}
```

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

```json
{
  "messageMediaInstanceId": "int64"
}
```

**调用示例**

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

---

## deleteMessageMediaInstance
> 删除消息媒介实例

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/deleteMessageMediaInstance`
- RPC：`rpc deleteMessageMediaInstance (DeleteMessageMediaInstanceRequest) returns (RPCSuccess);`

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

```json
{
  "messageMediaInstanceId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findEnabledMessageMediaInstance
> 查找单个消息媒介实例信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/findEnabledMessageMediaInstance`
- RPC：`rpc findEnabledMessageMediaInstance (FindEnabledMessageMediaInstanceRequest) returns (FindEnabledMessageMediaInstanceResponse);`

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

```json
{
  "messageMediaInstanceId": "int64"
}
```

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

```json
{
  "messageMediaInstance": "MessageMediaInstance"
}
```

**调用示例**

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

---

## listEnabledMessageMediaInstances
> 列出单页消息媒介实例

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/listEnabledMessageMediaInstances`
- RPC：`rpc listEnabledMessageMediaInstances (ListEnabledMessageMediaInstancesRequest) returns (ListEnabledMessageMediaInstancesResponse);`

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

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

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

```json
{
  "messageMediaInstances": "[]MessageMediaInstance"
}
```

**调用示例**

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

---

## updateMessageMediaInstance
> 修改消息媒介实例

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MessageMediaInstanceService/updateMessageMediaInstance`
- RPC：`rpc updateMessageMediaInstance (UpdateMessageMediaInstanceRequest) returns (RPCSuccess);`

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

```json
{
  "messageMediaInstanceId": "int64",
  "name": "string // 名称",
  "mediaType": "string",
  "paramsJSON": "bytes",
  "description": "string // 描述（备注）",
  "rateJSON": "bytes",
  "hashLife": "int32",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---
