- Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathrepo_branch.go
25 lines (20 loc) · 776 Bytes
/
repo_branch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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 gogs
import (
"fmt"
)
// Branch represents a repository branch.
typeBranchstruct {
Namestring`json:"name"`
Commit*PayloadCommit`json:"commit"`
}
func (c*Client) ListRepoBranches(user, repostring) ([]*Branch, error) {
branches:=make([]*Branch, 0, 10)
returnbranches, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branches", user, repo), nil, nil, &branches)
}
func (c*Client) GetRepoBranch(user, repo, branchstring) (*Branch, error) {
b:=new(Branch)
returnb, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branches/%s", user, repo, branch), nil, nil, &b)
}