From 10296af427b9af7488ce80a6e82f3a55aaee8edf Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Thu, 14 Jan 2016 16:21:47 +0100 Subject: [PATCH 1/3] Create repo_branches.go --- repo_branches.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 repo_branches.go diff --git a/repo_branches.go b/repo_branches.go new file mode 100644 index 0000000..850fb93 --- /dev/null +++ b/repo_branches.go @@ -0,0 +1,16 @@ +package gogs + +type Branch struct { + name string `json:"name"` + commit *PayloadCommit `json:"commit"` +} + +func (c *Client) ListRepoBranches(user, repo string) ([]*Branch, error) { + branches := make([]*Branch, 0, 10) + return branches, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branches", user, repo), nil, nil, &branches) +} + +func (c *Client) GetRepoBranch(user, repo, branch string) (*Branch, error) { + b := new(Branch) + return b, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branches/%s", user, repo, branch), nil, nil, &b) +} From 3716eee47b7a20be8178e700eb26b2d5e41960a4 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Fri, 15 Jan 2016 14:30:47 +0100 Subject: [PATCH 2/3] Use uppercase for first letter --- repo_branches.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repo_branches.go b/repo_branches.go index 850fb93..944c895 100644 --- a/repo_branches.go +++ b/repo_branches.go @@ -1,8 +1,8 @@ package gogs type Branch struct { - name string `json:"name"` - commit *PayloadCommit `json:"commit"` + Name string `json:"name"` + Commit *PayloadCommit `json:"commit"` } func (c *Client) ListRepoBranches(user, repo string) ([]*Branch, error) { From 25f8ed637da48c4d8003f7548f9849d2d724943b Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Fri, 15 Jan 2016 14:35:31 +0100 Subject: [PATCH 3/3] Fix import --- repo_branches.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repo_branches.go b/repo_branches.go index 944c895..e6f5458 100644 --- a/repo_branches.go +++ b/repo_branches.go @@ -1,5 +1,9 @@ package gogs +import ( + "fmt" +) + type Branch struct { Name string `json:"name"` Commit *PayloadCommit `json:"commit"`