# TrafficPackageService
> 流量包服务

---

## createTrafficPackage
> 创建流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/createTrafficPackage`
- RPC：`rpc createTrafficPackage(CreateTrafficPackageRequest) returns (CreateTrafficPackageResponse);`

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

```json
{
  "size": "int32 // 流量包尺寸",
  "unit": "string // 单位：gb, tb, pb"
}
```

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

```json
{
  "trafficPackageId": "int64"
}
```

**调用示例**

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

---

## deleteTrafficPackage
> 删除流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/deleteTrafficPackage`
- RPC：`rpc deleteTrafficPackage(DeleteTrafficPackageRequest) returns (RPCSuccess);`

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

```json
{
  "trafficPackageId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllAvailableTrafficPackages
> 查找所有可用流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/findAllAvailableTrafficPackages`
- RPC：`rpc findAllAvailableTrafficPackages(FindAllAvailableTrafficPackagesRequest) returns (FindAllAvailableTrafficPackagesResponse);`

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

```json
{}
```

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

```json
{
  "trafficPackages": "[]TrafficPackage"
}
```

**调用示例**

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

---

## findAllTrafficPackages
> 查找所有流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/findAllTrafficPackages`
- RPC：`rpc findAllTrafficPackages(FindAllTrafficPackagesRequest) returns (FindAllTrafficPackagesResponse);`

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

```json
{}
```

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

```json
{
  "trafficPackages": "[]TrafficPackage"
}
```

**调用示例**

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

---

## findTrafficPackage
> 查找流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/findTrafficPackage`
- RPC：`rpc findTrafficPackage(FindTrafficPackageRequest) returns (FindTrafficPackageResponse);`

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

```json
{
  "trafficPackageId": "int64"
}
```

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

```json
{
  "trafficPackage": "TrafficPackage"
}
```

**调用示例**

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

---

## updateTrafficPackage
> 修改流量包

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackageService/updateTrafficPackage`
- RPC：`rpc updateTrafficPackage(UpdateTrafficPackageRequest) returns (RPCSuccess);`

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

```json
{
  "trafficPackageId": "int64",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---
