mirror of
https://gitea.com/gitea/tea.git
synced 2026-06-06 03:08:44 +02:00
Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006)
Reviewed-on: https://gitea.com/gitea/tea/pulls/1006 Reviewed-by: Zettat123 <39446+zettat123@noreply.gitea.com>
This commit is contained in:
+3
-3
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -31,7 +31,7 @@ var CmdTrackedTimesAdd = cli.Command{
|
||||
Flags: flags.LoginRepoFlags,
|
||||
}
|
||||
|
||||
func runTrackedTimesAdd(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runTrackedTimesAdd(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -54,7 +54,7 @@ func runTrackedTimesAdd(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
_, _, err = ctx.Login.Client().AddTime(ctx.Owner, ctx.Repo, issue, gitea.AddTimeOption{
|
||||
_, _, err = ctx.Login.Client().Issues.AddTime(requestCtx, ctx.Owner, ctx.Repo, issue, gitea.AddTimeOption{
|
||||
Time: int64(duration.Seconds()),
|
||||
})
|
||||
return err
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ var CmdTrackedTimesDelete = cli.Command{
|
||||
Flags: flags.LoginRepoFlags,
|
||||
}
|
||||
|
||||
func runTrackedTimesDelete(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runTrackedTimesDelete(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -49,6 +49,6 @@ func runTrackedTimesDelete(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = client.DeleteTime(ctx.Owner, ctx.Repo, issue, timeID)
|
||||
_, err = client.Issues.DeleteTime(requestCtx, ctx.Owner, ctx.Repo, issue, timeID)
|
||||
return err
|
||||
}
|
||||
|
||||
+6
-6
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -71,7 +71,7 @@ Depending on your permissions on the repository, only your own tracked times mig
|
||||
}
|
||||
|
||||
// RunTimesList list repositories
|
||||
func RunTimesList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func RunTimesList(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -106,11 +106,11 @@ func RunTimesList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
|
||||
user := ctx.Args().First()
|
||||
if ctx.Bool("mine") {
|
||||
times, _, err = client.ListMyTrackedTimes(opts)
|
||||
times, _, err = client.Issues.ListMyTrackedTimes(requestCtx, opts)
|
||||
fields = []string{"created", "repo", "issue", "duration"}
|
||||
} else if user == "" {
|
||||
// get all tracked times on the repo
|
||||
times, _, err = client.ListRepoTrackedTimes(ctx.Owner, ctx.Repo, opts)
|
||||
times, _, err = client.Issues.ListRepoTrackedTimes(requestCtx, ctx.Owner, ctx.Repo, opts)
|
||||
fields = []string{"created", "issue", "user", "duration"}
|
||||
} else if strings.HasPrefix(user, "#") {
|
||||
// get all tracked times on the specified issue
|
||||
@@ -118,12 +118,12 @@ func RunTimesList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
if parseErr != nil {
|
||||
return parseErr
|
||||
}
|
||||
times, _, err = client.ListIssueTrackedTimes(ctx.Owner, ctx.Repo, issue, opts)
|
||||
times, _, err = client.Issues.ListIssueTrackedTimes(requestCtx, ctx.Owner, ctx.Repo, issue, opts)
|
||||
fields = []string{"created", "user", "duration"}
|
||||
} else {
|
||||
// get all tracked times by the specified user
|
||||
opts.User = user
|
||||
times, _, err = client.ListRepoTrackedTimes(ctx.Owner, ctx.Repo, opts)
|
||||
times, _, err = client.Issues.ListRepoTrackedTimes(requestCtx, ctx.Owner, ctx.Repo, opts)
|
||||
fields = []string{"created", "issue", "duration"}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ var CmdTrackedTimesReset = cli.Command{
|
||||
Flags: flags.LoginRepoFlags,
|
||||
}
|
||||
|
||||
func runTrackedTimesReset(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runTrackedTimesReset(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -43,6 +43,6 @@ func runTrackedTimesReset(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = client.ResetIssueTime(ctx.Owner, ctx.Repo, issue)
|
||||
_, err = client.Issues.ResetIssueTime(requestCtx, ctx.Owner, ctx.Repo, issue)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user