summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-06-08 20:22:49 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-08 20:22:49 +0200
commit6f6e89e2715c9ecbadda6b8dbe5227995348dae8 (patch)
treeda867633cdd72981460baf76615a81ab3390ce9c /internal/api/model
parent[frontend] linkify header mascot+title (#633) (diff)
downloadgotosocial-6f6e89e2715c9ecbadda6b8dbe5227995348dae8.tar.xz
[feature] Add paging via `Link` header for notifications and account statuses (#629)
* test link headers * page get account statuses properly * page get notifications * add util func for packaging timeline responses * return timelined stuff from accountstatusesget * rename timeline response * use new convenience function * go fmt
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/notification.go21
-rw-r--r--internal/api/model/timeline.go8
2 files changed, 26 insertions, 3 deletions
diff --git a/internal/api/model/notification.go b/internal/api/model/notification.go
index 8f929cab4..efcd2431b 100644
--- a/internal/api/model/notification.go
+++ b/internal/api/model/notification.go
@@ -43,3 +43,24 @@ type Notification struct {
// Status that was the object of the notification, e.g. in mentions, reblogs, favourites, or polls.
Status *Status `json:"status,omitempty"`
}
+
+/*
+ The below functions are added onto the apimodel notification so that it satisfies
+ the Timelineable interface in internal/timeline.
+*/
+
+func (n *Notification) GetID() string {
+ return n.ID
+}
+
+func (n *Notification) GetAccountID() string {
+ return ""
+}
+
+func (n *Notification) GetBoostOfID() string {
+ return ""
+}
+
+func (n *Notification) GetBoostOfAccountID() string {
+ return ""
+}
diff --git a/internal/api/model/timeline.go b/internal/api/model/timeline.go
index 66a5263b8..71d839ed2 100644
--- a/internal/api/model/timeline.go
+++ b/internal/api/model/timeline.go
@@ -18,9 +18,11 @@
package model
-// StatusTimelineResponse wraps a slice of statuses, ready to be serialized, along with the Link
+import "github.com/superseriousbusiness/gotosocial/internal/timeline"
+
+// TimelineResponse wraps a slice of timelineables, ready to be serialized, along with the Link
// header for the previous and next queries, to be returned to the client.
-type StatusTimelineResponse struct {
- Statuses []*Status
+type TimelineResponse struct {
+ Items []timeline.Timelineable
LinkHeader string
}