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:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
stdctx "context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
"github.com/araddon/dateparse"
|
||||
"github.com/urfave/cli/v3"
|
||||
|
||||
@@ -50,7 +50,7 @@ var CmdMilestonesCreate = cli.Command{
|
||||
}, flags.AllDefaultFlags...),
|
||||
}
|
||||
|
||||
func runMilestonesCreate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runMilestonesCreate(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -72,14 +72,13 @@ func runMilestonesCreate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
|
||||
if ctx.IsInteractiveMode() {
|
||||
if err := interact.CreateMilestone(ctx.Login, ctx.Owner, ctx.Repo); err != nil && !interact.IsQuitting(err) {
|
||||
if err := interact.CreateMilestone(requestCtx, ctx.Login, ctx.Owner, ctx.Repo); err != nil && !interact.IsQuitting(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return task.CreateMilestone(
|
||||
ctx.Login,
|
||||
return task.CreateMilestone(requestCtx, ctx.Login,
|
||||
ctx.Owner,
|
||||
ctx.Repo,
|
||||
ctx.String("title"),
|
||||
|
||||
@@ -23,7 +23,7 @@ var CmdMilestonesDelete = cli.Command{
|
||||
Flags: flags.AllDefaultFlags,
|
||||
}
|
||||
|
||||
func deleteMilestone(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func deleteMilestone(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -33,6 +33,6 @@ func deleteMilestone(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
client := ctx.Login.Client()
|
||||
|
||||
_, err = client.DeleteMilestoneByName(ctx.Owner, ctx.Repo, ctx.Args().First())
|
||||
_, err = client.Repositories.DeleteMilestoneByName(requestCtx, ctx.Owner, ctx.Repo, ctx.Args().First())
|
||||
return err
|
||||
}
|
||||
|
||||
+10
-10
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
stdctx "context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
"github.com/urfave/cli/v3"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
@@ -71,7 +71,7 @@ var CmdMilestoneRemoveIssue = cli.Command{
|
||||
Flags: flags.AllDefaultFlags,
|
||||
}
|
||||
|
||||
func runMilestoneIssueList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runMilestoneIssueList(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -97,12 +97,12 @@ func runMilestoneIssueList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
|
||||
milestone := ctx.Args().First()
|
||||
// make sure milestone exist
|
||||
_, _, err = client.GetMilestoneByName(ctx.Owner, ctx.Repo, milestone)
|
||||
_, _, err = client.Repositories.GetMilestoneByName(requestCtx, ctx.Owner, ctx.Repo, milestone)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
issues, _, err := client.ListRepoIssues(ctx.Owner, ctx.Repo, gitea.ListIssueOption{
|
||||
issues, _, err := client.Issues.ListRepoIssues(requestCtx, ctx.Owner, ctx.Repo, gitea.ListIssueOption{
|
||||
ListOptions: flags.GetListOptions(cmd),
|
||||
Milestones: []string{milestone},
|
||||
Type: kind,
|
||||
@@ -119,7 +119,7 @@ func runMilestoneIssueList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return print.IssuesPullsList(issues, ctx.Output, fields)
|
||||
}
|
||||
|
||||
func runMilestoneIssueAdd(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runMilestoneIssueAdd(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -140,12 +140,12 @@ func runMilestoneIssueAdd(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
|
||||
// make sure milestone exist
|
||||
mile, _, err := client.GetMilestoneByName(ctx.Owner, ctx.Repo, mileName)
|
||||
mile, _, err := client.Repositories.GetMilestoneByName(requestCtx, ctx.Owner, ctx.Repo, mileName)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get milestone '%s': %w", mileName, err)
|
||||
}
|
||||
|
||||
_, _, err = client.EditIssue(ctx.Owner, ctx.Repo, idx, gitea.EditIssueOption{
|
||||
_, _, err = client.Issues.EditIssue(requestCtx, ctx.Owner, ctx.Repo, idx, gitea.EditIssueOption{
|
||||
Milestone: &mile.ID,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -154,7 +154,7 @@ func runMilestoneIssueAdd(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func runMilestoneIssueRemove(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runMilestoneIssueRemove(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -174,7 +174,7 @@ func runMilestoneIssueRemove(_ stdctx.Context, cmd *cli.Command) error {
|
||||
return fmt.Errorf("invalid issue index '%s': %w", issueIndex, err)
|
||||
}
|
||||
|
||||
issue, _, err := client.GetIssue(ctx.Owner, ctx.Repo, idx)
|
||||
issue, _, err := client.Issues.GetIssue(requestCtx, ctx.Owner, ctx.Repo, idx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get issue #%d: %w", idx, err)
|
||||
}
|
||||
@@ -188,7 +188,7 @@ func runMilestoneIssueRemove(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
|
||||
zero := int64(0)
|
||||
_, _, err = client.EditIssue(ctx.Owner, ctx.Repo, idx, gitea.EditIssueOption{
|
||||
_, _, err = client.Issues.EditIssue(requestCtx, ctx.Owner, ctx.Repo, idx, gitea.EditIssueOption{
|
||||
Milestone: &zero,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ package milestones
|
||||
import (
|
||||
stdctx "context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -39,7 +39,7 @@ var CmdMilestonesList = cli.Command{
|
||||
}
|
||||
|
||||
// RunMilestonesList list milestones
|
||||
func RunMilestonesList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func RunMilestonesList(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -62,7 +62,7 @@ func RunMilestonesList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
|
||||
client := ctx.Login.Client()
|
||||
milestones, _, err := client.ListRepoMilestones(ctx.Owner, ctx.Repo, gitea.ListMilestoneOption{
|
||||
milestones, _, err := client.Repositories.ListMilestones(requestCtx, ctx.Owner, ctx.Repo, gitea.ListMilestoneOption{
|
||||
ListOptions: flags.GetListOptions(cmd),
|
||||
State: state,
|
||||
})
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
stdctx "context"
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -28,7 +28,7 @@ var CmdMilestonesReopen = cli.Command{
|
||||
Flags: flags.AllDefaultFlags,
|
||||
}
|
||||
|
||||
func editMilestoneStatus(_ stdctx.Context, cmd *cli.Command, close bool) error {
|
||||
func editMilestoneStatus(requestCtx stdctx.Context, cmd *cli.Command, close bool) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -58,7 +58,7 @@ func editMilestoneStatus(_ stdctx.Context, cmd *cli.Command, close bool) error {
|
||||
State: &state,
|
||||
Title: ms,
|
||||
}
|
||||
milestone, _, err := client.EditMilestoneByName(ctx.Owner, ctx.Repo, ms, opts)
|
||||
milestone, _, err := client.Repositories.EditMilestoneByName(requestCtx, ctx.Owner, ctx.Repo, ms, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user