diff options
author | Paul Tirk <paultirk@paultirk.com> | 2020-12-25 11:48:38 +0000 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 10:23:11 +0200 |
commit | 6e067dfd430721c6672988d6ac34f3a4d03678c8 (patch) | |
tree | f3c357650940cf90415500feb794a202594a3b7f /lib/Db/Item.php | |
parent | 6e845124df1d9238d28875c8f745868be1f765b7 (diff) |
add serialization methods for v2 API
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
Diffstat (limited to 'lib/Db/Item.php')
-rw-r--r-- | lib/Db/Item.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php index 2d87babf7..6e09fde31 100644 --- a/lib/Db/Item.php +++ b/lib/Db/Item.php @@ -574,6 +574,28 @@ class Item extends Entity implements IAPI, \JsonSerializable ]; } + public function toAPI2(): array + { + return [ + 'id' => $this->getId(), + 'url' => $this->getUrl(), + 'title' => $this->getTitle(), + 'author' => $this->getAuthor(), + 'publishedAt' => date('c', $this->getPubDate()), + 'updatedAt' => date('c', $this->getUpdatedDate()), + 'enclosure' => [ + 'mimeType' => $this->getEnclosureMime(), + 'url' => $this->getEnclosureLink() + ], + 'body' => $this->getBody(), + 'feedId' => $this->getFeedId(), + 'isUnread' => $this->isUnread(), + 'isStarred' => $this->isStarred(), + 'fingerprint' => $this->getFingerprint(), + 'contentHash' => $this->getContentHash() + ]; + } + /** * Format for exporting. * |