{
  "tags": [
    "用户默认配置"
  ],
  "description": "更新一个用户配置。路径中的 `config_id` 会覆盖请求体 ID，请求体必须是 JSON 对象。普通用户只能更新自己的配置；管理员可更新其他用户配置。更新时配置值与作用域会重新校验，名称与类型不写入数据库但仍用于校验。",
  "operationId": "user_put_v1_user_configs_config_id",
  "security": [
    {
      "AccessToken": []
    },
    {
      "ApiKey": [],
      "ApiSecret": []
    }
  ],
  "responses": {
    "200": {
      "description": "请求已被处理。成功时 `code` 为 0、`msg` 为“更新用户配置成功”、`data` 为 null；配置不存在、请求体非对象、值或作用域无效、无权限时仍返回 HTTP 200。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "code",
              "msg",
              "data"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "description": "业务状态码；成功为 0。",
                "example": 0
              },
              "msg": {
                "type": "string",
                "description": "处理结果说明。",
                "example": "更新用户配置成功"
              },
              "data": {
                "type": "string",
                "nullable": true,
                "description": "成功时为 null；失败时为空字符串。",
                "example": null
              }
            }
          },
          "examples": {
            "success": {
              "summary": "更新成功",
              "value": {
                "code": 0,
                "msg": "更新用户配置成功",
                "data": null
              }
            },
            "invalidBody": {
              "summary": "请求体不是对象",
              "value": {
                "code": "user_config-13",
                "msg": "需要字典格式",
                "data": ""
              }
            }
          },
          "example": {
            "code": 0,
            "msg": "更新用户配置成功",
            "data": null
          }
        }
      }
    }
  },
  "x-python-handler": "config.UserConfigAPI",
  "x-python-route-line": 614,
  "x-audience": "user",
  "x-auth": "user",
  "x-reviewed": true,
  "parameters": [
    {
      "name": "config_id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "example": 9
      },
      "description": "要更新的用户配置 ID，必须存在且当前用户有权限操作。"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string",
              "description": "配置项名称；更新时不写入数据库，但用于 value 校验和配置唯一性检查。未传时使用原名称。"
            },
            "value": {
              "type": "string",
              "description": "配置值；按照 name 与 type 对应的服务端规则校验。未传时使用原值。"
            },
            "type": {
              "type": "string",
              "enum": [
                "site",
                "stream",
                "cert"
              ],
              "description": "配置类型；更新时不写入数据库，但用于 value 校验。未传时使用原类型。"
            },
            "scope_name": {
              "type": "string",
              "enum": [
                "global",
                "group"
              ],
              "description": "作用域名称；global 时 scope_id 固定为 0。"
            },
            "scope_id": {
              "type": "integer",
              "minimum": 0,
              "description": "作用域 ID；分组作用域必须存在对应的网站组或转发组。"
            },
            "enable": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "description": "启用状态。"
            },
            "uid": {
              "type": "integer",
              "description": "管理员专用。指定操作用户；不会改变已有配置的归属。"
            }
          },
          "example": {
            "value": "[]",
            "enable": 1
          }
        }
      }
    }
  },
  "x-itecdn-source-reviewed": true,
  "extensions": [
    {
      "key": "x-python-handler",
      "value": "config.UserConfigAPI"
    },
    {
      "key": "x-python-route-line",
      "value": 614
    },
    {
      "key": "x-audience",
      "value": "user"
    },
    {
      "key": "x-auth",
      "value": "user"
    },
    {
      "key": "x-reviewed",
      "value": true
    },
    {
      "key": "x-itecdn-source-reviewed",
      "value": true
    }
  ],
  "method": "put",
  "path": "/v1/user-configs/{config_id}",
  "servers": [
    {
      "url": "https://master.example.invalid",
      "description": "不可调用的示例地址；复制示例后替换为自己的主控域名。"
    }
  ],
  "securitySchemes": {
    "AccessToken": {
      "type": "apiKey",
      "in": "header",
      "name": "access-token",
      "description": "通过登录接口获得的短期访问令牌。"
    },
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "api-key",
      "description": "API Key；必须和 api-secret 同时发送。"
    },
    "ApiSecret": {
      "type": "apiKey",
      "in": "header",
      "name": "api-secret",
      "description": "API Secret；必须和 api-key 同时发送。"
    }
  },
  "jsonRequestBodyExample": {
    "value": "[]",
    "enable": 1
  },
  "info": {
    "title": "itecdn v5 用户 API",
    "version": "5.x",
    "description": "itecdn v5.x Python 主控用户 API。本文档不适用于 v6 或其它实现。"
  },
  "postman": {
    "name": "更新指定用户配置",
    "description": {
      "content": "更新一个用户配置。路径中的 `config_id` 会覆盖请求体 ID，请求体必须是 JSON 对象。普通用户只能更新自己的配置；管理员可更新其他用户配置。更新时配置值与作用域会重新校验，名称与类型不写入数据库但仍用于校验。",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "v1",
        "user-configs",
        ":config_id"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [],
      "variable": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) 要更新的用户配置 ID，必须存在且当前用户有权限操作。",
            "type": "text/plain"
          },
          "type": "any",
          "value": "",
          "key": "config_id"
        }
      ]
    },
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "PUT",
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "auth": {
      "type": "apikey",
      "apikey": [
        {
          "type": "any",
          "value": "access-token",
          "key": "key"
        },
        {
          "type": "any",
          "value": "{{apiKey}}",
          "key": "value"
        },
        {
          "type": "any",
          "value": "header",
          "key": "in"
        }
      ]
    }
  }
}