# NodeActionService
> 节点动作服务

---

## createNodeAction
> 添加动作

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/createNodeAction`
- RPC：`rpc createNodeAction(CreateNodeActionRequest) returns (CreateNodeActionResponse);`

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

```json
{
  "nodeId": "int64 // 节点ID",
  "role": "string // 节点角色",
  "condsJSON": "bytes // 条件设置",
  "actionJSON": "bytes // 动作设置",
  "durationJSON": "bytes // 持续时间"
}
```

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

```json
{
  "nodeActionId": "int64"
}
```

**调用示例**

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

---

## deleteNodeAction
> 删除动作

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/deleteNodeAction`
- RPC：`rpc deleteNodeAction(DeleteNodeActionRequest) returns (RPCSuccess);`

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

```json
{
  "nodeActionId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllNodeActions
> 列出某个节点的所有动作

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/findAllNodeActions`
- RPC：`rpc findAllNodeActions(FindAllNodeActionsRequest) returns (FindAllNodeActionsResponse);`

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

```json
{
  "nodeId": "int64 // 节点ID",
  "role": "string // 节点角色"
}
```

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

```json
{
  "nodeActions": "[]NodeAction // 动作列表"
}
```

**调用示例**

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

---

## findNodeAction
> 查找单个节点动作

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/findNodeAction`
- RPC：`rpc findNodeAction(FindNodeActionRequest) returns (FindNodeActionResponse);`

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

```json
{
  "nodeActionId": "int64 // 动作ID"
}
```

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

```json
{
  "nodeAction": "NodeAction"
}
```

**调用示例**

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

---

## updateNodeAction
> 修改动作

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/updateNodeAction`
- RPC：`rpc updateNodeAction(UpdateNodeActionRequest) returns (RPCSuccess);`

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

```json
{
  "nodeActionId": "int64 // 动作ID",
  "condsJSON": "bytes",
  "actionJSON": "bytes",
  "durationJSON": "bytes // 持续时间",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---

## updateNodeActionOrders
> 设置节点动作排序

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/NodeActionService/updateNodeActionOrders`
- RPC：`rpc updateNodeActionOrders(UpdateNodeActionOrdersRequest) returns (RPCSuccess);`

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

```json
{
  "nodeActionIds": "[]int64 // 节点动作ID列表"
}
```

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

```json
{}
```

**调用示例**

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

---
