takahe/api/urls.py

139 lines
5.3 KiB
Python
Raw Normal View History

from django.urls import path
2023-02-14 02:40:10 +00:00
from hatchway import methods
from api.views import (
accounts,
announcements,
apps,
bookmarks,
emoji,
filters,
follow_requests,
instance,
lists,
media,
notifications,
polls,
preferences,
2023-07-15 18:37:34 +00:00
push,
search,
statuses,
suggestions,
tags,
timelines,
2023-02-10 23:10:53 +00:00
trends,
)
urlpatterns = [
# Accounts
path("v1/accounts/verify_credentials", accounts.verify_credentials),
path("v1/accounts/update_credentials", accounts.update_credentials),
path("v1/accounts/relationships", accounts.account_relationships),
path("v1/accounts/familiar_followers", accounts.familiar_followers),
path("v1/accounts/search", accounts.accounts_search),
path("v1/accounts/lookup", accounts.lookup),
2024-05-24 13:51:31 +00:00
path("v1/accounts/<int:id>", accounts.account),
path("v1/accounts/<int:id>/statuses", accounts.account_statuses),
path("v1/accounts/<int:id>/follow", accounts.account_follow),
path("v1/accounts/<int:id>/unfollow", accounts.account_unfollow),
path("v1/accounts/<int:id>/block", accounts.account_block),
path("v1/accounts/<int:id>/unblock", accounts.account_unblock),
path("v1/accounts/<int:id>/mute", accounts.account_mute),
path("v1/accounts/<int:id>/unmute", accounts.account_unmute),
path("v1/accounts/<int:id>/following", accounts.account_following),
path("v1/accounts/<int:id>/followers", accounts.account_followers),
path("v1/accounts/<int:id>/featured_tags", accounts.account_featured_tags),
# Announcements
path("v1/announcements", announcements.announcement_list),
2024-05-24 13:51:31 +00:00
path("v1/announcements/<int:pk>/dismiss", announcements.announcement_dismiss),
# Apps
path("v1/apps", apps.add_app),
2023-07-15 18:37:34 +00:00
path("v1/apps/verify_credentials", apps.verify_credentials),
# Bookmarks
path("v1/bookmarks", bookmarks.bookmarks),
2023-02-10 23:10:53 +00:00
# Emoji
path("v1/custom_emojis", emoji.emojis),
# Filters
path("v2/filters", filters.list_filters),
path("v1/filters", filters.list_filters),
# Follow requests
path("v1/follow_requests", follow_requests.follow_requests),
2024-05-24 13:51:31 +00:00
path(
"v1/follow_requests/<int:id>/authorize", follow_requests.accept_follow_request
),
path("v1/follow_requests/<int:id>/reject", follow_requests.reject_follow_request),
# Instance
path("v1/instance", instance.instance_info_v1),
2023-07-15 18:37:34 +00:00
path("v1/instance/activity", instance.activity),
path("v1/instance/peers", instance.peers),
path("v2/instance", instance.instance_info_v2),
# Lists
path("v1/lists", lists.get_lists),
2023-02-10 23:10:53 +00:00
# Media
path("v1/media", media.upload_media),
path("v2/media", media.upload_media),
2024-05-24 13:51:31 +00:00
path("v1/media/<int:id>", methods(get=media.get_media, put=media.update_media)),
path(
2024-05-24 13:51:31 +00:00
"v1/statuses/<int:id>",
methods(
get=statuses.status,
2023-02-14 02:40:10 +00:00
put=statuses.edit_status,
delete=statuses.delete_status,
),
),
2024-05-24 13:51:31 +00:00
path("v1/statuses/<int:id>/source", statuses.status_source),
2023-02-10 23:10:53 +00:00
# Notifications
path("v1/notifications", notifications.notifications),
path("v1/notifications/clear", notifications.dismiss_notifications),
2024-05-24 13:51:31 +00:00
path("v1/notifications/<int:id>", notifications.get_notification),
path("v1/notifications/<int:id>/dismiss", notifications.dismiss_notification),
# Polls
2024-05-24 13:51:31 +00:00
path("v1/polls/<int:id>", polls.get_poll),
path("v1/polls/<int:id>/votes", polls.vote_poll),
# Preferences
path("v1/preferences", preferences.preferences),
2023-07-15 18:37:34 +00:00
# Push
path(
"v1/push/subscription",
methods(
get=push.get_subscription,
post=push.create_subscription,
put=push.update_subscription,
delete=push.delete_subscription,
),
),
2023-02-10 23:10:53 +00:00
# Search
2023-05-06 16:30:21 +00:00
path("v1/search", search.search),
2023-02-10 23:10:53 +00:00
path("v2/search", search.search),
# Statuses
path("v1/statuses", statuses.post_status),
2024-05-24 13:51:31 +00:00
path("v1/statuses/<int:id>/context", statuses.status_context),
path("v1/statuses/<int:id>/favourite", statuses.favourite_status),
path("v1/statuses/<int:id>/unfavourite", statuses.unfavourite_status),
path("v1/statuses/<int:id>/favourited_by", statuses.favourited_by),
path("v1/statuses/<int:id>/reblog", statuses.reblog_status),
path("v1/statuses/<int:id>/unreblog", statuses.unreblog_status),
path("v1/statuses/<int:id>/reblogged_by", statuses.reblogged_by),
path("v1/statuses/<int:id>/bookmark", statuses.bookmark_status),
path("v1/statuses/<int:id>/unbookmark", statuses.unbookmark_status),
path("v1/statuses/<int:id>/pin", statuses.pin_status),
path("v1/statuses/<int:id>/unpin", statuses.unpin_status),
# Tags
path("v1/followed_tags", tags.followed_tags),
2024-05-24 13:51:31 +00:00
path("v1/tags/<str:hashtag>", tags.hashtag),
path("v1/tags/<str:id>/follow", tags.follow),
path("v1/tags/<str:id>/unfollow", tags.unfollow),
2023-02-10 23:10:53 +00:00
# Timelines
path("v1/timelines/home", timelines.home),
path("v1/timelines/public", timelines.public),
2024-05-24 13:51:31 +00:00
path("v1/timelines/tag/<str:hashtag>", timelines.hashtag),
2023-02-10 23:10:53 +00:00
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),
# Suggestions
path("v2/suggestions", suggestions.suggested_users),
]