From 7863f89aba165f764a2b37568d0bacc89ed6c568 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 10 Feb 2023 16:10:53 -0700 Subject: [PATCH] Stub out some more empty API endpoints --- api/urls.py | 29 ++++++++++++++++++++--------- api/views/trends.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 api/views/trends.py diff --git a/api/urls.py b/api/urls.py index 8c53222..2261648 100644 --- a/api/urls.py +++ b/api/urls.py @@ -12,6 +12,7 @@ from api.views import ( search, statuses, timelines, + trends, ) from hatchway import methods @@ -38,19 +39,15 @@ urlpatterns = [ path("v1/announcements//dismiss", announcements.announcement_dismiss), # Apps path("v1/apps", apps.add_app), + # Emoji + path("v1/custom_emojis", emoji.emojis), # Filters path("v2/filters", filters.list_filters), path("v1/filters", filters.list_filters), # Instance path("v1/instance", instance.instance_info_v1), path("v2/instance", instance.instance_info_v2), - path("v1/timelines/home", timelines.home), - path("v1/timelines/public", timelines.public), - path("v1/timelines/tag/", timelines.hashtag), - path("v1/timelines/conversations", timelines.conversations), - path("v1/favourites", timelines.favourites), - path("v1/notifications", notifications.notifications), - path("v1/statuses", statuses.post_status), + # Media path("v1/media", media.upload_media), path("v2/media", media.upload_media), path("v1/media/", methods(get=media.get_media, put=media.update_media)), @@ -61,12 +58,26 @@ urlpatterns = [ delete=statuses.delete_status, ), ), + # Notifications + path("v1/notifications", notifications.notifications), + # Search + path("v2/search", search.search), + # Statuses + path("v1/statuses", statuses.post_status), path("v1/statuses//context", statuses.status_context), path("v1/statuses//favourite", statuses.favourite_status), path("v1/statuses//unfavourite", statuses.unfavourite_status), path("v1/statuses//favourited_by", statuses.favourited_by), path("v1/statuses//reblog", statuses.reblog_status), path("v1/statuses//unreblog", statuses.unreblog_status), - path("v1/custom_emojis", emoji.emojis), - path("v2/search", search.search), + # Timelines + path("v1/timelines/home", timelines.home), + path("v1/timelines/public", timelines.public), + path("v1/timelines/tag/", timelines.hashtag), + path("v1/conversations", timelines.conversations), + path("v1/favourites", timelines.favourites), + # Trends + path("v1/trends/tags", trends.trends_tags), + path("v1/trends/statuses", trends.trends_statuses), + path("v1/trends/links", trends.trends_links), ] diff --git a/api/views/trends.py b/api/views/trends.py new file mode 100644 index 0000000..35b79fd --- /dev/null +++ b/api/views/trends.py @@ -0,0 +1,38 @@ +from django.http import HttpRequest + +from api import schemas +from api.decorators import identity_required +from hatchway import api_view + + +@identity_required +@api_view.get +def trends_tags( + request: HttpRequest, + limit: int = 10, + offset: int | None = None, +) -> list[schemas.Tag]: + # We don't implement this yet + return [] + + +@identity_required +@api_view.get +def trends_statuses( + request: HttpRequest, + limit: int = 10, + offset: int | None = None, +) -> list[schemas.Status]: + # We don't implement this yet + return [] + + +@identity_required +@api_view.get +def trends_links( + request: HttpRequest, + limit: int = 10, + offset: int | None = None, +) -> list: + # We don't implement this yet + return []