{"openapi":"3.0.3","info":{"title":"YYB JS API","description":"Ported from the Go implementation for QR login, account management, and wxapp calls.","version":"1.0.0"},"servers":[{"url":"/"}],"tags":[{"name":"health"},{"name":"qr"},{"name":"accounts"},{"name":"wxapp"}],"paths":{"/health":{"get":{"tags":["health"],"summary":"Health check","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}}}},"/qr":{"post":{"tags":["qr"],"summary":"Create QR session","responses":{"200":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"type":"object","properties":{"session_id":{"type":"string"},"status":{"type":"string"},"image_url":{"type":"string"},"image_base64":{"type":"string","nullable":true,"description":"optional data URI"}},"required":["session_id","status","image_url"]}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"as_base64","in":"query","description":"Return data URI too","required":false,"schema":{"type":"boolean"}}]}},"/qr/{session_id}/image":{"get":{"tags":["qr"],"summary":"Get QR image","responses":{"200":{"description":"qr image","content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"session_id","in":"path","description":"QR session ID","required":true,"schema":{"type":"string"}}]}},"/qr/{session_id}/poll":{"get":{"tags":["qr"],"summary":"Poll QR status","responses":{"200":{"description":"status","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"type":"object","properties":{"status":{"type":"string","enum":["pending","scanned","authorized","confirmed","expired","cancelled","unknown"]},"errcode":{"type":"integer","nullable":true}},"required":["status"]}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"session_id","in":"path","description":"QR session ID","required":true,"schema":{"type":"string"}}]}},"/qr/{session_id}/confirm":{"post":{"tags":["qr"],"summary":"Confirm QR session","responses":{"200":{"description":"account","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/AccountPublic"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"session_id","in":"path","description":"QR session ID","required":true,"schema":{"type":"string"}}]}},"/accounts":{"get":{"tags":["accounts"],"summary":"List accounts","responses":{"200":{"description":"accounts","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AccountPublic"}}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}}},"delete":{"tags":["accounts"],"summary":"Delete account","responses":{"200":{"description":"deleted","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/DeleteAccountResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"ref","in":"query","description":"account id/uin/openid","required":true,"schema":{"type":"string"}}]}},"/accounts/avatar":{"get":{"tags":["accounts"],"summary":"Get avatar","responses":{"200":{"description":"avatar","content":{"image/jpeg":{"schema":{"type":"string","format":"binary"}}}},"302":{"description":"redirect"},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"parameters":[{"name":"ref","in":"query","description":"account id/uin/openid","required":true,"schema":{"type":"string"}}]}},"/accounts/refresh":{"post":{"tags":["accounts"],"summary":"Refresh account","responses":{"200":{"description":"refresh result","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/RefreshResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRefRequest"}}}}}},"/accounts/resync":{"post":{"tags":["accounts"],"summary":"Resync account","responses":{"200":{"description":"resync result","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/ResyncResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRefRequest"}}}}}},"/wxapp/getCode":{"post":{"tags":["wxapp"],"summary":"Call getCode","responses":{"200":{"description":"wxapp result","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/WxappResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WxappRequest"}}}}}},"/wxapp/getPhoneNumber":{"post":{"tags":["wxapp"],"summary":"Call getPhoneNumber","responses":{"200":{"description":"wxapp result","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/WxappResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WxappRequest"}}}}}},"/wxapp/operateWxData":{"post":{"tags":["wxapp"],"summary":"Call operateWxData","responses":{"200":{"description":"wxapp result","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","example":0},"msg":{"type":"string","example":"success"},"data":{"$ref":"#/components/schemas/WxappResponse"}},"required":["code","msg","data"]}}}},"default":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperateWXDataRequest"}}}}}}},"components":{"schemas":{"APIErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","additionalProperties":true,"nullable":true,"description":"always null"}},"required":["code","msg","data"]},"AccountPublic":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"openid":{"type":"string"},"uin":{"type":"integer","format":"int64","nullable":true},"alias":{"type":"string","nullable":true,"description":"alias"},"nickname":{"type":"string","nullable":true,"description":"nickname"},"avatar":{"type":"string","nullable":true,"description":"avatar"},"status":{"type":"string","nullable":true,"description":"status"},"last_checked_at":{"type":"integer","format":"int64","nullable":true},"created_at":{"type":"integer","format":"int64"},"updated_at":{"type":"integer","format":"int64"}},"required":["id","openid","created_at","updated_at"]},"DeleteAccountResponse":{"type":"object","properties":{"deleted":{"type":"integer","format":"int64"},"openid":{"type":"string"}},"required":["deleted","openid"]},"AccountRefRequest":{"type":"object","properties":{"ref":{"type":"string"}}},"RefreshResult":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"openid":{"type":"string"},"uin":{"type":"integer","format":"int64","nullable":true},"nickname":{"type":"string","nullable":true,"description":"nickname"},"status":{"type":"string"}},"required":["id","openid","status"]},"RefreshResponse":{"oneOf":[{"$ref":"#/components/schemas/RefreshResult"},{"type":"array","items":{"$ref":"#/components/schemas/RefreshResult"}}]},"ResyncResponse":{"oneOf":[{"$ref":"#/components/schemas/AccountPublic"},{"type":"array","items":{"$ref":"#/components/schemas/AccountPublic"}}]},"WxappRequest":{"type":"object","properties":{"ref":{"type":"string"},"app_id":{"type":"string"}},"required":["ref","app_id"]},"OperateWXDataRequest":{"type":"object","properties":{"ref":{"type":"string"},"app_id":{"type":"string"},"payload":{"type":"object","additionalProperties":true,"nullable":true,"description":"full request payload"}},"required":["ref","app_id","payload"]},"WxappResponse":{"type":"object","properties":{"openid":{"type":"string"},"result":{"type":"object","additionalProperties":true,"nullable":true,"description":"wxapp result"}},"required":["openid","result"]}}}}