mirror of
https://gitea.com/gitea/tea.git
synced 2026-06-05 18:58:43 +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 (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -93,7 +93,7 @@ func runWebhooksCreate(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
hook, _, err = client.CreateOrgHook(c.Org, gitea.CreateHookOption{
|
||||
hook, _, err = client.Hooks.CreateOrgHook(ctx, c.Org, gitea.CreateHookOption{
|
||||
Type: webhookType,
|
||||
Config: config,
|
||||
Events: events,
|
||||
@@ -102,7 +102,7 @@ func runWebhooksCreate(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
AuthorizationHeader: authHeader,
|
||||
})
|
||||
} else {
|
||||
hook, _, err = client.CreateRepoHook(c.Owner, c.Repo, gitea.CreateHookOption{
|
||||
hook, _, err = client.Hooks.CreateRepoHook(ctx, c.Owner, c.Repo, gitea.CreateHookOption{
|
||||
Type: webhookType,
|
||||
Config: config,
|
||||
Events: events,
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
@@ -7,8 +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"
|
||||
"gitea.dev/tea/modules/utils"
|
||||
@@ -53,9 +52,9 @@ func runWebhooksDelete(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
hook, _, err = client.GetOrgHook(c.Org, int64(webhookID))
|
||||
hook, _, err = client.Hooks.GetOrgHook(ctx, c.Org, int64(webhookID))
|
||||
} else {
|
||||
hook, _, err = client.GetRepoHook(c.Owner, c.Repo, int64(webhookID))
|
||||
hook, _, err = client.Hooks.GetRepoHook(ctx, c.Owner, c.Repo, int64(webhookID))
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -74,9 +73,9 @@ func runWebhooksDelete(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
_, err = client.DeleteOrgHook(c.Org, int64(webhookID))
|
||||
_, err = client.Hooks.DeleteOrgHook(ctx, c.Org, int64(webhookID))
|
||||
} else {
|
||||
_, err = client.DeleteRepoHook(c.Owner, c.Repo, int64(webhookID))
|
||||
_, err = client.Hooks.DeleteRepoHook(ctx, c.Owner, c.Repo, int64(webhookID))
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -6,7 +6,7 @@ package webhooks
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
@@ -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"
|
||||
@@ -40,11 +40,11 @@ func RunWebhooksList(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
hooks, _, err = client.ListOrgHooks(c.Org, gitea.ListHooksOptions{
|
||||
hooks, _, err = client.Hooks.ListOrgHooks(ctx, c.Org, gitea.ListHooksOptions{
|
||||
ListOptions: flags.GetListOptions(cmd),
|
||||
})
|
||||
} else {
|
||||
hooks, _, err = client.ListRepoHooks(c.Owner, c.Repo, gitea.ListHooksOptions{
|
||||
hooks, _, err = client.Hooks.ListRepoHooks(ctx, c.Owner, c.Repo, gitea.ListHooksOptions{
|
||||
ListOptions: flags.GetListOptions(cmd),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
gitea "gitea.dev/sdk"
|
||||
|
||||
"gitea.dev/tea/cmd/flags"
|
||||
"gitea.dev/tea/modules/context"
|
||||
@@ -77,9 +77,9 @@ func runWebhooksUpdate(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
hook, _, err = client.GetOrgHook(c.Org, int64(webhookID))
|
||||
hook, _, err = client.Hooks.GetOrgHook(ctx, c.Org, int64(webhookID))
|
||||
} else {
|
||||
hook, _, err = client.GetRepoHook(c.Owner, c.Repo, int64(webhookID))
|
||||
hook, _, err = client.Hooks.GetRepoHook(ctx, c.Owner, c.Repo, int64(webhookID))
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -128,7 +128,7 @@ func runWebhooksUpdate(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
if c.IsGlobal {
|
||||
return fmt.Errorf("global webhooks not yet supported in this version")
|
||||
} else if len(c.Org) > 0 {
|
||||
_, err = client.EditOrgHook(c.Org, int64(webhookID), gitea.EditHookOption{
|
||||
_, err = client.Hooks.EditOrgHook(ctx, c.Org, int64(webhookID), gitea.EditHookOption{
|
||||
Config: config,
|
||||
Events: events,
|
||||
Active: &active,
|
||||
@@ -136,7 +136,7 @@ func runWebhooksUpdate(ctx stdctx.Context, cmd *cli.Command) error {
|
||||
AuthorizationHeader: authHeader,
|
||||
})
|
||||
} else {
|
||||
_, err = client.EditRepoHook(c.Owner, c.Repo, int64(webhookID), gitea.EditHookOption{
|
||||
_, err = client.Hooks.EditRepoHook(ctx, c.Owner, c.Repo, int64(webhookID), gitea.EditHookOption{
|
||||
Config: config,
|
||||
Events: events,
|
||||
Active: &active,
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"gitea.dev/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user