api.rb 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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 :profile do
  80. resource :avatar, only: :destroy
  81. resource :header, only: :destroy
  82. end
  83. namespace :apps do
  84. get :verify_credentials, to: 'credentials#show'
  85. end
  86. resources :apps, only: [:create]
  87. namespace :trends do
  88. resources :tags, only: [:index]
  89. resources :links, only: [:index]
  90. resources :statuses, only: [:index]
  91. end
  92. namespace :emails do
  93. resources :confirmations, only: [:create]
  94. get :check_confirmation, to: 'confirmations#check'
  95. end
  96. resource :instance, only: [:show] do
  97. resources :peers, only: [:index], controller: 'instances/peers'
  98. resources :rules, only: [:index], controller: 'instances/rules'
  99. resources :domain_blocks, only: [:index], controller: 'instances/domain_blocks'
  100. resource :privacy_policy, only: [:show], controller: 'instances/privacy_policies'
  101. resource :extended_description, only: [:show], controller: 'instances/extended_descriptions'
  102. resource :translation_languages, only: [:show], controller: 'instances/translation_languages'
  103. resource :languages, only: [:show], controller: 'instances/languages'
  104. resource :activity, only: [:show], controller: 'instances/activity'
  105. end
  106. namespace :peers do
  107. get :search, to: 'search#index'
  108. end
  109. resource :domain_blocks, only: [:show, :create, :destroy]
  110. resource :directory, only: [:show]
  111. resources :follow_requests, only: [:index] do
  112. member do
  113. post :authorize
  114. post :reject
  115. end
  116. end
  117. resources :notifications, only: [:index, :show] do
  118. collection do
  119. post :clear
  120. end
  121. member do
  122. post :dismiss
  123. end
  124. end
  125. namespace :accounts do
  126. get :verify_credentials, to: 'credentials#show'
  127. patch :update_credentials, to: 'credentials#update'
  128. resource :search, only: :show, controller: :search
  129. resource :lookup, only: :show, controller: :lookup
  130. resources :relationships, only: :index
  131. resources :familiar_followers, only: :index
  132. end
  133. resources :accounts, only: [:create, :show] do
  134. resources :statuses, only: :index, controller: 'accounts/statuses'
  135. resources :followers, only: :index, controller: 'accounts/follower_accounts'
  136. resources :following, only: :index, controller: 'accounts/following_accounts'
  137. resources :lists, only: :index, controller: 'accounts/lists'
  138. resources :identity_proofs, only: :index, controller: 'accounts/identity_proofs'
  139. resources :featured_tags, only: :index, controller: 'accounts/featured_tags'
  140. member do
  141. post :follow
  142. post :unfollow
  143. post :remove_from_followers
  144. post :block
  145. post :unblock
  146. post :mute
  147. post :unmute
  148. end
  149. resource :pin, only: :create, controller: 'accounts/pins'
  150. post :unpin, to: 'accounts/pins#destroy'
  151. resource :note, only: :create, controller: 'accounts/notes'
  152. end
  153. resources :tags, only: [:show] do
  154. member do
  155. post :follow
  156. post :unfollow
  157. end
  158. end
  159. resources :followed_tags, only: [:index]
  160. resources :lists, only: [:index, :create, :show, :update, :destroy] do
  161. resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
  162. end
  163. namespace :featured_tags do
  164. get :suggestions, to: 'suggestions#index'
  165. end
  166. resources :featured_tags, only: [:index, :create, :destroy]
  167. resources :polls, only: [:create, :show] do
  168. resources :votes, only: :create, controller: 'polls/votes'
  169. end
  170. namespace :push do
  171. resource :subscription, only: [:create, :show, :update, :destroy]
  172. end
  173. namespace :admin do
  174. resources :accounts, only: [:index, :show, :destroy] do
  175. member do
  176. post :enable
  177. post :unsensitive
  178. post :unsilence
  179. post :unsuspend
  180. post :approve
  181. post :reject
  182. end
  183. resource :action, only: [:create], controller: 'account_actions'
  184. end
  185. resources :reports, only: [:index, :update, :show] do
  186. member do
  187. post :assign_to_self
  188. post :unassign
  189. post :reopen
  190. post :resolve
  191. end
  192. end
  193. resources :domain_allows, only: [:index, :show, :create, :destroy]
  194. resources :domain_blocks, only: [:index, :show, :update, :create, :destroy]
  195. resources :email_domain_blocks, only: [:index, :show, :create, :destroy]
  196. resources :ip_blocks, only: [:index, :show, :update, :create, :destroy]
  197. namespace :trends do
  198. resources :tags, only: [:index] do
  199. member do
  200. post :approve
  201. post :reject
  202. end
  203. end
  204. resources :links, only: [:index] do
  205. member do
  206. post :approve
  207. post :reject
  208. end
  209. end
  210. resources :statuses, only: [:index] do
  211. member do
  212. post :approve
  213. post :reject
  214. end
  215. end
  216. namespace :links do
  217. resources :preview_card_providers, only: [:index], path: :publishers do
  218. member do
  219. post :approve
  220. post :reject
  221. end
  222. end
  223. end
  224. end
  225. post :measures, to: 'measures#create'
  226. post :dimensions, to: 'dimensions#create'
  227. post :retention, to: 'retention#create'
  228. resources :canonical_email_blocks, only: [:index, :create, :show, :destroy] do
  229. collection do
  230. post :test
  231. end
  232. end
  233. resources :tags, only: [:index, :show, :update]
  234. end
  235. end
  236. namespace :v2 do
  237. get '/search', to: 'search#index', as: :search
  238. resources :media, only: [:create]
  239. resources :suggestions, only: [:index]
  240. resource :instance, only: [:show]
  241. resources :filters, only: [:index, :create, :show, :update, :destroy] do
  242. resources :keywords, only: [:index, :create], controller: 'filters/keywords'
  243. resources :statuses, only: [:index, :create], controller: 'filters/statuses'
  244. end
  245. namespace :filters do
  246. resources :keywords, only: [:show, :update, :destroy]
  247. resources :statuses, only: [:show, :destroy]
  248. end
  249. namespace :admin do
  250. resources :accounts, only: [:index]
  251. end
  252. end
  253. namespace :web do
  254. resource :settings, only: [:update]
  255. resources :embeds, only: [:show]
  256. resources :push_subscriptions, only: [:create] do
  257. member do
  258. put :update
  259. end
  260. end
  261. end
  262. end