mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-07-17 02:57:31 -05:00
Adding WebHook and GetPullRequestDiffRaw
This commit is contained in:
@ -11438,6 +11438,85 @@ func (a *DefaultApiService) StreamDiff_39(projectKey, repositorySlug string, pat
|
||||
return NewBitbucketAPIResponse(localVarHTTPResponse)
|
||||
}
|
||||
|
||||
/* DefaultApiService
|
||||
Streams a diff within a pull request. <p> If the specified file has been copied, moved or renamed, the <code>srcPath</code> must also be specified to produce the correct diff. <p> Note: This RESTful endpoint is currently <i>not paged</i>. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. <p> The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource.
|
||||
|
||||
@param optional (nil or map[string]interface{}) with one or more of:
|
||||
@param "contextLines" (int32) the number of context lines to include around added/removed lines in the diff
|
||||
@param "diffType" (string) the type of diff being requested. When {@code withComments} is {@code true} this works as a hint to the system to attach the correct set of comments to the diff
|
||||
@param "sinceId" (string) the since commit hash to stream a diff between two arbitrary hashes
|
||||
@param "srcPath" (string) the previous path to the file, if the file has been copied, moved or renamed
|
||||
@param "untilId" (string) the until commit hash to stream a diff between two arbitrary hashes
|
||||
@param "whitespace" (string) optional whitespace flag which can be set to <code>ignore-all</code>
|
||||
@param "withComments" (bool) <code>true</code> to embed comments in the diff (the default); otherwise, <code>false</code> to stream the diff without comments
|
||||
@return */
|
||||
func (a *DefaultApiService) GetPullRequestDiffRaw(projectKey, repositorySlug string, pullRequestID int, localVarOptionals map[string]interface{}) (*APIResponse, error) {
|
||||
var (
|
||||
localVarHTTPMethod = strings.ToUpper("Get")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}.diff"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"repositorySlug"+"}", fmt.Sprintf("%v", repositorySlug), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"pullRequestId"+"}", fmt.Sprintf("%v", pullRequestID), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if err := typeCheckParameter(localVarOptionals["contextLines"], "int32", "contextLines"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := typeCheckParameter(localVarOptionals["whitespace"], "string", "whitespace"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if localVarTempParam, localVarOk := localVarOptionals["contextLines"].(int32); localVarOk {
|
||||
localVarQueryParams.Add("contextLines", parameterToString(localVarTempParam, ""))
|
||||
}
|
||||
if localVarTempParam, localVarOk := localVarOptionals["whitespace"].(string); localVarOk {
|
||||
localVarQueryParams.Add("whitespace", parameterToString(localVarTempParam, ""))
|
||||
}
|
||||
|
||||
// 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 NewAPIResponseWithError(localVarHTTPResponse, nil, err)
|
||||
}
|
||||
defer localVarHTTPResponse.Body.Close()
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
|
||||
}
|
||||
|
||||
return NewRawAPIResponse(localVarHTTPResponse)
|
||||
}
|
||||
|
||||
/* DefaultApiService
|
||||
Streams a diff within a pull request. <p> If the specified file has been copied, moved or renamed, the <code>srcPath</code> must also be specified to produce the correct diff. <p> Note: This RESTful endpoint is currently <i>not paged</i>. The server will internally apply a hard cap to the streamed lines, and it is not possible to request subsequent pages if that cap is exceeded. <p> The authenticated user must have <strong>REPO_READ</strong> permission for the repository that this pull request targets to call this resource.
|
||||
|
||||
|
Reference in New Issue
Block a user