{"openapi":"3.1.0","info":{"title":"Instinct API","version":"1.0.0"},"components":{"schemas":{"PostList":{"type":"object","properties":{"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}},"cursor":{"type":"string","nullable":true}},"required":["posts","cursor"]},"Post":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"authorId":{"type":"string"},"authorUsername":{"type":"string","nullable":true},"communityId":{"type":"string"},"content":{"type":"string"},"media":{"type":"array","items":{"$ref":"#/components/schemas/MediaItem"}},"poll":{"$ref":"#/components/schemas/Poll"},"likes":{"type":"integer"},"comments":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"liked":{"type":"boolean"},"userVote":{"type":"integer","nullable":true}},"required":["id","authorId","authorUsername","communityId","content","media","poll","likes","comments","createdAt"]},"MediaItem":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"type":{"type":"string","enum":["image","video","gif"]},"alt":{"type":"string","maxLength":300},"width":{"type":"integer","minimum":0,"exclusiveMinimum":true},"height":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["url","type"]},"Poll":{"type":"object","nullable":true,"properties":{"options":{"type":"array","items":{"$ref":"#/components/schemas/PollOption"}},"endsAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["options","endsAt"]},"PollOption":{"type":"object","properties":{"text":{"type":"string"},"votes":{"type":"integer","minimum":0}},"required":["text","votes"]},"UserStats":{"type":"object","properties":{"followers":{"type":"integer"},"following":{"type":"integer"},"posts":{"type":"integer"}},"required":["followers","following","posts"]},"Profile":{"type":"object","properties":{"username":{"type":"string","nullable":true,"minLength":3,"maxLength":20,"pattern":"^[a-zA-Z0-9_]+$"},"displayName":{"type":"string","nullable":true},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true}},"required":["username","displayName","avatarUrl","bio"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"UpdateProfile":{"type":"object","properties":{"username":{"type":"string","minLength":3,"maxLength":20,"pattern":"^[a-zA-Z0-9_]+$"},"displayName":{"type":"string","maxLength":50},"avatarUrl":{"type":"string","format":"uri"},"bio":{"type":"string","maxLength":500}}},"UsernameCheck":{"oneOf":[{"type":"object","properties":{"available":{"type":"boolean","enum":[true]}},"required":["available"]},{"type":"object","properties":{"available":{"type":"boolean","enum":[false]},"reason":{"type":"string"}},"required":["available","reason"]}]},"Setting":{"type":"object","properties":{"key":{"type":"string"},"value":{"nullable":true}},"required":["key"]},"UpdateSetting":{"type":"object","properties":{"value":{"nullable":true}}},"CreatePost":{"type":"object","properties":{"communityId":{"type":"string","minLength":1},"content":{"type":"string","minLength":1,"maxLength":5000},"media":{"type":"array","items":{"$ref":"#/components/schemas/MediaItem"},"maxItems":4,"default":[]},"poll":{"$ref":"#/components/schemas/PollInput"}},"required":["communityId","content"]},"PollInput":{"type":"object","properties":{"options":{"type":"array","items":{"$ref":"#/components/schemas/PollOptionInput"},"minItems":2,"maxItems":10},"endsAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["options"]},"PollOptionInput":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":200}},"required":["text"]},"LikeResponse":{"type":"object","properties":{"liked":{"type":"boolean"},"total":{"type":"integer"}},"required":["liked","total"]},"VoteResponse":{"type":"object","properties":{"poll":{"$ref":"#/components/schemas/Poll"},"userVote":{"type":"integer","nullable":true}},"required":["poll","userVote"]},"VoteRequest":{"type":"object","properties":{"optionIndex":{"type":"integer","nullable":true,"minimum":0}},"required":["optionIndex"]},"Comment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"postId":{"type":"string","format":"uuid"},"authorId":{"type":"string"},"authorUsername":{"type":"string","nullable":true},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","postId","authorId","authorUsername","content","createdAt"]},"CreateComment":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":2000}},"required":["content"]},"CommentList":{"type":"object","properties":{"comments":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}},"required":["comments"]},"FollowResponse":{"type":"object","properties":{"following":{"type":"boolean"}},"required":["following"]},"FollowRequest":{"type":"object","properties":{"targetType":{"type":"string","enum":["community","author"]},"targetId":{"type":"string","minLength":1}},"required":["targetType","targetId"]},"FollowingList":{"type":"object","properties":{"following":{"type":"array","items":{"$ref":"#/components/schemas/FollowingItem"}}},"required":["following"]},"FollowingItem":{"type":"object","properties":{"targetType":{"type":"string","enum":["community","author"]},"targetId":{"type":"string"}},"required":["targetType","targetId"]}},"parameters":{}},"paths":{"/feed/community/{communityId}":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"communityId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Community Posts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostList"}}}}}}},"/feed/author/{authorId}":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"authorId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Author Posts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostList"}}}}}}},"/feed/user/{userId}/counts":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"User Stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserStats"}}}}}}},"/user/profile":{"get":{"tags":["User"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"User Profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}}}},"post":{"tags":["User"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfile"}}}},"responses":{"200":{"description":"Profile Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Username Taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/user/check-username/{username}":{"get":{"tags":["User"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"username","in":"path"}],"responses":{"200":{"description":"Username Availability","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameCheck"}}}}}}},"/user/settings/{key}":{"get":{"tags":["User"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"User Setting","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Setting"}}}}}},"put":{"tags":["User"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSetting"}}}},"responses":{"200":{"description":"Setting Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Setting"}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/feed/post":{"post":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePost"}}}},"responses":{"201":{"description":"Post Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]}}}},"400":{"description":"Community Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/feed/post/{postId}":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"responses":{"200":{"description":"Post Details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Post"}}}},"404":{"description":"Post Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"responses":{"200":{"description":"Post Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string","format":"uuid"}},"required":["deleted"]}}}},"403":{"description":"Not Authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Post Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/feed/post/{postId}/like":{"post":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"responses":{"200":{"description":"Like Toggled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LikeResponse"}}}}}},"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"responses":{"200":{"description":"Like Status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LikeResponse"}}}}}}},"/feed/post/{postId}/vote":{"post":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoteRequest"}}}},"responses":{"200":{"description":"Vote Cast","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoteResponse"}}}},"400":{"description":"Option Index Out Of Bounds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/feed/post/{postId}/votes":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"responses":{"200":{"description":"Vote Counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoteResponse"}}}}}}},"/feed/post/{postId}/comment":{"post":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateComment"}}}},"responses":{"201":{"description":"Comment Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Comment"}}}},"404":{"description":"Post Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/feed/post/{postId}/comments":{"get":{"tags":["Feed"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"postId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Post Comments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentList"}}}}}}},"/feed/follow":{"post":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowRequest"}}}},"responses":{"200":{"description":"Follow Toggled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowResponse"}}}}}}},"/feed/following":{"get":{"tags":["Feed"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Following List","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowingList"}}}}}}}}}