api.rb 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. # frozen_string_literal: true
  2. namespace :api, format: false do
  3. # OEmbed
  4. get '/oembed', to: 'oembed#show', as: :oembed
  5. # JSON / REST API
  6. namespace :v1 do
  7. resources :statuses, only: [:create, :show, :update, :destroy] do
  8. scope module: :statuses do
  9. resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
  10. resources :favourited_by, controller: :favourited_by_accounts, only: :index
  11. resource :reblog, only: :create
  12. post :unreblog, to: 'reblogs#destroy'
  13. resource :favourite, only: :create
  14. post :unfavourite, to: 'favourites#destroy'
  15. resource :bookmark, only: :create
  16. post :unbookmark, to: 'bookmarks#destroy'
  17. resource :mute, only: :create
  18. post :unmute, to: 'mutes#destroy'
  19. resource :pin, only: :create
  20. post :unpin, to: 'pins#destroy'
  21. resource :history, only: :show
  22. resource :source, only: :show
  23. post :translate, to: 'translations#create'
  24. end
  25. member do
  26. get :context
  27. end
  28. end
  29. namespace :timelines do
  30. resource :home, only: :show, controller: :home
  31. resource :public, only: :show, controller: :public
  32. resources :tag, only: :show
  33. resources :list, only: :show
  34. end
  35. get '/streaming', to: 'streaming#index'
  36. get '/streaming/(*any)', to: 'streaming#index'
  37. resources :custom_emojis, only: [:index]
  38. resources :suggestions, only: [:index, :destroy]
  39. resources :scheduled_statuses, only: [:index, :show, :update, :destroy]
  40. resources :preferences, only: [:index]
  41. resources :announcements, only: [:index] do
  42. scope module: :announcements do
  43. resources :reactions, only: [:update, :destroy]
  44. end
  45. member do
  46. post :dismiss
  47. end
  48. end
  49. # namespace :crypto do
  50. # resources :deliveries, only: :create
  51. # namespace :keys do
  52. # resource :upload, only: [:create]
  53. # resource :query, only: [:create]
  54. # resource :claim, only: [:create]
  55. # resource :count, only: [:show]
  56. # end
  57. # resources :encrypted_messages, only: [:index] do
  58. # collection do
  59. # post :clear
  60. # end
  61. # end
  62. # end
  63. resources :conversations, only: [:index, :destroy] do
  64. member do
  65. post :read
  66. post :unread
  67. end
  68. end
  69. resources :media, only: [:create, :update, :show]
  70. resources :blocks, only: [:index]
  71. resources :mutes, only: [:index]
  72. resources :favourites, only: [:index]
  73. resources :bookmarks, only: [:index]
  74. resources :reports, only: [:create]
  75. resources :trends, only: [:index], controller: 'trends/tags'
  76. resources :filters, only: [:index, :create, :show, :update, :destroy]
  77. resources :endorsements, only: [:index]
  78. resources :markers, only: [:index, :create]
  79. namespace :apps do
  80. get :verify_credentials, to: 'credentials#show'
  81. end
  82. resources :apps, only: [:create]
  83. namespace :trends do
  84. resources :tags, only: [:index]
  85. resources :links, only: [:index]
  86. resources :statuses, only: [:index]
  87. end
  88. namespace :emails do
  89. resources :confirmations, only: [:create]
  90. get :check_confirmation, to: 'confirmations#check'
  91. end
  92. resource :instance, only: [:show] do
  93. resources :peers, only: [:index], controller: 'instances/peers'
  94. resources :rules, only: [:index], controller: 'instances/rules'
  95. resources :domain_blocks, only: [:index], controller: 'instances/domain_blocks'
  96. resource :privacy_policy, only: [:show], controller: 'instances/privacy_policies'
  97. resource :extended_description, only: [:show], controller: 'instances/extended_descriptions'
  98. resource :translation_languages, only: [:show], controller: 'instances/translation_languages'
  99. resource :activity, only: [:show], controller: 'instances/activity'
  100. end
  101. namespace :peers do
  102. get :search, to: 'search#index'
  103. end
  104. resource :domain_blocks, only: [:show, :create, :destroy]
  105. resource :directory, only: [:show]
  106. resources :follow_requests, only: [:index] do
  107. member do
  108. post :authorize
  109. post :reject
  110. end
  111. end
  112. resources :notifications, only: [:index, :show] do
  113. collection do
  114. post :clear
  115. end
  116. member do
  117. post :dismiss
  118. end
  119. end
  120. namespace :accounts do
  121. get :verify_credentials, to: 'credentials#show'
  122. patch :update_credentials, to: 'credentials#update'
  123. resource :search, only: :show, controller: :search
  124. resource :lookup, only: :show, controller: :lookup
  125. resources :relationships, only: :index
  126. resources :familiar_followers, only: :index
  127. end
  128. resources :accounts, only: [:create, :show] do
  129. resources :statuses, only: :index, controller: 'accounts/statuses'
  130. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  131. resources :following, only: :index, controller: 'accounts/following_accounts'
  132. resources :lists, only: :index, controller: 'accounts/lists'
  133. resources :identity_proofs, only: :index, controller: 'accounts/identity_proofs'
  134. resources :featured_tags, only: :index, controller: 'accounts/featured_tags'
  135. member do
  136. post :follow
  137. post :unfollow
  138. post :remove_from_followers
  139. post :block
  140. post :unblock
  141. post :mute
  142. post :unmute
  143. end
  144. resource :pin, only: :create, controller: 'accounts/pins'
  145. post :unpin, to: 'accounts/pins#destroy'
  146. resource :note, only: :create, controller: 'accounts/notes'
  147. end
  148. resources :tags, only: [:show] do
  149. member do
  150. post :follow
  151. post :unfollow
  152. end
  153. end
  154. resources :followed_tags, only: [:index]
  155. resources :lists, only: [:index, :create, :show, :update, :destroy] do
  156. resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
  157. end
  158. namespace :featured_tags do
  159. get :suggestions, to: 'suggestions#index'
  160. end
  161. resources :featured_tags, only: [:index, :create, :destroy]
  162. resources :polls, only: [:create, :show] do
  163. resources :votes, only: :create, controller: 'polls/votes'
  164. end
  165. namespace :push do
  166. resource :subscription, only: [:create, :show, :update, :destroy]
  167. end
  168. namespace :admin do
  169. resources :accounts, only: [:index, :show, :destroy] do
  170. member do
  171. post :enable
  172. post :unsensitive
  173. post :unsilence
  174. post :unsuspend
  175. post :approve
  176. post :reject
  177. end
  178. resource :action, only: [:create], controller: 'account_actions'
  179. end
  180. resources :reports, only: [:index, :update, :show] do
  181. member do
  182. post :assign_to_self
  183. post :unassign
  184. post :reopen
  185. post :resolve
  186. end
  187. end
  188. resources :domain_allows, only: [:index, :show, :create, :destroy]
  189. resources :domain_blocks, only: [:index, :show, :update, :create, :destroy]
  190. resources :email_domain_blocks, only: [:index, :show, :create, :destroy]
  191. resources :ip_blocks, only: [:index, :show, :update, :create, :destroy]
  192. namespace :trends do
  193. resources :tags, only: [:index] do
  194. member do
  195. post :approve
  196. post :reject
  197. end
  198. end
  199. resources :links, only: [:index] do
  200. member do
  201. post :approve
  202. post :reject
  203. end
  204. end
  205. resources :statuses, only: [:index] do
  206. member do
  207. post :approve
  208. post :reject
  209. end
  210. end
  211. namespace :links do
  212. resources :preview_card_providers, only: [:index], path: :publishers do
  213. member do
  214. post :approve
  215. post :reject
  216. end
  217. end
  218. end
  219. end
  220. post :measures, to: 'measures#create'
  221. post :dimensions, to: 'dimensions#create'
  222. post :retention, to: 'retention#create'
  223. resources :canonical_email_blocks, only: [:index, :create, :show, :destroy] do
  224. collection do
  225. post :test
  226. end
  227. end
  228. end
  229. end
  230. namespace :v2 do
  231. get '/search', to: 'search#index', as: :search
  232. resources :media, only: [:create]
  233. resources :suggestions, only: [:index]
  234. resource :instance, only: [:show]
  235. resources :filters, only: [:index, :create, :show, :update, :destroy] do
  236. resources :keywords, only: [:index, :create], controller: 'filters/keywords'
  237. resources :statuses, only: [:index, :create], controller: 'filters/statuses'
  238. end
  239. namespace :filters do
  240. resources :keywords, only: [:show, :update, :destroy]
  241. resources :statuses, only: [:show, :destroy]
  242. end
  243. namespace :admin do
  244. resources :accounts, only: [:index]
  245. end
  246. end
  247. namespace :web do
  248. resource :settings, only: [:update]
  249. resources :embeds, only: [:show]
  250. resources :push_subscriptions, only: [:create] do
  251. member do
  252. put :update
  253. end
  254. end
  255. end
  256. end