about summary refs log tree commit diff
path: root/app/views/api
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/api')
-rw-r--r--app/views/api/accounts/followers.rabl2
-rw-r--r--app/views/api/accounts/following.rabl2
-rw-r--r--app/views/api/accounts/show.rabl9
-rw-r--r--app/views/api/accounts/statuses.rabl2
-rw-r--r--app/views/api/follows/show.rabl5
-rw-r--r--app/views/api/statuses/show.rabl18
6 files changed, 38 insertions, 0 deletions
diff --git a/app/views/api/accounts/followers.rabl b/app/views/api/accounts/followers.rabl
new file mode 100644
index 000000000..9bb0d9c8f
--- /dev/null
+++ b/app/views/api/accounts/followers.rabl
@@ -0,0 +1,2 @@
+collection @followers
+extends('api/accounts/show')
diff --git a/app/views/api/accounts/following.rabl b/app/views/api/accounts/following.rabl
new file mode 100644
index 000000000..9f2155293
--- /dev/null
+++ b/app/views/api/accounts/following.rabl
@@ -0,0 +1,2 @@
+collection @following
+extends('api/accounts/show')
diff --git a/app/views/api/accounts/show.rabl b/app/views/api/accounts/show.rabl
new file mode 100644
index 000000000..e4c4883c8
--- /dev/null
+++ b/app/views/api/accounts/show.rabl
@@ -0,0 +1,9 @@
+object @account
+
+attributes :id, :username, :acct, :display_name, :note
+
+node(:url)       { |account| url_for_target(account) }
+node(:avatar)    { |account| asset_url(account.avatar.url(:large, false)) }
+node(:followers) { |account| account.followers.count }
+node(:following) { |account| account.following.count }
+node(:statuses)  { |account| account.statuses.count  }
diff --git a/app/views/api/accounts/statuses.rabl b/app/views/api/accounts/statuses.rabl
new file mode 100644
index 000000000..12f00dd21
--- /dev/null
+++ b/app/views/api/accounts/statuses.rabl
@@ -0,0 +1,2 @@
+collection @statuses
+extends('api/statuses/show')
diff --git a/app/views/api/follows/show.rabl b/app/views/api/follows/show.rabl
new file mode 100644
index 000000000..38c3424da
--- /dev/null
+++ b/app/views/api/follows/show.rabl
@@ -0,0 +1,5 @@
+object @follow
+
+child :target_account => :target_account do
+  extends('api/accounts/show')
+end
diff --git a/app/views/api/statuses/show.rabl b/app/views/api/statuses/show.rabl
new file mode 100644
index 000000000..344517236
--- /dev/null
+++ b/app/views/api/statuses/show.rabl
@@ -0,0 +1,18 @@
+object @status
+attributes :id, :created_at, :in_reply_to_id
+
+node(:uri)        { |status| uri_for_target(status) }
+node(:content)    { |status| status.local? ? linkify(status) : status.content }
+node(:url)        { |status| url_for_target(status) }
+node(:reblogs)    { |status| status.reblogs.count }
+node(:favourites) { |status| status.favourites.count }
+node(:favourited) { |status| current_user.account.favourited?(status) }
+node(:reblogged)  { |status| current_user.account.reblogged?(status) }
+
+child :reblog => :reblog do
+  extends('api/statuses/show')
+end
+
+child :account do
+  extends('api/accounts/show')
+end