# TrafficPackagePeriodService
> 流量包有效期服务

---

## createTrafficPackagePeriod
> 创建有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/createTrafficPackagePeriod`
- RPC：`rpc createTrafficPackagePeriod(CreateTrafficPackagePeriodRequest) returns (CreateTrafficPackagePeriodResponse);`

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

```json
{
  "count": "int32 // 数量",
  "unit": "string // month | year"
}
```

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

```json
{
  "trafficPackagePeriodId": "int64"
}
```

**调用示例**

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

---

## deleteTrafficPackagePeriod
> 删除有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/deleteTrafficPackagePeriod`
- RPC：`rpc deleteTrafficPackagePeriod(DeleteTrafficPackagePeriodRequest) returns (RPCSuccess);`

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

```json
{
  "trafficPackagePeriodId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllAvailableTrafficPackagePeriods
> 列出所有可用有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/findAllAvailableTrafficPackagePeriods`
- RPC：`rpc findAllAvailableTrafficPackagePeriods(FindAllAvailableTrafficPackagePeriodsRequest) returns (FindAllAvailableTrafficPackagePeriodsResponse);`

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

```json
{}
```

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

```json
{
  "trafficPackagePeriods": "[]TrafficPackagePeriod"
}
```

**调用示例**

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

---

## findAllTrafficPackagePeriods
> 列出所有有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/findAllTrafficPackagePeriods`
- RPC：`rpc findAllTrafficPackagePeriods(FindAllTrafficPackagePeriodsRequest) returns (FindAllTrafficPackagePeriodsResponse);`

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

```json
{}
```

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

```json
{
  "trafficPackagePeriods": "[]TrafficPackagePeriod"
}
```

**调用示例**

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

---

## findTrafficPackagePeriod
> 查找有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/findTrafficPackagePeriod`
- RPC：`rpc findTrafficPackagePeriod(FindTrafficPackagePeriodRequest) returns (FindTrafficPackagePeriodResponse);`

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

```json
{
  "trafficPackagePeriodId": "int64"
}
```

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

```json
{
  "trafficPackagePeriod": "TrafficPackagePeriod"
}
```

**调用示例**

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

---

## updateTrafficPackagePeriod
> 修改有效期

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/TrafficPackagePeriodService/updateTrafficPackagePeriod`
- RPC：`rpc updateTrafficPackagePeriod(UpdateTrafficPackagePeriodRequest) returns (RPCSuccess);`

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

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

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

```json
{}
```

**调用示例**

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

---
