diff --git a/api/convert.go b/api/convert.go index b5da35f..fcb993e 100644 --- a/api/convert.go +++ b/api/convert.go @@ -2,6 +2,7 @@ package api import ( "code.gitea.io/gitea/modules/structs" + gitea "code.gitea.io/sdk/gitea" "fmt" "github.com/google/go-github/v59/github" "time" @@ -39,7 +40,7 @@ func timePtrIfNotNil(t *time.Time) *github.Timestamp { return timePtr(*t) } -func convertUser(user *structs.User) *github.User { +func convertUser(user *gitea.User) *github.User { if user == nil { return &github.User{} } @@ -49,7 +50,7 @@ func convertUser(user *structs.User) *github.User { } } -func convertUsers(users []*structs.User) []*github.User { +func convertUsers(users []*gitea.User) []*github.User { var ghUsers []*github.User for _, user := range users { ghUsers = append(ghUsers, convertUser(user)) @@ -57,7 +58,7 @@ func convertUsers(users []*structs.User) []*github.User { return ghUsers } -func convertMilestone(milestone *structs.Milestone) *github.Milestone { +func convertMilestone(milestone *gitea.Milestone) *github.Milestone { if milestone == nil { return &github.Milestone{} } @@ -66,7 +67,7 @@ func convertMilestone(milestone *structs.Milestone) *github.Milestone { } } -func convertLabels(labels []*structs.Label) []*github.Label { +func convertLabels(labels []*gitea.Label) []*github.Label { if labels == nil { return make([]*github.Label, 0) } @@ -82,7 +83,7 @@ func convertLabels(labels []*structs.Label) []*github.Label { return ghLabels } -func convertPRBranch(branch *structs.PRBranchInfo) *github.PullRequestBranch { +func convertPRBranch(branch *gitea.PRBranchInfo) *github.PullRequestBranch { if branch == nil { return &github.PullRequestBranch{} } @@ -94,7 +95,7 @@ func convertPRBranch(branch *structs.PRBranchInfo) *github.PullRequestBranch { } } -func convertRepo(repo *structs.Repository) *github.Repository { +func convertRepo(repo *gitea.Repository) *github.Repository { if repo == nil { return &github.Repository{} } @@ -125,7 +126,7 @@ func convertRepo(repo *structs.Repository) *github.Repository { } } -func convertPullRequest(request *structs.PullRequest) *github.PullRequest { +func convertPullRequest(request *gitea.PullRequest) *github.PullRequest { if request == nil { return &github.PullRequest{} } @@ -183,7 +184,7 @@ func convertChanges(changes *structs.ChangesPayload) *github.EditChange { } } -func convertLabel(label *structs.Label) *github.Label { +func convertLabel(label *gitea.Label) *github.Label { if label == nil { return &github.Label{} } @@ -196,7 +197,7 @@ func convertLabel(label *structs.Label) *github.Label { } } -func convertCommitFile(file *structs.ChangedFile) *github.CommitFile { +func convertCommitFile(file *gitea.ChangedFile) *github.CommitFile { if file == nil { return &github.CommitFile{} } diff --git a/api/routes_rest_api.go b/api/routes_rest_api.go index 305dc15..bf09cd2 100644 --- a/api/routes_rest_api.go +++ b/api/routes_rest_api.go @@ -1,7 +1,6 @@ package api import ( - structs "code.gitea.io/gitea/modules/structs" gitea "code.gitea.io/sdk/gitea" "encoding/json" "fmt" @@ -53,8 +52,7 @@ func (r restApi) handlerGetPullRequestFiles(w http.ResponseWriter, request *http githubFiles := make([]*github.CommitFile, len(files)) for i, file := range files { - f := structs.ChangedFile(*file) - githubFiles[i] = convertCommitFile(&f) + githubFiles[i] = convertCommitFile(file) } r.sendPagingHeaders(w, r2)