[Vendor] update gitea-sdk v0.14.0 (#15103)
* upgraded code.gitea.io/sdk/gitea v0.13.2 => v0.14.0 * rm workaround
This commit is contained in:
parent
8567cba0d9
commit
5f038cd7fe
55 changed files with 1338 additions and 360 deletions
28
vendor/code.gitea.io/sdk/gitea/status.go
generated
vendored
28
vendor/code.gitea.io/sdk/gitea/status.go
generated
vendored
|
@ -8,6 +8,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -51,12 +52,15 @@ type CreateStatusOption struct {
|
|||
|
||||
// CreateStatus creates a new Status for a given Commit
|
||||
func (c *Client) CreateStatus(owner, repo, sha string, opts CreateStatusOption) (*Status, *Response, error) {
|
||||
if err := escapeValidatePathSegments(&owner, &repo); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
body, err := json.Marshal(&opts)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
status := new(Status)
|
||||
resp, err := c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/statuses/%s", owner, repo, sha), jsonHeader, bytes.NewReader(body), status)
|
||||
resp, err := c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/statuses/%s", owner, repo, url.QueryEscape(sha)), jsonHeader, bytes.NewReader(body), status)
|
||||
return status, resp, err
|
||||
}
|
||||
|
||||
|
@ -65,11 +69,14 @@ type ListStatusesOption struct {
|
|||
ListOptions
|
||||
}
|
||||
|
||||
// ListStatuses returns all statuses for a given Commit
|
||||
func (c *Client) ListStatuses(owner, repo, sha string, opt ListStatusesOption) ([]*Status, *Response, error) {
|
||||
// ListStatuses returns all statuses for a given Commit by ref
|
||||
func (c *Client) ListStatuses(owner, repo, ref string, opt ListStatusesOption) ([]*Status, *Response, error) {
|
||||
if err := escapeValidatePathSegments(&owner, &repo, &ref); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
opt.setDefaults()
|
||||
statuses := make([]*Status, 0, opt.PageSize)
|
||||
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s/statuses?%s", owner, repo, sha, opt.getURLQuery().Encode()), nil, nil, &statuses)
|
||||
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s/statuses?%s", owner, repo, ref, opt.getURLQuery().Encode()), jsonHeader, nil, &statuses)
|
||||
return statuses, resp, err
|
||||
}
|
||||
|
||||
|
@ -85,8 +92,17 @@ type CombinedStatus struct {
|
|||
}
|
||||
|
||||
// GetCombinedStatus returns the CombinedStatus for a given Commit
|
||||
func (c *Client) GetCombinedStatus(owner, repo, sha string) (*CombinedStatus, *Response, error) {
|
||||
func (c *Client) GetCombinedStatus(owner, repo, ref string) (*CombinedStatus, *Response, error) {
|
||||
if err := escapeValidatePathSegments(&owner, &repo, &ref); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
status := new(CombinedStatus)
|
||||
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s/status", owner, repo, sha), nil, nil, status)
|
||||
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s/status", owner, repo, ref), jsonHeader, nil, status)
|
||||
|
||||
// gitea api return empty body if nothing here jet
|
||||
if resp != nil && resp.StatusCode == 200 && err != nil {
|
||||
return status, resp, nil
|
||||
}
|
||||
|
||||
return status, resp, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue