Files
org-social-relay/app/public/views.py
2025-12-05 09:13:52 +01:00

93 lines
3.3 KiB
Python

from django.http import JsonResponse
def root_view(request):
"""Root endpoint with HATEOAS links"""
return JsonResponse(
{
"type": "Success",
"errors": [],
"data": {
"name": "Org Social Relay",
"description": "P2P system for Org Social files",
},
"_links": {
"self": {"href": "/", "method": "GET"},
"feeds": {"href": "/feeds/", "method": "GET"},
"add-feed": {"href": "/feeds/", "method": "POST"},
"feed-content": {
"href": "/feed-content/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"mentions": {
"href": "/mentions/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"replies": {
"href": "/replies/?post={post_url}",
"method": "GET",
"templated": True,
},
"notifications": {
"href": "/notifications/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"sse-notifications": {
"href": "/sse/notifications/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"reactions": {
"href": "/reactions/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"replies-to": {
"href": "/replies-to/?feed={feed_url}",
"method": "GET",
"templated": True,
},
"boosts": {
"href": "/boosts/?post={post_url}",
"method": "GET",
"templated": True,
},
"interactions": {
"href": "/interactions/?post={post_url}",
"method": "GET",
"templated": True,
},
"search": {
"href": "/search/?q={query}",
"method": "GET",
"templated": True,
},
"groups": {"href": "/groups/", "method": "GET"},
"group-messages": {
"href": "/groups/{group_name}/",
"method": "GET",
"templated": True,
},
"join-group": {
"href": "/groups/{group_name}/members/?feed={feed_url}",
"method": "POST",
"templated": True,
},
"polls": {"href": "/polls/", "method": "GET"},
"poll-votes": {
"href": "/polls/votes/?post={post_url}",
"method": "GET",
"templated": True,
},
"rss": {
"href": "/rss.xml",
"method": "GET",
"description": "RSS feed of latest posts (supports ?tag={tag} and ?feed={feed_url} filters)",
},
},
}
)