# UserNodeService
> 用户节点管理服务

---

## countAllEnabledUserNodes
> 计算用户节点数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/countAllEnabledUserNodes`
- RPC：`rpc countAllEnabledUserNodes (CountAllEnabledUserNodesRequest) returns (RPCCountResponse);`

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

```json
{}
```

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

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

**调用示例**

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

---

## countAllEnabledUserNodesWithSSLCertId
> 计算使用某个SSL证书的用户节点数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/countAllEnabledUserNodesWithSSLCertId`
- RPC：`rpc countAllEnabledUserNodesWithSSLCertId (CountAllEnabledUserNodesWithSSLCertIdRequest) returns (RPCCountResponse);`

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

```json
{
  "sslCertId": "int64"
}
```

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

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

**调用示例**

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

---

## createUserNode
> 创建用户节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/createUserNode`
- RPC：`rpc createUserNode (CreateUserNodeRequest) returns (CreateUserNodeResponse);`

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

```json
{
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "httpJSON": "bytes",
  "httpsJSON": "bytes",
  "accessAddrsJSON": "bytes",
  "isOn": "bool // 是否启用"
}
```

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

```json
{
  "userNodeId": "int64"
}
```

**调用示例**

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

---

## deleteUserNode
> 删除用户节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/deleteUserNode`
- RPC：`rpc deleteUserNode (DeleteUserNodeRequest) returns (RPCSuccess);`

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

```json
{
  "userNodeId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllEnabledUserNodes
> 列出所有可用用户节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/findAllEnabledUserNodes`
- RPC：`rpc findAllEnabledUserNodes (FindAllEnabledUserNodesRequest) returns (FindAllEnabledUserNodesResponse);`

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

```json
{}
```

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

```json
{
  "userNodes": "[]UserNode"
}
```

**调用示例**

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

---

## findEnabledUserNode
> 根据ID查找节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/findEnabledUserNode`
- RPC：`rpc findEnabledUserNode (FindEnabledUserNodeRequest) returns (FindEnabledUserNodeResponse);`

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

```json
{
  "userNodeId": "int64"
}
```

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

```json
{
  "userNode": "UserNode"
}
```

**调用示例**

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

---

## findUserNodeAccessAddr
> 获取用户节点访问地址

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/findUserNodeAccessAddr`
- RPC：`rpc findUserNodeAccessAddr(FindUserNodeAccessAddrRequest) returns (FindUserNodeAccessAddrResponse);`

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

```json
{}
```

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

```json
{
  "accessAddr": "string"
}
```

**调用示例**

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

---

## listEnabledUserNodes
> 列出单页的用户节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/listEnabledUserNodes`
- RPC：`rpc listEnabledUserNodes (ListEnabledUserNodesRequest) returns (ListEnabledUserNodesResponse);`

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

```json
{
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

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

```json
{
  "userNodes": "[]UserNode"
}
```

**调用示例**

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

---

## updateUserNode
> 修改用户节点

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/updateUserNode`
- RPC：`rpc updateUserNode (UpdateUserNodeRequest) returns (RPCSuccess);`

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

```json
{
  "userNodeId": "int64",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "httpJSON": "bytes",
  "httpsJSON": "bytes",
  "accessAddrsJSON": "bytes",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateUserNodeStatus
> 更新节点状态

- 角色：`user`
- HTTP：`POST https://backend.dooki.cloud/UserNodeService/updateUserNodeStatus`
- RPC：`rpc updateUserNodeStatus (UpdateUserNodeStatusRequest) returns (RPCSuccess);`

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

```json
{
  "userNodeId": "int64",
  "statusJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateUserNodeUpgrade
> 更新节点升级状态

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

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

```json
{
  "userNodeId": "int64",
  "upgradeJSON": "bytes"
}
```

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

```json
{}
```

**调用示例**

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

---
