- default:
- // TRANS: Client error displayed when trying to handle an unknown API method.
- $this->clientError(_('API method not found.'), $code = 404);
+ case 'as':
+ header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
+ $doc = new ActivityStreamJSONDocument($this->auth_user);
+ $doc->setTitle($atom->title);
+ $doc->addLink($link, 'alternate', 'text/html');
+ $doc->addItemsFromNotices($this->notices);
+
+ if (!empty($this->next_id)) {
+ $doc->addLink($nextUrl,
+ array('rel' => 'next',
+ 'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
+ }
+
+ if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
+ $doc->addLink($prevUrl,
+ array('rel' => 'prev',
+ 'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
+ }
+
+ if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
+ $doc->addLink($firstUrl,
+ array('rel' => 'first',
+ 'type' => ActivityStreamJSONDocument::CONTENT_TYPE));
+ }
+
+ $this->raw($doc->asString());