# ADPackageService
> 高防产品服务

---

## countADPackages
> 查询高防产品数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/countADPackages`
- RPC：`rpc countADPackages(CountADPackagesRequest) returns (RPCCountResponse);`

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

```json
{
  "adNetworkId": "int64"
}
```

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

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

**调用示例**

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

---

## countAllIdleADPackages
> 查询可用的产品数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/countAllIdleADPackages`
- RPC：`rpc countAllIdleADPackages(CountAllIdleADPackages) returns (RPCCountResponse);`

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

```json
{}
```

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

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

**调用示例**

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

---

## createADPackage
> 创建高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/createADPackage`
- RPC：`rpc createADPackage(CreateADPackageRequest) returns (CreateADPackageResponse);`

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

```json
{
  "adNetworkId": "int64",
  "protectionBandwidthSize": "int32",
  "protectionBandwidthUnit": "string",
  "serverBandwidthSize": "int32",
  "serverBandwidthUnit": "string"
}
```

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

```json
{
  "adPackageId": "int64"
}
```

**调用示例**

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

---

## deleteADPackage
> 删除高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/deleteADPackage`
- RPC：`rpc deleteADPackage(DeleteADPackageRequest) returns (RPCSuccess);`

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

```json
{
  "adPackageId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findADPackage
> 查找单个高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/findADPackage`
- RPC：`rpc findADPackage(FindADPackageRequest) returns (FindADPackageResponse);`

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

```json
{
  "adPackageId": "int64"
}
```

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

```json
{
  "adPackage": "ADPackage"
}
```

**调用示例**

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

---

## findAllIdleADPackages
> 列出所有可用的高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/findAllIdleADPackages`
- RPC：`rpc findAllIdleADPackages(FindAllIdleADPackagesRequest) returns (FindAllIdleADPackagesResponse);`

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

```json
{}
```

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

```json
{
  "adPackages": "[]ADPackage"
}
```

**调用示例**

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

---

## listADPackages
> 列出单页高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/listADPackages`
- RPC：`rpc listADPackages(ListADPackagesRequest) returns (ListADPackagesResponse);`

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

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

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

```json
{
  "adPackages": "[]ADPackage"
}
```

**调用示例**

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

---

## updateADPackage
> 修改高防产品

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/ADPackageService/updateADPackage`
- RPC：`rpc updateADPackage(UpdateADPackageRequest) returns (RPCSuccess);`

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

```json
{
  "adPackageId": "int64",
  "isOn": "bool // 是否启用",
  "adNetworkId": "int64",
  "protectionBandwidthSize": "int32",
  "protectionBandwidthUnit": "string",
  "serverBandwidthSize": "int32",
  "serverBandwidthUnit": "string"
}
```

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

```json
{}
```

**调用示例**

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

---
