diff --git a/api_response.go b/api_response.go index 48c379d..6500221 100644 --- a/api_response.go +++ b/api_response.go @@ -152,6 +152,15 @@ type Commit struct { } `json:"parents"` } +type BuildStatus struct { + State string `json:"state"` + Key string `json:"key"` + Name string `json:"name"` + Url string `json:"url"` + Description string `json:"description` + DateAdded int64 `json:"dateAdded"` +} + type Diff struct { Diffs []struct { Source struct { diff --git a/default_api.go b/default_api.go index 7780f58..066a759 100644 --- a/default_api.go +++ b/default_api.go @@ -3669,6 +3669,57 @@ func (a *DefaultApiService) GetCommit(commitId string, localVarOptionals map[str return NewBitbucketAPIResponse(localVarHTTPResponse) } +func (a *DefaultApiService) GetCommitBuildStatuses(commitSHA string) (*APIResponse, error) { + var ( + localVarHTTPMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/build-status/1.0/commits/{commitId}" + localVarPath = strings.Replace(localVarPath, "{"+"commitId"+"}", fmt.Sprintf("%v", commitSHA), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(a.client.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return NewBitbucketAPIResponse(localVarHTTPResponse) + } + defer localVarHTTPResponse.Body.Close() + if localVarHTTPResponse.StatusCode >= 300 { + bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body) + return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes)) + } + + return NewBitbucketAPIResponse(localVarHTTPResponse) +} + /* DefaultApiService Retrieve a page of commits from a given starting commit or \"between\" two commits. If no explicit commit is specified, the tip of the repository's default branch is assumed. commits may be identified by branch or tag name or by ID. A path may be supplied to restrict the returned commits to only those which affect that path. <p> The authenticated user must have <b>REPO_READ</b> permission for the specified repository to call this resource. * @param ctx context.Context for authentication, logging, tracing, etc.