# UserAccessKeyService
> 用户AccessKey相关服务

---

## countAllEnabledUserAccessKeys
> 计算AccessKey数量

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

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

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

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

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

**调用示例**

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

---

## createUserAccessKey
> 创建AccessKey

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserAccessKeyService/createUserAccessKey`
- RPC：`rpc createUserAccessKey (CreateUserAccessKeyRequest) returns (CreateUserAccessKeyResponse);`

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

```json
{
  "userId": "int64 // 用户ID",
  "adminId": "int64 // 管理员ID",
  "description": "string // 描述（备注）"
}
```

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

```json
{
  "userAccessKeyId": "int64"
}
```

**调用示例**

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

---

## deleteUserAccessKey
> 删除AccessKey

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

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

```json
{
  "userAccessKeyId": "int64"
}
```

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

```json
{}
```

**调用示例**

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

---

## findAllEnabledUserAccessKeys
> 查找所有的AccessKey

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserAccessKeyService/findAllEnabledUserAccessKeys`
- RPC：`rpc findAllEnabledUserAccessKeys (FindAllEnabledUserAccessKeysRequest) returns (FindAllEnabledUserAccessKeysResponse);`

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

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

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

```json
{
  "userAccessKeys": "[]UserAccessKey"
}
```

**调用示例**

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

---

## updateUserAccessKeyIsOn
> 设置是否启用AccessKey

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

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

```json
{
  "userAccessKeyId": "int64",
  "isOn": "bool // 是否启用"
}
```

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

```json
{}
```

**调用示例**

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

---
