-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.go
39 lines (31 loc) · 847 Bytes
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package mapi
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/uakihir0/nostr-rest/server/domain"
"github.com/uakihir0/nostr-rest/server/mastodon/injection"
"github.com/uakihir0/nostr-rest/server/mastodon/openapi"
)
func (h *MastodonHandler) GetApiV1AccountsUidStatuses(
c echo.Context,
uid string,
params mopenapi.GetApiV1AccountsUidStatusesParams,
) error {
statusService := minjection.StatusService()
// TODO: for authentication fields
_ = c.(*domain.Context).PubKey
userPk := domain.UserPubKey(uid)
options := params.ToTimeLineOptions()
responses, err := statusService.GetUserStatues(userPk, options)
if err != nil {
return err
}
statuses := make([]mopenapi.Status, len(responses))
for i, status := range responses {
statuses[i] = ToStatus(status)
}
return c.JSON(
http.StatusOK,
statuses,
)
}