# DNSProviderService
> DNS服务商相关服务

---

## countAllEnabledDNSProviders
> 计算服务商数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/countAllEnabledDNSProviders`
- RPC：`rpc countAllEnabledDNSProviders (CountAllEnabledDNSProvidersRequest) returns (RPCCountResponse);`

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

```json
{
  "adminId": "int64 // 管理员ID",
  "userId": "int64 // 用户ID",
  "keyword": "string // 关键词",
  "domain": "string",
  "type": "string"
}
```

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

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

**调用示例**

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

---

## createDNSProvider
> 创建服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/createDNSProvider`
- RPC：`rpc createDNSProvider (CreateDNSProviderRequest) returns (CreateDNSProviderResponse);`

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

```json
{
  "name": "string // 名称",
  "type": "string",
  "apiParamsJSON": "bytes",
  "minTTL": "int32 // 最小TTL"
}
```

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

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

**调用示例**

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

---

## deleteDNSProvider
> 删除服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/deleteDNSProvider`
- RPC：`rpc deleteDNSProvider (DeleteDNSProviderRequest) returns (RPCSuccess);`

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

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

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

```json
{}
```

**调用示例**

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

---

## findAllDNSProviderTypes
> 取得所有服务商类型

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/findAllDNSProviderTypes`
- RPC：`rpc findAllDNSProviderTypes (FindAllDNSProviderTypesRequest) returns (FindAllDNSProviderTypesResponse);`

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

```json
{}
```

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

```json
{
  "providerTypes": "[]DNSProviderType"
}
```

**调用示例**

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

---

## findAllEnabledDNSProviders
> 查找所有的DNS服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/findAllEnabledDNSProviders`
- RPC：`rpc findAllEnabledDNSProviders (FindAllEnabledDNSProvidersRequest) returns (FindAllEnabledDNSProvidersResponse);`

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

```json
{
  "adminId": "int64 // 管理员ID",
  "userId": "int64 // 用户ID"
}
```

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

```json
{
  "dnsProviders": "[]DNSProvider"
}
```

**调用示例**

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

---

## findAllEnabledDNSProvidersWithType
> 取得某个类型的所有服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/findAllEnabledDNSProvidersWithType`
- RPC：`rpc findAllEnabledDNSProvidersWithType (FindAllEnabledDNSProvidersWithTypeRequest) returns (FindAllEnabledDNSProvidersWithTypeResponse);`

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

```json
{
  "providerTypeCode": "string"
}
```

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

```json
{
  "dnsProviders": "[]DNSProvider"
}
```

**调用示例**

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

---

## findEnabledDNSProvider
> 查找单个服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/findEnabledDNSProvider`
- RPC：`rpc findEnabledDNSProvider (FindEnabledDNSProviderRequest) returns (FindEnabledDNSProviderResponse);`

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

```json
{
  "dnsProviderId": "int64 // DNS服务商ID",
  "maskParams": "bool // 是否对参数中的密钥进行掩码"
}
```

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

```json
{
  "dnsProvider": "DNSProvider // DNS服务商信息"
}
```

**调用示例**

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

---

## listEnabledDNSProviders
> 列出单页服务商信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/listEnabledDNSProviders`
- RPC：`rpc listEnabledDNSProviders (ListEnabledDNSProvidersRequest) returns (ListEnabledDNSProvidersResponse);`

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

```json
{
  "adminId": "int64 // 管理员ID",
  "userId": "int64 // 用户ID",
  "keyword": "string // 关键词",
  "domain": "string",
  "type": "string",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "dnsProviders": "[]DNSProvider"
}
```

**调用示例**

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

---

## updateDNSProvider
> 修改服务商

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/DNSProviderService/updateDNSProvider`
- RPC：`rpc updateDNSProvider (UpdateDNSProviderRequest) returns (RPCSuccess);`

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

```json
{
  "dnsProviderId": "int64",
  "name": "string // 名称",
  "apiParamsJSON": "bytes",
  "minTTL": "int32 // 最小TTL"
}
```

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

```json
{}
```

**调用示例**

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

---
