Files
ad/molodetz/docs_api/content.py
T

47 lines
2.6 KiB
Python

# retoor <retoor@molodetz.nl>
from molodetz.docs_api.registry import endpoint, field
GROUP = {
"slug": "content",
"title": "Content",
"description": "Public read routes: the roll, the standard, posts, galleries and people.",
"endpoints": [
endpoint("GET", "/", "Home", "Latest posts and the featured flyer.", sample={"posts": [], "flyer_count": 4, "meme_count": 22}),
endpoint(
"GET",
"/roll",
"The roll",
"Published notes in the roll topic, newest first, cursor paginated.",
fields=[field("before", description="Cursor from next_cursor", location="query")],
sample={"title": "Roll", "topic": "roll", "posts": [], "next_cursor": None},
),
endpoint("GET", "/standard", "The standard", "Published posts in the standard topic.", sample={"title": "Standard", "topic": "standard", "posts": []}),
endpoint(
"GET",
"/posts/{slug}",
"Post",
"A published post by slug or uid. Old slugs redirect with 301 to the canonical slug.",
fields=[field("slug", required=True, location="path", example="a-pass-is-not-an-ambition")],
sample={"post": {"title": "A pass is not an ambition.", "topic": "roll"}, "author": {"username": "retoor"}},
probe_path="/posts/does-not-exist",
),
endpoint("GET", "/flyers", "Flyers", "Flyer gallery.", sample={"kind": "flyer", "title": "Flyers", "items": []}),
endpoint("GET", "/memes", "Memes", "Meme gallery.", sample={"kind": "meme", "title": "Memes", "items": []}),
endpoint("GET", "/people", "People", "People on the roll.", sample={"people": [{"username": "retoor", "post_count": 5}]}),
endpoint(
"GET",
"/people/{username}",
"Person",
"Profile with posts.",
fields=[field("username", required=True, location="path", example="retoor")],
sample={"person": {"username": "retoor"}, "posts": []},
probe_path="/people/retoor",
),
endpoint("GET", "/robots.txt", "robots.txt", negotiation="none", interactive=False),
endpoint("GET", "/sitemap.xml", "Sitemap", negotiation="none", interactive=False),
endpoint("GET", "/avatar/svg/{seed}", "Avatar", "Deterministic SVG avatar.", negotiation="none", interactive=False, probe_path="/avatar/svg/retoor"),
endpoint("GET", "/health", "Health", "Liveness and version.", negotiation="json", sample={"status": "ok", "version": "1.0.0"}),
endpoint("GET", "/presence/roster", "Presence", "Online set (uids).", negotiation="json", sample={"online": [], "tracked": 0}),
],
}