# MetricChartService
> 指标图表相关服务

---

## countEnabledMetricCharts
> 计算图表数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/countEnabledMetricCharts`
- RPC：`rpc countEnabledMetricCharts (CountEnabledMetricChartsRequest) returns (RPCCountResponse);`

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

```json
{
  "metricItemId": "int64"
}
```

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

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

**调用示例**

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

---

## createMetricChart
> 创建图表

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/createMetricChart`
- RPC：`rpc createMetricChart (CreateMetricChartRequest) returns (CreateMetricChartResponse);`

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

```json
{
  "metricItemId": "int64",
  "name": "string // 名称",
  "type": "string",
  "widthDiv": "int32",
  "paramsJSON": "bytes",
  "maxItems": "int32",
  "ignoreEmptyKeys": "bool",
  "ignoredKeys": "[]string"
}
```

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

```json
{
  "metricChartId": "int64"
}
```

**调用示例**

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

---

## deleteMetricChart
> 删除图表

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/deleteMetricChart`
- RPC：`rpc deleteMetricChart (DeleteMetricChartRequest) returns (RPCSuccess);`

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

```json
{
  "metricChartId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findEnabledMetricChart
> 查找单个图表

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/findEnabledMetricChart`
- RPC：`rpc findEnabledMetricChart (FindEnabledMetricChartRequest) returns (FindEnabledMetricChartResponse);`

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

```json
{
  "metricChartId": "int64"
}
```

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

```json
{
  "metricChart": "MetricChart"
}
```

**调用示例**

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

---

## listEnabledMetricCharts
> 列出单页图表

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/listEnabledMetricCharts`
- RPC：`rpc listEnabledMetricCharts (ListEnabledMetricChartsRequest) returns (ListEnabledMetricChartsResponse);`

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

```json
{
  "metricItemId": "int64",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "metricCharts": "[]MetricChart"
}
```

**调用示例**

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

---

## updateMetricChart
> 修改图表

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/MetricChartService/updateMetricChart`
- RPC：`rpc updateMetricChart (UpdateMetricChartRequest) returns (RPCSuccess);`

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

```json
{
  "metricChartId": "int64",
  "name": "string // 名称",
  "type": "string",
  "widthDiv": "int32",
  "paramsJSON": "bytes",
  "isOn": "bool // 是否启用",
  "maxItems": "int32",
  "ignoreEmptyKeys": "bool",
  "ignoredKeys": "[]string"
}
```

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

```json
{}
```

**调用示例**

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

---
