aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/convert
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@sapk.fr>2016-01-15 19:24:03 +0100
committerAntoine GIRARD <sapk@sapk.fr>2016-01-28 20:51:19 +0100
commitc11c3b6c1125c8de1f86ea4d41eb88728d8e0b48 (patch)
tree051061e60ff43c1e740c9819a16e5ace15a38e1a /routers/api/v1/convert
parent566163ab8257ba2b828985c2cc00f705341ba73f (diff)
downloadgitea-c11c3b6c1125c8de1f86ea4d41eb88728d8e0b48.tar.gz
gitea-c11c3b6c1125c8de1f86ea4d41eb88728d8e0b48.zip
Near ready
Diffstat (limited to 'routers/api/v1/convert')
-rw-r--r--routers/api/v1/convert/convert.go21
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{