@@ -41,25 +41,26 @@ func (c *Client) BuildStatusCreate(gitCommit string, payload BuildStatusCreatePa
41
41
return nil
42
42
}
43
43
44
- type BuildStatusPage struct {
45
- Size int `json:"size"`
46
- Limit int `json:"limit"`
47
- Islastpage bool `json:"isLastPage"`
48
- BuildStatus []BuildStatus `json:"values"`
49
- Start int `json:"start"`
50
- }
51
44
type BuildStatus struct {
52
45
State string `json:"state"`
53
46
Key string `json:"key"`
54
47
Name string `json:"name"`
55
48
URL string `json:"url"`
56
49
Description string `json:"description"`
57
- Dateadded int64 `json:"dateAdded"`
50
+ DateAdded int64 `json:"dateAdded"`
51
+ }
52
+
53
+ type BuildStatusPage struct {
54
+ Size int `json:"size"`
55
+ Limit int `json:"limit"`
56
+ IsLastPage bool `json:"isLastPage"`
57
+ Values []BuildStatus `json:"values"` // newest build status appears first
58
+ Start int `json:"start"`
58
59
}
59
60
60
- // BuildStatusGet gets the build statuses associated with a commit.
61
+ // BuildStatusList gets the build statuses associated with a commit.
61
62
// https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-build-rest.html#idp8
62
- func (c * Client ) BuildStatusGet (gitCommit string ) (* BuildStatus , error ) {
63
+ func (c * Client ) BuildStatusList (gitCommit string ) (* BuildStatusPage , error ) {
63
64
urlPath := fmt .Sprintf ("/rest/build-status/1.0/commits/%s" , gitCommit )
64
65
statusCode , response , err := c .get (urlPath )
65
66
if err != nil {
@@ -75,7 +76,7 @@ func (c *Client) BuildStatusGet(gitCommit string) (*BuildStatus, error) {
75
76
"could not unmarshal response: %w. status code: %d, body: %s" , err , statusCode , string (response ),
76
77
)
77
78
}
78
- return & BuildStatusPage . BuildStatus [ 0 ] , nil // return the newest by default
79
+ return & BuildStatusPage , nil
79
80
case 401 :
80
81
return nil , fmt .Errorf ("you are not permitted to get the build status of git commit %s" , gitCommit )
81
82
default :
0 commit comments