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:
@@ -10,7 +10,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -45,7 +45,7 @@ var CmdLabelCreate = cli.Command{
|
||||
}, flags.AllDefaultFlags...),
|
||||
}
|
||||
|
||||
func runLabelCreate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runLabelCreate(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -56,7 +56,7 @@ func runLabelCreate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
|
||||
labelFile := ctx.String("file")
|
||||
if len(labelFile) == 0 {
|
||||
_, _, err := ctx.Login.Client().CreateLabel(ctx.Owner, ctx.Repo, gitea.CreateLabelOption{
|
||||
_, _, err := ctx.Login.Client().Repositories.CreateLabel(requestCtx, ctx.Owner, ctx.Repo, gitea.CreateLabelOption{
|
||||
Name: ctx.String("name"),
|
||||
Color: ctx.String("color"),
|
||||
Description: ctx.String("description"),
|
||||
@@ -78,7 +78,7 @@ func runLabelCreate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
if color == "" || name == "" {
|
||||
log.Printf("Line %d ignored because lack of enough fields: %s\n", i, line)
|
||||
} else {
|
||||
_, _, err = ctx.Login.Client().CreateLabel(ctx.Owner, ctx.Repo, gitea.CreateLabelOption{
|
||||
_, _, err = ctx.Login.Client().Repositories.CreateLabel(requestCtx, ctx.Owner, ctx.Repo, gitea.CreateLabelOption{
|
||||
Name: name,
|
||||
Color: color,
|
||||
Description: description,
|
||||
|
||||
@@ -30,7 +30,7 @@ var CmdLabelDelete = cli.Command{
|
||||
}, flags.AllDefaultFlags...),
|
||||
}
|
||||
|
||||
func runLabelDelete(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runLabelDelete(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -43,12 +43,12 @@ func runLabelDelete(_ stdctx.Context, cmd *cli.Command) error {
|
||||
client := ctx.Login.Client()
|
||||
|
||||
// Verify the label exists first
|
||||
label, _, err := client.GetRepoLabel(ctx.Owner, ctx.Repo, labelID)
|
||||
label, _, err := client.Repositories.GetRepoLabel(requestCtx, ctx.Owner, ctx.Repo, labelID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get label %d: %w", labelID, err)
|
||||
}
|
||||
|
||||
_, err = client.DeleteLabel(ctx.Owner, ctx.Repo, labelID)
|
||||
_, err = client.Repositories.DeleteLabel(requestCtx, ctx.Owner, ctx.Repo, labelID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to delete label '%s' (id: %d): %w", label.Name, labelID, err)
|
||||
}
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ package labels
|
||||
import (
|
||||
stdctx "context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -35,7 +35,7 @@ var CmdLabelsList = cli.Command{
|
||||
}
|
||||
|
||||
// RunLabelsList list labels.
|
||||
func RunLabelsList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func RunLabelsList(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -45,7 +45,7 @@ func RunLabelsList(_ stdctx.Context, cmd *cli.Command) error {
|
||||
}
|
||||
|
||||
client := ctx.Login.Client()
|
||||
labels, _, err := client.ListRepoLabels(ctx.Owner, ctx.Repo, gitea.ListLabelsOptions{
|
||||
labels, _, err := client.Repositories.ListRepoLabels(requestCtx, ctx.Owner, ctx.Repo, gitea.ListLabelsOptions{
|
||||
ListOptions: flags.GetListOptions(cmd),
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -6,7 +6,7 @@ package labels
|
||||
import (
|
||||
stdctx "context"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -40,7 +40,7 @@ var CmdLabelUpdate = cli.Command{
|
||||
}, flags.AllDefaultFlags...),
|
||||
}
|
||||
|
||||
func runLabelUpdate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
func runLabelUpdate(requestCtx stdctx.Context, cmd *cli.Command) error {
|
||||
ctx, err := context.InitCommand(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -66,7 +66,7 @@ func runLabelUpdate(_ stdctx.Context, cmd *cli.Command) error {
|
||||
pDescription = &description
|
||||
}
|
||||
|
||||
_, _, err = ctx.Login.Client().EditLabel(ctx.Owner, ctx.Repo, id, gitea.EditLabelOption{
|
||||
_, _, err = ctx.Login.Client().Repositories.EditLabel(requestCtx, ctx.Owner, ctx.Repo, id, gitea.EditLabelOption{
|
||||
Name: pName,
|
||||
Color: pColor,
|
||||
Description: pDescription,
|
||||
|
||||
Reference in New Issue
Block a user