Adding GetPullRequestResponse and fixing Create (PullRequest)

This commit is contained in:
gfleury 2019-06-05 10:19:00 +02:00
parent 9972314a4b
commit 061898a310
2 changed files with 13 additions and 10 deletions

View File

@ -299,6 +299,13 @@ func GetSSHKeysResponse(r *APIResponse) ([]SSHKey, error) {
return m, err
}
// GetPullRequestResponse cast PullRequest into structure
func GetPullRequestResponse(r *APIResponse) (PullRequest, error) {
var m PullRequest
err := mapstructure.Decode(r.Values["values"], &m)
return m, err
}
// NewAPIResponse create new APIResponse from http.Response
func NewAPIResponse(r *http.Response) *APIResponse {

View File

@ -5,6 +5,7 @@
package bitbucketv1
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/url"
@ -611,18 +612,13 @@ func (a *DefaultApiService) Create(projectKey, repositorySlug string, localVarOp
return nil, err
}
if localVarTempParam, localVarOk := localVarOptionals["from"].(string); localVarOk {
localVarQueryParams.Add("from", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["to"].(string); localVarOk {
localVarQueryParams.Add("to", parameterToString(localVarTempParam, ""))
}
if localVarTempParam, localVarOk := localVarOptionals["fromRepo"].(string); localVarOk {
localVarQueryParams.Add("fromRepo", parameterToString(localVarTempParam, ""))
localVarPostBody, err := json.Marshal(localVarOptionals)
if err != nil {
return nil, err
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)