@@ -41,25 +41,26 @@ func (c *Client) BuildStatusCreate(gitCommit string, payload BuildStatusCreatePa
4141 return nil
4242}
4343
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- }
5144type BuildStatus struct {
5245 State string `json:"state"`
5346 Key string `json:"key"`
5447 Name string `json:"name"`
5548 URL string `json:"url"`
5649 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"`
5859}
5960
60- // BuildStatusGet gets the build statuses associated with a commit.
61+ // BuildStatusList gets the build statuses associated with a commit.
6162// 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 ) {
6364 urlPath := fmt .Sprintf ("/rest/build-status/1.0/commits/%s" , gitCommit )
6465 statusCode , response , err := c .get (urlPath )
6566 if err != nil {
@@ -75,7 +76,7 @@ func (c *Client) BuildStatusGet(gitCommit string) (*BuildStatus, error) {
7576 "could not unmarshal response: %w. status code: %d, body: %s" , err , statusCode , string (response ),
7677 )
7778 }
78- return & BuildStatusPage . BuildStatus [ 0 ] , nil // return the newest by default
79+ return & BuildStatusPage , nil
7980 case 401 :
8081 return nil , fmt .Errorf ("you are not permitted to get the build status of git commit %s" , gitCommit )
8182 default :
0 commit comments