summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/admin/org.go2
-rw-r--r--routers/api/v1/admin/user.go2
-rw-r--r--routers/api/v1/convert/convert.go312
-rw-r--r--routers/api/v1/convert/utils.go19
-rw-r--r--routers/api/v1/org/hook.go2
-rw-r--r--routers/api/v1/org/member.go2
-rw-r--r--routers/api/v1/org/org.go2
-rw-r--r--routers/api/v1/org/team.go2
-rw-r--r--routers/api/v1/repo/branch.go2
-rw-r--r--routers/api/v1/repo/collaborators.go2
-rw-r--r--routers/api/v1/repo/git_hook.go2
-rw-r--r--routers/api/v1/repo/hook.go2
-rw-r--r--routers/api/v1/repo/key.go2
-rw-r--r--routers/api/v1/repo/repo.go2
-rw-r--r--routers/api/v1/repo/star.go2
-rw-r--r--routers/api/v1/repo/subscriber.go2
-rw-r--r--routers/api/v1/repo/tag.go2
-rw-r--r--routers/api/v1/repo/topic.go2
-rw-r--r--routers/api/v1/user/email.go2
-rw-r--r--routers/api/v1/user/follower.go2
-rw-r--r--routers/api/v1/user/gpg_key.go2
-rw-r--r--routers/api/v1/user/key.go2
-rw-r--r--routers/api/v1/user/user.go2
-rw-r--r--routers/api/v1/utils/hook.go2
24 files changed, 22 insertions, 353 deletions
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index cdec9e7fad..8d3b0123c5 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -8,8 +8,8 @@ package admin
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
)
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index f35ad297b0..3a4750c6ba 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -10,10 +10,10 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/password"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
"code.gitea.io/gitea/services/mailer"
)
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go
deleted file mode 100644
index f52ed63476..0000000000
--- a/routers/api/v1/convert/convert.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright 2015 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package convert
-
-import (
- "fmt"
- "time"
-
- "code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/git"
- "code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/markup"
- "code.gitea.io/gitea/modules/structs"
- api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/modules/util"
- "code.gitea.io/gitea/modules/webhook"
-
- "github.com/unknwon/com"
-)
-
-// ToEmail convert models.EmailAddress to api.Email
-func ToEmail(email *models.EmailAddress) *api.Email {
- return &api.Email{
- Email: email.Email,
- Verified: email.IsActivated,
- Primary: email.IsPrimary,
- }
-}
-
-// ToBranch convert a git.Commit and git.Branch to an api.Branch
-func ToBranch(repo *models.Repository, b *git.Branch, c *git.Commit) *api.Branch {
- return &api.Branch{
- Name: b.Name,
- Commit: ToCommit(repo, c),
- }
-}
-
-// ToTag convert a git.Tag to an api.Tag
-func ToTag(repo *models.Repository, t *git.Tag) *api.Tag {
- return &api.Tag{
- Name: t.Name,
- ID: t.ID.String(),
- Commit: ToCommitMeta(repo, t),
- ZipballURL: util.URLJoin(repo.HTMLURL(), "archive", t.Name+".zip"),
- TarballURL: util.URLJoin(repo.HTMLURL(), "archive", t.Name+".tar.gz"),
- }
-}
-
-// ToCommit convert a git.Commit to api.PayloadCommit
-func ToCommit(repo *models.Repository, c *git.Commit) *api.PayloadCommit {
- authorUsername := ""
- if author, err := models.GetUserByEmail(c.Author.Email); err == nil {
- authorUsername = author.Name
- } else if !models.IsErrUserNotExist(err) {
- log.Error("GetUserByEmail: %v", err)
- }
-
- committerUsername := ""
- if committer, err := models.GetUserByEmail(c.Committer.Email); err == nil {
- committerUsername = committer.Name
- } else if !models.IsErrUserNotExist(err) {
- log.Error("GetUserByEmail: %v", err)
- }
-
- return &api.PayloadCommit{
- ID: c.ID.String(),
- Message: c.Message(),
- URL: util.URLJoin(repo.HTMLURL(), "commit", c.ID.String()),
- Author: &api.PayloadUser{
- Name: c.Author.Name,
- Email: c.Author.Email,
- UserName: authorUsername,
- },
- Committer: &api.PayloadUser{
- Name: c.Committer.Name,
- Email: c.Committer.Email,
- UserName: committerUsername,
- },
- Timestamp: c.Author.When,
- Verification: ToVerification(c),
- }
-}
-
-// ToVerification convert a git.Commit.Signature to an api.PayloadCommitVerification
-func ToVerification(c *git.Commit) *api.PayloadCommitVerification {
- verif := models.ParseCommitWithSignature(c)
- commitVerification := &api.PayloadCommitVerification{
- Verified: verif.Verified,
- Reason: verif.Reason,
- }
- if c.Signature != nil {
- commitVerification.Signature = c.Signature.Signature
- commitVerification.Payload = c.Signature.Payload
- }
- if verif.SigningUser != nil {
- commitVerification.Signer = &structs.PayloadUser{
- Name: verif.SigningUser.Name,
- Email: verif.SigningUser.Email,
- }
- }
- return commitVerification
-}
-
-// ToPublicKey convert models.PublicKey to api.PublicKey
-func ToPublicKey(apiLink string, key *models.PublicKey) *api.PublicKey {
- return &api.PublicKey{
- ID: key.ID,
- Key: key.Content,
- URL: apiLink + com.ToStr(key.ID),
- Title: key.Name,
- Fingerprint: key.Fingerprint,
- Created: key.CreatedUnix.AsTime(),
- }
-}
-
-// ToGPGKey converts models.GPGKey to api.GPGKey
-func ToGPGKey(key *models.GPGKey) *api.GPGKey {
- subkeys := make([]*api.GPGKey, len(key.SubsKey))
- for id, k := range key.SubsKey {
- subkeys[id] = &api.GPGKey{
- ID: k.ID,
- PrimaryKeyID: k.PrimaryKeyID,
- KeyID: k.KeyID,
- PublicKey: k.Content,
- Created: k.CreatedUnix.AsTime(),
- Expires: k.ExpiredUnix.AsTime(),
- CanSign: k.CanSign,
- CanEncryptComms: k.CanEncryptComms,
- CanEncryptStorage: k.CanEncryptStorage,
- CanCertify: k.CanSign,
- }
- }
- emails := make([]*api.GPGKeyEmail, len(key.Emails))
- for i, e := range key.Emails {
- emails[i] = ToGPGKeyEmail(e)
- }
- return &api.GPGKey{
- ID: key.ID,
- PrimaryKeyID: key.PrimaryKeyID,
- KeyID: key.KeyID,
- PublicKey: key.Content,
- Created: key.CreatedUnix.AsTime(),
- Expires: key.ExpiredUnix.AsTime(),
- Emails: emails,
- SubsKey: subkeys,
- CanSign: key.CanSign,
- CanEncryptComms: key.CanEncryptComms,
- CanEncryptStorage: key.CanEncryptStorage,
- CanCertify: key.CanSign,
- }
-}
-
-// ToGPGKeyEmail convert models.EmailAddress to api.GPGKeyEmail
-func ToGPGKeyEmail(email *models.EmailAddress) *api.GPGKeyEmail {
- return &api.GPGKeyEmail{
- Email: email.Email,
- Verified: email.IsActivated,
- }
-}
-
-// ToHook convert models.Webhook to api.Hook
-func ToHook(repoLink string, w *models.Webhook) *api.Hook {
- config := map[string]string{
- "url": w.URL,
- "content_type": w.ContentType.Name(),
- }
- if w.HookTaskType == models.SLACK {
- s := webhook.GetSlackHook(w)
- config["channel"] = s.Channel
- config["username"] = s.Username
- config["icon_url"] = s.IconURL
- config["color"] = s.Color
- }
-
- return &api.Hook{
- ID: w.ID,
- Type: w.HookTaskType.Name(),
- URL: fmt.Sprintf("%s/settings/hooks/%d", repoLink, w.ID),
- Active: w.IsActive,
- Config: config,
- Events: w.EventsArray(),
- Updated: w.UpdatedUnix.AsTime(),
- Created: w.CreatedUnix.AsTime(),
- }
-}
-
-// ToGitHook convert git.Hook to api.GitHook
-func ToGitHook(h *git.Hook) *api.GitHook {
- return &api.GitHook{
- Name: h.Name(),
- IsActive: h.IsActive,
- Content: h.Content,
- }
-}
-
-// ToDeployKey convert models.DeployKey to api.DeployKey
-func ToDeployKey(apiLink string, key *models.DeployKey) *api.DeployKey {
- return &api.DeployKey{
- ID: key.ID,
- KeyID: key.KeyID,
- Key: key.Content,
- Fingerprint: key.Fingerprint,
- URL: apiLink + com.ToStr(key.ID),
- Title: key.Name,
- Created: key.CreatedUnix.AsTime(),
- ReadOnly: key.Mode == models.AccessModeRead, // All deploy keys are read-only.
- }
-}
-
-// ToOrganization convert models.User to api.Organization
-func ToOrganization(org *models.User) *api.Organization {
- return &api.Organization{
- ID: org.ID,
- AvatarURL: org.AvatarLink(),
- UserName: org.Name,
- FullName: org.FullName,
- Description: org.Description,
- Website: org.Website,
- Location: org.Location,
- Visibility: org.Visibility.String(),
- RepoAdminChangeTeamAccess: org.RepoAdminChangeTeamAccess,
- }
-}
-
-// ToTeam convert models.Team to api.Team
-func ToTeam(team *models.Team) *api.Team {
- return &api.Team{
- ID: team.ID,
- Name: team.Name,
- Description: team.Description,
- IncludesAllRepositories: team.IncludesAllRepositories,
- Permission: team.Authorize.String(),
- Units: team.GetUnitNames(),
- }
-}
-
-// ToUser convert models.User to api.User
-func ToUser(user *models.User, signed, authed bool) *api.User {
- result := &api.User{
- UserName: user.Name,
- AvatarURL: user.AvatarLink(),
- FullName: markup.Sanitize(user.FullName),
- Created: user.CreatedUnix.AsTime(),
- }
- // hide primary email if API caller isn't user itself or an admin
- if !signed {
- result.Email = ""
- } else if user.KeepEmailPrivate && !authed {
- result.Email = user.GetEmail()
- } else { // only user himself and admin could visit these information
- result.ID = user.ID
- result.Email = user.Email
- result.IsAdmin = user.IsAdmin
- result.LastLogin = user.LastLoginUnix.AsTime()
- }
- return result
-}
-
-// ToAnnotatedTag convert git.Tag to api.AnnotatedTag
-func ToAnnotatedTag(repo *models.Repository, t *git.Tag, c *git.Commit) *api.AnnotatedTag {
- return &api.AnnotatedTag{
- Tag: t.Name,
- SHA: t.ID.String(),
- Object: ToAnnotatedTagObject(repo, c),
- Message: t.Message,
- URL: util.URLJoin(repo.APIURL(), "git/tags", t.ID.String()),
- Tagger: ToCommitUser(t.Tagger),
- Verification: ToVerification(c),
- }
-}
-
-// ToAnnotatedTagObject convert a git.Commit to an api.AnnotatedTagObject
-func ToAnnotatedTagObject(repo *models.Repository, commit *git.Commit) *api.AnnotatedTagObject {
- return &api.AnnotatedTagObject{
- SHA: commit.ID.String(),
- Type: string(git.ObjectCommit),
- URL: util.URLJoin(repo.APIURL(), "git/commits", commit.ID.String()),
- }
-}
-
-// ToCommitUser convert a git.Signature to an api.CommitUser
-func ToCommitUser(sig *git.Signature) *api.CommitUser {
- return &api.CommitUser{
- Identity: api.Identity{
- Name: sig.Name,
- Email: sig.Email,
- },
- Date: sig.When.UTC().Format(time.RFC3339),
- }
-}
-
-// ToCommitMeta convert a git.Tag to an api.CommitMeta
-func ToCommitMeta(repo *models.Repository, tag *git.Tag) *api.CommitMeta {
- return &api.CommitMeta{
- SHA: tag.Object.String(),
- // TODO: Add the /commits API endpoint and use it here (https://developer.github.com/v3/repos/commits/#get-a-single-commit)
- URL: util.URLJoin(repo.APIURL(), "git/commits", tag.ID.String()),
- }
-}
-
-// ToTopicResponse convert from models.Topic to api.TopicResponse
-func ToTopicResponse(topic *models.Topic) *api.TopicResponse {
- return &api.TopicResponse{
- ID: topic.ID,
- Name: topic.Name,
- RepoCount: topic.RepoCount,
- Created: topic.CreatedUnix.AsTime(),
- Updated: topic.UpdatedUnix.AsTime(),
- }
-}
diff --git a/routers/api/v1/convert/utils.go b/routers/api/v1/convert/utils.go
deleted file mode 100644
index 66fb21be67..0000000000
--- a/routers/api/v1/convert/utils.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Gogs Authors. All rights reserved.
-// Use of this source code is governed by a MIT-style
-// license that can be found in the LICENSE file.
-
-package convert
-
-import (
- "code.gitea.io/gitea/modules/setting"
-)
-
-// ToCorrectPageSize makes sure page size is in allowed range.
-func ToCorrectPageSize(size int) int {
- if size <= 0 {
- size = 10
- } else if size > setting.API.MaxResponseItems {
- size = setting.API.MaxResponseItems
- }
- return size
-}
diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go
index 3f391e4b2b..c7b0bd5b6b 100644
--- a/routers/api/v1/org/hook.go
+++ b/routers/api/v1/org/hook.go
@@ -7,8 +7,8 @@ package org
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/utils"
)
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go
index 370536d22f..be47b6963f 100644
--- a/routers/api/v1/org/member.go
+++ b/routers/api/v1/org/member.go
@@ -9,9 +9,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
)
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index 8a1a478ba1..d698592361 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -8,8 +8,8 @@ package org
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
)
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index a22b60a2c6..b2b5fe6dad 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -10,9 +10,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/user"
)
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index 670123a858..9f6a2e6294 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -7,9 +7,9 @@ package repo
import (
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// GetBranch get a branch of a repository
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 132652e2a9..81d472dffb 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -10,8 +10,8 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListCollaborators list a repository's collaborators
diff --git a/routers/api/v1/repo/git_hook.go b/routers/api/v1/repo/git_hook.go
index 80610356dd..46651ef614 100644
--- a/routers/api/v1/repo/git_hook.go
+++ b/routers/api/v1/repo/git_hook.go
@@ -6,9 +6,9 @@ package repo
import (
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListGitHooks list all Git hooks of a repository
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 18f1fba056..3666d79fa0 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -7,10 +7,10 @@ package repo
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/webhook"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/utils"
)
diff --git a/routers/api/v1/repo/key.go b/routers/api/v1/repo/key.go
index 42bf024a5f..6b499d2fb1 100644
--- a/routers/api/v1/repo/key.go
+++ b/routers/api/v1/repo/key.go
@@ -9,9 +9,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// appendPrivateInformation appends the owner and key type information to api.PublicKey
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 7b752370d4..c907bba66b 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/notification"
@@ -24,7 +25,6 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/validation"
- "code.gitea.io/gitea/routers/api/v1/convert"
mirror_service "code.gitea.io/gitea/services/mirror"
repo_service "code.gitea.io/gitea/services/repository"
)
diff --git a/routers/api/v1/repo/star.go b/routers/api/v1/repo/star.go
index 2eb5daeced..8fe5b17c5f 100644
--- a/routers/api/v1/repo/star.go
+++ b/routers/api/v1/repo/star.go
@@ -6,8 +6,8 @@ package repo
import (
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListStargazers list a repository's stargazers
diff --git a/routers/api/v1/repo/subscriber.go b/routers/api/v1/repo/subscriber.go
index 79ad0e0221..0e576b4ff0 100644
--- a/routers/api/v1/repo/subscriber.go
+++ b/routers/api/v1/repo/subscriber.go
@@ -6,8 +6,8 @@ package repo
import (
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListSubscribers list a repo's subscribers (i.e. watchers)
diff --git a/routers/api/v1/repo/tag.go b/routers/api/v1/repo/tag.go
index a802048285..6cfdb461ee 100644
--- a/routers/api/v1/repo/tag.go
+++ b/routers/api/v1/repo/tag.go
@@ -8,8 +8,8 @@ import (
"net/http"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListTags list all the tags of a repository
diff --git a/routers/api/v1/repo/topic.go b/routers/api/v1/repo/topic.go
index 6c3ac0020a..1656fd1b16 100644
--- a/routers/api/v1/repo/topic.go
+++ b/routers/api/v1/repo/topic.go
@@ -10,9 +10,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListTopics returns list of current topics for repo
diff --git a/routers/api/v1/user/email.go b/routers/api/v1/user/email.go
index 027f4e2763..8c0eb889ed 100644
--- a/routers/api/v1/user/email.go
+++ b/routers/api/v1/user/email.go
@@ -7,9 +7,9 @@ package user
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
// ListEmails list all of the authenticated user's email addresses
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index 59df9665f4..ec512b9806 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -7,8 +7,8 @@ package user
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
func responseAPIUsers(ctx *context.APIContext, users []*models.User) {
diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go
index fa85e47a82..82113caf0c 100644
--- a/routers/api/v1/user/gpg_key.go
+++ b/routers/api/v1/user/gpg_key.go
@@ -7,8 +7,8 @@ package user
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
)
func listGPGKeys(ctx *context.APIContext, uid int64) {
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go
index 8425535b10..a812edfcc7 100644
--- a/routers/api/v1/user/key.go
+++ b/routers/api/v1/user/key.go
@@ -7,9 +7,9 @@ package user
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/api/v1/repo"
)
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 0639494c0e..6f3fc4d32b 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -10,8 +10,8 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
- "code.gitea.io/gitea/routers/api/v1/convert"
"github.com/unknwon/com"
)
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go
index 6f72e99b71..f88b152003 100644
--- a/routers/api/v1/utils/hook.go
+++ b/routers/api/v1/utils/hook.go
@@ -11,9 +11,9 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/webhook"
- "code.gitea.io/gitea/routers/api/v1/convert"
"code.gitea.io/gitea/routers/utils"
"github.com/unknwon/com"