30 lines
1.8 KiB
Python
30 lines
1.8 KiB
Python
# retoor <retoor@molodetz.nl>
|
|
from molodetz.docs_api.registry import endpoint, field
|
|
|
|
GROUP = {
|
|
"slug": "account",
|
|
"title": "Account",
|
|
"description": "Session login, API key, notifications. No JWT, no OAuth.",
|
|
"endpoints": [
|
|
endpoint("GET", "/auth/login", "Login page", sample={"errors": [], "next": "/admin"}),
|
|
endpoint(
|
|
"POST",
|
|
"/auth/login",
|
|
"Log in",
|
|
"Sets an httponly session cookie (7 days, 30 with remember me).",
|
|
fields=[field("username", required=True, example="{{username}}"), field("password", required=True, type="password"), field("remember", type="boolean")],
|
|
sample={"ok": True, "redirect": "/admin", "data": None},
|
|
interactive=False,
|
|
),
|
|
endpoint("POST", "/auth/logout", "Log out", sample={"ok": True, "redirect": "/", "data": None}, interactive=False),
|
|
endpoint("GET", "/profile/api-key", "View API key", auth="member", sample={"api_key": "{{api_key}}"}),
|
|
endpoint("POST", "/profile/api-key/regenerate", "Renew API key", auth="member", destructive=True, sample={"ok": True, "redirect": "/profile/api-key", "data": {"api_key": "..."}}, interactive=False),
|
|
endpoint("POST", "/profile/avatar/regenerate", "Renew avatar", auth="member", destructive=True, sample={"ok": True}, interactive=False),
|
|
endpoint("GET", "/notifications", "Notifications", auth="member", sample={"notifications": [], "unread": 0}),
|
|
endpoint("POST", "/notifications/read", "Mark all read", auth="member", sample={"ok": True, "redirect": "/notifications"}),
|
|
endpoint("GET", "/terms", "Terms", sample={"title": "Terms"}),
|
|
endpoint("POST", "/terms/accept", "Accept terms", auth="member", sample={"ok": True, "redirect": "/"}),
|
|
endpoint("GET", "/privacy", "Privacy", sample={"title": "Privacy"}),
|
|
],
|
|
}
|