Update SDK to v0.13.0 (#179)

check err

Notifications: Add Pinned Filter

migrate & adapt

update sdk to v0.13.0

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/179
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
6543
2020-09-16 02:01:41 +00:00
committed by Lunny Xiao
parent ed961c795e
commit f47ac8f96e
63 changed files with 2024 additions and 924 deletions

View File

@ -24,13 +24,16 @@ var CmdNotifications = cli.Command{
Aliases: []string{"a"},
Usage: "show all notifications of related gitea instance",
},
/* // not supported jet
&cli.BoolFlag{
Name: "read",
Aliases: []string{"rd"},
Usage: "show read notifications instead unread",
},
*/
&cli.BoolFlag{
Name: "pinned",
Aliases: []string{"pd"},
Usage: "show pinned notifications instead unread",
},
&cli.IntFlag{
Name: "page",
Aliases: []string{"p"},
@ -54,15 +57,25 @@ func runNotifications(ctx *cli.Context) error {
PageSize: ctx.Int("limit"),
}
var status []gitea.NotifyStatus
if ctx.Bool("read") {
status = []gitea.NotifyStatus{gitea.NotifyStatusRead}
}
if ctx.Bool("pinned") {
status = append(status, gitea.NotifyStatusPinned)
}
if ctx.Bool("all") {
login := initCommandLoginOnly()
news, err = login.Client().ListNotifications(gitea.ListNotificationOptions{
news, _, err = login.Client().ListNotifications(gitea.ListNotificationOptions{
ListOptions: listOpts,
Status: status,
})
} else {
login, owner, repo := initCommand()
news, err = login.Client().ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{
news, _, err = login.Client().ListRepoNotifications(owner, repo, gitea.ListNotificationOptions{
ListOptions: listOpts,
Status: status,
})
}
if err != nil {