# NSRouteService
> 线路相关服务

---

## countAllNSRoutes
> 查询自定义线路数量

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/countAllNSRoutes`
- RPC：`rpc countAllNSRoutes(CountAllNSRoutesRequest) returns (RPCCountResponse);`

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

```json
{
  "nsClusterId": "int64",
  "nsDomainId": "int64",
  "userId": "int64 // 用户ID"
}
```

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

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

**调用示例**

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

---

## createNSRoute
> 创建自定义线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/createNSRoute`
- RPC：`rpc createNSRoute (CreateNSRouteRequest) returns (CreateNSRouteResponse);`

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

```json
{
  "nsClusterId": "int64",
  "nsDomainId": "int64",
  "userId": "int64 // 用户ID",
  "name": "string // 名称",
  "rangesJSON": "bytes",
  "isPublic": "bool // 是否公用",
  "nsRouteCategoryId": "int64 // 分类ID",
  "priority": "int32 // 优先级"
}
```

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

```json
{
  "nsRouteId": "int64"
}
```

**调用示例**

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

---

## deleteNSRoute
> 删除自定义线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/deleteNSRoute`
- RPC：`rpc deleteNSRoute (DeleteNSRouteRequest) returns (RPCSuccess);`

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

```json
{
  "nsRouteId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllAgentNSRoutes
> 查找默认的搜索引擎线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findAllAgentNSRoutes`
- RPC：`rpc findAllAgentNSRoutes(FindAllAgentNSRoutesRequest) returns (FindAllAgentNSRoutesResponse);`

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

```json
{}
```

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

```json
{
  "nsRoutes": "[]NSRoute"
}
```

**调用示例**

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

---

## findAllDefaultChinaProvinceRoutes
> 查找默认的中国省份线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findAllDefaultChinaProvinceRoutes`
- RPC：`rpc findAllDefaultChinaProvinceRoutes(FindAllDefaultChinaProvinceRoutesRequest) returns (FindAllDefaultChinaProvinceRoutesResponse);`

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

```json
{}
```

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

```json
{
  "nsRoutes": "[]NSRoute"
}
```

**调用示例**

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

---

## findAllDefaultISPRoutes
> 查找默认的ISP线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findAllDefaultISPRoutes`
- RPC：`rpc findAllDefaultISPRoutes(FindAllDefaultISPRoutesRequest) returns (FindAllDefaultISPRoutesResponse);`

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

```json
{}
```

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

```json
{
  "nsRoutes": "[]NSRoute"
}
```

**调用示例**

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

---

## findAllDefaultWorldRegionRoutes
> 查找默认的世界区域线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findAllDefaultWorldRegionRoutes`
- RPC：`rpc findAllDefaultWorldRegionRoutes(FindAllDefaultWorldRegionRoutesRequest) returns (FindAllDefaultWorldRegionRoutesResponse);`

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

```json
{}
```

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

```json
{
  "nsRoutes": "[]NSRoute"
}
```

**调用示例**

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

---

## findAllNSRoutes
> 读取所有自定义线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findAllNSRoutes`
- RPC：`rpc findAllNSRoutes (FindAllNSRoutesRequest) returns (FindAllNSRoutesResponse);`

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

```json
{
  "nsClusterId": "int64 // 集群ID",
  "nsDomainId": "int64 // 域名ID",
  "userId": "int64 // 用户ID",
  "nsRouteCategoryId": "int64 // 线路分类ID"
}
```

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

```json
{
  "nsRoutes": "[]NSRoute"
}
```

**调用示例**

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

---

## findNSRoute
> 获取单个自定义路线信息

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/findNSRoute`
- RPC：`rpc findNSRoute (FindNSRouteRequest) returns (FindNSRouteResponse);`

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

```json
{
  "nsRouteId": "int64"
}
```

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

```json
{
  "nsRoute": "NSRoute"
}
```

**调用示例**

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

---

## updateNSRoute
> 修改自定义线路

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/updateNSRoute`
- RPC：`rpc updateNSRoute (UpdateNSRouteRequest) returns (RPCSuccess);`

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

```json
{
  "nsRouteId": "int64",
  "name": "string // 名称",
  "rangesJSON": "bytes",
  "isPublic": "bool // 是否公用",
  "nsRouteCategoryId": "int64 // 分类ID",
  "priority": "int32 // 优先级",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNSRouteOrders
> 设置自定义线路排序

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/NSRouteService/updateNSRouteOrders`
- RPC：`rpc updateNSRouteOrders (UpdateNSRouteOrdersRequest) returns (RPCSuccess);`

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

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

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

```json
{}
```

**调用示例**

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

---
