{"openapi":"3.1.0","info":{"title":"HY2 节点管理 API","version":"1.0.0","description":"使用 Bearer API_TOKEN。ID 为链接内容 SHA-256，排序不改变 ID，编辑会返回新 ID。所有写入应串行执行；KV 不提供并发事务。"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Snapshot":{"type":"object","required":["nodes","count","subscriptionUrl"],"properties":{"nodes":{"type":"array","items":{"type":"object","required":["id","name","server","port","link"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"server":{"type":"string"},"port":{"type":"string"},"link":{"type":"string"}}}},"count":{"type":"integer"},"subscriptionUrl":{"type":"string","format":"uri"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/api/nodes":{"get":{"operationId":"listNodes","summary":"查询节点及 ID","responses":{"200":{"description":"当前节点快照（nodes、count、subscriptionUrl）；编辑后使用响应中的新 ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snapshot"}}}},"400":{"description":"参数错误，未写入","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"未授权","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ID 已失效或不存在","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"存储不可用","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"importNodes","summary":"批量追加；相同链接去重，整批先验证","responses":{"200":{"description":"当前节点快照（nodes、count、subscriptionUrl）；编辑后使用响应中的新 ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snapshot"}}}},"400":{"description":"参数错误，未写入","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"未授权","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ID 已失效或不存在","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"存储不可用","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","minItems":1,"items":{"type":"string"}}},"required":["links"]}}}}}},"/api/nodes/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"patch":{"operationId":"updateNode","summary":"修改备注或链接，或单独传 position（从 1 起）调整顺序","responses":{"200":{"description":"当前节点快照（nodes、count、subscriptionUrl）；编辑后使用响应中的新 ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snapshot"}}}},"400":{"description":"参数错误，未写入","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"未授权","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ID 已失效或不存在","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"存储不可用","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"position":{"type":"integer","minimum":1,"description":"单独传入，从 1 到当前节点数，表示移动后的全列表位置"},"move":{"type":"string","enum":["up","down"],"description":"单独传入，每次移动一位"},"name":{"type":"string"},"link":{"type":"string"}}}}}}},"delete":{"operationId":"deleteNode","summary":"按内容 ID 删除；重复删除返回 404","responses":{"200":{"description":"当前节点快照（nodes、count、subscriptionUrl）；编辑后使用响应中的新 ID。","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snapshot"}}}},"400":{"description":"参数错误，未写入","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"未授权","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ID 已失效或不存在","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"存储不可用","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}