You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
844 B

8 years ago
8 years ago
8 years ago
8 years ago
  1. module Mastodon
  2. class Rest < Grape::API
  3. version 'v1', using: :path
  4. format :json
  5. helpers do
  6. def current_user
  7. User.first
  8. end
  9. end
  10. resource :timelines do
  11. desc 'Return a public timeline'
  12. get :public do
  13. # todo
  14. end
  15. desc 'Return the home timeline of a logged in user'
  16. get :home do
  17. present current_user.timeline, with: Mastodon::Entities::StreamEntry
  18. end
  19. desc 'Return the notifications timeline of a logged in user'
  20. get :notifications do
  21. # todo
  22. end
  23. end
  24. resource :accounts do
  25. desc 'Return a user profile'
  26. params do
  27. requires :id, type: String, desc: 'Account ID'
  28. end
  29. get ':id' do
  30. present Account.find(params[:id]), with: Mastodon::Entities::Account
  31. end
  32. end
  33. end
  34. end