diff options
Diffstat (limited to 'routers/api/v1/convert/convert.go')
-rw-r--r-- | routers/api/v1/convert/convert.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/routers/api/v1/convert/convert.go b/routers/api/v1/convert/convert.go index b91abbdd39..d20732bfd6 100644 --- a/routers/api/v1/convert/convert.go +++ b/routers/api/v1/convert/convert.go @@ -10,11 +10,32 @@ import ( "github.com/Unknwon/com" api "github.com/gogits/go-gogs-client" + "github.com/gogits/git-module" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/setting" ) +// ToApiBranch converts user to its API format. +func ToApiBranch(b *models.Branch,c *git.Commit) *api.Branch { + return &api.Branch{ + Name: b.Name, + Commit: ToApiCommit(c), + } +} +// ToApiCommit converts user to its API format. +func ToApiCommit(c *git.Commit) *api.PayloadCommit { + return &api.PayloadCommit{ + ID: c.ID.String(), + Message: c.Message(), + URL: "Not implemented", + Author: &api.PayloadAuthor{ + Name: c.Committer.Name, + Email: c.Committer.Email, + /* UserName: c.Committer.UserName, */ + }, + } +} // ToApiUser converts user to its API format. func ToApiUser(u *models.User) *api.User { return &api.User{ |