"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/code.gitea.io/sdk/gitea/repo_branch_protection.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

repo_branch_protection.go  (gitea-1.13.1):repo_branch_protection.go  (gitea-1.13.2)
skipping to change at line 95 skipping to change at line 95
ProtectedFilePatterns *string `json:"protected_file_patterns"` ProtectedFilePatterns *string `json:"protected_file_patterns"`
} }
// ListBranchProtectionsOptions list branch protection options // ListBranchProtectionsOptions list branch protection options
type ListBranchProtectionsOptions struct { type ListBranchProtectionsOptions struct {
ListOptions ListOptions
} }
// ListBranchProtections list branch protections for a repo // ListBranchProtections list branch protections for a repo
func (c *Client) ListBranchProtections(owner, repo string, opt ListBranchProtect ionsOptions) ([]*BranchProtection, *Response, error) { func (c *Client) ListBranchProtections(owner, repo string, opt ListBranchProtect ionsOptions) ([]*BranchProtection, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, nil, err return nil, nil, err
} }
bps := make([]*BranchProtection, 0, opt.PageSize) bps := make([]*BranchProtection, 0, opt.PageSize)
link, _ := url.Parse(fmt.Sprintf("/repos/%s/%s/branch_protections", owner , repo)) link, _ := url.Parse(fmt.Sprintf("/repos/%s/%s/branch_protections", owner , repo))
link.RawQuery = opt.getURLQuery().Encode() link.RawQuery = opt.getURLQuery().Encode()
resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & bps) resp, err := c.getParsedResponse("GET", link.String(), jsonHeader, nil, & bps)
return bps, resp, err return bps, resp, err
} }
// GetBranchProtection gets a branch protection // GetBranchProtection gets a branch protection
func (c *Client) GetBranchProtection(owner, repo, name string) (*BranchProtectio n, *Response, error) { func (c *Client) GetBranchProtection(owner, repo, name string) (*BranchProtectio n, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, nil, err return nil, nil, err
} }
bp := new(BranchProtection) bp := new(BranchProtection)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branch_ protections/%s", owner, repo, name), jsonHeader, nil, bp) resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/branch_ protections/%s", owner, repo, name), jsonHeader, nil, bp)
return bp, resp, err return bp, resp, err
} }
// CreateBranchProtection creates a branch protection for a repo // CreateBranchProtection creates a branch protection for a repo
func (c *Client) CreateBranchProtection(owner, repo string, opt CreateBranchProt ectionOption) (*BranchProtection, *Response, error) { func (c *Client) CreateBranchProtection(owner, repo string, opt CreateBranchProt ectionOption) (*BranchProtection, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, nil, err return nil, nil, err
} }
bp := new(BranchProtection) bp := new(BranchProtection)
body, err := json.Marshal(&opt) body, err := json.Marshal(&opt)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
resp, err := c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/branch _protections", owner, repo), jsonHeader, bytes.NewReader(body), bp) resp, err := c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/branch _protections", owner, repo), jsonHeader, bytes.NewReader(body), bp)
return bp, resp, err return bp, resp, err
} }
// EditBranchProtection edits a branch protection for a repo // EditBranchProtection edits a branch protection for a repo
func (c *Client) EditBranchProtection(owner, repo, name string, opt EditBranchPr otectionOption) (*BranchProtection, *Response, error) { func (c *Client) EditBranchProtection(owner, repo, name string, opt EditBranchPr otectionOption) (*BranchProtection, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, nil, err return nil, nil, err
} }
bp := new(BranchProtection) bp := new(BranchProtection)
body, err := json.Marshal(&opt) body, err := json.Marshal(&opt)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
resp, err := c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/branc h_protections/%s", owner, repo, name), jsonHeader, bytes.NewReader(body), bp) resp, err := c.getParsedResponse("PATCH", fmt.Sprintf("/repos/%s/%s/branc h_protections/%s", owner, repo, name), jsonHeader, bytes.NewReader(body), bp)
return bp, resp, err return bp, resp, err
} }
// DeleteBranchProtection deletes a branch protection for a repo // DeleteBranchProtection deletes a branch protection for a repo
func (c *Client) DeleteBranchProtection(owner, repo, name string) (*Response, er ror) { func (c *Client) DeleteBranchProtection(owner, repo, name string) (*Response, er ror) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, err return nil, err
} }
_, resp, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/branch_ protections/%s", owner, repo, name), jsonHeader, nil) _, resp, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/branch_ protections/%s", owner, repo, name), jsonHeader, nil)
return resp, err return resp, err
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)