# DNSDomainService
> DNS域名相关

---

## countAllDNSDomainsWithDNSProviderId
> 计算服务商下的域名数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/countAllDNSDomainsWithDNSProviderId`
- RPC：`rpc countAllDNSDomainsWithDNSProviderId (CountAllDNSDomainsWithDNSProviderIdRequest) returns (RPCCountResponse);`

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

```json
{
  "dnsProviderId": "int64",
  "isDeleted": "bool // 是否已删除",
  "isDown": "bool"
}
```

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

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

**调用示例**

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

---

## createDNSDomain
> 创建域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/createDNSDomain`
- RPC：`rpc createDNSDomain (CreateDNSDomainRequest) returns (CreateDNSDomainResponse);`

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

```json
{
  "dnsProviderId": "int64",
  "name": "string // 名称"
}
```

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

```json
{
  "dnsDomainId": "int64"
}
```

**调用示例**

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

---

## deleteDNSDomain
> 删除域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/deleteDNSDomain`
- RPC：`rpc deleteDNSDomain (DeleteDNSDomainRequest) returns (RPCSuccess);`

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

```json
{
  "dnsDomainId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## existAvailableDomains
> 判断是否有域名可选

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/existAvailableDomains`
- RPC：`rpc existAvailableDomains (ExistAvailableDomainsRequest) returns (ExistAvailableDomainsResponse);`

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

```json
{}
```

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

```json
{
  "exist": "bool"
}
```

**调用示例**

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

---

## existDNSDomainRecord
> 检查域名是否在记录中

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/existDNSDomainRecord`
- RPC：`rpc existDNSDomainRecord (ExistDNSDomainRecordRequest) returns (ExistDNSDomainRecordResponse);`

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

```json
{
  "dnsDomainId": "int64",
  "name": "string // 名称",
  "type": "string // 解析类型，比如A, CNAME等",
  "route": "string // 线路",
  "value": "string // 值"
}
```

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

```json
{
  "isOk": "bool"
}
```

**调用示例**

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

---

## findAllBasicDNSDomainsWithDNSProviderId
> 列出服务商下的所有域名基本信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/findAllBasicDNSDomainsWithDNSProviderId`
- RPC：`rpc findAllBasicDNSDomainsWithDNSProviderId (FindAllBasicDNSDomainsWithDNSProviderIdRequest) returns (FindAllBasicDNSDomainsWithDNSProviderIdResponse);`

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

```json
{
  "dnsProviderId": "int64"
}
```

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

```json
{
  "dnsDomains": "[]DNSDomain"
}
```

**调用示例**

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

---

## findAllDNSDomainRoutes
> 查看支持的线路

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/findAllDNSDomainRoutes`
- RPC：`rpc findAllDNSDomainRoutes (FindAllDNSDomainRoutesRequest) returns (FindAllDNSDomainRoutesResponse);`

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

```json
{
  "dnsDomainId": "int64"
}
```

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

```json
{
  "routes": "[]DNSRoute"
}
```

**调用示例**

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

---

## findAllDNSDomainsWithDNSProviderId
> 列出服务商下的所有域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/findAllDNSDomainsWithDNSProviderId`
- RPC：`rpc findAllDNSDomainsWithDNSProviderId (FindAllDNSDomainsWithDNSProviderIdRequest) returns (FindAllDNSDomainsWithDNSProviderIdResponse);`

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

```json
{
  "dnsProviderId": "int64"
}
```

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

```json
{
  "dnsDomains": "[]DNSDomain"
}
```

**调用示例**

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

---

## findBasicDNSDomain
> 查询单个域名基础信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/findBasicDNSDomain`
- RPC：`rpc findBasicDNSDomain (FindBasicDNSDomainRequest) returns (FindBasicDNSDomainResponse);`

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

```json
{
  "dnsDomainId": "int64"
}
```

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

```json
{
  "dnsDomain": "DNSDomain"
}
```

**调用示例**

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

---

## findDNSDomain
> 查询单个域名完整信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/findDNSDomain`
- RPC：`rpc findDNSDomain (FindDNSDomainRequest) returns (FindDNSDomainResponse);`

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

```json
{
  "dnsDomainId": "int64"
}
```

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

```json
{
  "dnsDomain": "DNSDomain"
}
```

**调用示例**

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

---

## listBasicDNSDomainsWithDNSProviderId
> 列出服务商下的单页域名信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/listBasicDNSDomainsWithDNSProviderId`
- RPC：`rpc listBasicDNSDomainsWithDNSProviderId (ListBasicDNSDomainsWithDNSProviderIdRequest) returns (ListDNSDomainsWithDNSProviderIdResponse);`

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

```json
{
  "dnsProviderId": "int64",
  "isDeleted": "bool // 是否已删除",
  "isDown": "bool",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "dnsDomains": "[]DNSDomain"
}
```

**调用示例**

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

---

## recoverDNSDomain
> 恢复删除的域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/recoverDNSDomain`
- RPC：`rpc recoverDNSDomain (RecoverDNSDomainRequest) returns (RPCSuccess);`

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

```json
{
  "dnsDomainId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## syncDNSDomainData
> 同步域名解析

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/syncDNSDomainData`
- RPC：`rpc syncDNSDomainData (SyncDNSDomainDataRequest) returns (SyncDNSDomainDataResponse);`

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

```json
{
  "dnsDomainId": "int64",
  "nodeClusterId": "int64 // 如果指定，表示只更新单个集群ID",
  "checkNodeIssues": "bool // 是否检查节点问题"
}
```

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

```json
{
  "isOk": "bool",
  "error": "string",
  "shouldFix": "bool"
}
```

**调用示例**

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

---

## syncDNSDomainsFromProvider
> 从服务商同步域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/syncDNSDomainsFromProvider`
- RPC：`rpc syncDNSDomainsFromProvider(SyncDNSDomainsFromProviderRequest) returns (SyncDNSDomainsFromProviderResponse);`

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

```json
{
  "dnsProviderId": "int64"
}
```

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

```json
{
  "hasChanges": "bool"
}
```

**调用示例**

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

---

## updateDNSDomain
> 修改域名

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSDomainService/updateDNSDomain`
- RPC：`rpc updateDNSDomain (UpdateDNSDomainRequest) returns (RPCSuccess);`

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

```json
{
  "dnsDomainId": "int64",
  "name": "string // 名称",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---
