# NSPlanService
> DNS套餐服务

---

## createNSPlan
> 创建DNS套餐

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/createNSPlan`
- RPC：`rpc createNSPlan(CreateNSPlanRequest) returns (CreateNSPlanResponse);`

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

```json
{
  "name": "string // 名称",
  "monthlyPrice": "float",
  "yearlyPrice": "float",
  "configJSON": "bytes"
}
```

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

```json
{
  "nsPlanId": "int64"
}
```

**调用示例**

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

---

## deleteNSPlan
> 删除DNS套餐

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/deleteNSPlan`
- RPC：`rpc deleteNSPlan(DeleteNSPlanRequest) returns (RPCSuccess);`

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

```json
{
  "nsPlanId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllEnabledNSPlans
> 查找所有可用DNS套餐

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/findAllEnabledNSPlans`
- RPC：`rpc findAllEnabledNSPlans(FindAllEnabledNSPlansRequest) returns (FindAllEnabledNSPlansResponse);`

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

```json
{}
```

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

```json
{
  "nsPlans": "[]NSPlan"
}
```

**调用示例**

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

---

## findAllNSPlans
> 查找所有DNS套餐

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/findAllNSPlans`
- RPC：`rpc findAllNSPlans(FindAllNSPlansRequest) returns (FindAllNSPlansResponse);`

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

```json
{}
```

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

```json
{
  "nsPlans": "[]NSPlan"
}
```

**调用示例**

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

---

## findNSPlan
> 查找DNS套餐

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/findNSPlan`
- RPC：`rpc findNSPlan(FindNSPlanRequest) returns (FindNSPlanResponse);`

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

```json
{
  "nsPlanId": "int64"
}
```

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

```json
{
  "nsPlan": "NSPlan"
}
```

**调用示例**

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

---

## sortNSPlanOrders
> 修改DNS套餐顺序

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/sortNSPlanOrders`
- RPC：`rpc sortNSPlanOrders(SortNSPlansRequest) returns (RPCSuccess);`

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

```json
{
  "nsPlanIds": "[]int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSPlan
> 修改DNS套餐

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NSPlanService/updateNSPlan`
- RPC：`rpc updateNSPlan(UpdateNSPlanRequest) returns (RPCSuccess);`

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

```json
{
  "nsPlanId": "int64",
  "name": "string // 名称",
  "isOn": "bool // 是否启用",
  "monthlyPrice": "float",
  "yearlyPrice": "float",
  "configJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---
